Created
September 4, 2014 13:12
-
-
Save username13107/78ec776f3cdc784f701c to your computer and use it in GitHub Desktop.
反编译android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
静默安装 | |
manifest file add this android:sharedUserId="android.uid.system" | |
jar signapk.jar platform.x509.pem platform.pk8 abc.apk abc_signed.apk | |
Runtime.getRuntime().exec("pm install abc_signed.apk"); | |
反编译后重新打包 | |
apktool b -f test test.apk | |
sign-sys test.apk -> test_signed.apk | |
smali tips | |
toast show | |
const-string v0, "Button1 clicked!" | |
const/4 v1, 0x0 | |
invoke static {p0, v0, v1}, Landroid/widget/Toast;->makeText(Landroid/context;Ljava/lang/CharSequence;I)Landroid/widget/Toast; | |
move-result-object v0 | |
invoke-virtual {v0}, Landroid/widget/Toast;->show()v | |
.line 20 | |
return-void | |
smali error debug | |
adb logcat | grep dalvikvm | |
adb logcat | grep VFY | |
并且,注入内容的时候, 严格空行 | |
函数调用(invoke-virtual等指令)的参数只能使用v0~v15,使用超过v15的变量会报错。修复这个问题有两种方法: A.使用invoke-virtual/range {p1 .. p1}指令,但是这里要求变量名称需要连续。 B.增加move-object/from16 v0, v18类似指令,调整变量名,使之小于等于v15。 | |
函数调用中p0相当于函数可用变量值+1,pN相当于函数可用变量值+N。例如函数.local值为16,表明函数可用变量值为v0~v15,则p0相当于v16,p1相当于v17。 | |
增加简单的Smali日志信息: A.修改函数的.local变量,在原来基础上增加两个变量,例如v11,v12。 B.在需要打印日志的地方增加如下Smali代码 | |
const-string v11, "@@@@" | |
const-string v12, "interceptPowerKeyDown enter" | |
invoke-static {v11, v12}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I | |
如果增加的变量为v28和v29,则需要使用下面的语句。 | |
invoke-static/range {v28 .. v29}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I | |
打印程序调用栈的方法: A.修改函数的.local变量,在原来基础上增加一个变量,例如v11。 B.在需要打印调用栈的地方增加如下Smali代码 | |
new-instance v1 Ljava/lang/Exception; | |
invoke-direct {v1, Ljava/lang/Exception;-><init>()V | |
invoke-virtual {v1, Ljava/lang/Exception;->printStackTrace()V |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment