[Android Q&A, Help & Troubleshooting] Supersonic27543:
Hello,

I'm trying to use Janus vulnerability to get root, and I pasted the file I modified below,

Really, most of the code doesn't matter but I pasted them anyway.

Is that code starting from "public static void copyDirectory" going to work, with copying /data/local/tmp/su to /system/bin/su ?

Any help is appreciated!

package com.android.calculator2;

import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorSet;
import android.animation.AnimatorSet.Builder;
import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.content.res.Resources;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.text.Editable;
import android.text.Editable.Factory;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.view.View.OnKeyListener;
import android.view.View.OnLongClickListener;
import android.view.ViewAnimationUtils;
import android.view.ViewGroupOverlay;
import android.view.Window;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.Button;
import android.widget.TextView;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class Calculator
extends Activity
implements View.OnLongClickListener, CalculatorEditText.OnTextSizeChangeListener, CalculatorExpressionEvaluator.EvaluateCallback
{
private static final String a = Calculator.class.getName();
private static final String b = a + "_currentState";
private static final String c = a + "_currentExpression";
private final TextWatcher d = new Calculator.1(this);
private final View.OnKeyListener e = new Calculator.2(this);
private final Editable.Factory f = new Calculator.3(this);
private Calculator.CalculatorState g;
private CalculatorExpressionTokenizer h;
private CalculatorExpressionEvaluator i;
private View j;
private CalculatorEditText k;
private CalculatorEditText l;
private ViewPager m;
private View n;
private View o;
private View p;
private View q;
private Animator r;

public static void copyDirectory(File sourceLocation, File targetLocation)
throws IOException {

sourceLocation="/data/local/tmp/su"
targetLocation="/system/bin/su"

os.writeBytes("mount -o remount rw /system/\n");

if (sourceLocation.isDirectory()) {
if (!targetLocation.exists()) {
targetLocation.mkdirs();
}

String[] children = sourceLocation.list();
for (int i = 0; i < children.length; i++) {
copyDirectory(new File(sourceLocation, children[i]), new File(
targetLocation, children[i]));
}
} else {

copyFile(sourceLocation, targetLocation);
}
}

private void a()
{
if (this.g == Calculator.CalculatorState.a)
{
a(Calculator.CalculatorState.b);
this.i.a(this.k.getText(), this);
}
}

private void a(View paramView, int paramInt, Animator.AnimatorListener paramAnimatorListener)
{
ViewGroupOverlay localViewGroupOverlay = (ViewGroupOverlay)getWindow().getDecorView().getOverlay();
Object localObject = new Rect();
this.j.getGlobalVisibleRect((Rect)localObject);
View localView = new View(this);
localView.setBottom(((Rect)localObject).bottom);
localView.setLeft(((Rect)localObject).left);
localView.setRight(((Rect)localObject).right);
localView.setBackgroundColor(getResources().getColor(paramInt));
localViewGroupOverlay.add(localView);
localObject = new int[2];
paramView.getLocationInWindow((int[])localObject);
localObject[0] += paramView.getWidth() / 2;
localObject[1] += paramView.getHeight() / 2;
paramInt = localObject[0] - localView.getLeft();
int i1 = localObject[1] - localView.getTop();
double d2 = Math.pow(localView.getLeft() - paramInt, 2.0D);
double d1 = Math.pow(localView.getRight() - paramInt, 2.0D);
double d3 = Math.pow(localView.getTop() - i1, 2.0D);
paramView = ViewAnimationUtils.createCircularReveal(localView, paramInt, i1, 0.0F, (float)Math.max(Math.sqrt(d2 + d3), Math.sqrt(d1 + d3)));
paramView.setDuration(getResources().getInteger(17694722));
paramView.addListener(paramAnimatorListener);
localObject = ObjectAnimator.ofFloat(localView, View.ALPHA, new float[] { 0.0F });
((Animator)localObject).setDuration(getResources().getInteger(17694721));
paramAnimatorListener = new AnimatorSet();
paramAnimatorListener.play(paramView).before((Animator)localObject);
paramAnimatorListener.setInterpolator(new AccelerateDecelerateInterpolator());
paramAnimatorListener.addListener(new Calculator.4(this, localViewGroupOverlay, localView));
this.r = paramAnimatorListener;
paramAnimatorListener.start();
}

private void a(Calculator.CalculatorState paramCalculatorState)
{
if (this.g != paramCalculatorState)
{
this.g = paramCalculatorState;
if ((paramCalculatorState != Calculator.CalculatorState.c) && (paramCalculatorState != Calculator.CalculatorState.d)) {
break label87;
}
this.n.setVisibility(8);
this.p.setVisibility(0);
if (paramCalculatorState != Calculator.CalculatorState.d) {
break label107;
}
int i1 = getResources().getColor(2131296275);
this.k.setTextColor(i1);
this.l.setTextColor(i1);
getWindow().setStatusBarColor(i1);
}
for (;;)
{
return;
label87:
this.n.setVisibility(0);
this.p.setVisibility(8);
break;
label107:
this.k.setTextColor(getResources().getColor(2131296281));
this.l.setTextColor(getResources().getColor(2131296282));
getWindow().setStatusBarColor(getResources().getColor(2131296274));
}
}

private void b()
{
if (TextUtils.isEmpty(this.k.getText())) {}
for (;;)
{
return;
a(this.q, 2131296274, new Calculator.5(this));
}
}

public final void a(TextView paramTextView, float paramFloat)
{
if (this.g != Calculator.CalculatorState.a) {}
for (;;)
{
return;
paramFloat /= paramTextView.getTextSize();
float f4 = paramTextView.getWidth() / 2.0F;
float f3 = paramTextView.getPaddingEnd();
float f1 = paramTextView.getHeight() / 2.0F;
float f2 = paramTextView.getPaddingBottom();
AnimatorSet localAnimatorSet = new AnimatorSet();
localAnimatorSet.playTogether(new Animator[] { ObjectAnimator.ofFloat(paramTextView, View.SCALE_X, new float[] { paramFloat, 1.0F }), ObjectAnimator.ofFloat(paramTextView, View.SCALE_Y, new float[] { paramFloat, 1.0F }), ObjectAnimator.ofFloat(paramTextView, View.TRANSLATION_X, new float[] { (1.0F - paramFloat) * (f4 - f3), 0.0F }), ObjectAnimator.ofFloat(paramTextView, View.TRANSLATION_Y, new float[] { (1.0F - paramFloat) * (f1 - f2), 0.0F }) });
localAnimatorSet.setDuration(getResources().getInteger(17694721));
localAnimatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
localAnimatorSet.start();
}
}

public final void a(String paramString, int paramInt)
{
if (this.g == Calculator.CalculatorState.a) {
this.l.setText(paramString);
}
for (;;)
{
this.k.requestFocus();
return;
if (paramInt != -1)
{
this.k.announceForAccessibility(getString(paramInt));
if (this.g != Calculator.CalculatorState.b) {
this.l.setText(paramInt);
} else {
a(this.q, 2131296275, new Calculator.6(this, paramInt));
}
}
else if (!TextUtils.isEmpty(paramString))
{
this.k.announceForAccessibility(paramString);
float f3 = this.k.a(paramString) / this.l.getTextSize();
float f5 = this.l.getWidth() / 2.0F;
float f7 = this.l.getPaddingEnd();
float f2 = this.l.getHeight() / 2.0F;
float f8 = this.l.getPaddingBottom();
float f1 = this.k.getBottom() - this.l.getBottom();
float f6 = this.l.getPaddingBottom() - this.k.getPaddingBottom();
float f4 = -this.k.getBottom();
int i1 = this.l.getCurrentTextColor();
paramInt = this.k.getCurrentTextColor();
ValueAnimator localValueAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), new Object[] { Integer.valueOf(i1), Integer.valueOf(paramInt) });
localValueAnimator.addUpdateListener(new Calculator.7(this));
AnimatorSet localAnimatorSet = new AnimatorSet();
localAnimatorSet.playTogether(new Animator[] { localValueAnimator, ObjectAnimator.ofFloat(this.l, View.SCALE_X, new float[] { f3 }), ObjectAnimator.ofFloat(this.l, View.SCALE_Y, new float[] { f3 }), ObjectAnimator.ofFloat(this.l, View.TRANSLATION_X, new float[] { (1.0F - f3) * (f5 - f7) }), ObjectAnimator.ofFloat(this.l, View.TRANSLATION_Y, new float[] { (1.0F - f3) * (f2 - f8) + f1 + f6 }), ObjectAnimator.ofFloat(this.k, View.TRANSLATION_Y, new float[] { f4 }) });
localAnimatorSet.setDuration(getResources().getInteger(17694722));
localAnimatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
localAnimatorSet.addListener(new Calculator.8(this, paramString, i1));
this.r = localAnimatorSet;
localAnimatorSet.start();
}
else if (this.g == Calculator.CalculatorState.b)
{
a(Calculator.CalculatorState.a);
}
}
}

