SuperAPI AI Directory

find-crypto-entry

General & other

View repository

Updated 10-16 09:31

About this skill

find-crypto-entry

Locate the encryption parameter $ARGUMENTS generation entry point.

Goal: find the function location that generates this parameter (script URL + line/column number + function name + call path + encryption type).


Strategy selection

Choose a strategy based on signals, do not execute in a fixed order:

Strategy A: Request initiation stack (fastest path)

Directly obtain the JS call stack of the target request, and locate the encryption logic from the stack:

1. list_network_requests → 找到目标请求的 reqid
2. get_request_initiator(reqid) → 获取发起该请求的完整 JS 调用栈
3. 分析栈帧:跳过底层框架(axios/fetch),在中上层找业务代码
4. 在可疑帧处设断点验证

Applicable scenarios: known target request, can reproduce the trigger. This is the most efficient path provided by js-reverse-mcp — one call directly obtains the complete call stack, no need to manually set breakpoints.

Strategy B: Static search

Use search_in_sources to search for the parameter name (with excludeMinified=false). In most cases, directly find the assignment location, then read the context to trace the source.

Applicable scenarios: the parameter name is a plaintext string, not obfuscated.

Strategy C: XHR/Fetch breakpoints

break_on_xhr set on the request URL characteristic, after triggering find the business code frame from the call stack:

1. break_on_xhr(url_pattern) → 设置 XHR 断点
2. 触发请求(刷新页面或操作界面)
3. get_paused_info() → 获取调用栈 + 作用域变量
4. evaluate_script(expression, frameIndex) → 在指定帧检查变量

Applicable scenarios: static search has no results, need to infer backward from the request.

Strategy D: Function tracing (breakpoint-free monitoring)

Use trace_function to trace calls of suspicious functions:

1. 通过策略 B/C 找到可疑函数位置
2. trace_function(scriptId, lineNumber) → 设置 logpoint 追踪
3. 触发请求 → 观察函数调用参数和频率
4. 不中断执行,适合追踪高频调用的加密函数

Applicable scenarios: need to observe function call patterns (parameters, frequency), or breakpoints would affect the execution flow (such as when there is anti-debugging detection).

Strategy E: Pre-injection interception

Inject an interception script before the page loads, to capture encryption function calls:

1. inject_before_load(script) → 注入 Hook 脚本
2. 脚本示例:劫持 XMLHttpRequest.prototype.setRequestHeader / fetch
3. 刷新页面 → 拦截脚本在所有 JS 执行前生效
4. list_console_messages() → 读取拦截到的信息

Applicable scenarios: encryption is completed during the page initialization phase, ordinary breakpoints are too late; or need to hook native APIs (setRequestHeader/fetch) for full capture.

Strategy F: WebSocket message analysis

Locate encryption parameters in the WebSocket protocol:

1. get_websocket_messages() → 列出 WebSocket 连接和消息概览
2. get_websocket_messages(wsId) → 获取特定连接的消息详情
3. 分析消息模式(JSON? 二进制? Protobuf?)
4. 在 WebSocket 构造/send 处设断点追溯加密逻辑

Applicable scenarios: the target is not an HTTP request but an encrypted field in a WebSocket message.

Multi-strategy combination: A/B/C can be used in combination — first A to quickly obtain the call stack and locate the scope, then B static search to confirm the code, finally D tracing to verify.


Domain knowledge

Pitfalls that agents easily fall into during reverse analysis, these are experiences that cannot be derived through reasoning:

3 common architectures of encryption parameters

  1. Business code directly assigns — in the request function headers["x-sign"] = encrypt(data). Static search directly finds it.
  2. Request interceptor uniformly adds signature — uniformly added in axios interceptor or fetch wrapper. Searching for the parameter name may only appear once in the interceptor.
  3. External security SDK — independent JS file (usually obfuscated) mounts a global object (such as window.h5sign), business code calls its methods. Static search can find the call site, but the SDK internal code is all obfuscated.

Impact of OB obfuscation

When the encryption logic is in an OB-obfuscated file (characteristics:_0x prefix, large string array, RC4 decryption function),all strings are encrypted, so static searching within that file cannot match any plaintext. However, the business code that calls that file is usually not obfuscated, so searching from the business code side is more efficient.

Stack characteristics when an XHR breakpoint is hit

The XHR breakpoint is hit at the send() call site, and the bottom of the call stack is usually framework code (axios/fetch wrapper). The encryption logic is in the middle and upper layers of the stack. Skip the bottom framework frames directly and focus on the business code frames.

Notes in an anti-detection environment

js-reverse-mcp has a built-in Patchright anti-detection engine, but some scenarios still require attention:

  • Dynamically encrypted code: the encryption code of some sites is dynamically delivered from an API (not in the page JS), so you need to first find the delivery endpoint of the encryption code through network requests.
  • iframe isolation: the encryption logic may execute in an iframe. Use select_frame to switch to the target frame before searching/setting breakpoints.
  • Service Worker: the signature may be generated in a SW. Check whether there is a SW script in list_scripts .

Anti-patterns

  • Do not repeatedly step_into — it is easy to fall into the framework's reactive system (Vue reactivity, React fiber). Using evaluate_script to directly inspect variables is much more efficient than single-step tracing.
  • Do not search for strings in OB-obfuscated files — all plaintext is encrypted, so you will not find it. Search from the non-obfuscated caller.
  • Do not refresh the page frequently — every refresh invalidates all scriptIds. Set the breakpoints first and then refresh, getting it right in one go.
  • When a breakpoint is hit, prioritize using evaluate_script to specify the frame — passing the frameIndex parameter allows you to execute an expression in the specified call frame and inspect that frame's local variables.
  • Do not ignore get_request_initiator — this is the fastest path to locating the encryption entry point. One call directly obtains the complete JS call stack, which is preferable to manually setting breakpoints.

Completion criteria

Completion is achieved when the following information is found:

入口位置:
- 参数:$ARGUMENTS
- 脚本:https://example.com/static/js/main.abc123.js
- 位置:第 X 行,第 Y 列
- 函数:functionName (或 anonymous)
- 调用路径:request → addSign → encrypt
- 加密类型:[标准算法名 | 外部SDK | WASM | VM保护 | 未知/需解混淆]

下一步建议:
- 标准算法 → /ast-deobfuscate 还原后用 Python 实现
- 外部 SDK → /env-patch 补环境运行
- WASM → /wasm-reverse 分析 WASM 模块
- VM 保护 → /env-patch 补环境 + 直接调用

Only find the entry point; do not perform algorithm restoration.