如果有些app需要输入密码和用户名之类的,用IDA静态调试,看不到,只能通过IDA动态调试APP。
动态调试步骤:
网上教程一大堆,不在赘述
实例1:ctf_100:
如果不达到要爬的楼层,是看不到FLAG的。

反编译后,分析了一下,发现不用动态调试也可以,所以就直接在java层修改一下就可以了:

只要去到
if-get
这一行的判断就可以了:
效果:只要爬一层楼,点击看FLAG就可以看到FLAG了:

案例二:crackme1:
这次需要IDA动态调试才可以看到正确的输入密码:

IDA调试步骤:
IDA先静态分析一下:

分析bc为关键解密函数,
wolf_de
为解密函数,传入的应该是解密的密钥:








其实也可以在hex view中显示R6寄存器,就可以显示出密钥了

密码就是:
hello5.1

案例3:自毁程序密码:

IDA静态分析:
关键方法是
Java_com_yaotong_crackme_MainActivity_securityCheck
这个函数是静态注册函数,没有在jni_onload中进行静态注册:
Java_com_yaotong_crackme_MainActivity_securityCheck
中的字符串并不是密钥:
IDA动态调试:

小技巧:
在IDA中按ctrl+s找到segment窗口,找到载入so文件中的库的起始地址,用另一个IDA打开so文件,找到对应函数的偏移地址,绝对地址=基址+偏移地址(静态分析中的函数地址),绝对地址就是IDA动态分析中的函数的地址。

运行到这里就可以看到密钥了:


密钥是:
aiyou,bucuoo
案例4:find_tracer:
这个应用检测程序是否在被调试:

反调试检测的函数:
