@jshookmcp/jshook 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -40
- package/README.zh.md +77 -40
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +13 -1
- package/dist/index.js +0 -0
- package/dist/modules/analyzer/IntelligentAnalyzer.js +19 -11
- package/dist/modules/browser/BrowserModeManager.d.ts +5 -0
- package/dist/modules/browser/BrowserModeManager.js +96 -10
- package/dist/modules/browser/CamoufoxBrowserManager.d.ts +4 -0
- package/dist/modules/browser/CamoufoxBrowserManager.js +64 -3
- package/dist/modules/browser/TabRegistry.js +3 -2
- package/dist/modules/browser/UnifiedBrowserManager.d.ts +5 -0
- package/dist/modules/browser/UnifiedBrowserManager.js +62 -9
- package/dist/modules/debugger/DebuggerSessionManager.d.ts +4 -0
- package/dist/modules/debugger/DebuggerSessionManager.js +29 -19
- package/dist/modules/debugger/ScriptManager.impl.class.d.ts +4 -0
- package/dist/modules/debugger/ScriptManager.impl.class.js +46 -21
- package/dist/modules/emulator/EnvironmentEmulator.js +2 -2
- package/dist/modules/monitor/NetworkMonitor.impl.d.ts +1 -0
- package/dist/modules/monitor/NetworkMonitor.impl.js +22 -15
- package/dist/modules/monitor/PerformanceMonitor.js +64 -32
- package/dist/modules/process/LinuxProcessManager.d.ts +3 -1
- package/dist/modules/process/LinuxProcessManager.js +7 -3
- package/dist/modules/process/MacProcessManager.d.ts +3 -1
- package/dist/modules/process/MacProcessManager.js +7 -3
- package/dist/modules/process/ProcessManager.impl.d.ts +5 -1
- package/dist/modules/process/ProcessManager.impl.js +54 -13
- package/dist/modules/process/index.d.ts +3 -1
- package/dist/modules/process/index.js +2 -2
- package/dist/modules/process/memory/AuditTrail.d.ts +25 -0
- package/dist/modules/process/memory/AuditTrail.js +44 -0
- package/dist/modules/process/memory/linux/mapsParser.d.ts +16 -0
- package/dist/modules/process/memory/linux/mapsParser.js +28 -0
- package/dist/modules/process/memory/regions.enumerate.js +45 -1
- package/dist/modules/process/memory/regions.protection.js +48 -2
- package/dist/modules/process/memory/scanner.d.ts +4 -1
- package/dist/modules/process/memory/scanner.js +225 -24
- package/dist/native/NativeMemoryManager.impl.d.ts +4 -0
- package/dist/native/NativeMemoryManager.impl.js +72 -24
- package/dist/native/NativeMemoryManager.utils.d.ts +1 -0
- package/dist/native/NativeMemoryManager.utils.js +44 -1
- package/dist/server/MCPServer.search.d.ts +3 -0
- package/dist/server/MCPServer.search.js +21 -2
- package/dist/server/ToolCallContextGuard.d.ts +2 -0
- package/dist/server/ToolCallContextGuard.js +29 -14
- package/dist/server/ToolSearch.js +11 -5
- package/dist/server/domains/browser/handlers/tab-workflow.js +6 -4
- package/dist/server/domains/maintenance/handlers.extensions.js +46 -26
- package/dist/server/domains/process/definitions.js +20 -7
- package/dist/server/domains/process/handlers.impl.core.runtime.base.d.ts +35 -0
- package/dist/server/domains/process/handlers.impl.core.runtime.base.js +107 -1
- package/dist/server/domains/process/handlers.impl.core.runtime.inject.js +111 -2
- package/dist/server/domains/process/handlers.impl.core.runtime.memory.d.ts +9 -0
- package/dist/server/domains/process/handlers.impl.core.runtime.memory.js +282 -31
- package/dist/server/domains/process/manifest.js +1 -0
- package/dist/server/domains/workflow/handlers.impl.workflow-api.js +14 -4
- package/dist/server/registry/discovery.js +17 -12
- package/dist/server/registry/index.js +10 -2
- package/dist/utils/TokenBudgetManager.d.ts +1 -0
- package/dist/utils/TokenBudgetManager.js +22 -0
- package/package.json +28 -41
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
English | [中文](./README.zh.md)
|
|
10
10
|
|
|
11
|
-
An MCP (Model Context Protocol) server providing **
|
|
11
|
+
An MCP (Model Context Protocol) server providing **245 built-in tools** — **237 domain tools across 16 domains** plus **8 built-in meta-tools** — with runtime extension loading from `plugins/` and `workflows/` for AI-assisted JavaScript analysis and security analysis. Combines browser automation, Chrome DevTools Protocol debugging, network monitoring, intelligent JavaScript hooks, LLM-powered code analysis, process/memory inspection, WASM toolchain, binary encoding, anti-anti-debug, GraphQL discovery, source map reconstruction, AST transforms, crypto reconstruction, platform package analysis, Burp Suite / native analysis tool bridges, human behavior simulation, CAPTCHA solving, batch account workflows, and high-level composite workflow orchestration in a single server.
|
|
12
12
|
|
|
13
13
|
## Start Here
|
|
14
14
|
|
|
@@ -21,6 +21,9 @@ An MCP (Model Context Protocol) server providing **244 built-in tools** — **23
|
|
|
21
21
|
|
|
22
22
|
## Features
|
|
23
23
|
|
|
24
|
+
<details>
|
|
25
|
+
<summary>Open the full feature list</summary>
|
|
26
|
+
|
|
24
27
|
- **Browser Automation** — Launch Chromium/Camoufox, navigate pages, interact with the DOM, take screenshots, manage cookies and storage
|
|
25
28
|
- **CDP Debugger** — Set breakpoints, step through execution, inspect scope variables, watch expressions, session save/restore
|
|
26
29
|
- **Network Monitoring** — Capture requests/responses, filter by URL or method, retrieve response bodies, paginated access with `offset+limit`
|
|
@@ -53,20 +56,25 @@ An MCP (Model Context Protocol) server providing **244 built-in tools** — **23
|
|
|
53
56
|
- **Native Analysis Tool Bridge** — Ghidra and IDA Pro bridge: decompile functions, list symbols, run scripts, cross-reference analysis; loopback-only SSRF protection
|
|
54
57
|
- **Batch Account Registration** — Orchestrate multi-account registration with per-account retry, capped exponential backoff, idempotent key deduplication, PII masking, timeout cleanup
|
|
55
58
|
- **Stealth Injection** — Anti-detection patches for headless browser fingerprinting
|
|
56
|
-
- **Process & Memory** — Cross-platform process enumeration, memory read/write/scan, DLL/shellcode injection (Windows), Electron app attachment
|
|
59
|
+
- **Process & Memory** — Cross-platform process enumeration, memory read/write/scan with structured diagnostics, in-memory audit export, controlled DLL/shellcode injection (Windows, disabled by default), Electron app attachment
|
|
57
60
|
- **Performance** — Smart caching, token budget management, code coverage, progressive tool disclosure with lazy domain initialization, BM25 search-based discovery (~800 tokens init for search profile vs ~18K for full)
|
|
58
61
|
- **B-Skeleton Contracts** — Extensibility contracts for plugins (`PluginContract` with lifecycle state machine), workflows (`WorkflowContract` with declarative DAG builder), and observability (`InstrumentationContract` with noop default + OTLP-ready span/metric interface)
|
|
59
62
|
- **Domain Self-Discovery** — Runtime manifest scanning (`domains/*/manifest.ts`) replaces hardcoded imports; add new tool domains by creating a single `manifest.ts` file — no manual wiring needed
|
|
60
63
|
- **Security** — Bearer token auth (`MCP_AUTH_TOKEN`), Origin-based CSRF protection, per-hop SSRF validation, symlink-safe path handling, PowerShell injection prevention
|
|
61
64
|
|
|
65
|
+
</details>
|
|
66
|
+
|
|
62
67
|
## Architecture
|
|
63
68
|
|
|
69
|
+
<details>
|
|
70
|
+
<summary>Open architecture notes</summary>
|
|
71
|
+
|
|
64
72
|
Built on `@modelcontextprotocol/sdk` v1.27+ using the **McpServer high-level API**:
|
|
65
73
|
|
|
66
74
|
- All tools registered via `server.registerTool()` — no manual request handlers
|
|
67
75
|
- Tool schemas built dynamically from JSON Schema (input validated per-tool by domain handlers)
|
|
68
76
|
- **Four tool profiles**: `search` (BM25 discovery), `minimal` (fast startup), `workflow` (end-to-end JavaScript and security analysis), `full` (all domains)
|
|
69
|
-
- **Progressive discovery**: `search` profile exposes
|
|
77
|
+
- **Progressive discovery**: `search` profile exposes 12 maintenance-domain tools + 8 built-in meta-tools; `search_tools` covers built-ins plus loaded plugins/workflows, and workflow/full-tier sessions boost workflow-domain results
|
|
70
78
|
- **Domain self-discovery**: at startup the registry scans `domains/*/manifest.ts` via dynamic ESM import — new domains are auto-detected without modifying any central file
|
|
71
79
|
- **DomainManifest contract**: each domain exports a standardized manifest (`kind`, `version`, `domain`, `depKey`, `profiles`, `registrations`, `ensure`) — profile membership, tool definitions, and handler factories all co-located in one file
|
|
72
80
|
- **Lazy domain initialization**: handler classes instantiated on first tool invocation via Proxy, not during init
|
|
@@ -74,6 +82,8 @@ Built on `@modelcontextprotocol/sdk` v1.27+ using the **McpServer high-level API
|
|
|
74
82
|
- Two transport modes: **stdio** (default) and **Streamable HTTP** (MCP current revision)
|
|
75
83
|
- Capabilities: `{ tools: { listChanged: true }, logging: {} }`
|
|
76
84
|
|
|
85
|
+
</details>
|
|
86
|
+
|
|
77
87
|
## Requirements
|
|
78
88
|
|
|
79
89
|
- Node.js >= 20
|
|
@@ -132,6 +142,8 @@ On Windows, common cache locations are:
|
|
|
132
142
|
|
|
133
143
|
## Configuration
|
|
134
144
|
|
|
145
|
+
See the dedicated docs chapter for configuration details: `docs/guide/configuration.md:1`
|
|
146
|
+
|
|
135
147
|
If you are running from source, copy `.env.example` to `.env` and fill in your values:
|
|
136
148
|
|
|
137
149
|
```bash
|
|
@@ -182,10 +194,10 @@ Additional runtime options exist in code but are not enabled by default in `.env
|
|
|
182
194
|
|
|
183
195
|
| Profile | Domains | Tools | Init Tokens | vs Full |
|
|
184
196
|
| ---------- | ------------------------------------------------------------------------------------- | ------------------------- | ----------- | ------- |
|
|
185
|
-
| `search` | maintenance |
|
|
186
|
-
| `minimal` | browser, maintenance |
|
|
187
|
-
| `workflow` | browser, network, workflow, maintenance, core, debugger, streaming, encoding, graphql |
|
|
188
|
-
| `full` | all 16 domains |
|
|
197
|
+
| `search` | maintenance | 20 (12 domain + 8 meta) | ~3,440 | 8% |
|
|
198
|
+
| `minimal` | browser, maintenance | 80 (72 domain + 8 meta) | ~13,760 | 33% |
|
|
199
|
+
| `workflow` | browser, network, workflow, maintenance, core, debugger, streaming, encoding, graphql | 181 (173 domain + 8 meta) | ~31,132 | 74% |
|
|
200
|
+
| `full` | all 16 domains | 245 (237 domain + 8 meta) | ~42,140 | 100% |
|
|
189
201
|
|
|
190
202
|
> Token counts are rough estimates derived from the previous `claude /doctor` average of ~172 tokens/tool. All profiles include 8 meta-tools: `search_tools`, `activate_tools`, `deactivate_tools`, `activate_domain`, `boost_profile`, `unboost_profile`, `extensions_list`, `extensions_reload`.
|
|
191
203
|
|
|
@@ -243,7 +255,7 @@ Connect your MCP client to `http://localhost:3000/mcp`. The server supports:
|
|
|
243
255
|
|
|
244
256
|
Session IDs are issued via the `Mcp-Session-Id` response header.
|
|
245
257
|
|
|
246
|
-
## Tool Domains (
|
|
258
|
+
## Tool Domains (237 Domain Tools)
|
|
247
259
|
|
|
248
260
|
### Core / Analysis (13 tools)
|
|
249
261
|
|
|
@@ -457,40 +469,41 @@ Session IDs are issued via the `Mcp-Session-Id` response header.
|
|
|
457
469
|
|
|
458
470
|
</details>
|
|
459
471
|
|
|
460
|
-
### Process / Memory / Electron (
|
|
472
|
+
### Process / Memory / Electron (26 tools)
|
|
461
473
|
|
|
462
474
|
<details>
|
|
463
|
-
<summary>Process enumeration, memory
|
|
464
|
-
|
|
465
|
-
| # | Tool | Description
|
|
466
|
-
| --- | -------------------------- |
|
|
467
|
-
| 1 | `process_find` | Find processes by name pattern
|
|
468
|
-
| 2 | `process_list` | List all running processes
|
|
469
|
-
| 3 | `process_get` | Get detailed info about a specific process
|
|
470
|
-
| 4 | `process_windows` | Get all window handles for a process
|
|
471
|
-
| 5 | `process_find_chromium` |
|
|
472
|
-
| 6 | `process_check_debug_port` | Check if a process has a debug port enabled
|
|
473
|
-
| 7 | `process_launch_debug` | Launch an executable with remote debugging port
|
|
474
|
-
| 8 | `process_kill` | Kill a process by PID
|
|
475
|
-
| 9 | `memory_read` | Read process memory
|
|
476
|
-
| 10 | `memory_write` | Write
|
|
477
|
-
| 11 | `memory_scan` | Scan
|
|
478
|
-
| 12 | `memory_check_protection` | Check memory protection flags (R/W/X)
|
|
479
|
-
| 13 | `memory_protect` |
|
|
480
|
-
| 14 | `memory_scan_filtered` | Secondary scan within a filtered address set
|
|
481
|
-
| 15 | `memory_batch_write` | Write multiple memory patches at once
|
|
482
|
-
| 16 | `memory_dump_region` | Dump a memory region to binary file
|
|
483
|
-
| 17 | `memory_list_regions` | List all memory regions with protection flags
|
|
484
|
-
| 18 | `
|
|
485
|
-
| 19 | `
|
|
486
|
-
| 20 | `
|
|
487
|
-
| 21 | `
|
|
488
|
-
| 22 | `
|
|
489
|
-
| 23 | `
|
|
490
|
-
| 24 | `
|
|
491
|
-
| 25 | `
|
|
492
|
-
|
|
493
|
-
|
|
475
|
+
<summary>Process enumeration, memory diagnostics and audit export, controlled DLL/shellcode injection, Electron attachment</summary>
|
|
476
|
+
|
|
477
|
+
| # | Tool | Description |
|
|
478
|
+
| --- | -------------------------- | ---------------------------------------------------------------------------------- |
|
|
479
|
+
| 1 | `process_find` | Find processes by name pattern |
|
|
480
|
+
| 2 | `process_list` | List all running processes |
|
|
481
|
+
| 3 | `process_get` | Get detailed info about a specific process |
|
|
482
|
+
| 4 | `process_windows` | Get all window handles for a process |
|
|
483
|
+
| 5 | `process_find_chromium` | Disabled by design; use managed browser sessions |
|
|
484
|
+
| 6 | `process_check_debug_port` | Check if a process has a debug port enabled |
|
|
485
|
+
| 7 | `process_launch_debug` | Launch an executable with remote debugging port |
|
|
486
|
+
| 8 | `process_kill` | Kill a process by PID |
|
|
487
|
+
| 9 | `memory_read` | Read process memory; failures include diagnostics |
|
|
488
|
+
| 10 | `memory_write` | Write process memory; failures include diagnostics |
|
|
489
|
+
| 11 | `memory_scan` | Scan memory for a hex/value pattern with diagnostics on failure |
|
|
490
|
+
| 12 | `memory_check_protection` | Check memory protection flags (R/W/X) |
|
|
491
|
+
| 13 | `memory_protect` | Alias for `memory_check_protection` |
|
|
492
|
+
| 14 | `memory_scan_filtered` | Secondary scan within a filtered address set |
|
|
493
|
+
| 15 | `memory_batch_write` | Write multiple memory patches at once |
|
|
494
|
+
| 16 | `memory_dump_region` | Dump a memory region to binary file |
|
|
495
|
+
| 17 | `memory_list_regions` | List all memory regions with protection flags |
|
|
496
|
+
| 18 | `memory_audit_export` | Export the in-memory audit trail for memory operations |
|
|
497
|
+
| 19 | `inject_dll` | Disabled by default; set `ENABLE_INJECTION_TOOLS=true` to enable on Windows |
|
|
498
|
+
| 20 | `module_inject_dll` | Alias for `inject_dll` |
|
|
499
|
+
| 21 | `inject_shellcode` | Disabled by default; accepts hex/base64 and requires `ENABLE_INJECTION_TOOLS=true` |
|
|
500
|
+
| 22 | `module_inject_shellcode` | Alias for `inject_shellcode` |
|
|
501
|
+
| 23 | `check_debug_port` | Check if a process is being debugged |
|
|
502
|
+
| 24 | `enumerate_modules` | List all loaded modules (DLLs) with base addresses |
|
|
503
|
+
| 25 | `module_list` | Alias for `enumerate_modules` |
|
|
504
|
+
| 26 | `electron_attach` | Connect to a running Electron app via CDP |
|
|
505
|
+
|
|
506
|
+
> **Platform notes:** Memory read/write/scan/dump work on **Windows** (native API) and **macOS** (lldb + vmmap). Failed `memory_read` / `memory_write` / `memory_scan` calls now include structured `diagnostics`, and `memory_audit_export` lets you export the in-memory audit trail. Injection tools are disabled by default; enable them with `ENABLE_INJECTION_TOOLS=true` on Windows with elevated privileges.
|
|
494
507
|
|
|
495
508
|
</details>
|
|
496
509
|
|
|
@@ -681,6 +694,9 @@ Session IDs are issued via the `Mcp-Session-Id` response header.
|
|
|
681
694
|
|
|
682
695
|
### Meta-Tools (8 tools)
|
|
683
696
|
|
|
697
|
+
<details>
|
|
698
|
+
<summary>Open the meta-tool list</summary>
|
|
699
|
+
|
|
684
700
|
| # | Tool | Description |
|
|
685
701
|
| --- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
686
702
|
| 1 | `search_tools` | _(meta-tool)_ BM25 keyword search across built-in tools + loaded plugin/workflow tools; in `workflow/full` tiers, workflow-domain matches receive a ranking boost. When extension workflows are loaded, `run_extension_workflow` / `list_extension_workflows` get extra ranking weight (especially for register/captcha/keygen-style intents). |
|
|
@@ -692,8 +708,13 @@ Session IDs are issued via the `Mcp-Session-Id` response header.
|
|
|
692
708
|
| 7 | `extensions_list` | _(meta-tool)_ List currently loaded extensions from `plugins/` and `workflows/` |
|
|
693
709
|
| 8 | `extensions_reload` | _(meta-tool)_ Reload extensions at runtime and register extension tools dynamically |
|
|
694
710
|
|
|
711
|
+
</details>
|
|
712
|
+
|
|
695
713
|
## Dynamic Extensions (plugins/workflows)
|
|
696
714
|
|
|
715
|
+
<details>
|
|
716
|
+
<summary>Open extension layout, discovery, and reload rules</summary>
|
|
717
|
+
|
|
697
718
|
- Default extension roots (global, under jshook installation directory):
|
|
698
719
|
- `<jshook-install>/plugins`
|
|
699
720
|
- `<jshook-install>/workflows`
|
|
@@ -741,6 +762,14 @@ Session IDs are issued via the `Mcp-Session-Id` response header.
|
|
|
741
762
|
- `activate_domain` can include extension domains only after `extensions_reload`.
|
|
742
763
|
- On reload, plugin lifecycle cleanup hooks are executed when available (`onDeactivate` then `onUnload`).
|
|
743
764
|
|
|
765
|
+
</details>
|
|
766
|
+
|
|
767
|
+
## Safety & Liability Disclaimer
|
|
768
|
+
|
|
769
|
+
- Process memory mutation, code injection, traffic replay, and similar low-level capabilities are provided as-is.
|
|
770
|
+
- Third-party plugins, workflows, and extensions loaded from local paths or registries are not audited, endorsed, or warranted by this project.
|
|
771
|
+
- You are responsible for reviewing what you enable and for any operational, legal, security, or data-loss consequences that follow from using built-in mutation features or external extensions.
|
|
772
|
+
|
|
744
773
|
## Generated Artifacts & Cleanup
|
|
745
774
|
|
|
746
775
|
| Artifact | Default location | Created by |
|
|
@@ -798,8 +827,11 @@ pnpm run doctor
|
|
|
798
827
|
|
|
799
828
|
## Extension Templates
|
|
800
829
|
|
|
830
|
+
> This section is about extension authoring templates, not the installation path for the main `jshook` server. If you only want to use the server, prefer `npx @jshookmcp/jshook` above. Clone and build the template repositories only when you want to develop your own plugin or workflow.
|
|
831
|
+
|
|
801
832
|
- Plugin starter repo: `https://github.com/vmoranv/jshook_plugin_template`
|
|
802
833
|
- Workflow starter repo: `https://github.com/vmoranv/jshook_workflow_template`
|
|
834
|
+
- Registry submissions: open an issue in `https://github.com/vmoranv/jshookmcpextension/issues` if you want your plugin or workflow considered for the extension registry
|
|
803
835
|
|
|
804
836
|
## Project Stats
|
|
805
837
|
|
package/README.zh.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
[English](./README.md) | 中文
|
|
10
10
|
|
|
11
|
-
面向 AI 辅助 JavaScript 分析与安全分析的 MCP(模型上下文协议)服务器,提供 **
|
|
11
|
+
面向 AI 辅助 JavaScript 分析与安全分析的 MCP(模型上下文协议)服务器,提供 **245 个内置工具**——其中 **16 个域下 237 个域工具**,外加 **8 个内置元工具**——并支持从 `plugins/` 与 `workflows/` 目录运行时动态扩展。集成浏览器自动化、Chrome DevTools Protocol 调试、网络监控、智能 JavaScript Hook、LLM 驱动代码分析、进程/内存操作、WASM 工具链、二进制编码、反反调试、GraphQL 发现、Source Map 重建、AST 变换、加密重构、平台包分析、Burp Suite / Native 分析工具桥接及高层复合工作流编排。
|
|
12
12
|
|
|
13
13
|
## 从这里开始
|
|
14
14
|
|
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
|
|
22
22
|
## 功能特性
|
|
23
23
|
|
|
24
|
+
<details>
|
|
25
|
+
<summary>展开完整功能清单</summary>
|
|
26
|
+
|
|
24
27
|
- **浏览器自动化** — 启动 Chromium/Camoufox、页面导航、DOM 交互、截图、Cookie 与存储管理
|
|
25
28
|
- **CDP 调试器** — 断点设置、单步执行、作用域变量检查、监视表达式、会话保存/恢复
|
|
26
29
|
- **网络监控** — 请求/响应捕获、URL/方法过滤、响应体获取、`offset+limit` 分页访问
|
|
@@ -51,19 +54,24 @@
|
|
|
51
54
|
- **Native 分析工具桥接** — Ghidra 与 IDA Pro 桥接:函数反编译、符号查询、脚本执行、交叉引用分析;端点仅允许回环地址并具备 SSRF 防护
|
|
52
55
|
- **CAPTCHA 处理** — AI 视觉检测、手动验证流程、可配置轮询
|
|
53
56
|
- **隐身注入** — 针对无头浏览器指纹识别的反检测补丁
|
|
54
|
-
- **进程与内存** —
|
|
57
|
+
- **进程与内存** — 跨平台进程枚举、带结构化 diagnostics 的内存读写/扫描、内存操作审计导出、默认关闭的 DLL/Shellcode 注入(Windows)、Electron 应用附加
|
|
55
58
|
- **性能优化** — 智能缓存、Token 预算管理、代码覆盖率、渐进工具披露与按域懒初始化、BM25 搜索发现(search 档位初始化仅约 800 token,full 档位约 18K token)
|
|
56
59
|
- **域自发现** — 运行时清单扫描(`domains/*/manifest.ts`)替代硬编码导入;添加新工具域只需创建一个 `manifest.ts` 文件,无需修改任何中心注册代码
|
|
57
60
|
- **安全防护** — Bearer 令牌认证(`MCP_AUTH_TOKEN`)、Origin CSRF 防护、逐跳 SSRF 校验、symlink 安全路径处理、PowerShell 注入防护、外部工具安全执行
|
|
58
61
|
|
|
62
|
+
</details>
|
|
63
|
+
|
|
59
64
|
## 架构
|
|
60
65
|
|
|
66
|
+
<details>
|
|
67
|
+
<summary>展开架构说明</summary>
|
|
68
|
+
|
|
61
69
|
基于 `@modelcontextprotocol/sdk` v1.27+ 的 **McpServer 高层 API** 构建:
|
|
62
70
|
|
|
63
71
|
- 所有工具通过 `server.registerTool()` 注册,无手动请求处理
|
|
64
72
|
- 工具 Schema 从 JSON Schema 动态构建(输入由各域 handler 验证)
|
|
65
73
|
- **四种工具档位**:`search`(BM25 搜索发现)、`minimal`(快速启动)、`workflow`(端到端 JavaScript 与安全分析)、`full`(全部域)
|
|
66
|
-
- **渐进发现**:`search` 档位暴露
|
|
74
|
+
- **渐进发现**:`search` 档位暴露 12 个 maintenance 域工具 + 8 个内置元工具;`search_tools` 会同时搜索内置工具与已加载的插件/工作流工具,且 `workflow/full` 档位会提高工作流结果的排序优先级
|
|
67
75
|
- **域自发现**:启动时 registry 通过动态 ESM import 扫描 `domains/*/manifest.ts` — 新域无需修改任何中心文件即可被自动检测
|
|
68
76
|
- **DomainManifest 契约**:每个域导出标准化清单(`kind`、`version`、`domain`、`depKey`、`profiles`、`registrations`、`ensure`)— 档位归属、工具定义和 handler 工厂全部集中在一个文件中
|
|
69
77
|
- **按域懒初始化**:handler 类通过 Proxy 在首次工具调用时实例化,不在 init 阶段创建
|
|
@@ -71,6 +79,8 @@
|
|
|
71
79
|
- 两种传输模式:**stdio**(默认)和 **Streamable HTTP**(MCP 当前修订版)
|
|
72
80
|
- 能力声明:`{ tools: { listChanged: true }, logging: {} }`
|
|
73
81
|
|
|
82
|
+
</details>
|
|
83
|
+
|
|
74
84
|
## 环境要求
|
|
75
85
|
|
|
76
86
|
- Node.js >= 20
|
|
@@ -129,6 +139,8 @@ Windows 常见缓存路径:
|
|
|
129
139
|
|
|
130
140
|
## 配置
|
|
131
141
|
|
|
142
|
+
文档站中的独立配置章节见:`docs/guide/configuration.md:1`
|
|
143
|
+
|
|
132
144
|
如果你是从源码运行,请将 `.env.example` 复制为 `.env` 并填写:
|
|
133
145
|
|
|
134
146
|
```bash
|
|
@@ -179,10 +191,10 @@ cp .env.example .env
|
|
|
179
191
|
|
|
180
192
|
| 档位 | 包含域 | 工具数 | 初始化 Tokens | 占比 |
|
|
181
193
|
| ---------- | ------------------------------------------------------------------------------------- | -------------------------------- | ------------- | ---- |
|
|
182
|
-
| `search` | maintenance |
|
|
183
|
-
| `minimal` | browser, maintenance |
|
|
184
|
-
| `workflow` | browser, network, workflow, maintenance, core, debugger, streaming, encoding, graphql |
|
|
185
|
-
| `full` | 全部 16 个域 |
|
|
194
|
+
| `search` | maintenance | 20(12 个域工具 + 8 个元工具) | ~3,440 | 8% |
|
|
195
|
+
| `minimal` | browser, maintenance | 80(72 个域工具 + 8 个元工具) | ~13,760 | 33% |
|
|
196
|
+
| `workflow` | browser, network, workflow, maintenance, core, debugger, streaming, encoding, graphql | 181(173 个域工具 + 8 个元工具) | ~31,132 | 74% |
|
|
197
|
+
| `full` | 全部 16 个域 | 245(237 个域工具 + 8 个元工具) | ~42,140 | 100% |
|
|
186
198
|
|
|
187
199
|
> Token 数据为近似值,按此前 `claude /doctor` 的平均 172 tokens/工具估算。所有档位均包含 8 个元工具:`search_tools`、`activate_tools`、`deactivate_tools`、`activate_domain`、`boost_profile`、`unboost_profile`、`extensions_list`、`extensions_reload`。
|
|
188
200
|
|
|
@@ -190,6 +202,9 @@ cp .env.example .env
|
|
|
190
202
|
|
|
191
203
|
### 动态扩展(plugins/workflows)
|
|
192
204
|
|
|
205
|
+
<details>
|
|
206
|
+
<summary>展开扩展目录、约定与热加载规则</summary>
|
|
207
|
+
|
|
193
208
|
- 默认扩展目录:
|
|
194
209
|
- `./plugins`
|
|
195
210
|
- `./workflows`
|
|
@@ -225,6 +240,8 @@ MCP_TOOL_DOMAINS=browser,maintenance jshook
|
|
|
225
240
|
MCP_TRANSPORT=http MCP_AUTH_TOKEN=mysecret jshook
|
|
226
241
|
```
|
|
227
242
|
|
|
243
|
+
</details>
|
|
244
|
+
|
|
228
245
|
## MCP 客户端配置
|
|
229
246
|
|
|
230
247
|
### stdio(默认 — 本地 MCP 客户端)
|
|
@@ -258,7 +275,7 @@ MCP_TRANSPORT=http MCP_PORT=3000 jshook
|
|
|
258
275
|
|
|
259
276
|
会话 ID 通过 `Mcp-Session-Id` 响应头下发。
|
|
260
277
|
|
|
261
|
-
## 工具域(
|
|
278
|
+
## 工具域(237 个域工具)
|
|
262
279
|
|
|
263
280
|
### 核心 / 分析(13 个工具)
|
|
264
281
|
|
|
@@ -467,40 +484,41 @@ MCP_TRANSPORT=http MCP_PORT=3000 jshook
|
|
|
467
484
|
|
|
468
485
|
</details>
|
|
469
486
|
|
|
470
|
-
### 进程 / 内存 / Electron(
|
|
487
|
+
### 进程 / 内存 / Electron(26 个工具)
|
|
471
488
|
|
|
472
489
|
<details>
|
|
473
|
-
<summary
|
|
474
|
-
|
|
475
|
-
| # | 工具 | 说明
|
|
476
|
-
| --- | -------------------------- |
|
|
477
|
-
| 1 | `process_find` | 按名称模式查找进程
|
|
478
|
-
| 2 | `process_list` | 列出所有运行进程
|
|
479
|
-
| 3 | `process_get` | 获取特定进程详情
|
|
480
|
-
| 4 | `process_windows` | 获取进程的所有窗口句柄
|
|
481
|
-
| 5 | `process_find_chromium` |
|
|
482
|
-
| 6 | `process_check_debug_port` | 检查进程是否启用了调试端口
|
|
483
|
-
| 7 | `process_launch_debug` | 以远程调试端口启动可执行文件
|
|
484
|
-
| 8 | `process_kill` | 按 PID 结束进程
|
|
485
|
-
| 9 | `memory_read` |
|
|
486
|
-
| 10 | `memory_write` |
|
|
487
|
-
| 11 | `memory_scan` | 按 hex
|
|
488
|
-
| 12 | `memory_check_protection` | 检查内存保护标志(R/W/X)
|
|
489
|
-
| 13 | `memory_protect` |
|
|
490
|
-
| 14 | `memory_scan_filtered` | 在已过滤地址集中二次扫描
|
|
491
|
-
| 15 | `memory_batch_write` | 批量写入多个内存补丁
|
|
492
|
-
| 16 | `memory_dump_region` | 将内存区域转储为二进制文件
|
|
493
|
-
| 17 | `memory_list_regions` | 列出所有内存区域及保护标志
|
|
494
|
-
| 18 | `
|
|
495
|
-
| 19 | `
|
|
496
|
-
| 20 | `
|
|
497
|
-
| 21 | `
|
|
498
|
-
| 22 | `
|
|
499
|
-
| 23 | `
|
|
500
|
-
| 24 | `
|
|
501
|
-
| 25 | `
|
|
502
|
-
|
|
503
|
-
|
|
490
|
+
<summary>进程枚举、内存诊断与审计导出、受控 DLL/Shellcode 注入、Electron 附加</summary>
|
|
491
|
+
|
|
492
|
+
| # | 工具 | 说明 |
|
|
493
|
+
| --- | -------------------------- | ---------------------------------------------------------------------- |
|
|
494
|
+
| 1 | `process_find` | 按名称模式查找进程 |
|
|
495
|
+
| 2 | `process_list` | 列出所有运行进程 |
|
|
496
|
+
| 3 | `process_get` | 获取特定进程详情 |
|
|
497
|
+
| 4 | `process_windows` | 获取进程的所有窗口句柄 |
|
|
498
|
+
| 5 | `process_find_chromium` | 按设计禁用;请改用受管浏览器会话 |
|
|
499
|
+
| 6 | `process_check_debug_port` | 检查进程是否启用了调试端口 |
|
|
500
|
+
| 7 | `process_launch_debug` | 以远程调试端口启动可执行文件 |
|
|
501
|
+
| 8 | `process_kill` | 按 PID 结束进程 |
|
|
502
|
+
| 9 | `memory_read` | 读取进程指定地址的内存;失败时返回 diagnostics |
|
|
503
|
+
| 10 | `memory_write` | 写入进程内存;失败时返回 diagnostics |
|
|
504
|
+
| 11 | `memory_scan` | 按 hex/值模式扫描进程内存;失败时返回 diagnostics |
|
|
505
|
+
| 12 | `memory_check_protection` | 检查内存保护标志(R/W/X) |
|
|
506
|
+
| 13 | `memory_protect` | `memory_check_protection` 别名 |
|
|
507
|
+
| 14 | `memory_scan_filtered` | 在已过滤地址集中二次扫描 |
|
|
508
|
+
| 15 | `memory_batch_write` | 批量写入多个内存补丁 |
|
|
509
|
+
| 16 | `memory_dump_region` | 将内存区域转储为二进制文件 |
|
|
510
|
+
| 17 | `memory_list_regions` | 列出所有内存区域及保护标志 |
|
|
511
|
+
| 18 | `memory_audit_export` | 导出内存操作的内存内审计轨迹 |
|
|
512
|
+
| 19 | `inject_dll` | 默认关闭;需设置 `ENABLE_INJECTION_TOOLS=true` 后在 Windows 启用 |
|
|
513
|
+
| 20 | `module_inject_dll` | `inject_dll` 别名 |
|
|
514
|
+
| 21 | `inject_shellcode` | 默认关闭;支持 hex/base64,需设置 `ENABLE_INJECTION_TOOLS=true` 后启用 |
|
|
515
|
+
| 22 | `module_inject_shellcode` | `inject_shellcode` 别名 |
|
|
516
|
+
| 23 | `check_debug_port` | 检查进程是否被调试 |
|
|
517
|
+
| 24 | `enumerate_modules` | 列出所有已加载模块(DLL)及基址 |
|
|
518
|
+
| 25 | `module_list` | `enumerate_modules` 别名 |
|
|
519
|
+
| 26 | `electron_attach` | 通过 CDP 连接运行中的 Electron 应用 |
|
|
520
|
+
|
|
521
|
+
> **平台说明:** 内存读写/扫描/转储支持 **Windows**(原生 API)和 **macOS**(lldb + vmmap)。`memory_read`、`memory_write`、`memory_scan` 失败时会返回结构化 `diagnostics`。注入工具默认关闭;需在 Windows 提权后通过 `ENABLE_INJECTION_TOOLS=true` 启用。
|
|
504
522
|
|
|
505
523
|
</details>
|
|
506
524
|
|
|
@@ -690,6 +708,9 @@ MCP_TRANSPORT=http MCP_PORT=3000 jshook
|
|
|
690
708
|
|
|
691
709
|
### 元工具(8 个工具)
|
|
692
710
|
|
|
711
|
+
<details>
|
|
712
|
+
<summary>展开元工具清单</summary>
|
|
713
|
+
|
|
693
714
|
| # | 工具 | 说明 |
|
|
694
715
|
| --- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
695
716
|
| 1 | `search_tools` | _(元工具)_ BM25 关键字搜索内置工具 + 已加载的插件/工作流工具;在 `workflow/full` 档位下,工作流域结果会获得额外排序加权。若已加载扩展 workflow,`run_extension_workflow` / `list_extension_workflows` 还会获得额外权重(尤其在注册/验证码/keygen 等意图下)。 |
|
|
@@ -701,8 +722,13 @@ MCP_TRANSPORT=http MCP_PORT=3000 jshook
|
|
|
701
722
|
| 7 | `extensions_list` | _(元工具)_ 列出当前已加载的 `plugins/` / `workflows/` 扩展 |
|
|
702
723
|
| 8 | `extensions_reload` | _(元工具)_ 运行时重新扫描扩展目录并动态注册扩展工具 |
|
|
703
724
|
|
|
725
|
+
</details>
|
|
726
|
+
|
|
704
727
|
### 动态扩展(plugins/workflows)
|
|
705
728
|
|
|
729
|
+
<details>
|
|
730
|
+
<summary>展开扩展根目录、信任策略与放置规范</summary>
|
|
731
|
+
|
|
706
732
|
- 默认扩展根目录(全局,位于 jshook 安装目录下):
|
|
707
733
|
- `<jshook-install>/plugins`
|
|
708
734
|
- `<jshook-install>/workflows`
|
|
@@ -750,6 +776,14 @@ MCP_TRANSPORT=http MCP_PORT=3000 jshook
|
|
|
750
776
|
- `activate_domain` 只有在执行过 `extensions_reload` 后,才会包含扩展域。
|
|
751
777
|
- reload 时会在可用情况下执行插件清理生命周期(`onDeactivate` → `onUnload`)。
|
|
752
778
|
|
|
779
|
+
</details>
|
|
780
|
+
|
|
781
|
+
## 免责声明
|
|
782
|
+
|
|
783
|
+
- 进程内存修改、代码注入、流量重放等底层能力按现状提供,不附带适用性或结果保证。
|
|
784
|
+
- 通过本地目录或 registry 加载的第三方插件、工作流与扩展,不属于本项目已审计、背书或担保的内容。
|
|
785
|
+
- 是否启用这些内置变更能力或外部扩展,以及因此产生的运行、合规、安全、数据损失等后果,由使用者自行评估并承担。
|
|
786
|
+
|
|
753
787
|
## 生成产物与清理
|
|
754
788
|
|
|
755
789
|
| 产物 | 默认位置 | 生成工具 |
|
|
@@ -803,8 +837,11 @@ pnpm run doctor
|
|
|
803
837
|
|
|
804
838
|
## 扩展模板
|
|
805
839
|
|
|
840
|
+
> 这里说的是“开发扩展”的模板仓,不是主程序 `jshook` 的安装方式。普通使用者运行主程序,优先走上面的 `npx @jshookmcp/jshook`;只有在你要自己开发 plugin / workflow 时,才需要 clone 模板仓并本地 build。
|
|
841
|
+
|
|
806
842
|
- 插件模板仓:`https://github.com/vmoranv/jshook_plugin_template`
|
|
807
843
|
- 工作流模板仓:`https://github.com/vmoranv/jshook_workflow_template`
|
|
844
|
+
- 想让自己的 plugin / workflow 被扩展 registry 收录:到 `https://github.com/vmoranv/jshookmcpextension/issues` 提 issue 申报
|
|
808
845
|
|
|
809
846
|
## 项目统计
|
|
810
847
|
|
package/dist/constants.d.ts
CHANGED
|
@@ -103,6 +103,7 @@ export declare const MEMORY_SCAN_MAX_RESULTS: number;
|
|
|
103
103
|
export declare const MEMORY_SCAN_MAX_REGIONS: number;
|
|
104
104
|
export declare const MEMORY_SCAN_REGION_MAX_BYTES: number;
|
|
105
105
|
export declare const MEMORY_INJECT_TIMEOUT_MS: number;
|
|
106
|
+
export declare const ENABLE_INJECTION_TOOLS: boolean;
|
|
106
107
|
export declare const MEMORY_MONITOR_INTERVAL_MS: number;
|
|
107
108
|
export declare const MEMORY_VMMAP_TIMEOUT_MS: number;
|
|
108
109
|
export declare const MEMORY_PROTECTION_QUERY_TIMEOUT_MS: number;
|
package/dist/constants.js
CHANGED
|
@@ -12,6 +12,17 @@ const float = (key, fallback) => {
|
|
|
12
12
|
const n = Number.parseFloat(v);
|
|
13
13
|
return Number.isFinite(n) ? n : fallback;
|
|
14
14
|
};
|
|
15
|
+
const bool = (key, fallback) => {
|
|
16
|
+
const v = process.env[key];
|
|
17
|
+
if (v === undefined || v === '')
|
|
18
|
+
return fallback;
|
|
19
|
+
const normalized = v.trim().toLowerCase();
|
|
20
|
+
if (normalized === 'true' || normalized === '1')
|
|
21
|
+
return true;
|
|
22
|
+
if (normalized === 'false' || normalized === '0')
|
|
23
|
+
return false;
|
|
24
|
+
return fallback;
|
|
25
|
+
};
|
|
15
26
|
const str = (key, fallback) => process.env[key] || fallback;
|
|
16
27
|
const list = (key, fallback) => {
|
|
17
28
|
const v = process.env[key];
|
|
@@ -84,7 +95,7 @@ export const CAPTCHA_RESULT_TIMEOUT_MS = int('CAPTCHA_RESULT_TIMEOUT_MS', 10_000
|
|
|
84
95
|
export const CAPTCHA_DEFAULT_TIMEOUT_MS = int('CAPTCHA_DEFAULT_TIMEOUT_MS', 180_000);
|
|
85
96
|
export const CAPTCHA_MIN_TIMEOUT_MS = int('CAPTCHA_MIN_TIMEOUT_MS', 5_000);
|
|
86
97
|
export const CAPTCHA_MAX_TIMEOUT_MS = int('CAPTCHA_MAX_TIMEOUT_MS', 600_000);
|
|
87
|
-
export const CAPTCHA_MAX_RETRIES = int('
|
|
98
|
+
export const CAPTCHA_MAX_RETRIES = int('CAPTCHA_MAX_RETRIES', 5);
|
|
88
99
|
export const CAPTCHA_DEFAULT_RETRIES = int('CAPTCHA_DEFAULT_RETRIES', 2);
|
|
89
100
|
export const NETWORK_REPLAY_TIMEOUT_MS = int('NETWORK_REPLAY_TIMEOUT_MS', 30_000);
|
|
90
101
|
export const NETWORK_REPLAY_MAX_BODY_BYTES = int('NETWORK_REPLAY_MAX_BODY_BYTES', 512_000);
|
|
@@ -137,6 +148,7 @@ export const MEMORY_SCAN_MAX_RESULTS = int('MEMORY_SCAN_MAX_RESULTS', 10_000);
|
|
|
137
148
|
export const MEMORY_SCAN_MAX_REGIONS = int('MEMORY_SCAN_MAX_REGIONS', 50_000);
|
|
138
149
|
export const MEMORY_SCAN_REGION_MAX_BYTES = int('MEMORY_SCAN_REGION_MAX_BYTES', 16_777_216);
|
|
139
150
|
export const MEMORY_INJECT_TIMEOUT_MS = int('MEMORY_INJECT_TIMEOUT_MS', 30_000);
|
|
151
|
+
export const ENABLE_INJECTION_TOOLS = bool('ENABLE_INJECTION_TOOLS', false);
|
|
140
152
|
export const MEMORY_MONITOR_INTERVAL_MS = int('MEMORY_MONITOR_INTERVAL_MS', 1_000);
|
|
141
153
|
export const MEMORY_VMMAP_TIMEOUT_MS = int('MEMORY_VMMAP_TIMEOUT_MS', 15_000);
|
|
142
154
|
export const MEMORY_PROTECTION_QUERY_TIMEOUT_MS = int('MEMORY_PROTECTION_QUERY_TIMEOUT_MS', 15_000);
|
package/dist/index.js
CHANGED
|
File without changes
|
|
@@ -69,32 +69,40 @@ export class IntelligentAnalyzer {
|
|
|
69
69
|
}
|
|
70
70
|
generateAIFriendlySummary(result) {
|
|
71
71
|
const lines = [];
|
|
72
|
-
lines.push('===
|
|
73
|
-
lines.push(
|
|
72
|
+
lines.push('=== Analysis Summary ===');
|
|
73
|
+
lines.push('');
|
|
74
|
+
lines.push(`Statistics:`);
|
|
74
75
|
lines.push(` - Requests: ${result.summary.totalRequests} -> Filtered: ${result.summary.filteredRequests}`);
|
|
75
76
|
lines.push(` - Logs: ${result.summary.totalLogs} -> Filtered: ${result.summary.filteredLogs}`);
|
|
76
|
-
lines.push(` - : ${result.exceptions.length}
|
|
77
|
+
lines.push(` - Exceptions: ${result.exceptions.length}`);
|
|
78
|
+
lines.push('');
|
|
77
79
|
if (result.summary.suspiciousAPIs.length > 0) {
|
|
78
|
-
lines.push(`
|
|
80
|
+
lines.push(`Suspicious APIs (${result.summary.suspiciousAPIs.length}):`);
|
|
79
81
|
result.summary.suspiciousAPIs.slice(0, 10).forEach((api) => {
|
|
80
82
|
lines.push(` - ${api}`);
|
|
81
83
|
});
|
|
82
84
|
lines.push('');
|
|
83
85
|
}
|
|
84
86
|
if (result.patterns.encryption && result.patterns.encryption.length > 0) {
|
|
85
|
-
lines.push(`
|
|
87
|
+
lines.push(`Encryption Patterns (${result.patterns.encryption.length}):`);
|
|
86
88
|
result.patterns.encryption.slice(0, 5).forEach((pattern) => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
const evidence = Array.isArray(pattern.evidence)
|
|
90
|
+
? pattern.evidence.join(', ')
|
|
91
|
+
: String(pattern.evidence ?? '');
|
|
92
|
+
lines.push(` - ${pattern.type} (confidence: ${(pattern.confidence * 100).toFixed(0)}%)`);
|
|
93
|
+
lines.push(` location: ${pattern.location}`);
|
|
94
|
+
lines.push(` evidence: ${evidence}`);
|
|
90
95
|
});
|
|
91
96
|
lines.push('');
|
|
92
97
|
}
|
|
93
98
|
if (result.patterns.signature && result.patterns.signature.length > 0) {
|
|
94
99
|
lines.push(`Signature Patterns (${result.patterns.signature.length}):`);
|
|
95
100
|
result.patterns.signature.slice(0, 5).forEach((pattern) => {
|
|
101
|
+
const parameters = Array.isArray(pattern.parameters)
|
|
102
|
+
? pattern.parameters.join(', ')
|
|
103
|
+
: String(pattern.parameters ?? '');
|
|
96
104
|
lines.push(` - ${pattern.type}`);
|
|
97
|
-
lines.push(` : ${
|
|
105
|
+
lines.push(` parameters: ${parameters}`);
|
|
98
106
|
});
|
|
99
107
|
lines.push('');
|
|
100
108
|
}
|
|
@@ -106,11 +114,11 @@ export class IntelligentAnalyzer {
|
|
|
106
114
|
lines.push('');
|
|
107
115
|
}
|
|
108
116
|
if (result.summary.keyFunctions.length > 0) {
|
|
109
|
-
lines.push(`
|
|
117
|
+
lines.push(`Key Functions (${result.summary.keyFunctions.length}):`);
|
|
110
118
|
lines.push(` ${result.summary.keyFunctions.slice(0, 15).join(', ')}`);
|
|
111
119
|
lines.push('');
|
|
112
120
|
}
|
|
113
|
-
lines.push('===
|
|
121
|
+
lines.push('=== Analysis Summary ===');
|
|
114
122
|
return lines.join('\n');
|
|
115
123
|
}
|
|
116
124
|
async analyzeCriticalRequestsWithLLM(requests) {
|
|
@@ -10,19 +10,24 @@ export declare class BrowserModeManager {
|
|
|
10
10
|
private browser;
|
|
11
11
|
private currentPage;
|
|
12
12
|
private isHeadless;
|
|
13
|
+
private isClosing;
|
|
14
|
+
private launchPromise?;
|
|
13
15
|
private config;
|
|
14
16
|
private captchaDetector;
|
|
15
17
|
private launchOptions;
|
|
16
18
|
private sessionData;
|
|
17
19
|
constructor(config?: BrowserModeConfig, launchOptions?: LaunchOptions);
|
|
18
20
|
launch(): Promise<Browser>;
|
|
21
|
+
private doLaunch;
|
|
19
22
|
private resolveExecutablePath;
|
|
20
23
|
newPage(): Promise<Page>;
|
|
24
|
+
private finalizeClose;
|
|
21
25
|
goto(url: string, page?: Page): Promise<Page>;
|
|
22
26
|
checkAndHandleCaptcha(page: Page, originalUrl: string): Promise<void>;
|
|
23
27
|
private switchToHeaded;
|
|
24
28
|
private showCaptchaPrompt;
|
|
25
29
|
private saveSessionData;
|
|
30
|
+
private restoreSessionData;
|
|
26
31
|
private injectAntiDetectionScripts;
|
|
27
32
|
close(): Promise<void>;
|
|
28
33
|
getBrowser(): Browser | null;
|