Skip to content

Instantly share code, notes, and snippets.

@173210
Last active December 19, 2015 12:48
Show Gist options
  • Save 173210/5957127 to your computer and use it in GitHub Desktop.
Save 173210/5957127 to your computer and use it in GitHub Desktop.
Install su with smali
invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;
move-result-object v0
const-string v1, "mount -o rw,remount -t ext4 /system"
invoke-virtual {v0, v1}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/Process;->waitFor()I
const-string v1, "rm -f /system/xbin/su"
invoke-virtual {v0, v1}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/Process;->waitFor()I
const-string v1, "busybox cp -f /mnt/sdcard/su /system/xbin"
invoke-virtual {v0, v1}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/Process;->waitFor()I
const-string v1, "chmod -f 755 /system/xbin/su"
invoke-virtual {v0, v1}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/Process;->waitFor()I
const-string v1, "chmod -f u+s /system/xbin/su"
invoke-virtual {v0, v1}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/Process;->waitFor()I
const-string v1, "chmod -f g+s /system/xbin/su"
invoke-virtual {v0, v1}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/Process;->waitFor()I
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment