windows-exe-decompiler-mcp-server 0.1.0
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/CODEX_INSTALLATION.md +69 -0
- package/COPILOT_INSTALLATION.md +77 -0
- package/LICENSE +21 -0
- package/README.md +314 -0
- package/bin/windows-exe-decompiler-mcp-server.js +3 -0
- package/dist/analysis-provenance.d.ts +184 -0
- package/dist/analysis-provenance.js +74 -0
- package/dist/analysis-task-runner.d.ts +31 -0
- package/dist/analysis-task-runner.js +160 -0
- package/dist/artifact-inventory.d.ts +23 -0
- package/dist/artifact-inventory.js +175 -0
- package/dist/cache-manager.d.ts +128 -0
- package/dist/cache-manager.js +454 -0
- package/dist/confidence-semantics.d.ts +66 -0
- package/dist/confidence-semantics.js +122 -0
- package/dist/config.d.ts +335 -0
- package/dist/config.js +193 -0
- package/dist/database.d.ts +227 -0
- package/dist/database.js +601 -0
- package/dist/decompiler-worker.d.ts +441 -0
- package/dist/decompiler-worker.js +1962 -0
- package/dist/dynamic-trace.d.ts +95 -0
- package/dist/dynamic-trace.js +629 -0
- package/dist/env-validator.d.ts +15 -0
- package/dist/env-validator.js +249 -0
- package/dist/error-handler.d.ts +28 -0
- package/dist/error-handler.example.d.ts +22 -0
- package/dist/error-handler.example.js +141 -0
- package/dist/error-handler.js +139 -0
- package/dist/ghidra-analysis-status.d.ts +49 -0
- package/dist/ghidra-analysis-status.js +178 -0
- package/dist/ghidra-config.d.ts +134 -0
- package/dist/ghidra-config.js +464 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +200 -0
- package/dist/job-queue.d.ts +169 -0
- package/dist/job-queue.js +407 -0
- package/dist/logger.d.ts +106 -0
- package/dist/logger.js +176 -0
- package/dist/policy-guard.d.ts +115 -0
- package/dist/policy-guard.js +243 -0
- package/dist/process-output.d.ts +15 -0
- package/dist/process-output.js +90 -0
- package/dist/prompts/function-explanation-review.d.ts +5 -0
- package/dist/prompts/function-explanation-review.js +64 -0
- package/dist/prompts/semantic-name-review.d.ts +5 -0
- package/dist/prompts/semantic-name-review.js +63 -0
- package/dist/runtime-correlation.d.ts +34 -0
- package/dist/runtime-correlation.js +279 -0
- package/dist/runtime-paths.d.ts +3 -0
- package/dist/runtime-paths.js +11 -0
- package/dist/selection-diff.d.ts +667 -0
- package/dist/selection-diff.js +53 -0
- package/dist/semantic-name-suggestion-artifacts.d.ts +116 -0
- package/dist/semantic-name-suggestion-artifacts.js +314 -0
- package/dist/server.d.ts +129 -0
- package/dist/server.js +578 -0
- package/dist/tools/artifact-read.d.ts +235 -0
- package/dist/tools/artifact-read.js +317 -0
- package/dist/tools/artifacts-diff.d.ts +728 -0
- package/dist/tools/artifacts-diff.js +304 -0
- package/dist/tools/artifacts-list.d.ts +515 -0
- package/dist/tools/artifacts-list.js +389 -0
- package/dist/tools/attack-map.d.ts +290 -0
- package/dist/tools/attack-map.js +519 -0
- package/dist/tools/cache-observability.d.ts +4 -0
- package/dist/tools/cache-observability.js +36 -0
- package/dist/tools/code-function-cfg.d.ts +50 -0
- package/dist/tools/code-function-cfg.js +102 -0
- package/dist/tools/code-function-decompile.d.ts +55 -0
- package/dist/tools/code-function-decompile.js +103 -0
- package/dist/tools/code-function-disassemble.d.ts +43 -0
- package/dist/tools/code-function-disassemble.js +185 -0
- package/dist/tools/code-function-explain-apply.d.ts +255 -0
- package/dist/tools/code-function-explain-apply.js +225 -0
- package/dist/tools/code-function-explain-prepare.d.ts +535 -0
- package/dist/tools/code-function-explain-prepare.js +276 -0
- package/dist/tools/code-function-explain-review.d.ts +397 -0
- package/dist/tools/code-function-explain-review.js +589 -0
- package/dist/tools/code-function-rename-apply.d.ts +248 -0
- package/dist/tools/code-function-rename-apply.js +220 -0
- package/dist/tools/code-function-rename-prepare.d.ts +506 -0
- package/dist/tools/code-function-rename-prepare.js +279 -0
- package/dist/tools/code-function-rename-review.d.ts +574 -0
- package/dist/tools/code-function-rename-review.js +761 -0
- package/dist/tools/code-functions-list.d.ts +37 -0
- package/dist/tools/code-functions-list.js +91 -0
- package/dist/tools/code-functions-rank.d.ts +34 -0
- package/dist/tools/code-functions-rank.js +90 -0
- package/dist/tools/code-functions-reconstruct.d.ts +2725 -0
- package/dist/tools/code-functions-reconstruct.js +2807 -0
- package/dist/tools/code-functions-search.d.ts +39 -0
- package/dist/tools/code-functions-search.js +90 -0
- package/dist/tools/code-reconstruct-export.d.ts +1212 -0
- package/dist/tools/code-reconstruct-export.js +4002 -0
- package/dist/tools/code-reconstruct-plan.d.ts +274 -0
- package/dist/tools/code-reconstruct-plan.js +342 -0
- package/dist/tools/dotnet-metadata-extract.d.ts +541 -0
- package/dist/tools/dotnet-metadata-extract.js +355 -0
- package/dist/tools/dotnet-reconstruct-export.d.ts +567 -0
- package/dist/tools/dotnet-reconstruct-export.js +1151 -0
- package/dist/tools/dotnet-types-list.d.ts +325 -0
- package/dist/tools/dotnet-types-list.js +201 -0
- package/dist/tools/dynamic-dependencies.d.ts +115 -0
- package/dist/tools/dynamic-dependencies.js +213 -0
- package/dist/tools/dynamic-memory-import.d.ts +10 -0
- package/dist/tools/dynamic-memory-import.js +567 -0
- package/dist/tools/dynamic-trace-import.d.ts +10 -0
- package/dist/tools/dynamic-trace-import.js +235 -0
- package/dist/tools/entrypoint-fallback-disasm.d.ts +30 -0
- package/dist/tools/entrypoint-fallback-disasm.js +89 -0
- package/dist/tools/ghidra-analyze.d.ts +88 -0
- package/dist/tools/ghidra-analyze.js +208 -0
- package/dist/tools/ghidra-health.d.ts +37 -0
- package/dist/tools/ghidra-health.js +212 -0
- package/dist/tools/ioc-export.d.ts +209 -0
- package/dist/tools/ioc-export.js +542 -0
- package/dist/tools/packer-detect.d.ts +165 -0
- package/dist/tools/packer-detect.js +284 -0
- package/dist/tools/pe-exports-extract.d.ts +175 -0
- package/dist/tools/pe-exports-extract.js +253 -0
- package/dist/tools/pe-fingerprint.d.ts +234 -0
- package/dist/tools/pe-fingerprint.js +269 -0
- package/dist/tools/pe-imports-extract.d.ts +105 -0
- package/dist/tools/pe-imports-extract.js +245 -0
- package/dist/tools/report-generate.d.ts +157 -0
- package/dist/tools/report-generate.js +457 -0
- package/dist/tools/report-summarize.d.ts +2131 -0
- package/dist/tools/report-summarize.js +596 -0
- package/dist/tools/runtime-detect.d.ts +135 -0
- package/dist/tools/runtime-detect.js +247 -0
- package/dist/tools/sample-ingest.d.ts +94 -0
- package/dist/tools/sample-ingest.js +327 -0
- package/dist/tools/sample-profile-get.d.ts +183 -0
- package/dist/tools/sample-profile-get.js +121 -0
- package/dist/tools/sandbox-execute.d.ts +441 -0
- package/dist/tools/sandbox-execute.js +392 -0
- package/dist/tools/strings-extract.d.ts +375 -0
- package/dist/tools/strings-extract.js +314 -0
- package/dist/tools/strings-floss-decode.d.ts +143 -0
- package/dist/tools/strings-floss-decode.js +259 -0
- package/dist/tools/system-health.d.ts +434 -0
- package/dist/tools/system-health.js +446 -0
- package/dist/tools/task-cancel.d.ts +21 -0
- package/dist/tools/task-cancel.js +70 -0
- package/dist/tools/task-status.d.ts +27 -0
- package/dist/tools/task-status.js +106 -0
- package/dist/tools/task-sweep.d.ts +22 -0
- package/dist/tools/task-sweep.js +77 -0
- package/dist/tools/tool-help.d.ts +340 -0
- package/dist/tools/tool-help.js +261 -0
- package/dist/tools/yara-scan.d.ts +554 -0
- package/dist/tools/yara-scan.js +313 -0
- package/dist/types.d.ts +266 -0
- package/dist/types.js +41 -0
- package/dist/worker-pool.d.ts +204 -0
- package/dist/worker-pool.js +650 -0
- package/dist/workflows/deep-static.d.ts +104 -0
- package/dist/workflows/deep-static.js +276 -0
- package/dist/workflows/function-explanation-review.d.ts +655 -0
- package/dist/workflows/function-explanation-review.js +440 -0
- package/dist/workflows/reconstruct.d.ts +2053 -0
- package/dist/workflows/reconstruct.js +666 -0
- package/dist/workflows/semantic-name-review.d.ts +2418 -0
- package/dist/workflows/semantic-name-review.js +521 -0
- package/dist/workflows/triage.d.ts +659 -0
- package/dist/workflows/triage.js +1374 -0
- package/dist/workspace-manager.d.ts +150 -0
- package/dist/workspace-manager.js +411 -0
- package/ghidra_scripts/DecompileFunction.java +487 -0
- package/ghidra_scripts/DecompileFunction.py +150 -0
- package/ghidra_scripts/ExtractCFG.java +256 -0
- package/ghidra_scripts/ExtractCFG.py +233 -0
- package/ghidra_scripts/ExtractFunctions.java +442 -0
- package/ghidra_scripts/ExtractFunctions.py +101 -0
- package/ghidra_scripts/README.md +125 -0
- package/ghidra_scripts/SearchFunctionReferences.java +380 -0
- package/helpers/DotNetMetadataProbe/DotNetMetadataProbe.csproj +9 -0
- package/helpers/DotNetMetadataProbe/Program.cs +566 -0
- package/install-to-codex.ps1 +178 -0
- package/install-to-copilot.ps1 +303 -0
- package/package.json +101 -0
- package/requirements.txt +9 -0
- package/workers/requirements-dynamic.txt +11 -0
- package/workers/requirements.txt +8 -0
- package/workers/speakeasy_compat.py +175 -0
- package/workers/static_worker.py +5183 -0
- package/workers/yara_rules/default.yar +33 -0
- package/workers/yara_rules/malware_families.yar +93 -0
- package/workers/yara_rules/packers.yar +80 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Install in Codex
|
|
2
|
+
|
|
3
|
+
## Quick start
|
|
4
|
+
|
|
5
|
+
Build the project first:
|
|
6
|
+
|
|
7
|
+
```powershell
|
|
8
|
+
npm run build
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Then run the helper script from the repository root:
|
|
12
|
+
|
|
13
|
+
```powershell
|
|
14
|
+
.\install-to-codex.ps1
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If Ghidra is not already configured through `GHIDRA_PATH` or
|
|
18
|
+
`GHIDRA_INSTALL_DIR`, pass it explicitly:
|
|
19
|
+
|
|
20
|
+
```powershell
|
|
21
|
+
.\install-to-codex.ps1 -GhidraPath "C:\tools\ghidra"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## What the script does
|
|
25
|
+
|
|
26
|
+
- validates that `dist/index.js` exists
|
|
27
|
+
- registers the MCP server with Codex
|
|
28
|
+
- updates `~/.codex/config.toml`
|
|
29
|
+
- writes `GHIDRA_PATH` and `GHIDRA_INSTALL_DIR` when a Ghidra path is provided
|
|
30
|
+
|
|
31
|
+
## Manual configuration example
|
|
32
|
+
|
|
33
|
+
If you prefer to edit the config by hand, add a block like this to
|
|
34
|
+
`C:\Users\<you>\.codex\config.toml`:
|
|
35
|
+
|
|
36
|
+
```toml
|
|
37
|
+
[mcp_servers.windows-exe-decompiler]
|
|
38
|
+
command = "node"
|
|
39
|
+
args = ["E:/path/to/repo/dist/index.js"]
|
|
40
|
+
cwd = "E:/path/to/repo"
|
|
41
|
+
startup_timeout_sec = 30
|
|
42
|
+
tool_timeout_sec = 300
|
|
43
|
+
enabled = true
|
|
44
|
+
env = { GHIDRA_PATH = "C:/tools/ghidra", GHIDRA_INSTALL_DIR = "C:/tools/ghidra" }
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Verify
|
|
48
|
+
|
|
49
|
+
Run:
|
|
50
|
+
|
|
51
|
+
```powershell
|
|
52
|
+
codex mcp list
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Then ask Codex to call one of these tools:
|
|
56
|
+
|
|
57
|
+
- `tool.help`
|
|
58
|
+
- `sample.ingest`
|
|
59
|
+
- `workflow.triage`
|
|
60
|
+
|
|
61
|
+
## Troubleshooting
|
|
62
|
+
|
|
63
|
+
- `dist/index.js was not found`
|
|
64
|
+
Run `npm run build` first.
|
|
65
|
+
- `node` was not found
|
|
66
|
+
Install Node.js or pass `-NodePath`.
|
|
67
|
+
- native analysis is unavailable
|
|
68
|
+
Set `GHIDRA_PATH` or `GHIDRA_INSTALL_DIR`, or rerun the script with
|
|
69
|
+
`-GhidraPath`.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Install in GitHub Copilot
|
|
2
|
+
|
|
3
|
+
This repository includes a helper script for local GitHub Copilot clients:
|
|
4
|
+
|
|
5
|
+
```powershell
|
|
6
|
+
.\install-to-copilot.ps1
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Build the project first:
|
|
10
|
+
|
|
11
|
+
```powershell
|
|
12
|
+
npm run build
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
If Ghidra is not already configured in the environment, pass it explicitly:
|
|
16
|
+
|
|
17
|
+
```powershell
|
|
18
|
+
.\install-to-copilot.ps1 -GhidraPath "C:\tools\ghidra"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## What the script updates
|
|
22
|
+
|
|
23
|
+
- workspace config: `.vscode/mcp.json`
|
|
24
|
+
- Copilot CLI config: `~/.copilot/mcp-config.json`
|
|
25
|
+
|
|
26
|
+
You can target only one config:
|
|
27
|
+
|
|
28
|
+
```powershell
|
|
29
|
+
.\install-to-copilot.ps1 -SkipCopilotCliConfig
|
|
30
|
+
.\install-to-copilot.ps1 -SkipWorkspaceConfig
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
If the `code` command is available and you also want to try the VS Code
|
|
34
|
+
user-level profile route:
|
|
35
|
+
|
|
36
|
+
```powershell
|
|
37
|
+
.\install-to-copilot.ps1 -InstallVsCodeUserProfile
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Verify
|
|
41
|
+
|
|
42
|
+
### VS Code / GitHub Copilot
|
|
43
|
+
|
|
44
|
+
1. Open the repository in VS Code.
|
|
45
|
+
2. Confirm that `.vscode/mcp.json` contains `windows-exe-decompiler`.
|
|
46
|
+
3. Trust the MCP server when VS Code prompts you.
|
|
47
|
+
4. Ask Copilot to call `tool.help` or `workflow.triage`.
|
|
48
|
+
|
|
49
|
+
### Copilot CLI
|
|
50
|
+
|
|
51
|
+
Run:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
/mcp list
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
or:
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
/mcp show windows-exe-decompiler
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## References
|
|
64
|
+
|
|
65
|
+
- https://code.visualstudio.com/docs/copilot/customization/mcp-servers
|
|
66
|
+
- https://code.visualstudio.com/docs/copilot/reference/mcp-configuration
|
|
67
|
+
- https://docs.github.com/copilot/how-tos/copilot-cli/customize-copilot/add-mcp-servers
|
|
68
|
+
- https://docs.github.com/en/enterprise-cloud@latest/copilot/reference/cli-command-reference
|
|
69
|
+
|
|
70
|
+
## Scope
|
|
71
|
+
|
|
72
|
+
These instructions are for local Copilot clients such as:
|
|
73
|
+
|
|
74
|
+
- VS Code with GitHub Copilot
|
|
75
|
+
- GitHub Copilot CLI
|
|
76
|
+
|
|
77
|
+
They do not configure GitHub.com hosted coding agents.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
# Windows EXE Decompiler MCP Server
|
|
2
|
+
|
|
3
|
+
中文说明见 [`README_zh.md`](./README_zh.md).
|
|
4
|
+
|
|
5
|
+
An MCP server for Windows binary reverse engineering.
|
|
6
|
+
|
|
7
|
+
It exposes PE triage, native and .NET analysis, Ghidra-backed function
|
|
8
|
+
inspection, runtime evidence import, reconstruction workflows, and report
|
|
9
|
+
generation as MCP tools that any tool-calling LLM can consume.
|
|
10
|
+
|
|
11
|
+
## What this project is for
|
|
12
|
+
|
|
13
|
+
This server is designed to provide a reusable reverse-engineering tool surface
|
|
14
|
+
over MCP instead of one-off local scripts.
|
|
15
|
+
|
|
16
|
+
Primary use cases:
|
|
17
|
+
|
|
18
|
+
- Windows PE triage
|
|
19
|
+
- import / export / string / YARA analysis
|
|
20
|
+
- Ghidra-assisted decompile, CFG, and function search
|
|
21
|
+
- .NET metadata inspection
|
|
22
|
+
- runtime trace and memory snapshot import
|
|
23
|
+
- function naming and explanation review workflows
|
|
24
|
+
- source-like reconstruction export with validation harnesses
|
|
25
|
+
|
|
26
|
+
## Current capability areas
|
|
27
|
+
|
|
28
|
+
### Static analysis
|
|
29
|
+
|
|
30
|
+
- `sample.ingest`
|
|
31
|
+
- `sample.profile.get`
|
|
32
|
+
- `pe.fingerprint`
|
|
33
|
+
- `pe.imports.extract`
|
|
34
|
+
- `pe.exports.extract`
|
|
35
|
+
- `strings.extract`
|
|
36
|
+
- `strings.floss.decode`
|
|
37
|
+
- `yara.scan`
|
|
38
|
+
- `runtime.detect`
|
|
39
|
+
- `packer.detect`
|
|
40
|
+
|
|
41
|
+
### Ghidra and code analysis
|
|
42
|
+
|
|
43
|
+
- `ghidra.health`
|
|
44
|
+
- `ghidra.analyze`
|
|
45
|
+
- `code.functions.list`
|
|
46
|
+
- `code.functions.rank`
|
|
47
|
+
- `code.functions.search`
|
|
48
|
+
- `code.function.decompile`
|
|
49
|
+
- `code.function.disassemble`
|
|
50
|
+
- `code.function.cfg`
|
|
51
|
+
- `code.functions.reconstruct`
|
|
52
|
+
|
|
53
|
+
### Reconstruction and review workflows
|
|
54
|
+
|
|
55
|
+
- `code.reconstruct.plan`
|
|
56
|
+
- `code.reconstruct.export`
|
|
57
|
+
- `dotnet.metadata.extract`
|
|
58
|
+
- `dotnet.types.list`
|
|
59
|
+
- `dotnet.reconstruct.export`
|
|
60
|
+
- `workflow.triage`
|
|
61
|
+
- `workflow.deep_static`
|
|
62
|
+
- `workflow.reconstruct`
|
|
63
|
+
- `workflow.semantic_name_review`
|
|
64
|
+
- `workflow.function_explanation_review`
|
|
65
|
+
|
|
66
|
+
### Runtime evidence and reporting
|
|
67
|
+
|
|
68
|
+
- `dynamic.dependencies`
|
|
69
|
+
- `sandbox.execute`
|
|
70
|
+
- `dynamic.trace.import`
|
|
71
|
+
- `dynamic.memory.import`
|
|
72
|
+
- `attack.map`
|
|
73
|
+
- `ioc.export`
|
|
74
|
+
- `report.summarize`
|
|
75
|
+
- `report.generate`
|
|
76
|
+
- `artifacts.list`
|
|
77
|
+
- `artifact.read`
|
|
78
|
+
- `artifacts.diff`
|
|
79
|
+
- `tool.help`
|
|
80
|
+
|
|
81
|
+
## Project layout
|
|
82
|
+
|
|
83
|
+
```text
|
|
84
|
+
bin/ npm CLI entrypoint
|
|
85
|
+
dist/ compiled TypeScript output
|
|
86
|
+
ghidra_scripts/ Ghidra helper scripts used by the server
|
|
87
|
+
helpers/DotNetMetadataProbe/ .NET metadata helper project
|
|
88
|
+
src/ TypeScript MCP server source
|
|
89
|
+
tests/ unit and integration tests
|
|
90
|
+
workers/ Python worker, YARA rules, dynamic helpers
|
|
91
|
+
install-to-codex.ps1 local Codex MCP install helper
|
|
92
|
+
install-to-copilot.ps1 local GitHub Copilot MCP install helper
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Prerequisites
|
|
96
|
+
|
|
97
|
+
Required:
|
|
98
|
+
|
|
99
|
+
- Node.js 18+
|
|
100
|
+
- npm 9+
|
|
101
|
+
- Python 3.9+
|
|
102
|
+
|
|
103
|
+
Optional but strongly recommended:
|
|
104
|
+
|
|
105
|
+
- Ghidra for native decompile and CFG features
|
|
106
|
+
- .NET SDK for `dotnet.metadata.extract`
|
|
107
|
+
- Clang for reconstruct export validation
|
|
108
|
+
- Python packages from [`requirements.txt`](./requirements.txt)
|
|
109
|
+
- Python worker packages from [`workers/requirements.txt`](./workers/requirements.txt)
|
|
110
|
+
|
|
111
|
+
## Local development setup
|
|
112
|
+
|
|
113
|
+
Install JavaScript dependencies:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npm install
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Install Python worker dependencies:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
python -m pip install -r requirements.txt
|
|
123
|
+
python -m pip install -r workers/requirements.txt
|
|
124
|
+
python -m pip install -r workers/requirements-dynamic.txt
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Build the server:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npm run build
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Run tests:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
npm test
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Start the server locally:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
npm start
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## MCP client configuration
|
|
146
|
+
|
|
147
|
+
### Generic stdio config
|
|
148
|
+
|
|
149
|
+
Most MCP clients can start this server with:
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"mcpServers": {
|
|
154
|
+
"windows-exe-decompiler": {
|
|
155
|
+
"command": "node",
|
|
156
|
+
"args": ["/absolute/path/to/repo/dist/index.js"],
|
|
157
|
+
"cwd": "/absolute/path/to/repo",
|
|
158
|
+
"env": {
|
|
159
|
+
"GHIDRA_PATH": "C:/path/to/ghidra",
|
|
160
|
+
"GHIDRA_INSTALL_DIR": "C:/path/to/ghidra"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Local install helpers
|
|
168
|
+
|
|
169
|
+
This repository already includes local install scripts:
|
|
170
|
+
|
|
171
|
+
- Codex: [`install-to-codex.ps1`](./install-to-codex.ps1)
|
|
172
|
+
- GitHub Copilot: [`install-to-copilot.ps1`](./install-to-copilot.ps1)
|
|
173
|
+
|
|
174
|
+
Related docs:
|
|
175
|
+
|
|
176
|
+
- [`CODEX_INSTALLATION.md`](./CODEX_INSTALLATION.md)
|
|
177
|
+
- [`COPILOT_INSTALLATION.md`](./COPILOT_INSTALLATION.md)
|
|
178
|
+
|
|
179
|
+
## Sample ingest note
|
|
180
|
+
|
|
181
|
+
For local IDE clients such as VS Code or Copilot, prefer:
|
|
182
|
+
|
|
183
|
+
```json
|
|
184
|
+
{
|
|
185
|
+
"tool": "sample.ingest",
|
|
186
|
+
"arguments": {
|
|
187
|
+
"path": "E:/absolute/path/to/sample.exe"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Use `bytes_b64` only when the MCP client cannot access the same filesystem as
|
|
193
|
+
the MCP server.
|
|
194
|
+
|
|
195
|
+
## Publishing to npm
|
|
196
|
+
|
|
197
|
+
### What is included in the npm package
|
|
198
|
+
|
|
199
|
+
The published package includes:
|
|
200
|
+
|
|
201
|
+
- compiled `dist/`
|
|
202
|
+
- a CLI entrypoint in `bin/`
|
|
203
|
+
- Python workers and YARA rules
|
|
204
|
+
- Ghidra helper scripts
|
|
205
|
+
- the .NET metadata helper source
|
|
206
|
+
- MCP client install scripts
|
|
207
|
+
|
|
208
|
+
It intentionally excludes:
|
|
209
|
+
|
|
210
|
+
- tests
|
|
211
|
+
- local workspaces
|
|
212
|
+
- caches
|
|
213
|
+
- generated reports
|
|
214
|
+
- scratch documents and internal progress notes
|
|
215
|
+
|
|
216
|
+
### Pre-publish checklist
|
|
217
|
+
|
|
218
|
+
1. Pick a package name that is available on npm.
|
|
219
|
+
2. Update the version in [`package.json`](./package.json).
|
|
220
|
+
3. Run:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
npm run release:check
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
4. Inspect the dry-run pack list:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
npm run pack:dry-run
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
5. Log in to npm:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
npm login
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
6. Publish:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
npm publish
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### GitHub Actions
|
|
245
|
+
|
|
246
|
+
This repository now includes:
|
|
247
|
+
|
|
248
|
+
- [`ci.yml`](./.github/workflows/ci.yml): build, Python syntax check, key unit tests, and `npm pack --dry-run`
|
|
249
|
+
- [`publish-npm.yml`](./.github/workflows/publish-npm.yml): publish on `v*` tags or manual dispatch, then create a GitHub Release with the npm tarball attached
|
|
250
|
+
- [`dependabot.yml`](./.github/dependabot.yml): weekly npm and GitHub Actions dependency updates
|
|
251
|
+
|
|
252
|
+
Before npm publishing from GitHub Actions, add this repository secret:
|
|
253
|
+
|
|
254
|
+
- `NPM_TOKEN`
|
|
255
|
+
|
|
256
|
+
Recommended release flow:
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
npm version patch
|
|
260
|
+
git push origin main --follow-tags
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
That tag push will trigger the publish workflow.
|
|
264
|
+
|
|
265
|
+
## Contributing
|
|
266
|
+
|
|
267
|
+
See [`CONTRIBUTING.md`](./CONTRIBUTING.md) for local
|
|
268
|
+
setup, validation, and release steps.
|
|
269
|
+
|
|
270
|
+
## Security
|
|
271
|
+
|
|
272
|
+
See [`SECURITY.md`](./SECURITY.md) for disclosure guidance
|
|
273
|
+
and operational boundaries.
|
|
274
|
+
|
|
275
|
+
### Using the published package
|
|
276
|
+
|
|
277
|
+
Once published, an MCP client can use `npx`:
|
|
278
|
+
|
|
279
|
+
```json
|
|
280
|
+
{
|
|
281
|
+
"mcpServers": {
|
|
282
|
+
"windows-exe-decompiler": {
|
|
283
|
+
"command": "npx",
|
|
284
|
+
"args": ["-y", "windows-exe-decompiler-mcp-server"],
|
|
285
|
+
"env": {
|
|
286
|
+
"GHIDRA_PATH": "C:/path/to/ghidra",
|
|
287
|
+
"GHIDRA_INSTALL_DIR": "C:/path/to/ghidra"
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## Security boundaries
|
|
295
|
+
|
|
296
|
+
This project is designed for analysis workflows, not for live malware
|
|
297
|
+
operations. Current practical strengths are:
|
|
298
|
+
|
|
299
|
+
- triage and classification support
|
|
300
|
+
- reverse-engineering evidence extraction
|
|
301
|
+
- IOC and ATT&CK export
|
|
302
|
+
- runtime evidence import and correlation
|
|
303
|
+
- source-like reconstruction and review
|
|
304
|
+
|
|
305
|
+
Current non-goals:
|
|
306
|
+
|
|
307
|
+
- original source recovery for complex native binaries
|
|
308
|
+
- guaranteed malware family attribution from static evidence alone
|
|
309
|
+
- full automatic unpacking for all packers
|
|
310
|
+
- high-confidence semantic recovery of every function in heavily optimized code
|
|
311
|
+
|
|
312
|
+
## License
|
|
313
|
+
|
|
314
|
+
This project is released under the MIT license. See [`LICENSE`](./LICENSE).
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { DynamicEvidenceScope, DynamicTraceSummary } from './dynamic-trace.js';
|
|
3
|
+
import type { SemanticArtifactScope, SemanticFunctionExplanationIndex, SemanticNameSuggestionIndex } from './semantic-name-suggestion-artifacts.js';
|
|
4
|
+
export declare const ArtifactSelectionProvenanceSchema: z.ZodObject<{
|
|
5
|
+
scope: z.ZodEnum<["all", "latest", "session"]>;
|
|
6
|
+
session_selector: z.ZodNullable<z.ZodString>;
|
|
7
|
+
artifact_count: z.ZodNumber;
|
|
8
|
+
artifact_ids: z.ZodArray<z.ZodString, "many">;
|
|
9
|
+
session_tags: z.ZodArray<z.ZodString, "many">;
|
|
10
|
+
earliest_artifact_at: z.ZodNullable<z.ZodString>;
|
|
11
|
+
latest_artifact_at: z.ZodNullable<z.ZodString>;
|
|
12
|
+
scope_note: z.ZodString;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
artifact_count: number;
|
|
15
|
+
scope_note: string;
|
|
16
|
+
artifact_ids: string[];
|
|
17
|
+
session_selector: string | null;
|
|
18
|
+
session_tags: string[];
|
|
19
|
+
scope: "all" | "latest" | "session";
|
|
20
|
+
earliest_artifact_at: string | null;
|
|
21
|
+
latest_artifact_at: string | null;
|
|
22
|
+
}, {
|
|
23
|
+
artifact_count: number;
|
|
24
|
+
scope_note: string;
|
|
25
|
+
artifact_ids: string[];
|
|
26
|
+
session_selector: string | null;
|
|
27
|
+
session_tags: string[];
|
|
28
|
+
scope: "all" | "latest" | "session";
|
|
29
|
+
earliest_artifact_at: string | null;
|
|
30
|
+
latest_artifact_at: string | null;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const AnalysisProvenanceSchema: z.ZodObject<{
|
|
33
|
+
runtime: z.ZodObject<{
|
|
34
|
+
scope: z.ZodEnum<["all", "latest", "session"]>;
|
|
35
|
+
session_selector: z.ZodNullable<z.ZodString>;
|
|
36
|
+
artifact_count: z.ZodNumber;
|
|
37
|
+
artifact_ids: z.ZodArray<z.ZodString, "many">;
|
|
38
|
+
session_tags: z.ZodArray<z.ZodString, "many">;
|
|
39
|
+
earliest_artifact_at: z.ZodNullable<z.ZodString>;
|
|
40
|
+
latest_artifact_at: z.ZodNullable<z.ZodString>;
|
|
41
|
+
scope_note: z.ZodString;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
artifact_count: number;
|
|
44
|
+
scope_note: string;
|
|
45
|
+
artifact_ids: string[];
|
|
46
|
+
session_selector: string | null;
|
|
47
|
+
session_tags: string[];
|
|
48
|
+
scope: "all" | "latest" | "session";
|
|
49
|
+
earliest_artifact_at: string | null;
|
|
50
|
+
latest_artifact_at: string | null;
|
|
51
|
+
}, {
|
|
52
|
+
artifact_count: number;
|
|
53
|
+
scope_note: string;
|
|
54
|
+
artifact_ids: string[];
|
|
55
|
+
session_selector: string | null;
|
|
56
|
+
session_tags: string[];
|
|
57
|
+
scope: "all" | "latest" | "session";
|
|
58
|
+
earliest_artifact_at: string | null;
|
|
59
|
+
latest_artifact_at: string | null;
|
|
60
|
+
}>;
|
|
61
|
+
semantic_names: z.ZodOptional<z.ZodObject<{
|
|
62
|
+
scope: z.ZodEnum<["all", "latest", "session"]>;
|
|
63
|
+
session_selector: z.ZodNullable<z.ZodString>;
|
|
64
|
+
artifact_count: z.ZodNumber;
|
|
65
|
+
artifact_ids: z.ZodArray<z.ZodString, "many">;
|
|
66
|
+
session_tags: z.ZodArray<z.ZodString, "many">;
|
|
67
|
+
earliest_artifact_at: z.ZodNullable<z.ZodString>;
|
|
68
|
+
latest_artifact_at: z.ZodNullable<z.ZodString>;
|
|
69
|
+
scope_note: z.ZodString;
|
|
70
|
+
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
artifact_count: number;
|
|
72
|
+
scope_note: string;
|
|
73
|
+
artifact_ids: string[];
|
|
74
|
+
session_selector: string | null;
|
|
75
|
+
session_tags: string[];
|
|
76
|
+
scope: "all" | "latest" | "session";
|
|
77
|
+
earliest_artifact_at: string | null;
|
|
78
|
+
latest_artifact_at: string | null;
|
|
79
|
+
}, {
|
|
80
|
+
artifact_count: number;
|
|
81
|
+
scope_note: string;
|
|
82
|
+
artifact_ids: string[];
|
|
83
|
+
session_selector: string | null;
|
|
84
|
+
session_tags: string[];
|
|
85
|
+
scope: "all" | "latest" | "session";
|
|
86
|
+
earliest_artifact_at: string | null;
|
|
87
|
+
latest_artifact_at: string | null;
|
|
88
|
+
}>>;
|
|
89
|
+
semantic_explanations: z.ZodOptional<z.ZodObject<{
|
|
90
|
+
scope: z.ZodEnum<["all", "latest", "session"]>;
|
|
91
|
+
session_selector: z.ZodNullable<z.ZodString>;
|
|
92
|
+
artifact_count: z.ZodNumber;
|
|
93
|
+
artifact_ids: z.ZodArray<z.ZodString, "many">;
|
|
94
|
+
session_tags: z.ZodArray<z.ZodString, "many">;
|
|
95
|
+
earliest_artifact_at: z.ZodNullable<z.ZodString>;
|
|
96
|
+
latest_artifact_at: z.ZodNullable<z.ZodString>;
|
|
97
|
+
scope_note: z.ZodString;
|
|
98
|
+
}, "strip", z.ZodTypeAny, {
|
|
99
|
+
artifact_count: number;
|
|
100
|
+
scope_note: string;
|
|
101
|
+
artifact_ids: string[];
|
|
102
|
+
session_selector: string | null;
|
|
103
|
+
session_tags: string[];
|
|
104
|
+
scope: "all" | "latest" | "session";
|
|
105
|
+
earliest_artifact_at: string | null;
|
|
106
|
+
latest_artifact_at: string | null;
|
|
107
|
+
}, {
|
|
108
|
+
artifact_count: number;
|
|
109
|
+
scope_note: string;
|
|
110
|
+
artifact_ids: string[];
|
|
111
|
+
session_selector: string | null;
|
|
112
|
+
session_tags: string[];
|
|
113
|
+
scope: "all" | "latest" | "session";
|
|
114
|
+
earliest_artifact_at: string | null;
|
|
115
|
+
latest_artifact_at: string | null;
|
|
116
|
+
}>>;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
runtime: {
|
|
119
|
+
artifact_count: number;
|
|
120
|
+
scope_note: string;
|
|
121
|
+
artifact_ids: string[];
|
|
122
|
+
session_selector: string | null;
|
|
123
|
+
session_tags: string[];
|
|
124
|
+
scope: "all" | "latest" | "session";
|
|
125
|
+
earliest_artifact_at: string | null;
|
|
126
|
+
latest_artifact_at: string | null;
|
|
127
|
+
};
|
|
128
|
+
semantic_names?: {
|
|
129
|
+
artifact_count: number;
|
|
130
|
+
scope_note: string;
|
|
131
|
+
artifact_ids: string[];
|
|
132
|
+
session_selector: string | null;
|
|
133
|
+
session_tags: string[];
|
|
134
|
+
scope: "all" | "latest" | "session";
|
|
135
|
+
earliest_artifact_at: string | null;
|
|
136
|
+
latest_artifact_at: string | null;
|
|
137
|
+
} | undefined;
|
|
138
|
+
semantic_explanations?: {
|
|
139
|
+
artifact_count: number;
|
|
140
|
+
scope_note: string;
|
|
141
|
+
artifact_ids: string[];
|
|
142
|
+
session_selector: string | null;
|
|
143
|
+
session_tags: string[];
|
|
144
|
+
scope: "all" | "latest" | "session";
|
|
145
|
+
earliest_artifact_at: string | null;
|
|
146
|
+
latest_artifact_at: string | null;
|
|
147
|
+
} | undefined;
|
|
148
|
+
}, {
|
|
149
|
+
runtime: {
|
|
150
|
+
artifact_count: number;
|
|
151
|
+
scope_note: string;
|
|
152
|
+
artifact_ids: string[];
|
|
153
|
+
session_selector: string | null;
|
|
154
|
+
session_tags: string[];
|
|
155
|
+
scope: "all" | "latest" | "session";
|
|
156
|
+
earliest_artifact_at: string | null;
|
|
157
|
+
latest_artifact_at: string | null;
|
|
158
|
+
};
|
|
159
|
+
semantic_names?: {
|
|
160
|
+
artifact_count: number;
|
|
161
|
+
scope_note: string;
|
|
162
|
+
artifact_ids: string[];
|
|
163
|
+
session_selector: string | null;
|
|
164
|
+
session_tags: string[];
|
|
165
|
+
scope: "all" | "latest" | "session";
|
|
166
|
+
earliest_artifact_at: string | null;
|
|
167
|
+
latest_artifact_at: string | null;
|
|
168
|
+
} | undefined;
|
|
169
|
+
semantic_explanations?: {
|
|
170
|
+
artifact_count: number;
|
|
171
|
+
scope_note: string;
|
|
172
|
+
artifact_ids: string[];
|
|
173
|
+
session_selector: string | null;
|
|
174
|
+
session_tags: string[];
|
|
175
|
+
scope: "all" | "latest" | "session";
|
|
176
|
+
earliest_artifact_at: string | null;
|
|
177
|
+
latest_artifact_at: string | null;
|
|
178
|
+
} | undefined;
|
|
179
|
+
}>;
|
|
180
|
+
type ArtifactSelectionProvenance = z.infer<typeof ArtifactSelectionProvenanceSchema>;
|
|
181
|
+
export declare function buildRuntimeArtifactProvenance(dynamicEvidence: DynamicTraceSummary | null | undefined, scope: DynamicEvidenceScope, sessionTag?: string | null): ArtifactSelectionProvenance;
|
|
182
|
+
export declare function buildSemanticArtifactProvenance(label: 'semantic naming artifacts' | 'semantic explanation artifacts', index: SemanticNameSuggestionIndex | SemanticFunctionExplanationIndex | null | undefined, scope: SemanticArtifactScope, sessionTag?: string | null): ArtifactSelectionProvenance;
|
|
183
|
+
export {};
|
|
184
|
+
//# sourceMappingURL=analysis-provenance.d.ts.map
|