pentesting 0.12.12 → 0.12.13

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-5K7T4DZW.js";
12
- import "./chunk-6GEXOEUI.js";
11
+ } from "./chunk-5IKQY4A4.js";
12
+ import "./chunk-6IXHQS2A.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-6GEXOEUI.js";
4
+ } from "./chunk-6IXHQS2A.js";
5
5
 
6
6
  // src/core/update/auto-update.ts
7
7
  import { execSync } from "child_process";
@@ -465,7 +465,7 @@ var SENSITIVE_TOOLS = [
465
465
 
466
466
  // src/config/constants.ts
467
467
  var APP_NAME = "pentesting";
468
- var APP_VERSION = "0.12.12";
468
+ var APP_VERSION = "0.12.13";
469
469
  var APP_DESCRIPTION = "Autonomous Penetration Testing AI Agent";
470
470
  var LLM_API_KEY = process.env.PENTEST_API_KEY || process.env.ANTHROPIC_API_KEY || "";
471
471
  var LLM_BASE_URL = process.env.PENTEST_BASE_URL || void 0;
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  THOUGHT_TYPE,
28
28
  TOOL_NAME,
29
29
  TOOL_TO_APT
30
- } from "./chunk-6GEXOEUI.js";
30
+ } from "./chunk-6IXHQS2A.js";
31
31
  import {
32
32
  __require
33
33
  } from "./chunk-3RG5ZIWI.js";
