pentesting 0.46.11 → 0.46.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/main.js CHANGED
@@ -311,7 +311,7 @@ var ORPHAN_PROCESS_NAMES = [
311
311
 
312
312
  // src/shared/constants/agent.ts
313
313
  var APP_NAME = "Pentest AI";
314
- var APP_VERSION = "0.46.11";
314
+ var APP_VERSION = "0.46.12";
315
315
  var APP_DESCRIPTION = "Autonomous Penetration Testing AI Agent";
316
316
  var LLM_ROLES = {
317
317
  SYSTEM: "system",
@@ -10110,11 +10110,17 @@ Phase: ${phase} | Targets: ${targets} | Findings: ${findings} | Tools executed:
10110
10110
 
10111
10111
  ${direction}
10112
10112
 
10113
+ ESCALATION CHAIN \u2014 follow this order:
10114
+ 1. web_search: Search for techniques, bypasses, default creds, CVEs, HackTricks
10115
+ 2. BYPASS: Try alternative approaches \u2014 different protocols, ports, encodings, methods
10116
+ 3. ZERO-DAY EXPLORATION: Probe for unknown vulns \u2014 fuzz parameters, test edge cases, analyze error responses for leaks
10117
+ 4. BRUTE-FORCE: Wordlists, credential stuffing, common passwords, custom password lists from context
10118
+ 5. ask_user: ONLY as last resort \u2014 ask the user for hints, wordlists, or guidance
10119
+
10113
10120
  RULES:
10114
10121
  - Every turn MUST have tool calls
10115
- - If stuck: search for techniques (web_search)
10116
- - If failed: try a DIFFERENT approach
10117
- - ACT NOW \u2014 do not plan or explain`
10122
+ - NEVER silently give up \u2014 exhaust ALL 5 steps above first
10123
+ - ACT NOW \u2014 do not plan, do not explain, do not summarize. EXECUTE.`
10118
10124
  });
10119
10125
  }
