pentesting 0.7.4 → 0.7.6
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/{auto-update-NF5LOTTR.js → auto-update-2TA2XEPG.js} +2 -2
- package/dist/{chunk-FWXRDTSB.js → chunk-3KWVDLNY.js} +1 -0
- package/dist/{chunk-NHTHJVRJ.js → chunk-RS2X7YKI.js} +1 -1
- package/dist/index.js +101 -4
- package/dist/{update-WBBD5QMK.js → update-S2YI6GZU.js} +2 -2
- package/package.json +1 -1
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
readVersionCache,
|
|
9
9
|
semverTuple,
|
|
10
10
|
writeVersionCache
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-RS2X7YKI.js";
|
|
12
|
+
import "./chunk-3KWVDLNY.js";
|
|
13
13
|
import "./chunk-3RG5ZIWI.js";
|
|
14
14
|
export {
|
|
15
15
|
checkForUpdate,
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
PHASE_STATUS,
|
|
16
16
|
THOUGHT_TYPE,
|
|
17
17
|
TOOL_NAME
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3KWVDLNY.js";
|
|
19
19
|
import {
|
|
20
20
|
__require
|
|
21
21
|
} from "./chunk-3RG5ZIWI.js";
|
|
@@ -281,6 +281,27 @@ IMPORTANT:
|
|
|
281
281
|
},
|
|
282
282
|
required: ["path"]
|
|
283
283
|
}
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
name: TOOL_NAME.SET_TARGET,
|
|
287
|
+
description: `Set the primary target for penetration testing.
|
|
288
|
+
|
|
289
|
+
CRITICAL: Use this IMMEDIATELY when user mentions any domain or IP.
|
|
290
|
+
This sets the target in the UI status bar.
|
|
291
|
+
|
|
292
|
+
WHEN TO USE:
|
|
293
|
+
- User says "attack example.com" \u2192 set_target(target: "example.com")
|
|
294
|
+
- User says "scan 192.168.1.1" \u2192 set_target(target: "192.168.1.1")
|
|
295
|
+
- User mentions any domain/IP \u2192 set_target first, then start scanning
|
|
296
|
+
|
|
297
|
+
After setting target, immediately begin reconnaissance.`,
|
|
298
|
+
input_schema: {
|
|
299
|
+
type: "object",
|
|
300
|
+
properties: {
|
|
301
|
+
target: { type: "string", description: "Domain, IP, or URL to set as primary target" }
|
|
302
|
+
},
|
|
303
|
+
required: ["target"]
|
|
304
|
+
}
|
|
284
305
|
}
|
|
285
306
|
];
|
|
286
307
|
var NETWORK_TOOLS = [
|
|
@@ -1435,6 +1456,9 @@ async function executeToolCall(toolName, input) {
|
|
|
1435
1456
|
input.hidden
|
|
1436
1457
|
);
|
|
1437
1458
|
break;
|
|
1459
|
+
case TOOL_NAME.SET_TARGET:
|
|
1460
|
+
result = await setTarget(input.target);
|
|
1461
|
+
break;
|
|
1438
1462
|
// network scanning
|
|
1439
1463
|
case TOOL_NAME.RUSTSCAN:
|
|
1440
1464
|
result = await executeRustscan(input);
|
|
@@ -1644,6 +1668,37 @@ ${stderr}` : ""),
|
|
|
1644
1668
|
};
|
|
1645
1669
|
}
|
|
1646
1670
|
}
|
|
1671
|
+
var _currentTarget = null;
|
|
1672
|
+
var _targetListeners = [];
|
|
1673
|
+
function onTargetChange(listener) {
|
|
1674
|
+
_targetListeners.push(listener);
|
|
1675
|
+
}
|
|
1676
|
+
async function setTarget(target) {
|
|
1677
|
+
try {
|
|
1678
|
+
_currentTarget = target;
|
|
1679
|
+
_targetListeners.forEach((listener) => {
|
|
1680
|
+
try {
|
|
1681
|
+
listener(target);
|
|
1682
|
+
} catch (e) {
|
|
1683
|
+
console.error("Target listener error:", e);
|
|
1684
|
+
}
|
|
1685
|
+
});
|
|
1686
|
+
return {
|
|
1687
|
+
success: true,
|
|
1688
|
+
output: `\u{1F3AF} Target set: ${target}
|
|
1689
|
+
|
|
1690
|
+
Now beginning reconnaissance...`,
|
|
1691
|
+
duration: 0
|
|
1692
|
+
};
|
|
1693
|
+
} catch (error) {
|
|
1694
|
+
return {
|
|
1695
|
+
success: false,
|
|
1696
|
+
output: "",
|
|
1697
|
+
error: error.message || String(error),
|
|
1698
|
+
duration: 0
|
|
1699
|
+
};
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1647
1702
|
async function readFile2(filePath, startLine, endLine) {
|
|
1648
1703
|
try {
|
|
1649
1704
|
const content = await fs.readFile(filePath, "utf-8");
|
|
@@ -4194,6 +4249,9 @@ var AutonomousHackingAgent = class extends EventEmitter4 {
|
|
|
4194
4249
|
output: 0,
|
|
4195
4250
|
total: 0
|
|
4196
4251
|
};
|
|
4252
|
+
// Execution control flags
|
|
4253
|
+
isPaused = false;
|
|
4254
|
+
isAborted = false;
|
|
4197
4255
|
// Rabbit hole detection settings
|
|
4198
4256
|
STUCK_THRESHOLD = 5;
|
|
4199
4257
|
// Same action repeat count
|
|
@@ -4395,6 +4453,13 @@ ${prompt}`
|
|
|
4395
4453
|
this.think(THOUGHT_TYPE.OBSERVATION, `Target Setting: ${target}`);
|
|
4396
4454
|
this.emit(AGENT_EVENT.TARGET_SET, target);
|
|
4397
4455
|
}
|
|
4456
|
+
// ===== Execution Control =====
|
|
4457
|
+
/**
|
|
4458
|
+
* Check if execution should stop (called by main loop)
|
|
4459
|
+
*/
|
|
4460
|
+
shouldStop() {
|
|
4461
|
+
return this.isPaused || this.isAborted;
|
|
4462
|
+
}
|
|
4398
4463
|
/**
|
|
4399
4464
|
* Add a target to the discovered list (multi-target support)
|
|
4400
4465
|
*/
|
|
@@ -4522,6 +4587,9 @@ ${prompt}`
|
|
|
4522
4587
|
* Uses string comparison to avoid TypeScript narrowing issues with const enums
|
|
4523
4588
|
*/
|
|
4524
4589
|
shouldStopLoop() {
|
|
4590
|
+
if (this.isPaused || this.isAborted) {
|
|
4591
|
+
return true;
|
|
4592
|
+
}
|
|
4525
4593
|
const status = this.state.status;
|
|
4526
4594
|
return status === AGENT_STATUS.PAUSED || status === AGENT_STATUS.COMPLETED || status === AGENT_STATUS.IDLE;
|
|
4527
4595
|
}
|
|
@@ -4791,6 +4859,10 @@ Use report_finding tool for important discoveries.
|
|
|
4791
4859
|
this.think(THOUGHT_TYPE.STUCK, `Tool blocked by hook: ${hookCheck.output}`);
|
|
4792
4860
|
continue;
|
|
4793
4861
|
}
|
|
4862
|
+
if (this.shouldStopLoop()) {
|
|
4863
|
+
this.think(THOUGHT_TYPE.OBSERVATION, "Execution paused before tool execution");
|
|
4864
|
+
break;
|
|
4865
|
+
}
|
|
4794
4866
|
if (this.approvalManager.requiresApproval(toolName, toolInput)) {
|
|
4795
4867
|
const risk = assessRisk(toolName, toolInput);
|
|
4796
4868
|
this.emit(AGENT_EVENT.APPROVAL_NEEDED, {
|
|
@@ -5142,19 +5214,30 @@ Available tools: ${this.tools.map((t) => t.name).join(", ")}
|
|
|
5142
5214
|
|
|
5143
5215
|
Respond helpfully to the user's message. If they ask to perform security testing actions, use the appropriate tools. Always explain what you're doing and why.`;
|
|
5144
5216
|
}
|
|
5145
|
-
// ===== Pause/Resume =====
|
|
5217
|
+
// ===== Pause/Resume/Abort =====
|
|
5146
5218
|
pause() {
|
|
5219
|
+
this.isPaused = true;
|
|
5147
5220
|
this.state.status = AGENT_STATUS.PAUSED;
|
|
5148
5221
|
this.emit(AGENT_EVENT.PAUSED);
|
|
5149
5222
|
}
|
|
5150
5223
|
resume() {
|
|
5224
|
+
this.isPaused = false;
|
|
5225
|
+
this.isAborted = false;
|
|
5151
5226
|
if (this.state.status === AGENT_STATUS.PAUSED) {
|
|
5152
5227
|
this.state.status = AGENT_STATUS.RUNNING;
|
|
5153
5228
|
this.emit(AGENT_EVENT.RESUMED);
|
|
5154
5229
|
}
|
|
5155
5230
|
}
|
|
5231
|
+
abort() {
|
|
5232
|
+
this.isPaused = true;
|
|
5233
|
+
this.isAborted = true;
|
|
5234
|
+
this.state.status = AGENT_STATUS.IDLE;
|
|
5235
|
+
this.emit(AGENT_EVENT.PAUSED);
|
|
5236
|
+
}
|
|
5156
5237
|
// ===== Reset =====
|
|
5157
5238
|
reset() {
|
|
5239
|
+
this.isPaused = false;
|
|
5240
|
+
this.isAborted = false;
|
|
5158
5241
|
this.state = this.createInitialState();
|
|
5159
5242
|
this.emit(AGENT_EVENT.RESET);
|
|
5160
5243
|
}
|
|
@@ -6423,6 +6506,7 @@ var App = ({ autoApprove = false, target }) => {
|
|
|
6423
6506
|
const [checkpointCount, setCheckpointCount] = useState(0);
|
|
6424
6507
|
const [preInputBuffer, setPreInputBuffer] = useState("");
|
|
6425
6508
|
const [wasInterrupted, setWasInterrupted] = useState(false);
|
|
6509
|
+
const [, forceUpdate] = useState(0);
|
|
6426
6510
|
const [agent] = useState(() => new AutonomousHackingAgent(void 0, { autoApprove }));
|
|
6427
6511
|
const sessionManager2 = getSessionManager();
|
|
6428
6512
|
const approvalManager2 = getApprovalManager({ yoloMode: autoApprove });
|
|
@@ -6443,7 +6527,7 @@ var App = ({ autoApprove = false, target }) => {
|
|
|
6443
6527
|
setCheckpointCount(contextManagerRef.current?.getCheckpoints().length || 0);
|
|
6444
6528
|
}
|
|
6445
6529
|
});
|
|
6446
|
-
import("./auto-update-
|
|
6530
|
+
import("./auto-update-2TA2XEPG.js").then(({ checkForUpdateAsync, formatUpdateNotification }) => {
|
|
6447
6531
|
checkForUpdateAsync().then((result) => {
|
|
6448
6532
|
if (result.hasUpdate) {
|
|
6449
6533
|
const notification = formatUpdateNotification(result);
|
|
@@ -6550,6 +6634,14 @@ var App = ({ autoApprove = false, target }) => {
|
|
|
6550
6634
|
agent.setTarget(target);
|
|
6551
6635
|
addMessage(MESSAGE_TYPE.SYSTEM, `\u{1F3AF} Target: ${target}`);
|
|
6552
6636
|
}
|
|
6637
|
+
onTargetChange((newTarget) => {
|
|
6638
|
+
agent.setTarget(newTarget);
|
|
6639
|
+
addMessage(MESSAGE_TYPE.SYSTEM, `\u{1F3AF} Target \u2192 ${newTarget}`);
|
|
6640
|
+
forceUpdate((n) => n + 1);
|
|
6641
|
+
});
|
|
6642
|
+
agent.on(AGENT_EVENT.TARGET_SET, () => {
|
|
6643
|
+
forceUpdate((n) => n + 1);
|
|
6644
|
+
});
|
|
6553
6645
|
agent.on(AGENT_EVENT.THOUGHT, (thought) => {
|
|
6554
6646
|
setCurrentStatus(thought.content.slice(0, 60));
|
|
6555
6647
|
wireLoggerRef.current?.contentPart(thought.content, thought.type === "thinking");
|
|
@@ -6573,10 +6665,15 @@ var App = ({ autoApprove = false, target }) => {
|
|
|
6573
6665
|
agent.on(AGENT_EVENT.FINDING, (finding) => {
|
|
6574
6666
|
addMessage(MESSAGE_TYPE.SYSTEM, `\u{1F3AF} [${finding.severity.toUpperCase()}] ${finding.title}`);
|
|
6575
6667
|
wireLoggerRef.current?.statusUpdate({ event: "finding", ...finding });
|
|
6668
|
+
forceUpdate((n) => n + 1);
|
|
6576
6669
|
});
|
|
6577
6670
|
agent.on(AGENT_EVENT.PHASE_CHANGE, (data) => {
|
|
6578
6671
|
addMessage(MESSAGE_TYPE.SYSTEM, `\u{1F4CD} Phase: ${data.phaseId}`);
|
|
6579
6672
|
wireLoggerRef.current?.statusUpdate({ event: "phase_change", phase: data.phaseId });
|
|
6673
|
+
forceUpdate((n) => n + 1);
|
|
6674
|
+
});
|
|
6675
|
+
agent.on(AGENT_EVENT.CREDENTIAL, () => {
|
|
6676
|
+
forceUpdate((n) => n + 1);
|
|
6580
6677
|
});
|
|
6581
6678
|
agent.on(AGENT_EVENT.CONTEXT_COMPACTED, () => {
|
|
6582
6679
|
addMessage(MESSAGE_TYPE.SYSTEM, "\u{1F4BE} Context compacted to save tokens");
|
|
@@ -7037,7 +7134,7 @@ ${list}`);
|
|
|
7037
7134
|
return;
|
|
7038
7135
|
case "update":
|
|
7039
7136
|
try {
|
|
7040
|
-
const { checkForUpdate, formatUpdateNotification, doUpdate } = await import("./update-
|
|
7137
|
+
const { checkForUpdate, formatUpdateNotification, doUpdate } = await import("./update-S2YI6GZU.js");
|
|
7041
7138
|
const result = checkForUpdate(true);
|
|
7042
7139
|
if (result.hasUpdate) {
|
|
7043
7140
|
const notification = formatUpdateNotification(result);
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
readVersionCache,
|
|
9
9
|
semverTuple,
|
|
10
10
|
writeVersionCache
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-RS2X7YKI.js";
|
|
12
|
+
import "./chunk-3KWVDLNY.js";
|
|
13
13
|
import "./chunk-3RG5ZIWI.js";
|
|
14
14
|
export {
|
|
15
15
|
checkForUpdate,
|