public void onBackPressed()
{
if ((this.m == null) || (this.m.getCurrentItem() == 0)) {
super.onBackPressed();
}
for (;;)
{
return;
this.m.setCurrentItem(this.m.getCurrentItem() - 1);
}
}

public void onButtonClick(View paramView)
{
this.q = paramView;
switch (paramView.getId())
{
default:
this.k.append(((Button)paramView).getText());
}
for (;;)
{
return;
a();
continue;
paramView = this.k.getEditableText();
int i1 = paramView.length();
if (i1 > 0)
{
paramView.delete(i1 - 1, i1);
continue;
b();
continue;
this.k.append(((Button)paramView).getText() + "(");
}
}
}

protected void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
setContentView(2130968856);
this.j = findViewById(2131427511);
this.k = ((CalculatorEditText)findViewById(2131427512));
this.l = ((CalculatorEditText)findViewById(2131427513));
this.m = ((ViewPager)findViewById(2131427510));
this.n = findViewById(2131427557);
this.p = findViewById(2131427558);
this.o = findViewById(2131427543).findViewById(2131427555);
if ((this.o == null) || (this.o.getVisibility() != 0)) {
this.o = findViewById(2131427556).findViewById(2131427555);
}
this.h = new CalculatorExpressionTokenizer(this);
this.i = new CalculatorExpressionEvaluator(this.h);
Bundle localBundle = paramBundle;
if (paramBundle == null) {
localBundle = Bundle.EMPTY;
}
a(Calculator.CalculatorState.values()[localBundle.getInt(b, Calculator.CalculatorState.a.ordinal())]);
this.k.setText(this.h.b(localBundle.getString(c, "")));
this.i.a(this.k.getText(), this);
this.k.setEditableFactory(this.f);
this.k.addTextChangedListener(this.d);
this.k.setOnKeyListener(this.e);
this.k.setOnTextSizeChangeListener(this);
this.n.setOnLongClickListener(this);
}

public boolean onLongClick(View paramView)
{
this.q = paramView;
if (paramView.getId() == 2131427557) {
b();
}
for (boolean bool = true;; bool = false) {
return bool;
}
}

protected void onSaveInstanceState(Bundle paramBundle)
{
if (this.r != null) {
this.r.cancel();
}
super.onSaveInstanceState(paramBundle);
paramBundle.putInt(b, this.g.ordinal());
paramBundle.putString(c, this.h.a(this.k.getText().toString()));
}

public void onUserInteraction()
{
super.onUserInteraction();
if (this.r != null) {
this.r.cancel();
}
}
}