45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""极简Frida方法名测试 - 只加载小脚本"""
|
|
import frida, time, json, sys
|
|
|
|
print("[1] Connecting to 192.168.0.12:27042...")
|
|
d = frida.get_device_manager().add_remote_device("192.168.0.12:27042")
|
|
print(f"[2] Device: {d.name}")
|
|
print("[3] Attaching to PID 7239...")
|
|
s = d.attach(7239)
|
|
print("[4] Creating mini script...")
|
|
|
|
# 极简脚本
|
|
MINI = """
|
|
'use strict';
|
|
rpc.exports = {
|
|
ping: function() { return "pong_mini"; },
|
|
getInfo: function() { return {pid: Process.id, arch: Process.arch}; },
|
|
camelCaseTest: function() { return "camel_works"; },
|
|
snake_case_test: function() { return "snake_works"; },
|
|
};
|
|
"""
|
|
|
|
sc = s.create_script(MINI)
|
|
sc.on("message", lambda m, d: None)
|
|
sc.load()
|
|
time.sleep(1)
|
|
print("[5] Script loaded!")
|
|
|
|
e = sc.exports_sync
|
|
methods = [x for x in dir(e) if not x.startswith("_")]
|
|
print(f"[6] Available methods: {methods}")
|
|
|
|
# 测试每个方法
|
|
for name in methods:
|
|
fn = getattr(e, name)
|
|
try:
|
|
r = fn()
|
|
print(f" {name}() -> {r}")
|
|
except Exception as ex:
|
|
print(f" {name}() -> ERROR: {ex}")
|
|
|
|
sc.unload()
|
|
s.detach()
|
|
print("\n[DONE]")
|