50 lines
1.2 KiB
Python
50 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
import frida
|
|
import sys
|
|
import time
|
|
|
|
device = frida.get_device_manager().add_remote_device("192.168.0.12:27042")
|
|
print("Connected to device")
|
|
|
|
# List processes to find wechat
|
|
procs = device.enumerate_processes()
|
|
wechat = [p for p in procs if 'tencent.mm' in p.name and ':' not in p.name]
|
|
print(f"WeChat procs: {[(p.pid, p.name) for p in wechat]}")
|
|
|
|
if not wechat:
|
|
# Try all tencent.mm
|
|
wechat_all = [p for p in procs if 'tencent.mm' in p.name]
|
|
print(f"All tencent.mm: {[(p.pid, p.name) for p in wechat_all]}")
|
|
# Use the first one without colon, or PID 7239
|
|
pid = 7239
|
|
else:
|
|
pid = wechat[0].pid
|
|
|
|
print(f"Attaching PID: {pid}")
|
|
session = device.attach(pid)
|
|
print("Attached!")
|
|
|
|
# Simple test script
|
|
script = session.create_script("""
|
|
rpc.exports = {
|
|
ping: function() { return 'pong_v3'; },
|
|
getprofile: function() { return {success: true, name: 'test'}; },
|
|
};
|
|
""")
|
|
script.load()
|
|
print("Script loaded!")
|
|
|
|
exports = script.exports_sync
|
|
print(f"Exports dir: {[x for x in dir(exports) if not x.startswith('_')]}")
|
|
print(f"ping: {exports.ping()}")
|
|
|
|
try:
|
|
r = exports.getprofile()
|
|
print(f"getprofile: {r}")
|
|
except Exception as e:
|
|
print(f"getprofile error: {e}")
|
|
|
|
script.unload()
|
|
session.detach()
|
|
print("Done!")
|