pentesting 0.8.33 → 0.8.35

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.
@@ -8,8 +8,8 @@ import {
8
8
  readVersionCache,
9
9
  semverTuple,
10
10
  writeVersionCache
11
- } from "./chunk-N27ISRFF.js";
12
- import "./chunk-IYELGZKK.js";
11
+ } from "./chunk-TTQCHK5V.js";
12
+ import "./chunk-UCB4BWTB.js";
13
13
  import "./chunk-3RG5ZIWI.js";
14
14
  export {
15
15
  checkForUpdate,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  APP_NAME,
3
3
  APP_VERSION
4
- } from "./chunk-IYELGZKK.js";
4
+ } from "./chunk-UCB4BWTB.js";
5
5
 
6
6
  // src/core/update/auto-update.ts
7
7
  import { execSync } from "child_process";
@@ -27,14 +27,26 @@ var PHASE_STATUS = {
27
27
  SKIPPED: "skipped"
28
28
  };
29
29
  var THOUGHT_TYPE = {
30
+ THINKING: "thinking",
31
+ // LLM text streaming
32
+ REASONING: "reasoning",
33
+ // LLM extended thinking
34
+ PLANNING: "planning",
35
+ // Strategic planning
30
36
  OBSERVATION: "observation",
37
+ // Observing results
31
38
  HYPOTHESIS: "hypothesis",
32
- PLAN: "plan",
39
+ // Forming hypothesis
40
+ REFLECTION: "reflection",
41
+ // Self-reflection
33
42
  ACTION: "action",
43
+ // Taking action
34
44
  RESULT: "result",
35
- REFLECTION: "reflection",
45
+ // Action result
36
46
  STUCK: "stuck",
47
+ // Detected stuck state
37
48
  BREAKTHROUGH: "breakthrough"
49
+ // Found breakthrough
38
50
  };
39
51
  var AGENT_EVENT = {
40
52
  // Lifecycle
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  PHASE_STATUS,
17
17
  THOUGHT_TYPE,
18
18
  TOOL_NAME
19
- } from "./chunk-IYELGZKK.js";
19
+ } from "./chunk-UCB4BWTB.js";
20
20
  import {
21
21
  __require
22
22
  } from "./chunk-3RG5ZIWI.js";
@@ -4581,7 +4581,7 @@ var AutonomousHackingAgent = class extends EventEmitter4 {
4581
4581
  target: this.state.target.primary
4582
4582
  };
4583
4583
  const result = await executeCommand(cmdName, args, context);
4584
- this.think(THOUGHT_TYPE.PLAN, `Executed command: /${cmdName}`);
4584
+ this.think(THOUGHT_TYPE.PLANNING, `Executed command: /${cmdName}`);
4585
4585
  this.emit(AGENT_EVENT.COMMAND_EXECUTE, { command: cmdName, args });
4586
4586
  return result.output;
4587
4587
  }
@@ -4592,7 +4592,7 @@ var AutonomousHackingAgent = class extends EventEmitter4 {
4592
4592
  );
4593
4593
  if (agent) {
4594
4594
  this.currentAgent = agent;
4595
- this.think(THOUGHT_TYPE.PLAN, `Switching to specialized agent: ${agent.name}`);
4595
+ this.think(THOUGHT_TYPE.PLANNING, `Switching to specialized agent: ${agent.name}`);
4596
4596
  this.emit(AGENT_EVENT.AGENT_SWITCH, { name: agent.name, description: agent.description });
4597
4597
  return true;
4598
4598
  }
@@ -4787,7 +4787,7 @@ ${prompt}`
4787
4787
  this.setPhaseStatus(this.state.currentPhase, PHASE_STATUS.COMPLETED);
4788
4788
  this.state.currentPhase = nextPhase.id;
4789
4789
  this.setPhaseStatus(nextPhase.id, PHASE_STATUS.IN_PROGRESS);
4790
- this.think(THOUGHT_TYPE.PLAN, `Advancing to next phase: ${nextPhase.shortName}`);
4790
+ this.think(THOUGHT_TYPE.PLANNING, `Advancing to next phase: ${nextPhase.shortName}`);
4791
4791
  this.autoSwitchAgentForPhase(nextPhase.id);
4792
4792
  this.resetStuckCounter();
4793
4793
  return true;
@@ -4980,7 +4980,7 @@ What went wrong and what different approach should be tried?
4980
4980
  Target ${this.state.target.primary} - performing full penetration test.
4981
4981
  Goal: Deep penetration to obtain root/system privileges, extract internal data, map entire network.
4982
4982
  `;
