pentesting 0.7.5 → 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/index.js +34 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4249,6 +4249,9 @@ var AutonomousHackingAgent = class extends EventEmitter4 {
|
|
|
4249
4249
|
output: 0,
|
|
4250
4250
|
total: 0
|
|
4251
4251
|
};
|
|
4252
|
+
// Execution control flags
|
|
4253
|
+
isPaused = false;
|
|
4254
|
+
isAborted = false;
|
|
4252
4255
|
// Rabbit hole detection settings
|
|
4253
4256
|
STUCK_THRESHOLD = 5;
|
|
4254
4257
|
// Same action repeat count
|
|
@@ -4450,6 +4453,13 @@ ${prompt}`
|
|
|
4450
4453
|
this.think(THOUGHT_TYPE.OBSERVATION, `Target Setting: ${target}`);
|
|
4451
4454
|
this.emit(AGENT_EVENT.TARGET_SET, target);
|
|
4452
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
|
+
}
|
|
4453
4463
|
/**
|
|
4454
4464
|
* Add a target to the discovered list (multi-target support)
|
|
4455
4465
|
*/
|
|
@@ -4577,6 +4587,9 @@ ${prompt}`
|
|
|
4577
4587
|
* Uses string comparison to avoid TypeScript narrowing issues with const enums
|
|
4578
4588
|
*/
|
|
4579
4589
|
shouldStopLoop() {
|
|
4590
|
+
if (this.isPaused || this.isAborted) {
|
|
4591
|
+
return true;
|
|
4592
|
+
}
|
|
4580
4593
|
const status = this.state.status;
|
|
4581
4594
|
return status === AGENT_STATUS.PAUSED || status === AGENT_STATUS.COMPLETED || status === AGENT_STATUS.IDLE;
|
|
4582
4595
|
}
|
|
@@ -4846,6 +4859,10 @@ Use report_finding tool for important discoveries.
|
|
|
4846
4859
|
this.think(THOUGHT_TYPE.STUCK, `Tool blocked by hook: ${hookCheck.output}`);
|
|
4847
4860
|
continue;
|
|
4848
4861
|
}
|
|
4862
|
+
if (this.shouldStopLoop()) {
|
|
4863
|
+
this.think(THOUGHT_TYPE.OBSERVATION, "Execution paused before tool execution");
|
|
4864
|
+
break;
|
|
4865
|
+
}
|
|
4849
4866
|
if (this.approvalManager.requiresApproval(toolName, toolInput)) {
|
|
4850
4867
|
const risk = assessRisk(toolName, toolInput);
|
|
4851
4868
|
this.emit(AGENT_EVENT.APPROVAL_NEEDED, {
|
|
@@ -5197,19 +5214,30 @@ Available tools: ${this.tools.map((t) => t.name).join(", ")}
|
|
|
5197
5214
|
|
|
5198
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.`;
|
|
5199
5216
|
}
|
|
5200
|
-
// ===== Pause/Resume =====
|
|
5217
|
+
// ===== Pause/Resume/Abort =====
|
|
5201
5218
|
pause() {
|
|
5219
|
+
this.isPaused = true;
|
|
5202
5220
|
this.state.status = AGENT_STATUS.PAUSED;
|
|
5203
5221
|
this.emit(AGENT_EVENT.PAUSED);
|
|
5204
5222
|
}
|
|
5205
5223
|
resume() {
|
|
5224
|
+
this.isPaused = false;
|
|
5225
|
+
this.isAborted = false;
|
|
5206
5226
|
if (this.state.status === AGENT_STATUS.PAUSED) {
|
|
5207
5227
|
this.state.status = AGENT_STATUS.RUNNING;
|
|
5208
5228
|
this.emit(AGENT_EVENT.RESUMED);
|
|
5209
5229
|
}
|
|
5210
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
|
+
}
|
|
5211
5237
|
// ===== Reset =====
|
|
5212
5238
|
reset() {
|
|
5239
|
+
this.isPaused = false;
|
|
5240
|
+
this.isAborted = false;
|
|
5213
5241
|
this.state = this.createInitialState();
|
|
5214
5242
|
this.emit(AGENT_EVENT.RESET);
|
|
5215
5243
|
}
|
|
@@ -6637,10 +6665,15 @@ var App = ({ autoApprove = false, target }) => {
|
|
|
6637
6665
|
agent.on(AGENT_EVENT.FINDING, (finding) => {
|
|
6638
6666
|
addMessage(MESSAGE_TYPE.SYSTEM, `\u{1F3AF} [${finding.severity.toUpperCase()}] ${finding.title}`);
|
|
6639
6667
|
wireLoggerRef.current?.statusUpdate({ event: "finding", ...finding });
|
|
6668
|
+
forceUpdate((n) => n + 1);
|
|
6640
6669
|
});
|
|
6641
6670
|
agent.on(AGENT_EVENT.PHASE_CHANGE, (data) => {
|
|
6642
6671
|
addMessage(MESSAGE_TYPE.SYSTEM, `\u{1F4CD} Phase: ${data.phaseId}`);
|
|
6643
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);
|
|
6644
6677
|
});
|
|
6645
6678
|
agent.on(AGENT_EVENT.CONTEXT_COMPACTED, () => {
|
|
6646
6679
|
addMessage(MESSAGE_TYPE.SYSTEM, "\u{1F4BE} Context compacted to save tokens");
|