高级配方
小于 1 分钟
高级配方
HTTP 调试入口
httpServer.start({
port: 18765,
allowLan: false,
token: "demo-token"
});
httpServer.get("/state", req => {
return {
status: 200,
mimeType: "application/json; charset=utf-8",
body: JSON.stringify({
packageName: req.packageName,
processName: req.processName,
activity: String(activity)
})
};
});
DexKit 查类
const bridge = openDexKit("/sdcard/Download/base.apk");
const result = bridge.findClass(
FindClass.create().matcher(
ClassMatcher.create().className("Login", StringMatchType.Contains)
)
);
log(JSON.stringify(result));
ImGui 调试面板
imgui
.window("debug-panel")
.title("JSXHook Debug")
.size(360, 520)
.text(`pkg=${lpparam.packageName}`)
.text(`process=${lpparam.processName}`)
.separator()
.button("Print Activity Fields", () => {
printFields(activity, "\n");
})
.show();
文件与存储
const store = storages.create("demo");
const logPath = files.join(files.cwd(), "logs/runtime.txt");
files.ensureDir(files.join(files.cwd(), "logs/"));
files.append(logPath, `${Date.now()} boot\n`);
store.put("lastLogPath", logPath);
设备信息与唤醒
log(`${device.brand} ${device.model} sdk=${device.sdkInt}`);
if (!device.isScreenOn()) {
device.wakeUp();
}
device.vibrate(60);
MCP Tool
mcpServer.start({
port: 5698,
endpoint: "/mcp",
token: "secret-token"
});
mcpServer.tool("current_context", {
title: "Current Context",
description: "Return package and process info",
inputSchema: {
type: "object",
properties: {}
}
}, () => {
return {
content: [
{
type: "text",
text: JSON.stringify({
packageName: lpparam.packageName,
processName: lpparam.processName
})
}
]
};
});
这些配方更适合当“调试脚手架”,先跑起来,再逐步替换成你自己的业务逻辑。
