pentesting 0.1.10 → 0.1.11

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.
Files changed (2) hide show
  1. package/dist/index.js +165 -111
  2. 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: "bash",
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: "read_file",
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: "write_file",
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: "list_directory",
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: "nmap_scan",
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: "tcpdump_capture",
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: "web_request",
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: "directory_bruteforce",
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: "sql_injection",
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: "browser_automation",
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: "searchsploit",
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: "metasploit",
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: "generate_payload",
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: "bruteforce_login",
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: "crack_hash",
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: "run_privesc_enum",
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: "check_sudo",
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: "find_suid",
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: "setup_tunnel",
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: "dump_credentials",
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: "lateral_movement",
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: "report_finding",
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: "take_screenshot",
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: ["credential_attack", "write_file", "metasploit", "generate_payload"],
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pentesting",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Autonomous Penetration Testing AI Agent",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",