更新 main.py

master
wangsiyuan 2023-10-19 11:26:22 +08:00
parent f16dd8cae1
commit 64e5f9c6d9
1 changed files with 6 additions and 1 deletions

View File

@ -8,7 +8,8 @@ import time
FIRST_WRITE = True # 全局变量,用于跟踪是否是首次写入
def on_message(message, data):
modules.files_utils.write_log(message)
print(message)
# modules.files_utils.write_log(message)
# print(message)
# if message['type'] == 'send':
# print(message['payload'])
@ -24,6 +25,7 @@ def attach_method(is_spawn):
def main(package_name,script_path,is_spawn):
# 从Python发送数据到Frida的JavaScript脚本
print(f"script_path: {script_path}")
js_code = modules.files_utils.read_javascript(script_path)
# print(js_code)
@ -39,6 +41,8 @@ def main(package_name,script_path,is_spawn):
script = process.create_script(js_code)
script.on("message", on_message)
script.load()
data_to_send = {'data': 'Hello from Python!'}
script.post({'type': 'input_data', 'payload': data_to_send})
device.resume(pid) # 加载完脚本后, 恢复进程运行
sys.stdin.read()
else:
@ -69,4 +73,5 @@ if __name__ == '__main__':
# 注入的脚本路径
script_path = "./hook_conversions.js"
# script_path = "./r0capture/script.js"
# script_path = "url_request.js"
main(package_name,script_path, is_spawn)