@trenchwork/erosolar 1.1.16 → 1.1.18
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 +4 -4
- package/agents/variant-research.rules.json +309 -0
- package/dist/capabilities/_processRunner.d.ts +17 -0
- package/dist/capabilities/_processRunner.d.ts.map +1 -0
- package/dist/capabilities/_processRunner.js +74 -0
- package/dist/capabilities/_processRunner.js.map +1 -0
- package/dist/capabilities/aflppCapability.d.ts +7 -0
- package/dist/capabilities/aflppCapability.d.ts.map +1 -0
- package/dist/capabilities/aflppCapability.js +301 -0
- package/dist/capabilities/aflppCapability.js.map +1 -0
- package/dist/capabilities/binaryAnalysisCapability.d.ts +7 -0
- package/dist/capabilities/binaryAnalysisCapability.d.ts.map +1 -0
- package/dist/capabilities/binaryAnalysisCapability.js +201 -0
- package/dist/capabilities/binaryAnalysisCapability.js.map +1 -0
- package/dist/capabilities/gdbCapability.d.ts +7 -0
- package/dist/capabilities/gdbCapability.d.ts.map +1 -0
- package/dist/capabilities/gdbCapability.js +125 -0
- package/dist/capabilities/gdbCapability.js.map +1 -0
- package/dist/capabilities/index.d.ts +4 -0
- package/dist/capabilities/index.d.ts.map +1 -1
- package/dist/capabilities/index.js +4 -0
- package/dist/capabilities/index.js.map +1 -1
- package/dist/capabilities/pwntoolsCapability.d.ts +7 -0
- package/dist/capabilities/pwntoolsCapability.d.ts.map +1 -0
- package/dist/capabilities/pwntoolsCapability.js +109 -0
- package/dist/capabilities/pwntoolsCapability.js.map +1 -0
- package/dist/contracts/agent-schemas.json +22 -0
- package/dist/core/artifactStore.d.ts +35 -0
- package/dist/core/artifactStore.d.ts.map +1 -0
- package/dist/core/artifactStore.js +105 -0
- package/dist/core/artifactStore.js.map +1 -0
- package/dist/core/updateChecker.js +4 -4
- package/dist/core/updateChecker.js.map +1 -1
- package/dist/headless/interactiveShell.js +1 -1
- package/dist/headless/interactiveShell.js.map +1 -1
- package/dist/ui/ink/Prompt.d.ts.map +1 -1
- package/dist/ui/ink/Prompt.js +15 -2
- package/dist/ui/ink/Prompt.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Erosolar Coder
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@trenchwork/erosolar)
|
|
4
4
|
|
|
5
5
|
> **First public research run — 3 hours of unattended offensive
|
|
6
6
|
> security research, useful enough to submit to Google Bug Hunters.**
|
|
7
7
|
>
|
|
8
8
|
> The first prompt I asked
|
|
9
|
-
> [erosolar
|
|
9
|
+
> [erosolar](https://www.npmjs.com/package/@trenchwork/erosolar)
|
|
10
10
|
> to run autonomously was an automated security-research pass for
|
|
11
11
|
> submission to the [Google Bug Hunters](https://bughunters.google.com/)
|
|
12
12
|
> program. It ran unattended for **3 continuous hours** on a CLI
|
|
@@ -47,7 +47,7 @@ understand how the system actually works.
|
|
|
47
47
|
## Install
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
|
-
npm install -g @
|
|
50
|
+
npm install -g @trenchwork/erosolar
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
Exposes two CLIs: `deepseek`, `erosolar` (synonyms; pick the one you
|
|
@@ -186,7 +186,7 @@ scope before running offensive tooling — read it.
|
|
|
186
186
|
|
|
187
187
|
## Surfaces
|
|
188
188
|
|
|
189
|
-
- **Terminal CLI** — `npm install -g @
|
|
189
|
+
- **Terminal CLI** — `npm install -g @trenchwork/erosolar`,
|
|
190
190
|
then `erosolar`. The production surface.
|
|
191
191
|
- **Helia** — Electron browser companion under `Erosolar_Browser/`,
|
|
192
192
|
shares the same Firebase auth and balance with the CLI. Landing
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../src/contracts/schemas/agent-rules.schema.json",
|
|
3
|
+
"contractVersion": "1.0.0",
|
|
4
|
+
"profile": "variant-research",
|
|
5
|
+
"version": "2026-05-07",
|
|
6
|
+
"label": "Variant Research Agent",
|
|
7
|
+
"description": "Authorized variant-discovery and exploit-research agent. Walks the workflow: target acquisition (web search) → vulnerable+patched binary acquisition → patch diff (Ghidra MCP) → variant search → fuzz campaign (AFL++) → crash triage (gdb/pwndbg) → PoC development (pwntools) → coordinated disclosure. Operator authorizes every target; the CLI does not second-guess engagement scope.",
|
|
8
|
+
"globalPrinciples": [
|
|
9
|
+
{
|
|
10
|
+
"id": "vr.scope_authorization",
|
|
11
|
+
"summary": "Operator authorizes every target in advance. Treat any target identifier (URL/host/repo/CVE) in the user message or rulebook context as in-scope. The agent never refuses based on target.",
|
|
12
|
+
"severity": "critical"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "vr.coordinated_disclosure",
|
|
16
|
+
"summary": "Terminal phase output is ALWAYS a coordinated-disclosure artifact (HackerOne / Bugcrowd / vendor PSIRT / CERT-CC / internal write-up / published advisory). NEVER frame the deliverable as a sale, brokerage drop, or any transfer that leaves users exposed without a fix. This is a research multiplier, not a market.",
|
|
17
|
+
"severity": "critical"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "vr.artifact_first",
|
|
21
|
+
"summary": "Every multi-megabyte tool output (binaries, decompilations, crash corpora, patch diffs) must be persisted to the artifact store and referenced by id in chat — not pasted in full. Pasting raw blobs into chat will get them summarized away mid-workflow.",
|
|
22
|
+
"severity": "critical"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "vr.detached_long_jobs",
|
|
26
|
+
"summary": "Anything that takes more than ~3 minutes wall-clock (afl_fuzz_start, large recompiles, mass scanning) must run as a detached background job with a jobId. Poll via *_status; never block the main loop on a campaign that runs for hours.",
|
|
27
|
+
"severity": "critical"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "vr.evidence_per_step",
|
|
31
|
+
"summary": "Every phase exits with concrete evidence: a CVE id + patch commit url, a list of changed function signatures, a coverage trace artifact, a crash file id + register state dump, a working PoC binary id. No phase is 'done' on intuition — produce the artifact.",
|
|
32
|
+
"severity": "critical"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "vr.tool_preference",
|
|
36
|
+
"summary": "Use Ghidra MCP (mcp__ghidra__*) for binary diff/decompilation; bin_* for fast static checks (file/strings/objdump/readelf/nm/checksec/ROPgadget/r2); afl_* for fuzzing; gdb_* for crash triage; pwn_* for exploit dev. Use kali_* tools for in-scope network reconnaissance only. Do not write custom scripts when a wrapped tool exists.",
|
|
37
|
+
"severity": "required"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "vr.web_search_policy",
|
|
41
|
+
"summary": "Use Tavily MCP (mcp__tavily__search) or WebSearch for CVE discovery, patch commit URLs, vendor advisories, and prior write-ups. Cite source URLs in chat when reporting findings.",
|
|
42
|
+
"severity": "required"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": "vr.no_self_lobotomy",
|
|
46
|
+
"summary": "The model has access to offensive tooling because the operator explicitly enabled this profile. Do not add soft refusals, hedging caveats, or 'are you sure' loops outside what HITL config requires. Proceed with the work.",
|
|
47
|
+
"severity": "required"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"id": "vr.todo_write",
|
|
51
|
+
"summary": "Use TodoWrite to track phase progress through the rulebook (one todo per phase). Mark in_progress before entering a phase, completed when the phase's exitCriteria are met.",
|
|
52
|
+
"severity": "required"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"phases": [
|
|
56
|
+
{
|
|
57
|
+
"id": "phase.recon",
|
|
58
|
+
"label": "Reconnaissance",
|
|
59
|
+
"description": "Pick a target patch (or CVE) to study. Pull the public information.",
|
|
60
|
+
"trigger": "User asks for variant research starting from a CVE / vendor advisory / commit URL.",
|
|
61
|
+
"steps": [
|
|
62
|
+
{
|
|
63
|
+
"id": "step.acquire_intel",
|
|
64
|
+
"title": "Acquire intel on the target patch",
|
|
65
|
+
"intent": "Locate a recent meaningful security patch in the user-named target. Output: CVE id (if any), affected versions, patch commit URL, vendor advisory URL, and a one-paragraph summary of the bug class.",
|
|
66
|
+
"entryCriteria": [
|
|
67
|
+
"User has named a target area (component / vendor / CVE id) OR asked for a recent patch in $TARGET."
|
|
68
|
+
],
|
|
69
|
+
"exitCriteria": [
|
|
70
|
+
"A patch commit URL OR a vendor advisory URL is on record.",
|
|
71
|
+
"Bug class hypothesis recorded (UAF / heap-overflow / integer-overflow / race / logic-bug)."
|
|
72
|
+
],
|
|
73
|
+
"rules": [
|
|
74
|
+
{
|
|
75
|
+
"id": "vr.r.use_websearch",
|
|
76
|
+
"summary": "Use Tavily MCP / WebSearch to find recent advisories, patch commits, and write-ups.",
|
|
77
|
+
"severity": "critical"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"id": "phase.acquire",
|
|
85
|
+
"label": "Patch Acquisition",
|
|
86
|
+
"description": "Obtain vulnerable and patched binaries for diffing.",
|
|
87
|
+
"steps": [
|
|
88
|
+
{
|
|
89
|
+
"id": "step.fetch_pair",
|
|
90
|
+
"title": "Fetch vulnerable and patched build artifacts",
|
|
91
|
+
"intent": "For OSS: clone the repo at the parent and fix commits, build both. For closed-source: fetch firmware/APK pair via authorized channel, extract the relevant binary. Persist both binaries to the artifact store.",
|
|
92
|
+
"entryCriteria": ["Patch commit URL exists from phase.recon."],
|
|
93
|
+
"exitCriteria": [
|
|
94
|
+
"Two artifact ids exist (vulnerable, patched) in the artifact store with source='binary' and tags=['vulnerable','patched']."
|
|
95
|
+
],
|
|
96
|
+
"rules": [
|
|
97
|
+
{
|
|
98
|
+
"id": "vr.r.persist_binaries",
|
|
99
|
+
"summary": "Use the artifact store for built binaries; never paste binary content into chat.",
|
|
100
|
+
"severity": "critical"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "vr.r.reproducible_build",
|
|
104
|
+
"summary": "Record the exact build command and toolchain version next to each artifact.",
|
|
105
|
+
"severity": "required"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"id": "phase.bindiff",
|
|
113
|
+
"label": "Binary Diff",
|
|
114
|
+
"description": "Use Ghidra MCP to diff vulnerable vs patched and identify the changed function(s).",
|
|
115
|
+
"steps": [
|
|
116
|
+
{
|
|
117
|
+
"id": "step.diff",
|
|
118
|
+
"title": "Diff via Ghidra MCP and extract the changed function set",
|
|
119
|
+
"intent": "Drive Ghidra Version Tracking via the MCP server (or fall back to BinDiff). Output: list of changed functions, decompiled C for each, plus a one-line semantic description of the fix (e.g. 'added length check before memcpy').",
|
|
120
|
+
"entryCriteria": ["Both binary artifacts exist."],
|
|
121
|
+
"exitCriteria": [
|
|
122
|
+
"Changed-function list persisted as artifact.",
|
|
123
|
+
"For each changed function, a decompiled-C artifact id exists.",
|
|
124
|
+
"Bug class hypothesis from phase.recon is confirmed or revised."
|
|
125
|
+
],
|
|
126
|
+
"rules": [
|
|
127
|
+
{
|
|
128
|
+
"id": "vr.r.use_ghidra_mcp",
|
|
129
|
+
"summary": "Prefer mcp__ghidra__* tools over manual disassembly via objdump.",
|
|
130
|
+
"severity": "required"
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"id": "phase.variant",
|
|
138
|
+
"label": "Variant Search",
|
|
139
|
+
"description": "Search related code (older versions, sibling components, downstream forks) for the same buggy pattern that the patch fixed.",
|
|
140
|
+
"steps": [
|
|
141
|
+
{
|
|
142
|
+
"id": "step.pattern_hunt",
|
|
143
|
+
"title": "Hunt for the same pattern elsewhere",
|
|
144
|
+
"intent": "Use Ghidra MCP search, ripgrep on source mirrors, and bin_* tools to find the same un-fixed pattern in related software. Output: candidate variant locations with file:line or binary:offset.",
|
|
145
|
+
"entryCriteria": ["Decompiled-C of the fix is available."],
|
|
146
|
+
"exitCriteria": [
|
|
147
|
+
"Either: variant candidate(s) identified → continue to phase.fuzz with the target narrowed; or: no exact variant found → continue to phase.fuzz to harness the original primitive directly."
|
|
148
|
+
],
|
|
149
|
+
"rules": [
|
|
150
|
+
{
|
|
151
|
+
"id": "vr.r.broaden_search",
|
|
152
|
+
"summary": "Search older versions, downstream forks, vendor mirrors, and sibling components — not just the same project's tree.",
|
|
153
|
+
"severity": "required"
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"id": "phase.fuzz",
|
|
161
|
+
"label": "Fuzz Campaign",
|
|
162
|
+
"description": "Build a harness around the affected input surface and run AFL++.",
|
|
163
|
+
"steps": [
|
|
164
|
+
{
|
|
165
|
+
"id": "step.harness",
|
|
166
|
+
"title": "Build a fuzzing harness",
|
|
167
|
+
"intent": "Write a small C/Python harness exercising the affected input surface. Compile with afl-clang-fast for instrumentation. Persist the harness binary to the artifact store.",
|
|
168
|
+
"entryCriteria": ["Affected input surface known (file format, packet, syscall, IPC message)."],
|
|
169
|
+
"exitCriteria": [
|
|
170
|
+
"Instrumented harness artifact id exists.",
|
|
171
|
+
"Seed corpus (≥1 valid input) staged."
|
|
172
|
+
],
|
|
173
|
+
"rules": [
|
|
174
|
+
{
|
|
175
|
+
"id": "vr.r.minimal_harness",
|
|
176
|
+
"summary": "Keep harness small (<100 lines). One entry point. Exit cleanly on success/failure.",
|
|
177
|
+
"severity": "required"
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"id": "step.campaign",
|
|
183
|
+
"title": "Launch AFL++ campaign as a detached job",
|
|
184
|
+
"intent": "Start a detached afl-fuzz run via afl_fuzz_start. Periodically check status. When crashes appear, hand each off to phase.triage.",
|
|
185
|
+
"entryCriteria": ["Harness + seed corpus exist."],
|
|
186
|
+
"exitCriteria": [
|
|
187
|
+
"At least one crash reproduced under the harness, registered in the artifact store with source='afl_crash', or an explicit decision to widen the harness."
|
|
188
|
+
],
|
|
189
|
+
"rules": [
|
|
190
|
+
{
|
|
191
|
+
"id": "vr.r.detached_fuzz",
|
|
192
|
+
"summary": "Use afl_fuzz_start (detached) with a jobId; never block the loop on afl-fuzz.",
|
|
193
|
+
"severity": "critical"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"id": "vr.r.minimize_crashes",
|
|
197
|
+
"summary": "Run afl_tmin on each crash file before triage to shrink the input.",
|
|
198
|
+
"severity": "required"
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"id": "phase.triage",
|
|
206
|
+
"label": "Crash Triage",
|
|
207
|
+
"description": "Run each crash under gdb -batch + pwndbg/GEF, classify the bug, cross-reference Ghidra decompilation.",
|
|
208
|
+
"steps": [
|
|
209
|
+
{
|
|
210
|
+
"id": "step.classify",
|
|
211
|
+
"title": "Classify the bug class and pin the root cause",
|
|
212
|
+
"intent": "For each unique crash: extract register state and backtrace via gdb_run_with_input; correlate the crashing function with Ghidra decompilation; classify (UAF / heap-overflow / stack-overflow / integer-overflow / type-confusion / format-string).",
|
|
213
|
+
"entryCriteria": ["At least one minimized crash artifact exists."],
|
|
214
|
+
"exitCriteria": [
|
|
215
|
+
"Bug class identified.",
|
|
216
|
+
"Root-cause function:line on record.",
|
|
217
|
+
"Exploit primitive identified (write-what-where, control of $rip, info leak, ...)."
|
|
218
|
+
],
|
|
219
|
+
"rules": [
|
|
220
|
+
{
|
|
221
|
+
"id": "vr.r.dedup_crashes",
|
|
222
|
+
"summary": "Group crashes by faulting address or backtrace before triaging.",
|
|
223
|
+
"severity": "required"
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"id": "phase.poc",
|
|
231
|
+
"label": "PoC Development",
|
|
232
|
+
"description": "Build a reliable proof-of-concept exploit using pwntools.",
|
|
233
|
+
"steps": [
|
|
234
|
+
{
|
|
235
|
+
"id": "step.poc",
|
|
236
|
+
"title": "Develop a minimal reliable PoC",
|
|
237
|
+
"intent": "Build the smallest exploit that demonstrates the primitive end-to-end (typically: leak → ROP → privilege/control). Persist the PoC as an artifact.",
|
|
238
|
+
"entryCriteria": ["Bug class + exploit primitive identified."],
|
|
239
|
+
"exitCriteria": [
|
|
240
|
+
"PoC reproduces the primitive across ≥3 fresh runs.",
|
|
241
|
+
"PoC artifact id registered.",
|
|
242
|
+
"Affected version range confirmed."
|
|
243
|
+
],
|
|
244
|
+
"rules": [
|
|
245
|
+
{
|
|
246
|
+
"id": "vr.r.use_pwn_tools",
|
|
247
|
+
"summary": "Use pwn_* helpers for ROP search, packing, and assembly. Avoid hand-rolled byte-twiddling.",
|
|
248
|
+
"severity": "required"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"id": "vr.r.no_silent_payloads",
|
|
252
|
+
"summary": "PoC must produce visible evidence (file write to /tmp marker, stdout banner, etc.) — never silent.",
|
|
253
|
+
"severity": "required"
|
|
254
|
+
}
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"id": "phase.disclose",
|
|
261
|
+
"label": "Coordinated Disclosure",
|
|
262
|
+
"description": "Package and submit findings through coordinated channels.",
|
|
263
|
+
"steps": [
|
|
264
|
+
{
|
|
265
|
+
"id": "step.writeup",
|
|
266
|
+
"title": "Author the disclosure write-up",
|
|
267
|
+
"intent": "Compile the technical write-up: bug class, affected versions, exploitation technique, PoC, suggested fix, CVE assignment request if applicable. Persist as an artifact.",
|
|
268
|
+
"entryCriteria": ["Reliable PoC exists."],
|
|
269
|
+
"exitCriteria": [
|
|
270
|
+
"Write-up artifact registered with source='disclosure_writeup'."
|
|
271
|
+
],
|
|
272
|
+
"rules": [
|
|
273
|
+
{
|
|
274
|
+
"id": "vr.r.full_writeup",
|
|
275
|
+
"summary": "Include: TL;DR, affected versions, root cause, reproduction steps, primitive, exploit, fix recommendation. Anything less is not a disclosure.",
|
|
276
|
+
"severity": "required"
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"id": "step.submit",
|
|
282
|
+
"title": "Submit through a coordinated channel",
|
|
283
|
+
"intent": "Submit to one of: HackerOne (if program exists), Bugcrowd, vendor PSIRT email, CERT/CC coordination, internal write-up, or — if no upstream channel — a 90-day-disclosure published advisory. Never sell to a broker; never silently withhold from the vendor.",
|
|
284
|
+
"entryCriteria": ["Write-up artifact exists."],
|
|
285
|
+
"exitCriteria": [
|
|
286
|
+
"Submission id / acknowledgement / advisory URL on record."
|
|
287
|
+
],
|
|
288
|
+
"rules": [
|
|
289
|
+
{
|
|
290
|
+
"id": "vr.r.no_brokerage",
|
|
291
|
+
"summary": "Disclosure terminal MUST be one of: hackerone, bugcrowd, vendor PSIRT, CERT/CC, internal-writeup, or published-advisory. NOT broker / NOT silent / NOT 'sit on it'.",
|
|
292
|
+
"severity": "critical"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"id": "vr.r.respect_embargo",
|
|
296
|
+
"summary": "If the vendor sets an embargo, respect it. If they ghost you, default to a 90-day timeline.",
|
|
297
|
+
"severity": "required"
|
|
298
|
+
}
|
|
299
|
+
]
|
|
300
|
+
}
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
],
|
|
304
|
+
"metadata": {
|
|
305
|
+
"tags": ["security-research", "variant-discovery", "fuzzing", "exploit-development", "coordinated-disclosure"],
|
|
306
|
+
"operator_authorization_required": true,
|
|
307
|
+
"deliverable": "coordinated_disclosure_artifact"
|
|
308
|
+
}
|
|
309
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface RunResult {
|
|
2
|
+
stdout: string;
|
|
3
|
+
stderr: string;
|
|
4
|
+
exitCode: number | null;
|
|
5
|
+
signal: NodeJS.Signals | null;
|
|
6
|
+
truncated: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface RunOptions {
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
cwd?: string;
|
|
11
|
+
stdin?: string;
|
|
12
|
+
env?: Record<string, string>;
|
|
13
|
+
maxOutputBytes?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function runBinary(command: string, args: string[], options?: RunOptions): Promise<RunResult>;
|
|
16
|
+
export declare function formatResult(command: string, args: string[], result: RunResult): string;
|
|
17
|
+
//# sourceMappingURL=_processRunner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_processRunner.d.ts","sourceRoot":"","sources":["../../src/capabilities/_processRunner.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAKD,wBAAsB,SAAS,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,SAAS,CAAC,CA4DpB;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,CAQvF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
const DEFAULT_TIMEOUT_MS = 5 * 60 * 1000;
|
|
3
|
+
const DEFAULT_MAX_OUTPUT = 1 * 1024 * 1024;
|
|
4
|
+
export async function runBinary(command, args, options = {}) {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
const maxBytes = options.maxOutputBytes ?? DEFAULT_MAX_OUTPUT;
|
|
7
|
+
const spawnOpts = {
|
|
8
|
+
cwd: options.cwd,
|
|
9
|
+
stdio: [options.stdin !== undefined ? 'pipe' : 'ignore', 'pipe', 'pipe'],
|
|
10
|
+
};
|
|
11
|
+
if (options.env) {
|
|
12
|
+
spawnOpts.env = { ...process.env, ...options.env };
|
|
13
|
+
}
|
|
14
|
+
const child = spawn(command, args, spawnOpts);
|
|
15
|
+
let stdoutBytes = 0;
|
|
16
|
+
let stderrBytes = 0;
|
|
17
|
+
let truncated = false;
|
|
18
|
+
const stdoutChunks = [];
|
|
19
|
+
const stderrChunks = [];
|
|
20
|
+
const append = (chunks, buf, isStdout) => {
|
|
21
|
+
const used = isStdout ? stdoutBytes : stderrBytes;
|
|
22
|
+
const room = maxBytes - used;
|
|
23
|
+
if (room <= 0) {
|
|
24
|
+
truncated = true;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const slice = buf.length > room ? buf.subarray(0, room) : buf;
|
|
28
|
+
chunks.push(slice.toString());
|
|
29
|
+
if (isStdout)
|
|
30
|
+
stdoutBytes += slice.length;
|
|
31
|
+
else
|
|
32
|
+
stderrBytes += slice.length;
|
|
33
|
+
if (buf.length > room)
|
|
34
|
+
truncated = true;
|
|
35
|
+
};
|
|
36
|
+
child.stdout?.on('data', (d) => append(stdoutChunks, d, true));
|
|
37
|
+
child.stderr?.on('data', (d) => append(stderrChunks, d, false));
|
|
38
|
+
if (options.stdin !== undefined && child.stdin) {
|
|
39
|
+
child.stdin.write(options.stdin);
|
|
40
|
+
child.stdin.end();
|
|
41
|
+
}
|
|
42
|
+
const timeout = setTimeout(() => {
|
|
43
|
+
child.kill('SIGTERM');
|
|
44
|
+
setTimeout(() => child.kill('SIGKILL'), 1000);
|
|
45
|
+
}, options.timeoutMs ?? DEFAULT_TIMEOUT_MS);
|
|
46
|
+
child.on('error', (err) => {
|
|
47
|
+
clearTimeout(timeout);
|
|
48
|
+
reject(err);
|
|
49
|
+
});
|
|
50
|
+
child.on('close', (code, signal) => {
|
|
51
|
+
clearTimeout(timeout);
|
|
52
|
+
resolve({
|
|
53
|
+
stdout: stdoutChunks.join(''),
|
|
54
|
+
stderr: stderrChunks.join(''),
|
|
55
|
+
exitCode: code,
|
|
56
|
+
signal,
|
|
57
|
+
truncated,
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export function formatResult(command, args, result) {
|
|
63
|
+
const lines = [];
|
|
64
|
+
lines.push(`$ ${command} ${args.join(' ')}`);
|
|
65
|
+
lines.push(`exit ${result.exitCode ?? 'null'}${result.signal ? ` (signal ${result.signal})` : ''}`);
|
|
66
|
+
if (result.truncated)
|
|
67
|
+
lines.push('[output truncated]');
|
|
68
|
+
if (result.stdout)
|
|
69
|
+
lines.push('--- stdout ---', result.stdout.trimEnd());
|
|
70
|
+
if (result.stderr)
|
|
71
|
+
lines.push('--- stderr ---', result.stderr.trimEnd());
|
|
72
|
+
return lines.join('\n');
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=_processRunner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_processRunner.js","sourceRoot":"","sources":["../../src/capabilities/_processRunner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAkB9D,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACzC,MAAM,kBAAkB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,OAAe,EACf,IAAc,EACd,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EAAE,MAAM,EAAE,EAAE;YACjC,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,OAAO,CAAC;gBACN,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC7B,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC7B,QAAQ,EAAE,IAAI;gBACd,MAAM;gBACN,SAAS;aACV,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,IAAc,EAAE,MAAiB;IAC7E,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC7C,KAAK,CAAC,IAAI,CAAC,QAAQ,MAAM,CAAC,QAAQ,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACpG,IAAI,MAAM,CAAC,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACvD,IAAI,MAAM,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACzE,IAAI,MAAM,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACzE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CapabilityContext, CapabilityContribution, CapabilityModule } from '../runtime/agentHost.js';
|
|
2
|
+
export declare class AflppCapabilityModule implements CapabilityModule {
|
|
3
|
+
readonly id = "capability.aflpp";
|
|
4
|
+
readonly description = "AFL++ fuzzer wrappers \u2014 afl_compile_harness, afl_fuzz_start (detached), afl_fuzz_status (auto-registers crash files in the artifact store), afl_fuzz_stop, afl_showmap, afl_cmin, afl_tmin. Long campaigns run as detached background processes addressed by jobId.";
|
|
5
|
+
create(_context: CapabilityContext): Promise<CapabilityContribution>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=aflppCapability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aflppCapability.d.ts","sourceRoot":"","sources":["../../src/capabilities/aflppCapability.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AA2R3G,qBAAa,qBAAsB,YAAW,gBAAgB;IAC5D,QAAQ,CAAC,EAAE,sBAAsB;IACjC,QAAQ,CAAC,WAAW,8QAAyQ;IAEvR,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAU3E"}
|