更新 main.py

master
wangsiyuan 2023-10-24 19:54:40 +08:00
parent e949fdc3e5
commit 9ec56ced34
1 changed files with 7 additions and 6 deletions

13
main.py
View File

@ -30,7 +30,7 @@ def main(package_name,script_path,is_spawn):
js_code = modules.files_utils.read_javascript(script_path) js_code = modules.files_utils.read_javascript(script_path)
# print(js_code) # print(js_code)
modules.command.start_frida() modules.command.start_frida()
modules.command.clearCache(package_name) # modules.command.clearCache(package_name)
# 连接到USB设备 # 连接到USB设备
device = frida.get_usb_device() device = frida.get_usb_device()
print(device) print(device)
@ -39,10 +39,10 @@ def main(package_name,script_path,is_spawn):
print(f"进程pid: {pid}") print(f"进程pid: {pid}")
process = device.attach(pid) process = device.attach(pid)
script = process.create_script(js_code) script = process.create_script(js_code)
script.on("message", on_message) # script.on("message", on_message)
script.load() script.load()
data_to_send = {'data': 'Hello from Python!'} # data_to_send = {'data': 'Hello from Python!'}
script.post({'type': 'input_data', 'payload': data_to_send}) # script.post({'type': 'input_data', 'payload': data_to_send})
device.resume(pid) # 加载完脚本后, 恢复进程运行 device.resume(pid) # 加载完脚本后, 恢复进程运行
sys.stdin.read() sys.stdin.read()
else: else:
@ -69,9 +69,10 @@ if __name__ == '__main__':
# 目标进程名 # 目标进程名
attach_process_name = "Navi" attach_process_name = "Navi"
# 目标包名 # 目标包名
package_name = "com.msf.angelmobile" package_name = "com.tencent.qqmusic"
# 注入的脚本路径 # 注入的脚本路径
script_path = "./hook_conversions.js" # script_path = "./hook_conversions.js"
# script_path = "./r0capture/script.js" # script_path = "./r0capture/script.js"
# script_path = "url_request.js" # script_path = "url_request.js"
script_path = "hook_qqmusic.js"
main(package_name,script_path, is_spawn) main(package_name,script_path, is_spawn)