32 lines
720 B
Python
32 lines
720 B
Python
import frida
|
||
|
||
APP_PACKAGE_NAME = "com.huoketuoke.www"
|
||
|
||
device = frida.get_usb_device()
|
||
|
||
# 冷启动 app,处于挂起状态
|
||
pid = device.spawn([APP_PACKAGE_NAME])
|
||
print(f"[+] Spawned {APP_PACKAGE_NAME} with PID {pid}")
|
||
|
||
# 附加到挂起进程
|
||
session = device.attach(pid)
|
||
|
||
# JS 脚本内容,可替换为从文件读取
|
||
script = session.create_script("""
|
||
console.log("Frida 注入成功 - spawn 模式");
|
||
""")
|
||
|
||
# 可选:监听 JS 中的 send 消息
|
||
def on_message(message, data):
|
||
print("[*] JS 消息:", message)
|
||
|
||
script.on("message", on_message)
|
||
script.load()
|
||
|
||
# 恢复 app 执行
|
||
device.resume(pid)
|
||
print("[+] App resumed. You can now interact with it.")
|
||
|
||
input("[*] 按 Enter 键退出...")
|
||
session.detach()
|