Crawler/APP/frida_attach.py

38 lines
763 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# frida_attach.py
import frida
APP_PACKAGE_NAME = "com.huoketuoke.www"
# 连接设备
device = frida.get_usb_device()
# 查找 PID
pid = None
for app in device.enumerate_processes():
if app.name == APP_PACKAGE_NAME:
pid = app.pid
break
if pid is None:
raise RuntimeError(f"[-] 找不到运行中的 {APP_PACKAGE_NAME}")
print(f"[+] 找到进程 {APP_PACKAGE_NAME}PID: {pid}")
# 附加进程
session = device.attach(pid)
# 注入 JS 脚本
script = session.create_script("""
console.log("Frida 注入成功 - attach 模式");
""")
# 可选:处理 JS 消息
def on_message(message, data):
print("[*] JS 消息:", message)
script.on("message", on_message)
script.load()
input("[*] 按 Enter 键退出...")
session.detach()