安装frida
pip3 install frida
pip3 install frida-tools
下载 frida-server 放入android手机 https://github.com/frida/frida/releases
这里用ctf的一个案例hook点击函数
https://bbs.pediy.com/thread-227232.htm
运行frida-server
另外开一个终端
安装那个ctf安全apk请添加链接描述
运行程序
查看进程
frida-ps -U |grep com.
端口转发
adb forward tcp:27042 tcp:27042
adb forward tcp:27043 tcp:27043
运行程序
testfridaonClick.py
import frida, sys
def on_message(message, data):
if message['type'] == 'send':
print("[*] {0}".format(message['payload']))
else:
print(message)
jscode = """
Java.perform(function () {
var MainActivity = Java.use('com.example.seccon2015.rock_paper_scissors.MainActivity');
MainActivity.onClick.implementation = function (v) {
send("Hook Start...");
this.onClick(v);
this.n.value = 0;
this.m.value = 2;
this.cnt.value = 999;
send("Success!")
}
});
"""
process = frida.get_usb_device().attach('com.example.seccon2015.rock_paper_scissors')
script = process.create_script(jscode)
script.on('message', on_message)
script.load()
sys.stdin.read()
转载于:https://blog.51cto.com/haidragon/2391273