pentesting 0.5.3 → 0.5.5

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.
Files changed (2) hide show
  1. package/dist/index.js +119 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3232,9 +3232,53 @@ ${prompt}`
3232
3232
  // ===== Target Setting =====
3233
3233
  setTarget(target) {
3234
3234
  this.state.target.primary = target;
3235
+ if (!this.state.target.discovered.includes(target)) {
3236
+ this.state.target.discovered.push(target);
3237
+ }
3235
3238
  this.think(THOUGHT_TYPE.OBSERVATION, `Target Setting: ${target}`);
3236
3239
  this.emit(AGENT_EVENT.TARGET_SET, target);
3237
3240
  }
3241
+ /**
3242
+ * Add a target to the discovered list (multi-target support)
3243
+ */
3244
+ addTarget(target) {
3245
+ if (this.state.target.discovered.includes(target)) {
3246
+ return false;
3247
+ }
3248
+ this.state.target.discovered.push(target);
3249
+ if (!this.state.target.primary) {
3250
+ this.state.target.primary = target;
3251
+ }
3252
+ this.think(THOUGHT_TYPE.OBSERVATION, `Target added: ${target}`);
3253
+ this.emit(AGENT_EVENT.TARGET_SET, { target, action: "added" });
3254
+ return true;
3255
+ }
3256
+ /**
3257
+ * Remove a target from the discovered list
3258
+ */
3259
+ removeTarget(target) {
3260
+ const index = this.state.target.discovered.indexOf(target);
3261
+ if (index === -1) {
3262
+ return false;
3263
+ }
3264
+ this.state.target.discovered.splice(index, 1);
3265
+ if (this.state.target.primary === target) {
3266
+ this.state.target.primary = this.state.target.discovered[0] || "";
3267
+ }
3268
+ this.think(THOUGHT_TYPE.OBSERVATION, `Target removed: ${target}`);
3269
+ this.emit(AGENT_EVENT.TARGET_SET, { target, action: "removed" });
3270
+ return true;
3271
+ }
3272
+ /**
3273
+ * Get all targets (primary + discovered)
3274
+ */
3275
+ getAllTargets() {
3276
+ const targets = [...this.state.target.discovered];
3277
+ if (this.state.target.primary && !targets.includes(this.state.target.primary)) {
3278
+ targets.unshift(this.state.target.primary);
3279
+ }
3280
+ return targets;
3281
+ }
3238
3282
  // ===== Phase Management =====
3239
3283
  getCurrentPhase() {
3240
3284
  return this.state.phases.find((p) => p.id === this.state.currentPhase);
@@ -5337,14 +5381,6 @@ var App = ({ autoApprove = false, target }) => {
5337
5381
  };
5338
5382
  }, []);
5339
5383
  useEffect(() => {
5340
- const banner = `
5341
- \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
5342
- \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D
5343
- \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551
5344
- \u2588\u2588\u2554\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551 \u2588\u2588\u2551
5345
- \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551
5346
- \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 `;
5347
- addMessage(MESSAGE_TYPE.SYSTEM, banner);
5348
5384
  addMessage(MESSAGE_TYPE.SYSTEM, `
5349
5385
  \u{1F680} /target <ip> \u2192 /start [goal] | /help for commands
5350
5386
  \u26A0\uFE0F For authorized penetration testing only. Unauthorized use is illegal.`);
@@ -5469,7 +5505,8 @@ var App = ({ autoApprove = false, target }) => {
5469
5505
  addMessage(
5470
5506
  MESSAGE_TYPE.SYSTEM,
5471
5507
  `\u2500\u2500 Core \u2500\u2500
5472
- /target <ip> Set target
5508
+ /target [domain|ip] Set/show targets
5509
+ add <t> list rm <t> set <t>
5473
5510
  /start [goal] Start autonomous pentest
5474
5511
  /stop Stop operation
5475
5512
  /status Show status report
