pentesting 0.7.7 → 0.7.9
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 +145 -98
- package/dist/index.js +6 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
```
|
|
2
|
-
██████╗ ███████╗███╗
|
|
3
|
-
██╔══██╗██╔════╝████╗
|
|
4
|
-
██████╔╝█████╗ ██╔██╗ ██║ ██║ █████╗ ███████╗ ██║
|
|
5
|
-
██╔═══╝ ██╔══╝ ██║╚██╗██║ ██║ ██╔══╝ ╚════██║ ██║
|
|
6
|
-
██║ ███████╗██║ ╚████║ ██║ ███████╗███████║ ██║
|
|
7
|
-
╚═╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚══════╝ ╚═╝
|
|
2
|
+
██████╗ ███████╗███╗ ██╗████████╗███████╗███████╗████████╗██╗███╗ ██╗ ██████╗
|
|
3
|
+
██╔══██╗██╔════╝████╗ ██║╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝██║████╗ ██║██╔════╝
|
|
4
|
+
██████╔╝█████╗ ██╔██╗ ██║ ██║ █████╗ ███████╗ ██║ ██║██╔██╗ ██║██║ ███╗
|
|
5
|
+
██╔═══╝ ██╔══╝ ██║╚██╗██║ ██║ ██╔══╝ ╚════██║ ██║ ██║██║╚██╗██║██║ ██║
|
|
6
|
+
██║ ███████╗██║ ╚████║ ██║ ███████╗███████║ ██║ ██║██║ ╚████║╚██████╔╝
|
|
7
|
+
╚═╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
**Autonomous AI Penetration Testing Agent**
|
|
11
11
|
|
|
12
12
|
[](https://www.npmjs.com/package/pentesting)
|
|
13
13
|
[](https://hub.docker.com/r/agnusdei1207/pentesting-tools)
|
|
@@ -36,67 +36,116 @@ pentesting
|
|
|
36
36
|
### Core Capabilities
|
|
37
37
|
- **10-Phase Attack Workflow**: Recon → Scan → Enum → Vuln Analysis → Exploitation → PrivEsc → Pivot → Persist → Exfil → Report
|
|
38
38
|
- **9 Specialized Agents**: Built-in domain experts for security testing
|
|
39
|
-
- **
|
|
39
|
+
- **Multi-Target Attack**: Register multiple targets and attack them sequentially
|
|
40
|
+
- **Auto-Target Detection**: Automatically sets targets from user input
|
|
40
41
|
- **Streaming Responses**: Real-time LLM output display
|
|
41
42
|
- **Session Persistence**: Save/resume pentesting sessions
|
|
42
|
-
- **
|
|
43
|
+
- **ESC Interrupt**: Stop execution anytime with ESC key
|
|
43
44
|
- **MCP Integration**: Extend with Model Context Protocol tools
|
|
44
45
|
- **Docker Toolkit**: 50+ pre-installed pentesting tools
|
|
45
46
|
- **Provider Agnostic**: Works with any OpenAI-compatible API
|
|
46
47
|
|
|
47
|
-
### v0.
|
|
48
|
-
- **
|
|
49
|
-
- **
|
|
50
|
-
- **
|
|
51
|
-
- **
|
|
52
|
-
- **
|
|
53
|
-
- **Wire Logging**: Detailed session recording in JSONL format
|
|
54
|
-
- **Rich TUI**: Premium ASCII banner, organized help, status reports
|
|
48
|
+
### v0.7+ New Features
|
|
49
|
+
- **Multi-Target Management**: `/target add`, `/target list`, `/target clear`
|
|
50
|
+
- **Batch Attack**: `/start all` to attack all registered targets
|
|
51
|
+
- **set_target Tool**: Agent can set targets directly via tool call
|
|
52
|
+
- **Enhanced ESC**: Properly interrupts even during tool execution
|
|
53
|
+
- **UI State Sync**: Real-time status bar updates for findings/creds/targets
|
|
55
54
|
|
|
56
55
|
---
|
|
57
56
|
|
|
58
57
|
## 📖 CLI Commands
|
|
59
58
|
|
|
60
|
-
###
|
|
59
|
+
### Target Management
|
|
61
60
|
```bash
|
|
62
|
-
/target <ip>
|
|
63
|
-
/
|
|
64
|
-
/
|
|
65
|
-
/
|
|
61
|
+
/target <domain|ip> Set primary target
|
|
62
|
+
/target add <t> Add target to list
|
|
63
|
+
/target list Show all targets (★ = primary)
|
|
64
|
+
/target rm <t> Remove target from list
|
|
65
|
+
/target set <t> Set as primary target
|
|
66
|
+
/target clear Remove ALL targets
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Attack Execution
|
|
70
|
+
```bash
|
|
71
|
+
/start [objective] Start pentest on primary target
|
|
72
|
+
/start all Attack ALL registered targets sequentially
|
|
73
|
+
/stop Stop current operation
|
|
74
|
+
/status Show status report
|
|
66
75
|
```
|
|
67
76
|
|
|
68
77
|
### Session Management
|
|
69
78
|
```bash
|
|
70
|
-
/checkpoint [desc]
|
|
71
|
-
/checkpoints
|
|
72
|
-
/undo
|
|
73
|
-
/revert <id>
|
|
74
|
-
/compact
|
|
75
|
-
/sessions
|
|
76
|
-
/resume [id]
|
|
77
|
-
/replay
|
|
79
|
+
/checkpoint [desc] Create checkpoint with optional description
|
|
80
|
+
/checkpoints List all checkpoints
|
|
81
|
+
/undo Undo to last checkpoint
|
|
82
|
+
/revert <id> Revert to specific checkpoint
|
|
83
|
+
/compact Compact context (keep last 3 messages)
|
|
84
|
+
/sessions List saved sessions
|
|
85
|
+
/resume [id] Resume a session
|
|
86
|
+
/replay Show session recordings
|
|
78
87
|
```
|
|
79
88
|
|
|
80
89
|
### Skills & Extras
|
|
81
90
|
```bash
|
|
82
|
-
/skills
|
|
83
|
-
/update
|
|
84
|
-
/update now
|
|
91
|
+
/skills List available skills
|
|
92
|
+
/update Check for updates
|
|
93
|
+
/update now Install update
|
|
85
94
|
```
|
|
86
95
|
|
|
87
96
|
### Findings & Reports
|
|
88
97
|
```bash
|
|
89
|
-
/findings
|
|
90
|
-
/report
|
|
98
|
+
/findings Show discovered findings
|
|
99
|
+
/report Generate pentest report
|
|
91
100
|
```
|
|
92
101
|
|
|
93
102
|
### Utility
|
|
94
103
|
```bash
|
|
95
|
-
/paste
|
|
96
|
-
/yolo
|
|
97
|
-
/clear
|
|
98
|
-
/exit
|
|
99
|
-
/y /n /ya
|
|
104
|
+
/paste Paste from clipboard (text or image)
|
|
105
|
+
/yolo Toggle auto-approve mode
|
|
106
|
+
/clear Clear screen
|
|
107
|
+
/exit Exit
|
|
108
|
+
/y /n /ya Approve/Deny/Always approve (for pending tools)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 🎯 Multi-Target Workflow
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Start pentesting CLI
|
|
117
|
+
pentesting
|
|
118
|
+
|
|
119
|
+
# Register multiple targets
|
|
120
|
+
/target add example1.com
|
|
121
|
+
/target add example2.com
|
|
122
|
+
/target add 192.168.1.1
|
|
123
|
+
/target add internal.corp
|
|
124
|
+
|
|
125
|
+
# View registered targets
|
|
126
|
+
/target list
|
|
127
|
+
🎯 Targets (4):
|
|
128
|
+
1. ★ example1.com
|
|
129
|
+
2. example2.com
|
|
130
|
+
3. 192.168.1.1
|
|
131
|
+
4. internal.corp
|
|
132
|
+
|
|
133
|
+
# Attack all targets sequentially
|
|
134
|
+
/start all
|
|
135
|
+
|
|
136
|
+
🚀 Starting multi-target attack on 4 targets
|
|
137
|
+
|
|
138
|
+
━━━ [1/4] example1.com ━━━
|
|
139
|
+
📁 Session: session-1707325423
|
|
140
|
+
... reconnaissance & exploitation ...
|
|
141
|
+
|
|
142
|
+
━━━ [2/4] example2.com ━━━
|
|
143
|
+
...
|
|
144
|
+
|
|
145
|
+
# Press ESC to stop between targets
|
|
146
|
+
⏸ Stopped at target 2/4
|
|
147
|
+
|
|
148
|
+
✓ Multi-target attack complete
|
|
100
149
|
```
|
|
101
150
|
|
|
102
151
|
---
|
|
@@ -137,35 +186,38 @@ pentesting
|
|
|
137
186
|
## 💻 Programmatic Usage
|
|
138
187
|
|
|
139
188
|
```typescript
|
|
140
|
-
import {
|
|
189
|
+
import { AutonomousHackingAgent, AGENT_EVENT } from 'pentesting';
|
|
141
190
|
|
|
142
|
-
const agent = new
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
maxIterations: 100, // Max Ralph loop iterations
|
|
146
|
-
autoSave: true, // Auto-save session state
|
|
191
|
+
const agent = new AutonomousHackingAgent(undefined, {
|
|
192
|
+
autoApprove: false, // Require approval for dangerous tools
|
|
193
|
+
maxIterations: 100, // Max loop iterations
|
|
147
194
|
});
|
|
148
195
|
|
|
196
|
+
// Multi-target setup
|
|
197
|
+
agent.addTarget('example1.com');
|
|
198
|
+
agent.addTarget('example2.com');
|
|
199
|
+
agent.setTarget('example1.com');
|
|
200
|
+
|
|
149
201
|
// Listen for events
|
|
150
|
-
agent.on(
|
|
202
|
+
agent.on(AGENT_EVENT.FINDING, (finding) => {
|
|
151
203
|
console.log(`Found: ${finding.title} (${finding.severity})`);
|
|
152
204
|
});
|
|
153
205
|
|
|
154
|
-
agent.on(
|
|
155
|
-
console.log(`
|
|
156
|
-
agent.approveToolCall(request.id, 'approve');
|
|
206
|
+
agent.on(AGENT_EVENT.TARGET_SET, (target) => {
|
|
207
|
+
console.log(`Target set: ${target}`);
|
|
157
208
|
});
|
|
158
209
|
|
|
159
|
-
agent.on(
|
|
160
|
-
|
|
210
|
+
agent.on(AGENT_EVENT.TOOL_CALL, ({ name, input }) => {
|
|
211
|
+
console.log(`Tool: ${name}`);
|
|
161
212
|
});
|
|
162
213
|
|
|
163
214
|
// Start pentesting
|
|
164
|
-
await agent.
|
|
215
|
+
await agent.runAutonomous('Get root access');
|
|
165
216
|
|
|
166
|
-
//
|
|
167
|
-
|
|
168
|
-
|
|
217
|
+
// Control execution
|
|
218
|
+
agent.pause(); // Pause (ESC key equivalent)
|
|
219
|
+
agent.resume(); // Resume
|
|
220
|
+
agent.abort(); // Complete stop
|
|
169
221
|
```
|
|
170
222
|
|
|
171
223
|
---
|
|
@@ -185,6 +237,15 @@ docker run -d --name pentesting-tools --network host \
|
|
|
185
237
|
docker exec -it pentesting-tools nmap -sCV 10.0.0.1
|
|
186
238
|
```
|
|
187
239
|
|
|
240
|
+
### Included Tools
|
|
241
|
+
- **Network**: nmap, rustscan, masscan, netcat
|
|
242
|
+
- **Web**: ffuf, nikto, sqlmap, httpx
|
|
243
|
+
- **Discovery**: subfinder, amass, nuclei
|
|
244
|
+
- **Service**: snmpwalk, nbtscan, hydra, smbclient
|
|
245
|
+
- **AD/Windows**: impacket, crackmapexec
|
|
246
|
+
- **Database**: mysql-client, postgresql-client, redis-tools
|
|
247
|
+
- **Utilities**: curl, wget, jq, python3
|
|
248
|
+
|
|
188
249
|
---
|
|
189
250
|
|
|
190
251
|
## 🔌 MCP Integration
|
|
@@ -192,7 +253,7 @@ docker exec -it pentesting-tools nmap -sCV 10.0.0.1
|
|
|
192
253
|
Extend with additional MCP servers:
|
|
193
254
|
|
|
194
255
|
```typescript
|
|
195
|
-
const agent = new
|
|
256
|
+
const agent = new AutonomousHackingAgent();
|
|
196
257
|
|
|
197
258
|
// Add filesystem access
|
|
198
259
|
await agent.addMCPServer('filesystem', 'npx', [
|
|
@@ -213,8 +274,12 @@ await agent.addMCPServer('security-tools', 'docker', [
|
|
|
213
274
|
┌─────────────────────────────────────────────────────────────────┐
|
|
214
275
|
│ TUI (app.tsx) │
|
|
215
276
|
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────────┐ │
|
|
216
|
-
│ │ WireLogger │ │ContextMgr │ │
|
|
217
|
-
│ │ (Recording) │ │(Checkpoints)│ │ (
|
|
277
|
+
│ │ WireLogger │ │ContextMgr │ │ Multi-Target Handler │ │
|
|
278
|
+
│ │ (Recording) │ │(Checkpoints)│ │ (add/list/rm/clear/all) │ │
|
|
279
|
+
│ └──────────────┘ └──────────────┘ └──────────────────────────┘ │
|
|
280
|
+
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────────┐ │
|
|
281
|
+
│ │ KeyboardLstn │ │ ForceUpdate │ │ SlashCommandRegistry │ │
|
|
282
|
+
│ │ (ESC/Ctrl+C) │ │ (UI Refresh) │ │ (Command Handling) │ │
|
|
218
283
|
│ └──────────────┘ └──────────────┘ └──────────────────────────┘ │
|
|
219
284
|
└────────────────────────────┬────────────────────────────────────┘
|
|
220
285
|
│ Events
|
|
@@ -224,6 +289,10 @@ await agent.addMCPServer('security-tools', 'docker', [
|
|
|
224
289
|
│ │ HookExecutor │ │ MCPManager │ │ApprovalMgr │ │
|
|
225
290
|
│ │ (Lifecycle) │ │ (Extensions) │ │(Tool Safety) │ │
|
|
226
291
|
│ └──────────────┘ └──────────────┘ └──────────────┘ │
|
|
292
|
+
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
|
|
293
|
+
│ │ TargetMgr │ │ PauseMgr │ │ContextMgr │ │
|
|
294
|
+
│ │ (Multi-Tgt) │ │ (ESC/Abort) │ │ (Compaction) │ │
|
|
295
|
+
│ └──────────────┘ └──────────────┘ └──────────────┘ │
|
|
227
296
|
│ │
|
|
228
297
|
│ ┌────────────────────────────────────────────────────────────┐ │
|
|
229
298
|
│ │ 9 Built-in Specialized Agents │ │
|
|
@@ -240,34 +309,6 @@ await agent.addMCPServer('security-tools', 'docker', [
|
|
|
240
309
|
└─────────┘ └─────────┘ └─────────┘
|
|
241
310
|
```
|
|
242
311
|
|
|
243
|
-
### Module Connectivity
|
|
244
|
-
|
|
245
|
-
```
|
|
246
|
-
Core Modules (src/core/):
|
|
247
|
-
├── agent/ AutonomousHackingAgent, PentestingAgent, AgentOrchestrator
|
|
248
|
-
├── approval/ ApprovalManager - tool execution safety
|
|
249
|
-
├── commands/ SlashCommandRegistry - command handling
|
|
250
|
-
├── context/ ContextManager (checkpoints) + Compaction (tokens)
|
|
251
|
-
├── display/ DisplayBlocks - rich output formatting
|
|
252
|
-
├── hooks/ HookExecutor - lifecycle events
|
|
253
|
-
├── loop/ RalphLoop - autonomous iteration
|
|
254
|
-
├── prompts/ System prompts for agents
|
|
255
|
-
├── replay/ SessionReplay - wire file parsing
|
|
256
|
-
├── session/ SessionManager - persistence
|
|
257
|
-
├── skill/ SkillManager + FlowExecutor - workflow automation
|
|
258
|
-
├── streaming/ StreamingAgent - real-time output
|
|
259
|
-
├── tools/ Tool definitions, executor, registry
|
|
260
|
-
└── update/ AutoUpdate - version management
|
|
261
|
-
|
|
262
|
-
Support Modules:
|
|
263
|
-
├── wire/ WireLogger (JSONL recording) + Wire Protocol
|
|
264
|
-
├── mcp/ MCPManager, MCPClient - extensions
|
|
265
|
-
├── utils/ Clipboard, Retry utilities
|
|
266
|
-
├── agents/ 9 built-in specialized agents
|
|
267
|
-
├── commands/ Built-in slash commands
|
|
268
|
-
└── config/ Constants, Theme, Agent configuration
|
|
269
|
-
```
|
|
270
|
-
|
|
271
312
|
---
|
|
272
313
|
|
|
273
314
|
## 📁 Project Structure
|
|
@@ -276,8 +317,9 @@ Support Modules:
|
|
|
276
317
|
src/
|
|
277
318
|
├── index.tsx # CLI entry point
|
|
278
319
|
├── cli/
|
|
279
|
-
│ ├── app.tsx # TUI with streaming,
|
|
280
|
-
│
|
|
320
|
+
│ ├── app.tsx # TUI with streaming, multi-target, approval
|
|
321
|
+
│ ├── components/ # Rich display components
|
|
322
|
+
│ └── utils/ # Keyboard listener
|
|
281
323
|
├── core/
|
|
282
324
|
│ ├── agent/ # Agent implementations
|
|
283
325
|
│ ├── approval/ # Tool approval system
|
|
@@ -322,19 +364,24 @@ npm run dev
|
|
|
322
364
|
|
|
323
365
|
---
|
|
324
366
|
|
|
325
|
-
## 📚
|
|
326
|
-
|
|
327
|
-
- [Architecture](docs/architecture.md) - System design and components
|
|
328
|
-
- [API Reference](docs/api-reference.md) - Full API documentation
|
|
329
|
-
- [Troubleshooting](docs/troubleshooting.md) - Common issues
|
|
367
|
+
## 📚 Changelog
|
|
330
368
|
|
|
331
|
-
|
|
369
|
+
### v0.7.7
|
|
370
|
+
- Multi-target management (`/target add/list/rm/clear`)
|
|
371
|
+
- Batch attack (`/start all`)
|
|
372
|
+
- `set_target` tool for agent
|
|
332
373
|
|
|
333
|
-
|
|
374
|
+
### v0.7.6
|
|
375
|
+
- ESC interrupt improvements
|
|
376
|
+
- UI state sync for findings/creds/phase
|
|
334
377
|
|
|
335
|
-
|
|
378
|
+
### v0.7.5
|
|
379
|
+
- `set_target` tool integration
|
|
380
|
+
- `forceUpdate` mechanism for React state
|
|
336
381
|
|
|
337
|
-
|
|
382
|
+
### v0.7.4
|
|
383
|
+
- Removed all legal/permission prompts
|
|
384
|
+
- Auto-target detection from user input
|
|
338
385
|
|
|
339
386
|
---
|
|
340
387
|
|
package/dist/index.js
CHANGED
|
@@ -7307,10 +7307,10 @@ ${list}`);
|
|
|
7307
7307
|
exit();
|
|
7308
7308
|
}
|
|
7309
7309
|
}
|
|
7310
|
-
if (key.
|
|
7310
|
+
if (key.tab) {
|
|
7311
7311
|
const newMode = mode === "agent" ? "shell" : "agent";
|
|
7312
7312
|
setMode(newMode);
|
|
7313
|
-
addMessage(MESSAGE_TYPE.SYSTEM, `Mode: ${newMode === "agent" ? "
|
|
7313
|
+
addMessage(MESSAGE_TYPE.SYSTEM, `Mode: ${newMode === "agent" ? "Agent" : "Shell"}`);
|
|
7314
7314
|
}
|
|
7315
7315
|
});
|
|
7316
7316
|
const getStyle = (type) => {
|
|
@@ -7409,26 +7409,15 @@ ${list}`);
|
|
|
7409
7409
|
] }),
|
|
7410
7410
|
/* @__PURE__ */ jsxs2(Box2, { marginTop: 1, justifyContent: "space-between", children: [
|
|
7411
7411
|
/* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
7412
|
-
mode === "agent" ? "\u{1F916}" : "$",
|
|
7413
|
-
" ",
|
|
7414
7412
|
state.target.primary || "No target",
|
|
7415
7413
|
state.target.discovered.length > 1 && ` (+${state.target.discovered.length - 1})`,
|
|
7416
|
-
|
|
7417
|
-
state.
|
|
7418
|
-
" findings \u2502",
|
|
7419
|
-
state.credentials.length,
|
|
7420
|
-
" creds \u2502",
|
|
7421
|
-
`${(tokenUsage.total / 1e3).toFixed(1)}k tokens`,
|
|
7422
|
-
" \u2502",
|
|
7423
|
-
state.currentPhase !== AGENT_STATUS.IDLE && ` ${state.currentPhase} \u2502`
|
|
7414
|
+
state.findings.length > 0 && ` \u2502 ${state.findings.length} findings`,
|
|
7415
|
+
state.credentials.length > 0 && ` \u2502 ${state.credentials.length} creds`
|
|
7424
7416
|
] }),
|
|
7425
7417
|
/* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
7418
|
+
isProcessing && "ESC \u2502 ",
|
|
7426
7419
|
"v",
|
|
7427
|
-
APP_VERSION
|
|
7428
|
-
" \u2502 Ctrl+X mode \u2502 /help \u2502 ",
|
|
7429
|
-
isProcessing ? "ESC interrupt \u2502 " : "",
|
|
7430
|
-
"Ctrl+C ",
|
|
7431
|
-
isProcessing ? "stop" : "exit"
|
|
7420
|
+
APP_VERSION
|
|
7432
7421
|
] })
|
|
7433
7422
|
] })
|
|
7434
7423
|
] });
|