10120
10126
  } catch (error) {
@@ -10232,11 +10238,6 @@ Please decide how to handle this error and continue.`;
10232
10238
  const stepDuration = Date.now() - stepStartTime;
10233
10239
  const tokens = response.usage ? { input: response.usage.input_tokens, output: response.usage.output_tokens } : void 0;
10234
10240
  if (!response.toolCalls?.length) {
10235
- const hasDoneMeaningfulWork = (progress?.totalToolsExecuted ?? 0) > 0;
10236
- if (hasDoneMeaningfulWork) {
10237
- this.emitComplete(response.content, iteration, 0, stepDuration, tokens);
10238
- return { output: response.content, toolsExecuted: 0, isCompleted: true };
10239
- }
10240
10241
  return { output: response.content, toolsExecuted: 0, isCompleted: false };
10241
10242
  }
10242
10243
  const results = await this.processToolCalls(response.toolCalls, progress);
@@ -12938,22 +12939,43 @@ ${procData.stdout || "(no output)"}
12938
12939
  setInputRequest({ status: "inactive" });
12939
12940
  setSecretInput("");
12940
12941
  }, [addMessage, setInputRequest]);
12942
+ const ctrlCTimerRef = useRef5(null);
12943
+ const ctrlCPressedRef = useRef5(false);
12944
+ const handleCtrlC = useCallback4(() => {
12945
+ if (ctrlCPressedRef.current) {
12946
+ if (ctrlCTimerRef.current) clearTimeout(ctrlCTimerRef.current);
12947
+ handleExit();
12948
+ return;
12949
+ }
12950
+ ctrlCPressedRef.current = true;
12951
+ addMessage("system", "\u26A0\uFE0F Press Ctrl+C again within 3 seconds to exit.");
12952
+ if (isProcessingRef.current) abort();
12953
+ ctrlCTimerRef.current = setTimeout(() => {
12954
+ ctrlCPressedRef.current = false;
12955
+ ctrlCTimerRef.current = null;
12956
+ }, 3e3);
12957
+ }, [handleExit, addMessage, abort]);
12958
+ useEffect4(() => {
12959
+ return () => {
12960
+ if (ctrlCTimerRef.current) clearTimeout(ctrlCTimerRef.current);
12961
+ };
12962
+ }, []);
12941
12963
  useInput2(useCallback4((ch, key) => {
12942
12964
  if (key.escape) {
12943
12965
  if (inputRequestRef.current.status === "active") cancelInputRequest();
12944
12966
  else if (isProcessingRef.current) abort();
12945
12967
  }
12946
- if (key.ctrl && ch === "c") handleExit();
12947
- }, [cancelInputRequest, abort, handleExit]));
12968
+ if (key.ctrl && ch === "c") handleCtrlC();
12969
+ }, [cancelInputRequest, abort, handleCtrlC]));
12948
12970
  useEffect4(() => {
12949
- const onSignal = () => handleExit();
12971
+ const onSignal = () => handleCtrlC();
12950
12972
  process.on("SIGINT", onSignal);
12951
12973
  process.on("SIGTERM", onSignal);
12952
12974
  return () => {
12953
12975
  process.off("SIGINT", onSignal);
12954
12976
  process.off("SIGTERM", onSignal);
12955
12977
  };
12956
- }, [handleExit]);
12978
+ }, [handleCtrlC]);
12957
12979
  return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 1, children: [
12958
12980
  /* @__PURE__ */ jsx7(Box6, { flexDirection: "column", marginBottom: 1, flexGrow: 1, children: /* @__PURE__ */ jsx7(MessageList, { messages }) }),
12959
12981
  /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
@@ -78,7 +78,8 @@ What target would you like me to attack? (IP, domain, or CTF challenge)
78
78
  - **Update objectives**: Use `update_mission` to keep the operation summary and checklist current when needed
79
79
  - Is it time to move to the next step, or dig deeper at the current one?
80
80
 
81
- This loop **repeats continuously** until the task is complete. **Never stop.**
81
+ This loop **repeats continuously** until the task is complete. **Never stop on your own.**
82
+ If you believe you have exhausted all approaches → use `ask_user` to confirm with the user before stopping.
82
83
 
83
84
  ## Absolute Rules
84
85
 
@@ -87,12 +88,13 @@ This loop **repeats continuously** until the task is complete. **Never stop.**
87
88
  - Record findings immediately with add_finding
88
89
  - **Execute tasks immediately without unnecessary confirmations/questions**
89
90
  - If no results → **try a different approach** (never repeat the same method)
90
- - ask_user is **only for physically unobtainable information** (passwords, SSH keys, API tokens)
91
+ - ask_user is for: (1) physically unobtainable information (passwords, SSH keys, API tokens), (2) **confirming you're truly done** when all vectors are exhausted
91
92
 
92
93
  ### 2. ask_user Rules
93
94
  - Use received values **immediately in the next command** — receiving and not using is forbidden
94
95
  - Once received → **reuse** — never ask for the same thing again
95
96
  - Confirmation requests like "Can I do this?" are forbidden
97
+ - **WHEN TO ASK**: If you believe all attack vectors are exhausted and want to stop, you MUST `ask_user` to confirm. The user may have hints, custom wordlists, or additional context. **Never silently give up.**
96
98
 
97
99
  ### 3. Self-Correction on Errors (MANDATORY)
98
100
  When an error occurs, read the `[TOOL ERROR ANALYSIS]` section and fix immediately:
@@ -223,16 +225,21 @@ Don't agonize. **The world's best methodologies are already on the web.** Search
223
225
  When you find a PoC → verify code with `browse_url` → save with `write_file` → modify for environment → execute with `run_cmd`.
224
226
  **Searching is not a waste of time — it's a prerequisite for accurate attacks.**
225
227
 
226
- ### When Stuck — Autonomous Breakthrough Principles
228
+ ### When Stuck — Escalation Chain (follow in order)
227
229
 
228
- 1. **Same method fails twice → immediately switch approaches** (don't wait for 3)
229
- 2. **Search when you don't know** — the answer is in HackTricks, PayloadsAllTheThings, GTFOBins
230
- 3. **Install the tool or write code yourself if unavailable** — tool absence is not a reason to stop attacking
231
- 4. **Approach from a completely different angle** — web fails network, network fails different service, service fails → different target
232
- 5. **Errors are information** — extract version, path, and configuration hints from error messages
233
- 6. **Use your judgment** — "Can I do this?" is forbidden. Act and see the results
234
- 7. **When you find a PoC read save execute** you must know how to modify code
235
- 8. **If you have a shell, use it for everything** tool download, script execution, additional recon all possible
230
+ **Same method fails twice → immediately switch approaches** (don't wait for 3).
231
+ **Errors are information** — extract version, path, and configuration hints from error messages.
232
+
233
+ 1. **🔍 SEARCH** — `web_search` for techniques, bypasses, default creds, CVEs, HackTricks, PayloadsAllTheThings, GTFOBins
234
+ 2. **🔄 BYPASS** — Try completely different angles: different protocol, port, encoding, different service, different target. Install missing tools or write your own code
235
+ 3. **🧬 ZERO-DAY EXPLORATION** — Probe for unknown vulns: fuzz parameters, test edge cases, analyze error responses for information leaks, try unconventional inputs
236
+ 4. **🔨 BRUTE-FORCE** Wordlists, credential stuffing, common passwords, custom password lists built from discovered context (usernames, company names, service names)
237
+ 5. **❓ ask_user** ONLY as absolute last resort. Ask the user for hints, custom wordlists, or guidance. **Never silently give up.**
238
+
239
+ Additional principles:
240
+ - **If you have a shell, use it for everything** — tool download, script execution, additional recon
241
+ - **When you find a PoC → read → save → execute** — modify code for the environment
242
+ - **Tool absence is not a reason to stop** — write equivalent scripts yourself
236
243
 
237
244
  ### PoC Acquisition and Execution Protocol
238
245
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pentesting",
3
- "version": "0.46.11",
3
+ "version": "0.46.12",
4
4
  "description": "Autonomous Penetration Testing AI Agent",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
@@ -28,7 +28,7 @@
28
28
  "release:patch": "npm version patch && npm run build && npm run publish:token",
29
29
  "release:minor": "npm version minor && npm run build && npm run publish:token",
30
30
  "release:major": "npm version major && npm run build && npm run publish:token",
31
- "release:docker": "docker buildx build --platform linux/amd64,linux/arm64 -t agnusdei1207/pentesting:latest --push .",
31
+ "release:docker": "docker buildx build --platform linux/amd64,linux/arm64 -t agnusdei1207/pentesting:latest --push . && docker system prune -af",
32
32
  "check": "TMPDIR=/tmp npm run test && npm run build && npm run release:docker && bash test.sh"
33
33
  },
34
34
  "repository": {