pentesting 0.1.10 → 0.1.12
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/dist/index.js +181 -127
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -200,10 +200,139 @@ Analyze your situation honestly:
|
|
|
200
200
|
|
|
201
201
|
Based on this reflection, propose 3 completely different approaches to try next.`;
|
|
202
202
|
|
|
203
|
+
// src/config/agent-constants.ts
|
|
204
|
+
var AGENT_STATUS = {
|
|
205
|
+
IDLE: "idle",
|
|
206
|
+
RUNNING: "running",
|
|
207
|
+
PAUSED: "paused",
|
|
208
|
+
STUCK: "stuck",
|
|
209
|
+
WAITING_INPUT: "waiting_input",
|
|
210
|
+
COMPLETED: "completed"
|
|
211
|
+
};
|
|
212
|
+
var PHASE_ID = {
|
|
213
|
+
RECON: "recon",
|
|
214
|
+
SCAN: "scan",
|
|
215
|
+
ENUM: "enum",
|
|
216
|
+
VULN: "vuln",
|
|
217
|
+
EXPLOIT: "exploit",
|
|
218
|
+
PRIVESC: "privesc",
|
|
219
|
+
PIVOT: "pivot",
|
|
220
|
+
PERSIST: "persist",
|
|
221
|
+
EXFIL: "exfil",
|
|
222
|
+
REPORT: "report"
|
|
223
|
+
};
|
|
224
|
+
var PHASE_STATUS = {
|
|
225
|
+
PENDING: "pending",
|
|
226
|
+
IN_PROGRESS: "in_progress",
|
|
227
|
+
COMPLETED: "completed",
|
|
228
|
+
FAILED: "failed",
|
|
229
|
+
SKIPPED: "skipped"
|
|
230
|
+
};
|
|
231
|
+
var THOUGHT_TYPE = {
|
|
232
|
+
OBSERVATION: "observation",
|
|
233
|
+
HYPOTHESIS: "hypothesis",
|
|
234
|
+
PLAN: "plan",
|
|
235
|
+
ACTION: "action",
|
|
236
|
+
RESULT: "result",
|
|
237
|
+
REFLECTION: "reflection",
|
|
238
|
+
STUCK: "stuck",
|
|
239
|
+
BREAKTHROUGH: "breakthrough"
|
|
240
|
+
};
|
|
241
|
+
var AGENT_EVENT = {
|
|
242
|
+
// Lifecycle
|
|
243
|
+
PLUGINS_LOADED: "plugins_loaded",
|
|
244
|
+
HOOKS_LOADED: "hooks_loaded",
|
|
245
|
+
COMMANDS_LOADED: "commands_loaded",
|
|
246
|
+
MCP_SERVER_ADDED: "mcp_server_added",
|
|
247
|
+
// Execution
|
|
248
|
+
ITERATION: "iteration",
|
|
249
|
+
THOUGHT: "thought",
|
|
250
|
+
RESPONSE: "response",
|
|
251
|
+
TOOL_CALL: "tool_call",
|
|
252
|
+
TOOL_RESULT: "tool_result",
|
|
253
|
+
COMMAND_EXECUTE: "command_execute",
|
|
254
|
+
// State changes
|
|
255
|
+
TARGET_SET: "target_set",
|
|
256
|
+
PHASE_CHANGE: "phase_change",
|
|
257
|
+
AGENT_SWITCH: "agent_switch",
|
|
258
|
+
PAUSED: "paused",
|
|
259
|
+
RESUMED: "resumed",
|
|
260
|
+
RESET: "reset",
|
|
261
|
+
// Discoveries
|
|
262
|
+
FINDING: "finding",
|
|
263
|
+
CREDENTIAL: "credential",
|
|
264
|
+
COMPROMISED: "compromised",
|
|
265
|
+
// Completion
|
|
266
|
+
COMPLETE: "complete",
|
|
267
|
+
REPORT: "report",
|
|
268
|
+
ERROR: "error",
|
|
269
|
+
HINT_RECEIVED: "hint_received"
|
|
270
|
+
};
|
|
271
|
+
var CLI_COMMAND = {
|
|
272
|
+
HELP: "help",
|
|
273
|
+
TARGET: "target",
|
|
274
|
+
START: "start",
|
|
275
|
+
STOP: "stop",
|
|
276
|
+
FINDINGS: "findings",
|
|
277
|
+
CLEAR: "clear",
|
|
278
|
+
EXIT: "exit"
|
|
279
|
+
};
|
|
280
|
+
var MESSAGE_TYPE = {
|
|
281
|
+
USER: "user",
|
|
282
|
+
ASSISTANT: "assistant",
|
|
283
|
+
TOOL: "tool",
|
|
284
|
+
THINKING: "thinking",
|
|
285
|
+
ERROR: "error",
|
|
286
|
+
SYSTEM: "system",
|
|
287
|
+
RESULT: "result"
|
|
288
|
+
};
|
|
289
|
+
var TOOL_NAME = {
|
|
290
|
+
// System
|
|
291
|
+
BASH: "bash",
|
|
292
|
+
READ_FILE: "read_file",
|
|
293
|
+
WRITE_FILE: "write_file",
|
|
294
|
+
LIST_DIRECTORY: "list_directory",
|
|
295
|
+
// Network
|
|
296
|
+
NMAP_SCAN: "nmap_scan",
|
|
297
|
+
TCPDUMP_CAPTURE: "tcpdump_capture",
|
|
298
|
+
// Web
|
|
299
|
+
WEB_REQUEST: "web_request",
|
|
300
|
+
DIRECTORY_BRUTEFORCE: "directory_bruteforce",
|
|
301
|
+
SQL_INJECTION: "sql_injection",
|
|
302
|
+
BROWSER_AUTOMATION: "browser_automation",
|
|
303
|
+
// Exploit
|
|
304
|
+
SEARCHSPLOIT: "searchsploit",
|
|
305
|
+
METASPLOIT: "metasploit",
|
|
306
|
+
GENERATE_PAYLOAD: "generate_payload",
|
|
307
|
+
// Credential
|
|
308
|
+
BRUTEFORCE_LOGIN: "bruteforce_login",
|
|
309
|
+
CRACK_HASH: "crack_hash",
|
|
310
|
+
DUMP_CREDENTIALS: "dump_credentials",
|
|
311
|
+
// Privilege Escalation
|
|
312
|
+
CHECK_SUDO: "check_sudo",
|
|
313
|
+
FIND_SUID: "find_suid",
|
|
314
|
+
RUN_PRIVESC_ENUM: "run_privesc_enum",
|
|
315
|
+
// Post-Exploitation
|
|
316
|
+
SETUP_TUNNEL: "setup_tunnel",
|
|
317
|
+
LATERAL_MOVEMENT: "lateral_movement",
|
|
318
|
+
// Reporting
|
|
319
|
+
REPORT_FINDING: "report_finding",
|
|
320
|
+
TAKE_SCREENSHOT: "take_screenshot"
|
|
321
|
+
};
|
|
322
|
+
var SENSITIVE_TOOLS = [
|
|
323
|
+
TOOL_NAME.WRITE_FILE,
|
|
324
|
+
TOOL_NAME.BRUTEFORCE_LOGIN,
|
|
325
|
+
TOOL_NAME.METASPLOIT,
|
|
326
|
+
TOOL_NAME.SQL_INJECTION,
|
|
327
|
+
TOOL_NAME.DUMP_CREDENTIALS,
|
|
328
|
+
TOOL_NAME.GENERATE_PAYLOAD,
|
|
329
|
+
TOOL_NAME.LATERAL_MOVEMENT
|
|
330
|
+
];
|
|
331
|
+
|
|
203
332
|
// src/core/tools/tool-definitions.ts
|
|
204
333
|
var SYSTEM_TOOLS = [
|
|
205
334
|
{
|
|
206
|
-
name:
|
|
335
|
+
name: TOOL_NAME.BASH,
|
|
207
336
|
description: `Execute any bash command. This is your primary tool for interacting with the system.
|
|
208
337
|
|
|
209
338
|
IMPORTANT:
|
|
@@ -224,7 +353,7 @@ IMPORTANT:
|
|
|
224
353
|
}
|
|
225
354
|
},
|
|
226
355
|
{
|
|
227
|
-
name:
|
|
356
|
+
name: TOOL_NAME.READ_FILE,
|
|
228
357
|
description: "Read file contents. Use for configs, source code, logs, data files.",
|
|
229
358
|
input_schema: {
|
|
230
359
|
type: "object",
|
|
@@ -237,7 +366,7 @@ IMPORTANT:
|
|
|
237
366
|
}
|
|
238
367
|
},
|
|
239
368
|
{
|
|
240
|
-
name:
|
|
369
|
+
name: TOOL_NAME.WRITE_FILE,
|
|
241
370
|
description: "Write content to file. Use for scripts, payloads, configs, reports.",
|
|
242
371
|
input_schema: {
|
|
243
372
|
type: "object",
|
|
@@ -250,7 +379,7 @@ IMPORTANT:
|
|
|
250
379
|
}
|
|
251
380
|
},
|
|
252
381
|
{
|
|
253
|
-
name:
|
|
382
|
+
name: TOOL_NAME.LIST_DIRECTORY,
|
|
254
383
|
description: "List directory contents with file details.",
|
|
255
384
|
input_schema: {
|
|
256
385
|
type: "object",
|
|
@@ -265,7 +394,7 @@ IMPORTANT:
|
|
|
265
394
|
];
|
|
266
395
|
var NETWORK_TOOLS = [
|
|
267
396
|
{
|
|
268
|
-
name:
|
|
397
|
+
name: TOOL_NAME.NMAP_SCAN,
|
|
269
398
|
description: `Network scanning with nmap.
|
|
270
399
|
|
|
271
400
|
SCAN TYPES:
|
|
@@ -294,7 +423,7 @@ SCAN TYPES:
|
|
|
294
423
|
}
|
|
295
424
|
},
|
|
296
425
|
{
|
|
297
|
-
name:
|
|
426
|
+
name: TOOL_NAME.TCPDUMP_CAPTURE,
|
|
298
427
|
description: `Capture network traffic with tcpdump.
|
|
299
428
|
|
|
300
429
|
Use for:
|
|
@@ -317,7 +446,7 @@ Use for:
|
|
|
317
446
|
];
|
|
318
447
|
var WEB_TOOLS = [
|
|
319
448
|
{
|
|
320
|
-
name:
|
|
449
|
+
name: TOOL_NAME.WEB_REQUEST,
|
|
321
450
|
description: `Make HTTP requests with full control. Use curl under the hood.
|
|
322
451
|
|
|
323
452
|
Use for:
|
|
@@ -340,7 +469,7 @@ Use for:
|
|
|
340
469
|
}
|
|
341
470
|
},
|
|
342
471
|
{
|
|
343
|
-
name:
|
|
472
|
+
name: TOOL_NAME.DIRECTORY_BRUTEFORCE,
|
|
344
473
|
description: `Directory/file bruteforcing with gobuster or ffuf.
|
|
345
474
|
|
|
346
475
|
MODES:
|
|
@@ -361,7 +490,7 @@ MODES:
|
|
|
361
490
|
}
|
|
362
491
|
},
|
|
363
492
|
{
|
|
364
|
-
name:
|
|
493
|
+
name: TOOL_NAME.SQL_INJECTION,
|
|
365
494
|
description: `SQL injection testing with sqlmap.
|
|
366
495
|
|
|
367
496
|
Automatically:
|
|
@@ -384,7 +513,7 @@ Automatically:
|
|
|
384
513
|
}
|
|
385
514
|
},
|
|
386
515
|
{
|
|
387
|
-
name:
|
|
516
|
+
name: TOOL_NAME.BROWSER_AUTOMATION,
|
|
388
517
|
description: `Headless browser automation with Playwright.
|
|
389
518
|
|
|
390
519
|
Use for:
|
|
@@ -413,7 +542,7 @@ Use for:
|
|
|
413
542
|
];
|
|
414
543
|
var EXPLOIT_TOOLS = [
|
|
415
544
|
{
|
|
416
|
-
name:
|
|
545
|
+
name: TOOL_NAME.SEARCHSPLOIT,
|
|
417
546
|
description: "Search Exploit-DB for exploits matching service/version.",
|
|
418
547
|
input_schema: {
|
|
419
548
|
type: "object",
|
|
@@ -427,7 +556,7 @@ var EXPLOIT_TOOLS = [
|
|
|
427
556
|
}
|
|
428
557
|
},
|
|
429
558
|
{
|
|
430
|
-
name:
|
|
559
|
+
name: TOOL_NAME.METASPLOIT,
|
|
431
560
|
description: `Execute Metasploit commands.
|
|
432
561
|
|
|
433
562
|
Use for:
|
|
@@ -444,7 +573,7 @@ Use for:
|
|
|
444
573
|
}
|
|
445
574
|
},
|
|
446
575
|
{
|
|
447
|
-
name:
|
|
576
|
+
name: TOOL_NAME.GENERATE_PAYLOAD,
|
|
448
577
|
description: `Generate custom payloads with msfvenom.
|
|
449
578
|
|
|
450
579
|
PAYLOAD TYPES:
|
|
@@ -469,7 +598,7 @@ PAYLOAD TYPES:
|
|
|
469
598
|
];
|
|
470
599
|
var CREDENTIAL_TOOLS = [
|
|
471
600
|
{
|
|
472
|
-
name:
|
|
601
|
+
name: TOOL_NAME.BRUTEFORCE_LOGIN,
|
|
473
602
|
description: `Password bruteforce attack with hydra.
|
|
474
603
|
|
|
475
604
|
SERVICES: ssh, ftp, telnet, http-get, http-post-form, smb, rdp, mysql, mssql, vnc`,
|
|
@@ -488,7 +617,7 @@ SERVICES: ssh, ftp, telnet, http-get, http-post-form, smb, rdp, mysql, mssql, vn
|
|
|
488
617
|
}
|
|
489
618
|
},
|
|
490
619
|
{
|
|
491
|
-
name:
|
|
620
|
+
name: TOOL_NAME.CRACK_HASH,
|
|
492
621
|
description: `Crack password hashes with john or hashcat.
|
|
493
622
|
|
|
494
623
|
HASH MODES (hashcat):
|
|
@@ -513,7 +642,7 @@ HASH MODES (hashcat):
|
|
|
513
642
|
];
|
|
514
643
|
var PRIVESC_TOOLS = [
|
|
515
644
|
{
|
|
516
|
-
name:
|
|
645
|
+
name: TOOL_NAME.RUN_PRIVESC_ENUM,
|
|
517
646
|
description: `Run privilege escalation enumeration scripts.
|
|
518
647
|
|
|
519
648
|
SCRIPTS:
|
|
@@ -532,7 +661,7 @@ SCRIPTS:
|
|
|
532
661
|
}
|
|
533
662
|
},
|
|
534
663
|
{
|
|
535
|
-
name:
|
|
664
|
+
name: TOOL_NAME.CHECK_SUDO,
|
|
536
665
|
description: "Check sudo permissions and potential escalation paths.",
|
|
537
666
|
input_schema: {
|
|
538
667
|
type: "object",
|
|
@@ -542,7 +671,7 @@ SCRIPTS:
|
|
|
542
671
|
}
|
|
543
672
|
},
|
|
544
673
|
{
|
|
545
|
-
name:
|
|
674
|
+
name: TOOL_NAME.FIND_SUID,
|
|
546
675
|
description: "Find SUID/SGID binaries and check for escalation.",
|
|
547
676
|
input_schema: {
|
|
548
677
|
type: "object",
|
|
@@ -554,7 +683,7 @@ SCRIPTS:
|
|
|
554
683
|
];
|
|
555
684
|
var POST_EXPLOIT_TOOLS = [
|
|
556
685
|
{
|
|
557
|
-
name:
|
|
686
|
+
name: TOOL_NAME.SETUP_TUNNEL,
|
|
558
687
|
description: `Set up network tunneling for pivoting.
|
|
559
688
|
|
|
560
689
|
TOOLS:
|
|
@@ -574,7 +703,7 @@ TOOLS:
|
|
|
574
703
|
}
|
|
575
704
|
},
|
|
576
705
|
{
|
|
577
|
-
name:
|
|
706
|
+
name: TOOL_NAME.DUMP_CREDENTIALS,
|
|
578
707
|
description: `Extract credentials from compromised system.
|
|
579
708
|
|
|
580
709
|
METHODS:
|
|
@@ -593,7 +722,7 @@ METHODS:
|
|
|
593
722
|
}
|
|
594
723
|
},
|
|
595
724
|
{
|
|
596
|
-
name:
|
|
725
|
+
name: TOOL_NAME.LATERAL_MOVEMENT,
|
|
597
726
|
description: `Move laterally to other systems.
|
|
598
727
|
|
|
599
728
|
METHODS:
|
|
@@ -617,7 +746,7 @@ METHODS:
|
|
|
617
746
|
];
|
|
618
747
|
var REPORT_TOOLS = [
|
|
619
748
|
{
|
|
620
|
-
name:
|
|
749
|
+
name: TOOL_NAME.REPORT_FINDING,
|
|
621
750
|
description: "Document a security finding with proper categorization.",
|
|
622
751
|
input_schema: {
|
|
623
752
|
type: "object",
|
|
@@ -635,7 +764,7 @@ var REPORT_TOOLS = [
|
|
|
635
764
|
}
|
|
636
765
|
},
|
|
637
766
|
{
|
|
638
|
-
name:
|
|
767
|
+
name: TOOL_NAME.TAKE_SCREENSHOT,
|
|
639
768
|
description: "Capture evidence screenshot of terminal or browser.",
|
|
640
769
|
input_schema: {
|
|
641
770
|
type: "object",
|
|
@@ -1252,13 +1381,25 @@ var AGENT_CONFIG = {
|
|
|
1252
1381
|
maxIterations: 200,
|
|
1253
1382
|
maxToolCallsPerIteration: 10,
|
|
1254
1383
|
autoApprove: false,
|
|
1255
|
-
sensitiveTools:
|
|
1384
|
+
sensitiveTools: SENSITIVE_TOOLS,
|
|
1256
1385
|
defaultTimeout: 6e4,
|
|
1257
1386
|
longRunningTimeout: 6e5,
|
|
1258
1387
|
stuckThreshold: 5,
|
|
1259
1388
|
stuckTimeThreshold: 3e5,
|
|
1260
1389
|
maxPhaseAttempts: 20
|
|
1261
1390
|
};
|
|
1391
|
+
var PENTEST_PHASES = [
|
|
1392
|
+
{ id: PHASE_ID.RECON, name: "Reconnaissance", description: "Information gathering" },
|
|
1393
|
+
{ id: PHASE_ID.SCAN, name: "Scanning", description: "Port and service scanning" },
|
|
1394
|
+
{ id: PHASE_ID.ENUM, name: "Enumeration", description: "Deep service enumeration" },
|
|
1395
|
+
{ id: PHASE_ID.VULN, name: "Vulnerability Analysis", description: "Vulnerability identification" },
|
|
1396
|
+
{ id: PHASE_ID.EXPLOIT, name: "Exploitation", description: "Gaining access" },
|
|
1397
|
+
{ id: PHASE_ID.PRIVESC, name: "Privilege Escalation", description: "Elevating privileges" },
|
|
1398
|
+
{ id: PHASE_ID.PIVOT, name: "Pivoting", description: "Lateral movement" },
|
|
1399
|
+
{ id: PHASE_ID.PERSIST, name: "Persistence", description: "Maintaining access" },
|
|
1400
|
+
{ id: PHASE_ID.EXFIL, name: "Data Exfiltration", description: "Data extraction" },
|
|
1401
|
+
{ id: PHASE_ID.REPORT, name: "Reporting", description: "Documentation" }
|
|
1402
|
+
];
|
|
1262
1403
|
|
|
1263
1404
|
// src/core/agent/agent-loader.ts
|
|
1264
1405
|
import * as fs2 from "fs/promises";
|
|
@@ -1840,93 +1981,6 @@ async function searchExploits(query) {
|
|
|
1840
1981
|
return searchDuckDuckGo(`${query} site:exploit-db.com OR site:github.com exploit`);
|
|
1841
1982
|
}
|
|
1842
1983
|
|
|
1843
|
-
// src/config/agent-constants.ts
|
|
1844
|
-
var AGENT_STATUS = {
|
|
1845
|
-
IDLE: "idle",
|
|
1846
|
-
RUNNING: "running",
|
|
1847
|
-
PAUSED: "paused",
|
|
1848
|
-
STUCK: "stuck",
|
|
1849
|
-
WAITING_INPUT: "waiting_input",
|
|
1850
|
-
COMPLETED: "completed"
|
|
1851
|
-
};
|
|
1852
|
-
var PHASE_ID = {
|
|
1853
|
-
RECON: "recon",
|
|
1854
|
-
SCAN: "scan",
|
|
1855
|
-
ENUM: "enum",
|
|
1856
|
-
VULN: "vuln",
|
|
1857
|
-
EXPLOIT: "exploit",
|
|
1858
|
-
PRIVESC: "privesc",
|
|
1859
|
-
PIVOT: "pivot",
|
|
1860
|
-
PERSIST: "persist",
|
|
1861
|
-
EXFIL: "exfil",
|
|
1862
|
-
REPORT: "report"
|
|
1863
|
-
};
|
|
1864
|
-
var PHASE_STATUS = {
|
|
1865
|
-
PENDING: "pending",
|
|
1866
|
-
IN_PROGRESS: "in_progress",
|
|
1867
|
-
COMPLETED: "completed",
|
|
1868
|
-
FAILED: "failed",
|
|
1869
|
-
SKIPPED: "skipped"
|
|
1870
|
-
};
|
|
1871
|
-
var THOUGHT_TYPE = {
|
|
1872
|
-
OBSERVATION: "observation",
|
|
1873
|
-
HYPOTHESIS: "hypothesis",
|
|
1874
|
-
PLAN: "plan",
|
|
1875
|
-
ACTION: "action",
|
|
1876
|
-
RESULT: "result",
|
|
1877
|
-
REFLECTION: "reflection",
|
|
1878
|
-
STUCK: "stuck",
|
|
1879
|
-
BREAKTHROUGH: "breakthrough"
|
|
1880
|
-
};
|
|
1881
|
-
var AGENT_EVENT = {
|
|
1882
|
-
// Lifecycle
|
|
1883
|
-
PLUGINS_LOADED: "plugins_loaded",
|
|
1884
|
-
HOOKS_LOADED: "hooks_loaded",
|
|
1885
|
-
COMMANDS_LOADED: "commands_loaded",
|
|
1886
|
-
MCP_SERVER_ADDED: "mcp_server_added",
|
|
1887
|
-
// Execution
|
|
1888
|
-
ITERATION: "iteration",
|
|
1889
|
-
THOUGHT: "thought",
|
|
1890
|
-
RESPONSE: "response",
|
|
1891
|
-
TOOL_CALL: "tool_call",
|
|
1892
|
-
TOOL_RESULT: "tool_result",
|
|
1893
|
-
COMMAND_EXECUTE: "command_execute",
|
|
1894
|
-
// State changes
|
|
1895
|
-
TARGET_SET: "target_set",
|
|
1896
|
-
PHASE_CHANGE: "phase_change",
|
|
1897
|
-
AGENT_SWITCH: "agent_switch",
|
|
1898
|
-
PAUSED: "paused",
|
|
1899
|
-
RESUMED: "resumed",
|
|
1900
|
-
RESET: "reset",
|
|
1901
|
-
// Discoveries
|
|
1902
|
-
FINDING: "finding",
|
|
1903
|
-
CREDENTIAL: "credential",
|
|
1904
|
-
COMPROMISED: "compromised",
|
|
1905
|
-
// Completion
|
|
1906
|
-
COMPLETE: "complete",
|
|
1907
|
-
REPORT: "report",
|
|
1908
|
-
ERROR: "error",
|
|
1909
|
-
HINT_RECEIVED: "hint_received"
|
|
1910
|
-
};
|
|
1911
|
-
var CLI_COMMAND = {
|
|
1912
|
-
HELP: "help",
|
|
1913
|
-
TARGET: "target",
|
|
1914
|
-
START: "start",
|
|
1915
|
-
STOP: "stop",
|
|
1916
|
-
FINDINGS: "findings",
|
|
1917
|
-
CLEAR: "clear",
|
|
1918
|
-
EXIT: "exit"
|
|
1919
|
-
};
|
|
1920
|
-
var MESSAGE_TYPE = {
|
|
1921
|
-
USER: "user",
|
|
1922
|
-
ASSISTANT: "assistant",
|
|
1923
|
-
TOOL: "tool",
|
|
1924
|
-
THINKING: "thinking",
|
|
1925
|
-
ERROR: "error",
|
|
1926
|
-
SYSTEM: "system",
|
|
1927
|
-
RESULT: "result"
|
|
1928
|
-
};
|
|
1929
|
-
|
|
1930
1984
|
// src/core/agent/autonomous-agent.ts
|
|
1931
1985
|
function toContentBlockParam(block) {
|
|
1932
1986
|
switch (block.type) {
|
|
@@ -1963,16 +2017,16 @@ function toMessageParam(msg) {
|
|
|
1963
2017
|
};
|
|
1964
2018
|
}
|
|
1965
2019
|
var DEFAULT_PHASES = [
|
|
1966
|
-
{ id:
|
|
1967
|
-
{ id:
|
|
1968
|
-
{ id:
|
|
1969
|
-
{ id:
|
|
1970
|
-
{ id:
|
|
1971
|
-
{ id:
|
|
1972
|
-
{ id:
|
|
1973
|
-
{ id:
|
|
1974
|
-
{ id:
|
|
1975
|
-
{ id:
|
|
2020
|
+
{ id: PHASE_ID.RECON, name: "Reconnaissance", shortName: "Recon", status: PHASE_STATUS.PENDING, attempts: 0 },
|
|
2021
|
+
{ id: PHASE_ID.SCAN, name: "Scanning", shortName: "Scan", status: PHASE_STATUS.PENDING, attempts: 0 },
|
|
2022
|
+
{ id: PHASE_ID.ENUM, name: "Enumeration", shortName: "Enum", status: PHASE_STATUS.PENDING, attempts: 0 },
|
|
2023
|
+
{ id: PHASE_ID.VULN, name: "Vulnerability Analysis", shortName: "Vuln", status: PHASE_STATUS.PENDING, attempts: 0 },
|
|
2024
|
+
{ id: PHASE_ID.EXPLOIT, name: "Exploitation", shortName: "Exploit", status: PHASE_STATUS.PENDING, attempts: 0 },
|
|
2025
|
+
{ id: PHASE_ID.PRIVESC, name: "Privilege Escalation", shortName: "PrivEsc", status: PHASE_STATUS.PENDING, attempts: 0 },
|
|
2026
|
+
{ id: PHASE_ID.PIVOT, name: "Pivoting", shortName: "Pivot", status: PHASE_STATUS.PENDING, attempts: 0 },
|
|
2027
|
+
{ id: PHASE_ID.PERSIST, name: "Persistence", shortName: "Persist", status: PHASE_STATUS.PENDING, attempts: 0 },
|
|
2028
|
+
{ id: PHASE_ID.EXFIL, name: "Data Exfiltration", shortName: "Exfil", status: PHASE_STATUS.PENDING, attempts: 0 },
|
|
2029
|
+
{ id: PHASE_ID.REPORT, name: "Reporting", shortName: "Report", status: PHASE_STATUS.PENDING, attempts: 0 }
|
|
1976
2030
|
];
|
|
1977
2031
|
var AutonomousHackingAgent = class extends EventEmitter3 {
|
|
1978
2032
|
client;
|
|
@@ -2136,7 +2190,7 @@ ${await this.commandRegistry.getHelp()}`;
|
|
|
2136
2190
|
if (phase) {
|
|
2137
2191
|
const oldStatus = phase.status;
|
|
2138
2192
|
phase.status = status;
|
|
2139
|
-
if (status ===
|
|
2193
|
+
if (status === PHASE_STATUS.IN_PROGRESS && !phase.startTime) {
|
|
2140
2194
|
phase.startTime = /* @__PURE__ */ new Date();
|
|
2141
2195
|
} else if ((status === PHASE_STATUS.COMPLETED || status === PHASE_STATUS.FAILED) && !phase.endTime) {
|
|
2142
2196
|
phase.endTime = /* @__PURE__ */ new Date();
|
|
@@ -2151,7 +2205,7 @@ ${await this.commandRegistry.getHelp()}`;
|
|
|
2151
2205
|
const nextPhase = this.state.phases[currentIndex + 1];
|
|
2152
2206
|
this.setPhaseStatus(this.state.currentPhase, PHASE_STATUS.COMPLETED);
|
|
2153
2207
|
this.state.currentPhase = nextPhase.id;
|
|
2154
|
-
this.setPhaseStatus(nextPhase.id,
|
|
2208
|
+
this.setPhaseStatus(nextPhase.id, PHASE_STATUS.IN_PROGRESS);
|
|
2155
2209
|
this.think(THOUGHT_TYPE.PLAN, `Advancing to next phase: ${nextPhase.shortName}`);
|
|
2156
2210
|
this.resetStuckCounter();
|
|
2157
2211
|
return true;
|
|
@@ -2269,7 +2323,7 @@ What went wrong and what different approach should be tried?
|
|
|
2269
2323
|
return;
|
|
2270
2324
|
}
|
|
2271
2325
|
this.state.status = AGENT_STATUS.RUNNING;
|
|
2272
|
-
this.setPhaseStatus(
|
|
2326
|
+
this.setPhaseStatus(PHASE_ID.RECON, PHASE_STATUS.IN_PROGRESS);
|
|
2273
2327
|
const mainObjective = objective || `
|
|
2274
2328
|
Target ${this.state.target.primary} - performing full penetration test.
|
|
2275
2329
|
Goal: Deep penetration to obtain root/system privileges, extract internal data, map entire network.
|
|
@@ -2293,7 +2347,7 @@ Goal: Deep penetration to obtain root/system privileges, extract internal data,
|
|
|
2293
2347
|
const reflection = await this.performSelfReflection();
|
|
2294
2348
|
const shouldSkip = await this.decideNextAction(reflection);
|
|
2295
2349
|
if (shouldSkip) {
|
|
2296
|
-
this.setPhaseStatus(this.state.currentPhase,
|
|
2350
|
+
this.setPhaseStatus(this.state.currentPhase, PHASE_STATUS.SKIPPED);
|
|
2297
2351
|
if (!this.advanceToNextPhase()) {
|
|
2298
2352
|
this.think(THOUGHT_TYPE.OBSERVATION, "All phases completed or skipped");
|
|
2299
2353
|
break;
|
|
@@ -2527,7 +2581,7 @@ Use report_finding tool for important discoveries.
|
|
|
2527
2581
|
}
|
|
2528
2582
|
// ===== Final Report Generation =====
|
|
2529
2583
|
async generateFinalReport() {
|
|
2530
|
-
this.setPhaseStatus(
|
|
2584
|
+
this.setPhaseStatus(PHASE_ID.REPORT, PHASE_STATUS.IN_PROGRESS);
|
|
2531
2585
|
const report = `
|
|
2532
2586
|
# Penetration Test Report
|
|
2533
2587
|
## Executive Summary
|
|
@@ -2929,7 +2983,7 @@ var App = ({ autoApprove = false, target }) => {
|
|
|
2929
2983
|
" \u2502",
|
|
2930
2984
|
state.findings.length,
|
|
2931
2985
|
" findings \u2502",
|
|
2932
|
-
state.currentPhase !==
|
|
2986
|
+
state.currentPhase !== AGENT_STATUS.IDLE && ` ${state.currentPhase} \u2502`
|
|
2933
2987
|
] }),
|
|
2934
2988
|
/* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
|
|
2935
2989
|
"/help \u2502 Ctrl+C ",
|