@@ -5505,11 +5542,76 @@ pentesting v${APP_VERSION}`
5505
5542
  return;
5506
5543
  case CLI_COMMAND.TARGET:
5507
5544
  case "t":
5508
- if (args[0]) {
5509
- agent.setTarget(args[0]);
5510
- addMessage(MESSAGE_TYPE.SYSTEM, `Target \u2192 ${args[0]}`);
5511
- } else {
5512
- addMessage(MESSAGE_TYPE.ERROR, "Usage: /target <ip>");
5545
+ const subCmd = args[0]?.toLowerCase();
5546
+ const targetArg = args.slice(1).join(" ") || args[0];
5547
+ if (!subCmd) {
5548
+ const allTargets = agent.getAllTargets();
5549
+ if (allTargets.length === 0) {
5550
+ addMessage(MESSAGE_TYPE.SYSTEM, `
5551
+ \u{1F3AF} No targets set
5552
+
5553
+ Usage:
5554
+ /target <domain|ip> Set primary target
5555
+ /target add <target> Add target to list
5556
+ /target list Show all targets
5557
+ /target rm <target> Remove target
5558
+ /target set <target> Set as primary`);
5559
+ } else {
5560
+ const primary = agent.getState().target.primary;
5561
+ const targetList = allTargets.map(
5562
+ (t) => t === primary ? ` \u2605 ${t} (primary)` : ` ${t}`
5563
+ ).join("\n");
5564
+ addMessage(MESSAGE_TYPE.SYSTEM, `\u{1F3AF} Targets:
5565
+ ${targetList}`);
5566
+ }
5567
+ return;
5568
+ }
5569
+ switch (subCmd) {
5570
+ case "add":
5571
+ case "+":
5572
+ if (args[1]) {
5573
+ const added = agent.addTarget(args[1]);
5574
+ addMessage(MESSAGE_TYPE.SYSTEM, added ? `\u2713 Target added: ${args[1]}` : `Already exists: ${args[1]}`);
5575
+ } else {
5576
+ addMessage(MESSAGE_TYPE.ERROR, "Usage: /target add <domain|ip>");
5577
+ }
5578
+ break;
5579
+ case "list":
5580
+ case "ls":
5581
+ const targets = agent.getAllTargets();
5582
+ if (targets.length === 0) {
5583
+ addMessage(MESSAGE_TYPE.SYSTEM, "No targets");
5584
+ } else {
5585
+ const primary = agent.getState().target.primary;
5586
+ const list = targets.map(
5587
+ (t, i) => t === primary ? ` ${i + 1}. \u2605 ${t}` : ` ${i + 1}. ${t}`
5588
+ ).join("\n");
5589
+ addMessage(MESSAGE_TYPE.SYSTEM, `\u{1F3AF} Targets (${targets.length}):
5590
+ ${list}`);
5591
+ }
5592
+ break;
5593
+ case "rm":
5594
+ case "remove":
5595
+ case "-":
5596
+ if (args[1]) {
5597
+ const removed = agent.removeTarget(args[1]);
5598
+ addMessage(MESSAGE_TYPE.SYSTEM, removed ? `\u2713 Target removed: ${args[1]}` : `Not found: ${args[1]}`);
5599
+ } else {
5600
+ addMessage(MESSAGE_TYPE.ERROR, "Usage: /target rm <domain|ip>");
5601
+ }
5602
+ break;
5603
+ case "set":
5604
+ case "primary":
5605
+ if (args[1]) {
5606
+ agent.setTarget(args[1]);
5607
+ addMessage(MESSAGE_TYPE.SYSTEM, `\u2605 Primary target \u2192 ${args[1]}`);
5608
+ } else {
5609
+ addMessage(MESSAGE_TYPE.ERROR, "Usage: /target set <domain|ip>");
5610
+ }
5611
+ break;
5612
+ default:
5613
+ agent.setTarget(subCmd);
5614
+ addMessage(MESSAGE_TYPE.SYSTEM, `\u{1F3AF} Target \u2192 ${subCmd}`);
5513
5615
  }
5514
5616
  return;
5515
5617
  case CLI_COMMAND.START:
@@ -5995,12 +6097,14 @@ pentesting v${APP_VERSION}`
5995
6097
  mode === "agent" ? "\u{1F916}" : "$",
5996
6098
  " ",
5997
6099
  state.target.primary || "No target",
6100
+ state.target.discovered.length > 1 && ` (+${state.target.discovered.length - 1})`,
5998
6101
  " \u2502",
5999
6102
  state.findings.length,
6000
6103
  " findings \u2502",
6001
6104
  state.credentials.length,
6002
6105
  " creds \u2502",
6003
- tokenUsage.total > 0 && `${(tokenUsage.total / 1e3).toFixed(1)}k tokens \u2502`,
6106
+ `${(tokenUsage.total / 1e3).toFixed(1)}k tokens`,
6107
+ " \u2502",
6004
6108
  state.currentPhase !== AGENT_STATUS.IDLE && ` ${state.currentPhase} \u2502`
6005
6109
  ] }),
6006
6110
  /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pentesting",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "Autonomous Penetration Testing AI Agent",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",