pentesting 0.55.0 → 0.55.1

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/main.js +152 -136
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -342,7 +342,7 @@ var ORPHAN_PROCESS_NAMES = [
342
342
 
343
343
  // src/shared/constants/agent.ts
344
344
  var APP_NAME = "Pentest AI";
345
- var APP_VERSION = "0.55.0";
345
+ var APP_VERSION = "0.55.1";
346
346
  var APP_DESCRIPTION = "Autonomous Penetration Testing AI Agent";
347
347
  var LLM_ROLES = {
348
348
  SYSTEM: "system",
@@ -4940,19 +4940,145 @@ var CHALLENGE_TYPE_SIGNALS = {
4940
4940
  ]
4941
4941
  };
4942
4942
 
4943
+ // src/shared/constants/prompts.ts
4944
+ var PROMPT_PATHS = {
4945
+ BASE: "base.md",
4946
+ OFFENSIVE_PLAYBOOK: "offensive-playbook.md",
4947
+ AGENT_FILES: {
4948
+ ORCHESTRATOR: "orchestrator.md",
4949
+ RECON: "recon.md",
4950
+ VULN: "vuln.md",
4951
+ WEB: "web.md",
4952
+ EXPLOIT: "exploit.md",
4953
+ POST: "post.md",
4954
+ REPORT: "report.md",
4955
+ INFRA: "infra.md",
4956
+ // Strategic methodology (always loaded as reference)
4957
+ STRATEGY: "strategy.md",
4958
+ EVASION: "evasion.md",
4959
+ ZERO_DAY: "zero-day.md",
4960
+ PAYLOAD_CRAFT: "payload-craft.md"
4961
+ },
4962
+ /** Technique reference library directory */
4963
+ TECHNIQUES_DIR: "techniques"
4964
+ };
4965
+ var TECHNIQUE_FILES = {
4966
+ INJECTION: "injection",
4967
+ PRIVESC: "privesc",
4968
+ LATERAL: "lateral",
4969
+ AD_ATTACK: "ad-attack",
4970
+ AUTH_ACCESS: "auth-access",
4971
+ CONTAINER_ESCAPE: "container-escape",
4972
+ SANDBOX_ESCAPE: "sandbox-escape",
4973
+ FILE_ATTACKS: "file-attacks",
4974
+ NETWORK_SVC: "network-svc",
4975
+ CRYPTO: "crypto",
4976
+ REVERSING: "reversing",
4977
+ FORENSICS: "forensics",
4978
+ PWN: "pwn",
4979
+ SHELLS: "shells"
4980
+ };
4981
+ var PROMPT_XML = {
4982
+ PHASE: (phase, content) => `<phase-instructions phase="${phase}">
4983
+ ${content}
4984
+ </phase-instructions>`,
4985
+ SCOPE: (allowed, domains, exclude, flags) => `<scope type="ABSOLUTE_CONSTRAINT">
4986
+ Authorized CIDR: ${allowed}
4987
+ Authorized Domains: ${domains}
4988
+ Exclusions: ${exclude}
4989
+ Constraints: ${flags}
4990
+ </scope>`,
4991
+ STATE: (content) => `<current-state>
4992
+ ${content}
4993
+ </current-state>`,
4994
+ TODO: (content) => `<todo>
4995
+ ${content}
4996
+ </todo>`
4997
+ };
4998
+ var PROMPT_DEFAULTS = {
4999
+ NO_SCOPE: "<scope>NO SCOPE DEFINED. STOP.</scope>",
5000
+ EMPTY_TODO: "Create initial plan",
5001
+ USER_CONTEXT: (context) => `
5002
+ <user-input>
5003
+ "${context}"
5004
+ </user-input>
5005
+
5006
+ <intent-rules>
5007
+ ANALYZE the user's intent before acting. Classify into ONE:
5008
+ ABORT \u2192 stop current work, confirm with \`ask_user\`
5009
+ CORRECTION \u2192 adjust approach, continue
5010
+ INFORMATION \u2192 store and USE immediately (credentials, paths, hints)
5011
+ COMMAND \u2192 execute EXACTLY what was asked, nothing more
5012
+ TARGET_CHANGE \u2192 \`add_target\`, then begin testing
5013
+ GUIDANCE \u2192 acknowledge via \`ask_user\`, adjust strategy, continue
5014
+ STATUS_QUERY \u2192 report via \`ask_user\`, then RESUME previous work
5015
+ CONVERSATION \u2192 respond via \`ask_user\`, do NOT scan or attack
5016
+
5017
+ RULES:
5018
+ - No target set and none provided \u2192 \`ask_user\` to request target.
5019
+ - Conversation or greeting \u2192 respond conversationally, do NOT attack.
5020
+ - Uncertain intent \u2192 ask for clarification with \`ask_user\`.
5021
+ - This is a collaborative tool. The user is your partner.
5022
+ </intent-rules>`
5023
+ };
5024
+ var PROMPT_CONFIG = {
5025
+ ENCODING: "utf-8"
5026
+ };
5027
+ var INITIAL_TASKS = {
5028
+ RECON: "Initial reconnaissance and target discovery"
5029
+ };
5030
+ var CONTEXT_EXTRACTOR_PROMPT = `You are extracting actionable intelligence from a penetration testing session.
5031
+ DO NOT simply summarize or shorten. EXTRACT critical facts:
5032
+
5033
+ 1. DISCOVERED: Services, versions, paths, parameters (exact IPs, ports, versions)
5034
+ 2. CONFIRMED: Vulnerabilities or access confirmed
5035
+ 3. CREDENTIALS: Usernames, passwords, tokens, keys
5036
+ 4. DEAD ENDS: What failed \u2014 include EXACT command, tool, arguments, wordlist/file used.
5037
+ Distinguish between:
5038
+ - "This approach itself is impossible" (e.g., SSH key-only \u2192 no password brute force works)
5039
+ - "This specific attempt failed" (e.g., sqlmap with default tamper \u2192 try different tamper)
5040
+ 5. OPEN LEADS: Unexplored paths worth pursuing
5041
+
5042
+ Every line must include exact commands/tools/files used.
5043
+ The reader must be able to judge whether a retry with different parameters is worthwhile.`;
5044
+ var REFLECTION_PROMPT = `You are a tactical reviewer for a penetration testing agent.
5045
+ Review ALL actions from this turn \u2014 successes AND failures.
5046
+
5047
+ 1. ASSESSMENT: What did this turn accomplish? Rate: HIGH / MED / LOW / NONE.
5048
+ 2. SUCCESSES: What worked? Can this pattern be replicated elsewhere?
5049
+ 3. FAILURES: What failed? Is this a repeated pattern? If so \u2192 STOP this approach.
5050
+ 4. BLIND SPOTS: What was missed or overlooked?
5051
+ 5. NEXT PRIORITY: Single most valuable next action.
5052
+
5053
+ 3-5 lines. Every word must be actionable.`;
5054
+ var SUMMARY_REGENERATOR_PROMPT = `Update this penetration testing session summary with the new turn data.
5055
+
5056
+ Must include:
5057
+ - All discovered hosts, services, versions (exact IPs, ports, software versions)
5058
+ - All confirmed vulnerabilities
5059
+ - All obtained credentials
5060
+ - Failed attempts with EXACT commands/tools/arguments/files used.
5061
+ For each failure, state:
5062
+ - The root cause (auth method? WAF? patched? wrong params?)
5063
+ - Whether retrying with different parameters could work
5064
+ - Top unexplored leads
5065
+
5066
+ Remove outdated/superseded info. Keep concise but COMPLETE.
5067
+ The reader must be able to decide what to retry and what to never attempt again.`;
5068
+
4943
5069
  // src/shared/utils/auto-prompter.ts
4944
5070
  var SECONDARY_TYPE_RATIO = 0.5;
4945
5071
  var MIN_CHALLENGE_CONFIDENCE = 0.2;
4946
5072
  var MIN_RECON_OUTPUT_LENGTH = 100;
4947
5073
  var TYPE_TECHNIQUE_MAP = {
4948
- web: ["injection", "auth-access", "file-attacks", "crypto"],
4949
- pwn: ["pwn", "shells", "reversing"],
4950
- crypto: ["crypto"],
4951
- forensics: ["forensics", "reversing", "crypto"],
4952
- reversing: ["reversing", "pwn"],
4953
- misc: ["sandbox-escape", "crypto", "forensics"],
4954
- network: ["network-svc", "shells", "lateral", "ad-attack"],
4955
- unknown: ["network-svc", "injection", "shells", "file-attacks"]
5074
+ web: [TECHNIQUE_FILES.INJECTION, TECHNIQUE_FILES.AUTH_ACCESS, TECHNIQUE_FILES.FILE_ATTACKS, TECHNIQUE_FILES.CRYPTO],
5075
+ pwn: [TECHNIQUE_FILES.PWN, TECHNIQUE_FILES.SHELLS, TECHNIQUE_FILES.REVERSING],
5076
+ crypto: [TECHNIQUE_FILES.CRYPTO],
5077
+ forensics: [TECHNIQUE_FILES.FORENSICS, TECHNIQUE_FILES.REVERSING, TECHNIQUE_FILES.CRYPTO],
5078
+ reversing: [TECHNIQUE_FILES.REVERSING, TECHNIQUE_FILES.PWN],
5079
+ misc: [TECHNIQUE_FILES.SANDBOX_ESCAPE, TECHNIQUE_FILES.CRYPTO, TECHNIQUE_FILES.FORENSICS],
5080
+ network: [TECHNIQUE_FILES.NETWORK_SVC, TECHNIQUE_FILES.SHELLS, TECHNIQUE_FILES.LATERAL, TECHNIQUE_FILES.AD_ATTACK],
5081
+ unknown: [TECHNIQUE_FILES.NETWORK_SVC, TECHNIQUE_FILES.INJECTION, TECHNIQUE_FILES.SHELLS, TECHNIQUE_FILES.FILE_ATTACKS]
4956
5082
  };
4957
5083
  var TYPE_PHASE_PROMPT_MAP = {
4958
5084
  web: "web.md",
@@ -10475,19 +10601,19 @@ var ANALYST_SYSTEM_PROMPT = `You are an independent pentesting output analyst. Y
10475
10601
 
10476
10602
  FORMAT YOUR RESPONSE EXACTLY LIKE THIS:
10477
10603
 
10478
- ## Key Findings
10604
+ ## ${MEMO_SECTIONS.KEY_FINDINGS}
10479
10605
  - [finding 1 with exact values: ports, versions, paths]
10480
10606
  - [finding 2]
10481
10607
 
10482
- ## Credentials/Secrets
10608
+ ## ${MEMO_SECTIONS.CREDENTIALS}
10483
10609
  - [any discovered credentials, hashes, tokens, keys, certificates]
10484
10610
  - (write "None found" if none)
10485
10611
 
10486
- ## Attack Vectors
10612
+ ## ${MEMO_SECTIONS.ATTACK_VECTORS}
10487
10613
  - [exploitable services, vulnerabilities, misconfigurations, CVEs]
10488
10614
  - (write "None identified" if none)
10489
10615
 
10490
- ## Failures/Errors
10616
+ ## ${MEMO_SECTIONS.FAILURES}
10491
10617
  Classify EVERY failure using one of these types. Format: [TYPE] exact_command \u2192 why_failed \u2192 recommended_pivot
10492
10618
 
10493
10619
  Failure types:
@@ -10504,7 +10630,7 @@ Examples:
10504
10630
  - "[TIMEOUT] nmap -sV -p- target --min-rate=5000 \u2192 timed out 5min \u2192 rustscan first, then targeted nmap on found ports"
10505
10631
  - (write "No failures" if everything succeeded)
10506
10632
 
10507
- ## Suspicious Signals
10633
+ ## ${MEMO_SECTIONS.SUSPICIONS}
10508
10634
  - [anomalies that are NOT confirmed vulnerabilities but suggest exploitable surface]
10509
10635
  - [e.g.: "Response time 3x slower on /admin path \u2014 possible auth check or backend processing"]
10510
10636
  - [e.g.: "X-Debug-Token header present \u2014 debug mode may be enabled"]
@@ -10512,11 +10638,11 @@ Examples:
10512
10638
  - [e.g.: "Unexpected 302 redirect with session param leaked in URL"]
10513
10639
  - (write "No suspicious signals" if nothing anomalous)
10514
10640
 
10515
- ## Attack Value
10641
+ ## ${MEMO_SECTIONS.ATTACK_VALUE}
10516
10642
  - [ONE word: HIGH / MED / LOW / NONE]
10517
10643
  - Reasoning: [1 sentence why \u2014 what makes this worth pursuing or abandoning]
10518
10644
 
10519
- ## Next Steps
10645
+ ## ${MEMO_SECTIONS.NEXT_STEPS}
10520
10646
  - [recommended immediate actions based on findings]
10521
10647
 
10522
10648
  RULES:
@@ -10530,7 +10656,7 @@ RULES:
10530
10656
  - Do NOT miss subtle signals: unusual HTTP headers, non-standard responses, timing differences
10531
10657
  - Write as much detail as needed \u2014 do NOT artificially shorten. Every detail matters for strategy.
10532
10658
 
10533
- ## Reflection
10659
+ ## ${MEMO_SECTIONS.REFLECTION}
10534
10660
  - What this output tells us: [1-line assessment]
10535
10661
  - Recommended next action: [1-2 specific follow-up actions]`;
10536
10662
  function parseAnalystMemo(response) {
@@ -11328,116 +11454,6 @@ import { readFileSync as readFileSync6, existsSync as existsSync10 } from "fs";
11328
11454
  import { join as join11, dirname as dirname4 } from "path";
11329
11455
  import { fileURLToPath as fileURLToPath2 } from "url";
11330
11456
 
11331
- // src/shared/constants/prompts.ts
11332
- var PROMPT_PATHS = {
11333
- BASE: "base.md",
11334
- OFFENSIVE_PLAYBOOK: "offensive-playbook.md",
11335
- AGENT_FILES: {
11336
- ORCHESTRATOR: "orchestrator.md",
11337
- RECON: "recon.md",
11338
- VULN: "vuln.md",
11339
- WEB: "web.md",
11340
- EXPLOIT: "exploit.md",
11341
- POST: "post.md",
11342
- REPORT: "report.md",
11343
- INFRA: "infra.md",
11344
- // Strategic methodology (always loaded as reference)
11345
- STRATEGY: "strategy.md",
11346
- EVASION: "evasion.md",
11347
- ZERO_DAY: "zero-day.md",
11348
- PAYLOAD_CRAFT: "payload-craft.md"
11349
- },
11350
- /** Technique reference library directory (auto-discovered) */
11351
- TECHNIQUES_DIR: "techniques"
11352
- };
11353
- var PROMPT_XML = {
11354
- PHASE: (phase, content) => `<phase-instructions phase="${phase}">
11355
- ${content}
11356
- </phase-instructions>`,
11357
- SCOPE: (allowed, domains, exclude, flags) => `<scope type="ABSOLUTE_CONSTRAINT">
11358
- Authorized CIDR: ${allowed}
11359
- Authorized Domains: ${domains}
11360
- Exclusions: ${exclude}
11361
- Constraints: ${flags}
11362
- </scope>`,
11363
- STATE: (content) => `<current-state>
11364
- ${content}
11365
- </current-state>`,
11366
- TODO: (content) => `<todo>
11367
- ${content}
11368
- </todo>`
11369
- };
11370
- var PROMPT_DEFAULTS = {
11371
- NO_SCOPE: "<scope>NO SCOPE DEFINED. STOP.</scope>",
11372
- EMPTY_TODO: "Create initial plan",
11373
- USER_CONTEXT: (context) => `
11374
- <user-input>
11375
- "${context}"
11376
- </user-input>
11377
-
11378
- <intent-rules>
11379
- ANALYZE the user's intent before acting. Classify into ONE:
11380
- ABORT \u2192 stop current work, confirm with \`ask_user\`
11381
- CORRECTION \u2192 adjust approach, continue
11382
- INFORMATION \u2192 store and USE immediately (credentials, paths, hints)
11383
- COMMAND \u2192 execute EXACTLY what was asked, nothing more
11384
- TARGET_CHANGE \u2192 \`add_target\`, then begin testing
11385
- GUIDANCE \u2192 acknowledge via \`ask_user\`, adjust strategy, continue
11386
- STATUS_QUERY \u2192 report via \`ask_user\`, then RESUME previous work
11387
- CONVERSATION \u2192 respond via \`ask_user\`, do NOT scan or attack
11388
-
11389
- RULES:
11390
- - No target set and none provided \u2192 \`ask_user\` to request target.
11391
- - Conversation or greeting \u2192 respond conversationally, do NOT attack.
11392
- - Uncertain intent \u2192 ask for clarification with \`ask_user\`.
11393
- - This is a collaborative tool. The user is your partner.
11394
- </intent-rules>`
11395
- };
11396
- var PROMPT_CONFIG = {
11397
- ENCODING: "utf-8"
11398
- };
11399
- var INITIAL_TASKS = {
11400
- RECON: "Initial reconnaissance and target discovery"
11401
- };
11402
- var CONTEXT_EXTRACTOR_PROMPT = `You are extracting actionable intelligence from a penetration testing session.
11403
- DO NOT simply summarize or shorten. EXTRACT critical facts:
11404
-
11405
- 1. DISCOVERED: Services, versions, paths, parameters (exact IPs, ports, versions)
11406
- 2. CONFIRMED: Vulnerabilities or access confirmed
11407
- 3. CREDENTIALS: Usernames, passwords, tokens, keys
11408
- 4. DEAD ENDS: What failed \u2014 include EXACT command, tool, arguments, wordlist/file used.
11409
- Distinguish between:
11410
- - "This approach itself is impossible" (e.g., SSH key-only \u2192 no password brute force works)
11411
- - "This specific attempt failed" (e.g., sqlmap with default tamper \u2192 try different tamper)
11412
- 5. OPEN LEADS: Unexplored paths worth pursuing
11413
-
11414
- Every line must include exact commands/tools/files used.
11415
- The reader must be able to judge whether a retry with different parameters is worthwhile.`;
11416
- var REFLECTION_PROMPT = `You are a tactical reviewer for a penetration testing agent.
11417
- Review ALL actions from this turn \u2014 successes AND failures.
11418
-
11419
- 1. ASSESSMENT: What did this turn accomplish? Rate: HIGH / MED / LOW / NONE.
11420
- 2. SUCCESSES: What worked? Can this pattern be replicated elsewhere?
11421
- 3. FAILURES: What failed? Is this a repeated pattern? If so \u2192 STOP this approach.
11422
- 4. BLIND SPOTS: What was missed or overlooked?
11423
- 5. NEXT PRIORITY: Single most valuable next action.
11424
-
11425
- 3-5 lines. Every word must be actionable.`;
11426
- var SUMMARY_REGENERATOR_PROMPT = `Update this penetration testing session summary with the new turn data.
11427
-
11428
- Must include:
11429
- - All discovered hosts, services, versions (exact IPs, ports, software versions)
11430
- - All confirmed vulnerabilities
11431
- - All obtained credentials
11432
- - Failed attempts with EXACT commands/tools/arguments/files used.
11433
- For each failure, state:
11434
- - The root cause (auth method? WAF? patched? wrong params?)
11435
- - Whether retrying with different parameters could work
11436
- - Top unexplored leads
11437
-
11438
- Remove outdated/superseded info. Keep concise but COMPLETE.
11439
- The reader must be able to decide what to retry and what to never attempt again.`;
11440
-
11441
11457
  // src/shared/constants/scoring.ts
11442
11458
  var ATTACK_SCORING = {
11443
11459
  /** Base score for all attack prioritization */
@@ -11822,15 +11838,15 @@ var CORE_KNOWLEDGE_FILES = [
11822
11838
  // Active Directory / infrastructure attack methodology
11823
11839
  ];
11824
11840
  var PHASE_TECHNIQUE_MAP = {
11825
- [PHASES.RECON]: ["network-svc", "shells", "crypto"],
11826
- [PHASES.VULN_ANALYSIS]: ["injection", "network-svc", "file-attacks", "crypto", "reversing"],
11827
- [PHASES.EXPLOIT]: ["injection", "shells", "file-attacks", "network-svc", "pwn", "container-escape", "reversing"],
11828
- [PHASES.POST_EXPLOIT]: ["privesc", "lateral", "auth-access", "shells", "container-escape", "forensics"],
11829
- [PHASES.PRIV_ESC]: ["privesc", "auth-access", "shells", "pwn", "container-escape"],
11830
- [PHASES.LATERAL]: ["lateral", "ad-attack", "auth-access", "container-escape", "network-svc"],
11831
- [PHASES.PERSISTENCE]: ["shells", "privesc", "lateral"],
11832
- [PHASES.EXFIL]: ["lateral", "network-svc", "forensics"],
11833
- [PHASES.WEB]: ["injection", "file-attacks", "auth-access", "crypto", "shells"],
11841
+ [PHASES.RECON]: [TECHNIQUE_FILES.NETWORK_SVC, TECHNIQUE_FILES.SHELLS, TECHNIQUE_FILES.CRYPTO],
11842
+ [PHASES.VULN_ANALYSIS]: [TECHNIQUE_FILES.INJECTION, TECHNIQUE_FILES.NETWORK_SVC, TECHNIQUE_FILES.FILE_ATTACKS, TECHNIQUE_FILES.CRYPTO, TECHNIQUE_FILES.REVERSING],
11843
+ [PHASES.EXPLOIT]: [TECHNIQUE_FILES.INJECTION, TECHNIQUE_FILES.SHELLS, TECHNIQUE_FILES.FILE_ATTACKS, TECHNIQUE_FILES.NETWORK_SVC, TECHNIQUE_FILES.PWN, TECHNIQUE_FILES.CONTAINER_ESCAPE, TECHNIQUE_FILES.SANDBOX_ESCAPE, TECHNIQUE_FILES.REVERSING],
11844
+ [PHASES.POST_EXPLOIT]: [TECHNIQUE_FILES.PRIVESC, TECHNIQUE_FILES.LATERAL, TECHNIQUE_FILES.AUTH_ACCESS, TECHNIQUE_FILES.SHELLS, TECHNIQUE_FILES.CONTAINER_ESCAPE, TECHNIQUE_FILES.SANDBOX_ESCAPE, TECHNIQUE_FILES.FORENSICS],
11845
+ [PHASES.PRIV_ESC]: [TECHNIQUE_FILES.PRIVESC, TECHNIQUE_FILES.AUTH_ACCESS, TECHNIQUE_FILES.SHELLS, TECHNIQUE_FILES.PWN, TECHNIQUE_FILES.CONTAINER_ESCAPE, TECHNIQUE_FILES.SANDBOX_ESCAPE],
11846
+ [PHASES.LATERAL]: [TECHNIQUE_FILES.LATERAL, TECHNIQUE_FILES.AD_ATTACK, TECHNIQUE_FILES.AUTH_ACCESS, TECHNIQUE_FILES.CONTAINER_ESCAPE, TECHNIQUE_FILES.NETWORK_SVC],
11847
+ [PHASES.PERSISTENCE]: [TECHNIQUE_FILES.SHELLS, TECHNIQUE_FILES.PRIVESC, TECHNIQUE_FILES.LATERAL],
11848
+ [PHASES.EXFIL]: [TECHNIQUE_FILES.LATERAL, TECHNIQUE_FILES.NETWORK_SVC, TECHNIQUE_FILES.FORENSICS],
11849
+ [PHASES.WEB]: [TECHNIQUE_FILES.INJECTION, TECHNIQUE_FILES.FILE_ATTACKS, TECHNIQUE_FILES.AUTH_ACCESS, TECHNIQUE_FILES.CRYPTO, TECHNIQUE_FILES.SHELLS],
11834
11850
  [PHASES.REPORT]: []
11835
11851
  // Report phase: no attack techniques needed
11836
11852
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pentesting",
3
- "version": "0.55.0",
3
+ "version": "0.55.1",
4
4
  "description": "Autonomous Penetration Testing AI Agent",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",