frida IOS hook方法入參方法
阿新 • • 發佈:2021-10-29
ios_hook.py
# _*_ coding: utf-8 _*_ # @Time:2021/10/28 4:10 下午 # @Author:YwY(慕白) # @File:ios_frida_hook.py import logging import frida import sys logging.basicConfig(level=logging.DEBUG) def on_message(message, data): if message['type'] == 'send': print("[*] {0}".format(message['payload'])) else: print(message) with open("ios_hook.js", 'r', encoding='utf-8') as f: sta = ''.join(f.readlines()) rdev = frida.get_device(id ="裝置id") print("裝置連線成功") session = rdev.attach('app包名') #app包名 print("淘寶連線成功") print(session) script = session.create_script(sta) print(script) def show(message,data): print(message) script.on("message",show) # 載入指令碼 script.load() sys.stdin.read()
ios_hook.js
var PDDURLRequestSetHeadersHook = eval('ObjC.classes.方法名["- 類名"]') #xxx["- xxx:xx:xxx:xx:xxxx:"]' Interceptor.attach(PDDURLRequestSetHeadersHook.implementation, { onEnter: function(args) { console.log(`2----${ObjC.Object(args[2])}`) console.log(`3----${ObjC.Object(args[3])}`) console.log(`4----${ObjC.Object(args[4])}`) console.log(`5----${ObjC.Object(args[5])}`) console.log(`6----${ObjC.Object(args[6])}`) //logBacktrace(this.context, "operationFromDict:") }, onLeave: function(retval) { console.log(`factorSign-result:${ObjC.Object(retval)}\n`); } });