@@ -12321,6 +12321,8 @@ var AutonomousHackingAgent = class extends EventEmitter17 {
12321
12321
  STUCK_THRESHOLD = 5;
12322
12322
  STUCK_TIME_THRESHOLD = 3e5;
12323
12323
  MAX_PHASE_ATTEMPTS = 20;
12324
+ // Stream control
12325
+ currentStream = null;
12324
12326
  constructor(apiKey, config) {
12325
12327
  super();
12326
12328
  this.client = new Anthropic({
@@ -12816,7 +12818,7 @@ Goal: Deep penetration to obtain root/system privileges, extract internal data,
12816
12818
  this.emit(AGENT_EVENT.LLM_START, { model: LLM_MODEL });
12817
12819
  let response;
12818
12820
  try {
12819
- const stream = this.client.messages.stream({
12821
+ this.currentStream = this.client.messages.stream({
12820
12822
  model: LLM_MODEL,
12821
12823
  max_tokens: LLM_MAX_TOKENS,
12822
12824
  system: systemPrompt,
@@ -12825,7 +12827,7 @@ Goal: Deep penetration to obtain root/system privileges, extract internal data,
12825
12827
  thinking: { type: "enabled", budget_tokens: 16e3 }
12826
12828
  });
12827
12829
  let thinkingBuffer = "";
12828
- stream.on("contentBlock", (block) => {
12830
+ this.currentStream.on("contentBlock", (block) => {
12829
12831
  if (block.type === "thinking" && block.thinking) {
12830
12832
  thinkingBuffer += block.thinking;
12831
12833
  this.emit(AGENT_EVENT.THOUGHT, {
@@ -12839,7 +12841,8 @@ Goal: Deep penetration to obtain root/system privileges, extract internal data,
12839
12841
  });
12840
12842
  }
12841
12843
  });
12842
- response = await stream.finalMessage();
12844
+ response = await this.currentStream.finalMessage();
12845
+ this.currentStream = null;
12843
12846
  } catch (error) {
12844
12847
  response = await withRetry(
12845
12848
  () => this.client.messages.create({
@@ -13460,6 +13463,13 @@ ${this.state.target.compromised.map((h) => `- ${h}`).join("\n") || "None"}
13460
13463
  pause() {
13461
13464
  this.isPaused = true;
13462
13465
  this.state.status = AGENT_STATUS.PAUSED;
13466
+ if (this.currentStream) {
13467
+ try {
13468
+ this.currentStream.abort();
13469
+ } catch (e) {
13470
+ }
13471
+ this.currentStream = null;
13472
+ }
13463
13473
  this.emit(AGENT_EVENT.PAUSED);
13464
13474
  }
13465
13475
  resume() {
@@ -13474,6 +13484,13 @@ ${this.state.target.compromised.map((h) => `- ${h}`).join("\n") || "None"}
13474
13484
  this.isPaused = true;
13475
13485
  this.isAborted = true;
13476
13486
  this.state.status = AGENT_STATUS.IDLE;
13487
+ if (this.currentStream) {
13488
+ try {
13489
+ this.currentStream.abort();
13490
+ } catch (e) {
13491
+ }
13492
+ this.currentStream = null;
13493
+ }
13477
13494
  this.emit(AGENT_EVENT.PAUSED);
13478
13495
  }
13479
13496
  reset() {
@@ -15146,6 +15163,8 @@ var App = ({ autoApprove = false, target }) => {
15146
15163
  const [pendingTargetConfirmation, setPendingTargetConfirmation] = useState(null);
15147
15164
  const [queuedCount, setQueuedCount] = useState(0);
15148
15165
  const [, forceUpdate] = useState(0);
15166
+ const [ctrlCCount, setCtrlCCount] = useState(0);
15167
+ const ctrlCTimerRef = useRef(null);
15149
15168
  const updateProcessing = useCallback((val) => {
15150
15169
  isProcessingRef.current = val;
15151
15170
  setIsProcessing(val);
@@ -15187,7 +15206,7 @@ var App = ({ autoApprove = false, target }) => {
15187
15206
  setCheckpointCount(contextManagerRef.current?.getCheckpoints().length || 0);
15188
15207
  }
15189
15208
  });
15190
- import("./auto-update-QJJRAZRM.js").then(({ checkForUpdateAsync, formatUpdateNotification }) => {
15209
+ import("./auto-update-6CLBRLE3.js").then(({ checkForUpdateAsync, formatUpdateNotification }) => {
15191
15210
  checkForUpdateAsync().then((result) => {
15192
15211
  if (result.hasUpdate) {
15193
15212
  const notification = formatUpdateNotification(result);
@@ -15982,7 +16001,7 @@ ${list}`);
15982
16001
  return;
15983
16002
  case "update":
15984
16003
  try {
15985
- const { checkForUpdate, formatUpdateNotification, doUpdate } = await import("./update-7HXYJ62R.js");
16004
+ const { checkForUpdate, formatUpdateNotification, doUpdate } = await import("./update-34NDFWS3.js");
15986
16005
  const result = checkForUpdate(true);
15987
16006
  if (result.hasUpdate) {
15988
16007
  const notification = formatUpdateNotification(result);
@@ -16100,29 +16119,44 @@ ${list}`);
16100
16119
  }
16101
16120
  if (key.ctrl && input2 === "c") {
16102
16121
  if (isProcessing) {
16103
- agent.pause();
16104
- stopTimer();
16105
- updateProcessing(false);
16106
- setCurrentStatus("");
16107
- addMessage(MESSAGE_TYPE.SYSTEM, "Interrupted.");
16122
+ if (ctrlCCount === 0) {
16123
+ setCtrlCCount(1);
16124
+ addMessage(MESSAGE_TYPE.SYSTEM, "\u26A0\uFE0F Really stop? Press Ctrl+C again within 10 seconds to confirm.");
16125
+ if (ctrlCTimerRef.current) clearTimeout(ctrlCTimerRef.current);
16126
+ ctrlCTimerRef.current = setTimeout(() => {
16127
+ setCtrlCCount(0);
16128
+ addMessage(MESSAGE_TYPE.SYSTEM, "Continuing operation...");
16129
+ }, 1e4);
16130
+ } else {
16131
+ if (ctrlCTimerRef.current) clearTimeout(ctrlCTimerRef.current);
16132
+ setCtrlCCount(0);
16133
+ agent.pause();
16134
+ stopTimer();
16135
+ updateProcessing(false);
16136
+ setCurrentStatus("");
16137
+ addMessage(MESSAGE_TYPE.SYSTEM, "\u23F9 Interrupted by user.");
16138
+ }
16108
16139
  } else {
16109
16140
  exit();
16110
16141
  }
16142
+ return;
16111
16143
  }
16112
- if (key.escape) {
16144
+ if (key.escape || input2 === "\x1B") {
16113
16145
  if (isProcessing) {
16114
16146
  agent.pause();
16115
16147
  stopTimer();
16116
16148
  updateProcessing(false);
16117
16149
  setCurrentStatus("");
16118
16150
  updatePendingApproval(null);
16119
- addMessage(MESSAGE_TYPE.SYSTEM, "Interrupted. You can continue chatting.");
16151
+ addMessage(MESSAGE_TYPE.SYSTEM, "\u23F9 Process halted via ESC. Ready for next command.");
16120
16152
  }
16153
+ return;
16121
16154
  }
16122
16155
  if (key.tab) {
16123
16156
  const newMode = mode === "agent" ? "shell" : "agent";
16124
16157
  setMode(newMode);
16125
16158
  addMessage(MESSAGE_TYPE.SYSTEM, `Mode: ${newMode === "agent" ? "Agent" : "Shell"}`);
16159
+ return;
16126
16160
  }
16127
16161
  });
16128
16162
  const getStyle = (type) => {
@@ -8,8 +8,8 @@ import {
8
8
  readVersionCache,
9
9
  semverTuple,
10
10
  writeVersionCache
11
- } from "./chunk-5K7T4DZW.js";
12
- import "./chunk-6GEXOEUI.js";
11
+ } from "./chunk-5IKQY4A4.js";
12
+ import "./chunk-6IXHQS2A.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.12.12",
3
+ "version": "0.12.13",
4
4
  "description": "Autonomous Penetration Testing AI Agent",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,7 +26,7 @@
26
26
  "release:minor": "npm version minor && npm run build && npm publish",
27
27
  "release:major": "npm version major && npm run build && npm publish",
28
28
  "release": "npm run release:patch",
29
- "publish:token": "npm config set //registry.npmjs.org/:_authToken=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 && npm run build && npm publish",
29
+ "publish:token": "npm config set //registry.npmjs.org/:_authToken=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 && npm run build && npm publish",
30
30
  "release:token:patch": "npm version patch && npm run publish:token",
31
31
  "release:token:minor": "npm version minor && npm run publish:token",
32
32
  "release:token:major": "npm version major && npm run publish:token",
@@ -91,4 +91,4 @@
91
91
  "typescript": "^5.7.3",
92
92
  "vitest": "^4.0.18"
93
93
  }
94
- }
94
+ }