【发布时间】:2020-12-11 20:12:11
【问题描述】:
我正在 Android 设备上通过 python 脚本运行 Frida,以更改应用程序的功能。 我正在尝试挂钩另一个函数内部的函数,但我找不到这样做的方法。 我在这里给出了我试图挂钩的相关代码部分:
public class ClockInActivity extends Activity {
...
public void onCreate(Bundle savedInstanceState) {
...
}
public void btnClockIn(View view) {
...
new AsyncTask<Void, Void, Integer>() {
public java.lang.Integer doInBackground(java.lang.Void... r14) {
...
}
public void onPostExecute(Integer result) {
...
}
}
}
}
(“...”在哪里,这是一个不相关的代码)。
我想访问 btnClockIn 中的“onPostExecute”方法。
我现在的python代码是这样的:
import frida, sys
jscript = """
Java.perform(function() {
console.log("Injection");
var change = Java.use('MyApplicationName.ClockInActivity');
change.btnClockIn.implementation = function()
{
console.log("check");
}
});
"""
process = frida.get_usb_device(1).attach("MyApplicationName")
script1 = process.create_script(jscript)
script1.load()
sys.stdin.read()
检查运行良好。感谢您的帮助!
【问题讨论】:
-
尝试像 Java.use("android.os.AsyncTask").doInBackground.implementation 那样挂钩 AsyncClass
标签: javascript android mobile reverse-engineering frida