一、追踪malloc以及free的调用地址(不含调用栈)
import sys
import frida
def on_message(message, data):
if message['type'] == 'send':
print(message['payload'])
pid = int(input("请输入目标进程的PID: "))
session = frida.attach(pid)
print("attach suscess")
script = session.create_script("""
Interceptor.attach(Module.findExportByName(null, "malloc"), {
onEnter: function(args) {
send("malloc called with: " + args[0]);
}
});
Interceptor.attach(Module.findExportByName(null, "free"), {
onEnter: function(args) {
send("free called with: " + args[0]);
}
});
""")
script.on('message', on_message)
script.load()
print("js load failed")
sys.stdin.read()
session.detach()
二、追踪malloc以及free的函数调用栈
import sys
import frida
def on_message(message, data):
if message['type'] ==