4983
- this.think(THOUGHT_TYPE.PLAN, `Autonomous hacking started: ${mainObjective}`);
4983
+ this.think(THOUGHT_TYPE.PLANNING, `Autonomous hacking started: ${mainObjective}`);
4984
4984
  this.state.history.push({
4985
4985
  role: "user",
4986
4986
  content: mainObjective
@@ -5044,13 +5044,13 @@ Goal: Deep penetration to obtain root/system privileges, extract internal data,
5044
5044
  // ===== Step Execution =====
5045
5045
  async executeStep() {
5046
5046
  const contextPrompt = this.buildContextPrompt();
5047
- this.think(THOUGHT_TYPE.PLAN, "Deciding next action...");
5047
+ this.think(THOUGHT_TYPE.PLANNING, "Deciding next action...");
5048
5048
  const contextStatus = this.contextManager.checkStatus(this.state.history);
5049
5049
  if (contextStatus.warning) {
5050
5050
  this.think(THOUGHT_TYPE.OBSERVATION, `Context at ${(contextStatus.percentage * 100).toFixed(1)}% capacity`);
5051
5051
  }
5052
5052
  if (contextStatus.needsCompaction) {
5053
- this.think(THOUGHT_TYPE.PLAN, "Compacting context...");
5053
+ this.think(THOUGHT_TYPE.PLANNING, "Compacting context...");
5054
5054
  const compactResult = await this.contextManager.compactIfNeeded(this.state.history);
5055
5055
  if (compactResult.wasCompacted && compactResult.result) {
5056
5056
  this.state.history = compactResult.messages;
@@ -5096,12 +5096,12 @@ ${this.currentSpec.systemPrompt}`;
5096
5096
  if (block.type === "thinking" && block.thinking) {
5097
5097
  thinkingBuffer += block.thinking;
5098
5098
  this.emit(AGENT_EVENT.THOUGHT, {
5099
- type: "reasoning",
5099
+ type: THOUGHT_TYPE.REASONING,
5100
5100
  content: block.thinking
5101
5101
  });
5102
5102
  } else if (block.type === "tool_use") {
5103
5103
  this.emit(AGENT_EVENT.THOUGHT, {
5104
- type: "action",
5104
+ type: THOUGHT_TYPE.ACTION,
5105
5105
  content: `Calling: ${block.name}`
5106
5106
  });
5107
5107
  }
@@ -5376,9 +5376,9 @@ Use report_finding tool for important discoveries.
5376
5376
  async attemptRecovery(error) {
5377
5377
  this.think(THOUGHT_TYPE.REFLECTION, `Attempting recovery: ${error.message}`);
5378
5378
  if (error.message.includes("timeout")) {
5379
- this.think(THOUGHT_TYPE.PLAN, "Timeout - retrying with shorter command");
5379
+ this.think(THOUGHT_TYPE.PLANNING, "Timeout - retrying with shorter command");
5380
5380
  } else if (error.message.includes("permission")) {
5381
- this.think(THOUGHT_TYPE.PLAN, "Permission error - trying different approach");
5381
+ this.think(THOUGHT_TYPE.PLANNING, "Permission error - trying different approach");
5382
5382
  }
5383
5383
  }
5384
5384
  // ===== Final Report Generation =====
@@ -5456,7 +5456,7 @@ ${this.state.findings.filter((f) => f.severity !== "info").map((f) => `- Address
5456
5456
  * This is the main method for interactive TUI conversations
5457
5457
  */
5458
5458
  async chat(userMessage) {
5459
- this.think(THOUGHT_TYPE.PLAN, `Processing: ${userMessage}`);
5459
+ this.think(THOUGHT_TYPE.PLANNING, `Processing: ${userMessage}`);
5460
5460
  this.state.history.push({
5461
5461
  role: "user",
5462
5462
  content: userMessage
@@ -6658,16 +6658,16 @@ var ASCII_BANNER = `
6658
6658
  \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D
6659
6659
  `;
6660
6660
  var THOUGHT_LABELS = {
6661
- thinking: "[think]",
6662
- reasoning: "[reason]",
6663
- planning: "[plan]",
6664
- observation: "[observe]",
6665
- hypothesis: "[hypothesis]",
6666
- reflection: "[reflect]",
6667
- action: "[action]",
6668
- result: "[result]",
6669
- stuck: "[stuck]",
6670
- breakthrough: "[!]"
6661
+ [THOUGHT_TYPE.THINKING]: "[think]",
6662
+ [THOUGHT_TYPE.REASONING]: "[reason]",
6663
+ [THOUGHT_TYPE.PLANNING]: "[plan]",
6664
+ [THOUGHT_TYPE.OBSERVATION]: "[observe]",
6665
+ [THOUGHT_TYPE.HYPOTHESIS]: "[hypothesis]",
6666
+ [THOUGHT_TYPE.REFLECTION]: "[reflect]",
6667
+ [THOUGHT_TYPE.ACTION]: "[action]",
6668
+ [THOUGHT_TYPE.RESULT]: "[result]",
6669
+ [THOUGHT_TYPE.STUCK]: "[stuck]",
6670
+ [THOUGHT_TYPE.BREAKTHROUGH]: "[!]"
6671
6671
  };
6672
6672
 
6673
6673
  // src/cli/components/rich-display.tsx
@@ -6959,6 +6959,142 @@ function getKeyboardListener() {
6959
6959
  return keyboardListenerInstance;
6960
6960
  }
6961
6961
 
6962
+ // src/utils/input-queue.ts
6963
+ import { EventEmitter as EventEmitter8 } from "events";
6964
+ var INPUT_QUEUE_EVENT = {
6965
+ QUEUED: "queued",
6966
+ // Message added to queue
6967
+ DEQUEUED: "dequeued",
6968
+ // Message removed from queue
6969
+ PROCESSING: "processing",
6970
+ // Message being processed
6971
+ CLEARED: "cleared",
6972
+ // Queue cleared
6973
+ SHUTDOWN: "shutdown"
6974
+ // Queue shutdown
6975
+ };
6976
+ var InputQueue = class extends EventEmitter8 {
6977
+ queue = [];
6978
+ isShutdown = false;
6979
+ isPaused = false;
6980
+ nextId = 1;
6981
+ constructor() {
6982
+ super();
6983
+ }
6984
+ /**
6985
+ * Add input to the queue
6986
+ * Returns immediately, input will be processed when agent is ready
6987
+ */
6988
+ enqueue(content, options = {}) {
6989
+ if (this.isShutdown) {
6990
+ throw new Error("Queue is shutdown");
6991
+ }
6992
+ const input = {
6993
+ id: `input_${this.nextId++}`,
6994
+ content,
6995
+ timestamp: /* @__PURE__ */ new Date(),
6996
+ priority: options.priority || "normal",
6997
+ metadata: options.metadata
6998
+ };
6999
+ if (input.priority === "interrupt") {
7000
+ this.queue.unshift(input);
7001
+ } else if (input.priority === "high") {
7002
+ const firstNormal = this.queue.findIndex((q) => q.priority === "normal");
7003
+ if (firstNormal === -1) {
7004
+ this.queue.push(input);
7005
+ } else {
7006
+ this.queue.splice(firstNormal, 0, input);
7007
+ }
7008
+ } else {
7009
+ this.queue.push(input);
7010
+ }
7011
+ this.emit(INPUT_QUEUE_EVENT.QUEUED, input);
7012
+ return input;
7013
+ }
7014
+ /**
7015
+ * Get next input from queue
7016
+ * Returns null if queue is empty or paused
7017
+ */
7018
+ dequeue() {
7019
+ if (this.isShutdown || this.isPaused || this.queue.length === 0) {
7020
+ return null;
7021
+ }
7022
+ const input = this.queue.shift();
7023
+ this.emit(INPUT_QUEUE_EVENT.DEQUEUED, input);
7024
+ return input;
7025
+ }
7026
+ /**
7027
+ * Peek at next input without removing it
7028
+ */
7029
+ peek() {
7030
+ return this.queue[0] || null;
7031
+ }
7032
+ /**
7033
+ * Check if there are pending inputs
7034
+ */
7035
+ hasPending() {
7036
+ return this.queue.length > 0 && !this.isPaused && !this.isShutdown;
7037
+ }
7038
+ /**
7039
+ * Get number of pending inputs
7040
+ */
7041
+ get length() {
7042
+ return this.queue.length;
7043
+ }
7044
+ /**
7045
+ * Get all pending inputs (for display)
7046
+ */
7047
+ getPending() {
7048
+ return [...this.queue];
7049
+ }
7050
+ /**
7051
+ * Pause queue processing (inputs can still be added)
7052
+ */
7053
+ pause() {
7054
+ this.isPaused = true;
7055
+ }
7056
+ /**
7057
+ * Resume queue processing
7058
+ */
7059
+ resume() {
7060
+ this.isPaused = false;
7061
+ }
7062
+ /**
7063
+ * Clear all pending inputs
7064
+ */
7065
+ clear() {
7066
+ this.queue = [];
7067
+ this.emit(INPUT_QUEUE_EVENT.CLEARED);
7068
+ }
7069
+ /**
7070
+ * Shutdown queue (no more inputs accepted)
7071
+ */
7072
+ shutdown() {
7073
+ this.isShutdown = true;
7074
+ this.queue = [];
7075
+ this.emit(INPUT_QUEUE_EVENT.SHUTDOWN);
7076
+ }
7077
+ /**
7078
+ * Check if queue is shutdown
7079
+ */
7080
+ get isTerminated() {
7081
+ return this.isShutdown;
7082
+ }
7083
+ /**
7084
+ * Check if queue is paused
7085
+ */
7086
+ get isHeld() {
7087
+ return this.isPaused;
7088
+ }
7089
+ };
7090
+ var inputQueueInstance = null;
7091
+ function getInputQueue() {
7092
+ if (!inputQueueInstance) {
7093
+ inputQueueInstance = new InputQueue();
7094
+ }
7095
+ return inputQueueInstance;
7096
+ }
7097
+
6962
7098
  // src/cli/app.tsx
6963
7099
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
6964
7100
  var App = ({ autoApprove = false, target }) => {
@@ -6977,6 +7113,7 @@ var App = ({ autoApprove = false, target }) => {
6977
7113
  const [preInputBuffer, setPreInputBuffer] = useState("");
6978
7114
  const [wasInterrupted, setWasInterrupted] = useState(false);
6979
7115
  const [spinnerHue, setSpinnerHue] = useState(0);
7116
+ const [queuedCount, setQueuedCount] = useState(0);
6980
7117
  const [, forceUpdate] = useState(0);
6981
7118
  const spinnerColor = THEME.spinner;
6982
7119
  const [agent] = useState(() => new AutonomousHackingAgent(void 0, { autoApprove }));
@@ -6999,7 +7136,7 @@ var App = ({ autoApprove = false, target }) => {
6999
7136
  setCheckpointCount(contextManagerRef.current?.getCheckpoints().length || 0);
7000
7137
  }
7001
7138
  });
7002
- import("./auto-update-NUVK35LG.js").then(({ checkForUpdateAsync, formatUpdateNotification }) => {
7139
+ import("./auto-update-RJK3Y5UW.js").then(({ checkForUpdateAsync, formatUpdateNotification }) => {
7003
7140
  checkForUpdateAsync().then((result) => {
7004
7141
  if (result.hasUpdate) {
7005
7142
  const notification = formatUpdateNotification(result);
@@ -7126,14 +7263,14 @@ var App = ({ autoApprove = false, target }) => {
7126
7263
  agent.on(AGENT_EVENT.THOUGHT, (thought) => {
7127
7264
  setCurrentStatus(thought.content.slice(0, 60));
7128
7265
  const label = THOUGHT_LABELS[thought.type] || "[?]";
7129
- if (thought.type === "reasoning") {
7266
+ if (thought.type === THOUGHT_TYPE.REASONING) {
7130
7267
  addMessage(MESSAGE_TYPE.SYSTEM, ` \u2503 \u{1F4AD} ${thought.content.slice(0, 300)}`);
7131
- } else if (thought.type === "thinking") {
7268
+ } else if (thought.type === THOUGHT_TYPE.THINKING) {
7132
7269
  addMessage(MESSAGE_TYPE.SYSTEM, ` \u2503 ${thought.content.slice(0, 150)}`);
7133
7270
  } else {
7134
7271
  addMessage(MESSAGE_TYPE.SYSTEM, `${label} ${thought.content.slice(0, 200)}`);
7135
7272
  }
7136
- wireLoggerRef.current?.contentPart(thought.content, thought.type === "thinking" || thought.type === "reasoning");
7273
+ wireLoggerRef.current?.contentPart(thought.content, thought.type === THOUGHT_TYPE.THINKING || thought.type === THOUGHT_TYPE.REASONING);
7137
7274
  });
7138
7275
  agent.on(AGENT_EVENT.TOOL_CALL, (data) => {
7139
7276
  const args = Object.entries(data.input).slice(0, 2).map(([k, v]) => `${k}=${typeof v === "string" ? v.slice(0, 30) : "..."}`).join(" ");
@@ -7220,6 +7357,17 @@ var App = ({ autoApprove = false, target }) => {
7220
7357
  addMessage(MESSAGE_TYPE.SYSTEM, `\u2713 Complete (${duration}s)`);
7221
7358
  setIsProcessing(false);
7222
7359
  setCurrentStatus("");
7360
+ const inputQueue = getInputQueue();
7361
+ if (inputQueue.hasPending()) {
7362
+ const next = inputQueue.dequeue();
7363
+ if (next) {
7364
+ setQueuedCount(inputQueue.length);
7365
+ addMessage(MESSAGE_TYPE.SYSTEM, ` \u{1F4E4} Processing queued: ${next.content.slice(0, 50)}...`);
7366
+ setTimeout(() => {
7367
+ handleSubmit(next.content);
7368
+ }, 100);
7369
+ }
7370
+ }
7223
7371
  });
7224
7372
  agent.on(AGENT_EVENT.ERROR, (error) => {
7225
7373
  stopTimer();
@@ -7275,7 +7423,14 @@ var App = ({ autoApprove = false, target }) => {
7275
7423
  exit();
7276
7424
  return;
7277
7425
  }
7278
- if (isProcessing && !trimmed.startsWith("/")) return;
7426
+ if (isProcessing && !trimmed.startsWith("/")) {
7427
+ const inputQueue = getInputQueue();
7428
+ inputQueue.enqueue(trimmed);
7429
+ setQueuedCount(inputQueue.length);
7430
+ setInput("");
7431
+ addMessage(MESSAGE_TYPE.SYSTEM, ` \u{1F4E5} Queued (${inputQueue.length} pending): ${trimmed.slice(0, 50)}...`);
7432
+ return;
7433
+ }
7279
7434
  setInput("");
7280
7435
  addMessage(MESSAGE_TYPE.USER, trimmed);
7281
7436
  if (trimmed.startsWith("/")) {
@@ -7734,7 +7889,7 @@ ${list}`);
7734
7889
  return;
7735
7890
  case "update":
7736
7891
  try {
7737
- const { checkForUpdate, formatUpdateNotification, doUpdate } = await import("./update-VGGUNUWQ.js");
7892
+ const { checkForUpdate, formatUpdateNotification, doUpdate } = await import("./update-LQDOCICM.js");
7738
7893
  const result = checkForUpdate(true);
7739
7894
  if (result.hasUpdate) {
7740
7895
  const notification = formatUpdateNotification(result);
@@ -7926,7 +8081,10 @@ ${list}`);
7926
8081
  /* @__PURE__ */ jsx2(Text2, { color: THEME.text.accent, children: preInputBuffer }),
7927
8082
  /* @__PURE__ */ jsx2(Text2, { color: THEME.text.muted, children: "\u258C" })
7928
8083
  ] }),
7929
- /* @__PURE__ */ jsx2(Box2, { marginTop: 1, children: /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "ESC to interrupt \u2502 Type ahead to queue input" }) })
8084
+ /* @__PURE__ */ jsx2(Box2, { marginTop: 1, children: /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
8085
+ "ESC to interrupt \u2502 Type ahead to queue input",
8086
+ queuedCount > 0 ? ` \u2502 \u{1F4E5} ${queuedCount} queued` : ""
8087
+ ] }) })
7930
8088
  ] }) : /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
7931
8089
  showCommandHints && input.startsWith("/") && /* @__PURE__ */ jsx2(Box2, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: [
7932
8090
  "/target <ip>",
@@ -8,8 +8,8 @@ import {
8
8
  readVersionCache,
9
9
  semverTuple,
10
10
  writeVersionCache
11
- } from "./chunk-N27ISRFF.js";
12
- import "./chunk-IYELGZKK.js";
11
+ } from "./chunk-TTQCHK5V.js";
12
+ import "./chunk-UCB4BWTB.js";
13
13
  import "./chunk-3RG5ZIWI.js";
14
14
  export {
15
15
  checkForUpdate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pentesting",
3
- "version": "0.8.33",
3
+ "version": "0.8.35",
4
4
  "description": "Autonomous Penetration Testing AI Agent",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",