pentesting 0.2.6 → 0.3.0

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 +133 -40
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1376,7 +1376,7 @@ const { chromium } = require('playwright');
1376
1376
  }
1377
1377
 
1378
1378
  // src/config/constants.ts
1379
- var APP_VERSION = "0.2.6";
1379
+ var APP_VERSION = "0.3.0";
1380
1380
  var APP_DESCRIPTION = "Autonomous Penetration Testing AI Agent";
1381
1381
  var LLM_API_KEY = process.env.PENTEST_API_KEY || process.env.ANTHROPIC_API_KEY || "";
1382
1382
  var LLM_BASE_URL = process.env.PENTEST_BASE_URL || void 0;
@@ -4254,45 +4254,51 @@ var THEME = {
4254
4254
  // Purple-gray
4255
4255
  muted: "#6b6b7d",
4256
4256
  // Muted purple-gray
4257
- accent: "#b794f6"
4257
+ accent: "#b794f6",
4258
4258
  // Soft purple (pentesting identity)
4259
+ highlight: "#f0abfc"
4260
+ // Pink highlight
4259
4261
  },
4260
- // Status colors (cyber-security themed)
4262
+ // Status colors (cyber-security themed) - Enhanced!
4261
4263
  status: {
4262
- success: "#6ee7b7",
4263
- // Mint green (shell access)
4264
- warning: "#fcd34d",
4265
- // Amber (vulnerabilities)
4266
- error: "#fca5a5",
4267
- // Soft red (failed)
4268
- info: "#93c5fd",
4269
- // Light blue (scanning)
4270
- running: "#c4b5fd"
4264
+ success: "#4ade80",
4265
+ // Bright green (shell access)
4266
+ warning: "#fbbf24",
4267
+ // Golden amber (vulnerabilities)
4268
+ error: "#f87171",
4269
+ // Coral red (failed)
4270
+ info: "#60a5fa",
4271
+ // Sky blue (scanning)
4272
+ running: "#a78bfa",
4271
4273
  // Violet (active operations)
4274
+ pending: "#facc15"
4275
+ // Yellow (waiting)
4272
4276
  },
4273
- // Severity colors (CVE-style)
4277
+ // Severity colors (CVE-style) - More vibrant!
4274
4278
  semantic: {
4275
- critical: "#dc2626",
4276
- // Critical (red)
4277
- high: "#ea580c",
4278
- // High (orange)
4279
- medium: "#d97706",
4280
- // Medium (amber)
4281
- low: "#16a34a",
4282
- // Low (green)
4283
- info: "#7c3aed"
4284
- // Informational (purple)
4279
+ critical: "#ef4444",
4280
+ // Vivid red
4281
+ high: "#f97316",
4282
+ // Bright orange
4283
+ medium: "#eab308",
4284
+ // Vivid yellow
4285
+ low: "#22c55e",
4286
+ // Bright green
4287
+ info: "#8b5cf6"
4288
+ // Violet
4285
4289
  },
4286
4290
  // Border colors (purple-tinted)
4287
4291
  border: {
4288
4292
  default: "#2e2e42",
4289
4293
  // Subtle purple-gray
4290
- focus: "#8b5cf6",
4294
+ focus: "#a78bfa",
4291
4295
  // Violet focus
4292
- error: "#f87171"
4296
+ error: "#f87171",
4293
4297
  // Red error
4298
+ success: "#4ade80"
4299
+ // Green success
4294
4300
  },
4295
- // Phase colors (attack lifecycle)
4301
+ // Phase colors (attack lifecycle) - Vibrant gradient-inspired
4296
4302
  phase: {
4297
4303
  recon: "#818cf8",
4298
4304
  // Indigo (reconnaissance)
@@ -4300,14 +4306,40 @@ var THEME = {
4300
4306
  // Emerald (enumeration)
4301
4307
  vuln: "#fbbf24",
4302
4308
  // Amber (vulnerability)
4303
- exploit: "#f97316",
4309
+ exploit: "#fb923c",
4304
4310
  // Orange (exploitation)
4305
- privesc: "#ef4444",
4311
+ privesc: "#f87171",
4306
4312
  // Red (privilege escalation)
4307
- persist: "#a78bfa",
4313
+ persist: "#c084fc",
4308
4314
  // Purple (persistence)
4309
4315
  report: "#22d3ee"
4310
4316
  // Cyan (reporting)
4317
+ },
4318
+ // Rich accent colors for UI elements
4319
+ accent: {
4320
+ purple: "#a855f7",
4321
+ violet: "#8b5cf6",
4322
+ indigo: "#6366f1",
4323
+ blue: "#3b82f6",
4324
+ cyan: "#06b6d4",
4325
+ teal: "#14b8a6",
4326
+ emerald: "#10b981",
4327
+ green: "#22c55e",
4328
+ lime: "#84cc16",
4329
+ yellow: "#eab308",
4330
+ amber: "#f59e0b",
4331
+ orange: "#f97316",
4332
+ red: "#ef4444",
4333
+ pink: "#ec4899",
4334
+ rose: "#f43f5e"
4335
+ },
4336
+ // Gradients (for special UI elements)
4337
+ gradient: {
4338
+ purple: ["#7c3aed", "#a855f7"],
4339
+ cyber: ["#06b6d4", "#8b5cf6"],
4340
+ danger: ["#ef4444", "#f97316"],
4341
+ success: ["#10b981", "#22c55e"],
4342
+ gold: ["#f59e0b", "#fbbf24"]
4311
4343
  }
4312
4344
  };
4313
4345
  var ASCII_BANNER = `
@@ -4326,8 +4358,10 @@ var App = ({ autoApprove = false, target }) => {
4326
4358
  const [currentStatus, setCurrentStatus] = useState("");
4327
4359
  const [elapsedTime, setElapsedTime] = useState(0);
4328
4360
  const [pendingApproval, setPendingApproval] = useState(null);
4361
+ const [approvalSelectedIndex, setApprovalSelectedIndex] = useState(0);
4329
4362
  const [tokenUsage, setTokenUsage] = useState({ input: 0, output: 0, total: 0 });
4330
4363
  const [showCommandHints, setShowCommandHints] = useState(false);
4364
+ const [mode, setMode] = useState("agent");
4331
4365
  const [agent] = useState(() => new AutonomousHackingAgent(void 0, { autoApprove }));
4332
4366
  const sessionManager2 = getSessionManager();
4333
4367
  const approvalManager2 = getApprovalManager({ yoloMode: autoApprove });
@@ -4604,6 +4638,27 @@ var App = ({ autoApprove = false, target }) => {
4604
4638
  return;
4605
4639
  }
4606
4640
  }
4641
+ if (mode === "shell") {
4642
+ setIsProcessing(true);
4643
+ startTimer();
4644
+ setCurrentStatus(`Running: ${trimmed}`);
4645
+ try {
4646
+ const { execSync } = await import("child_process");
4647
+ const output = execSync(trimmed, {
4648
+ encoding: "utf-8",
4649
+ timeout: 3e4,
4650
+ maxBuffer: 1024 * 1024
4651
+ }).trim();
4652
+ addMessage(MESSAGE_TYPE.RESULT, output || "(no output)");
4653
+ } catch (e) {
4654
+ const error = e;
4655
+ addMessage(MESSAGE_TYPE.ERROR, error.stderr?.toString() || error.message || "Command failed");
4656
+ }
4657
+ stopTimer();
4658
+ setIsProcessing(false);
4659
+ setCurrentStatus("");
4660
+ return;
4661
+ }
4607
4662
  setIsProcessing(true);
4608
4663
  startTimer();
4609
4664
  setCurrentStatus("Thinking...");
@@ -4618,8 +4673,31 @@ var App = ({ autoApprove = false, target }) => {
4618
4673
  stopTimer();
4619
4674
  setIsProcessing(false);
4620
4675
  setCurrentStatus("");
4621
- }, [agent, isProcessing, pendingApproval, addMessage, exit, startTimer, stopTimer, sessionManager2, approvalManager2]);
4676
+ }, [agent, isProcessing, pendingApproval, addMessage, exit, startTimer, stopTimer, sessionManager2, approvalManager2, mode]);
4677
+ const approvalOptions = [
4678
+ { label: "\u2713 Approve once", decision: "approve" },
4679
+ { label: "\u2713 Approve always (this session)", decision: "approve_always" },
4680
+ { label: "\u2717 Deny", decision: "deny" }
4681
+ ];
4622
4682
  useInput((input2, key) => {
4683
+ if (pendingApproval) {
4684
+ if (key.upArrow) {
4685
+ setApprovalSelectedIndex((i) => (i - 1 + approvalOptions.length) % approvalOptions.length);
4686
+ return;
4687
+ }
4688
+ if (key.downArrow) {
4689
+ setApprovalSelectedIndex((i) => (i + 1) % approvalOptions.length);
4690
+ return;
4691
+ }
4692
+ if (key.return) {
4693
+ const selected = approvalOptions[approvalSelectedIndex];
4694
+ approvalManager2.respond(pendingApproval.id, selected.decision);
4695
+ addMessage(MESSAGE_TYPE.SYSTEM, selected.decision === "deny" ? "\u2717 Denied" : `\u2713 Approved${selected.decision === "approve_always" ? " (always)" : ""}`);
4696
+ setPendingApproval(null);
4697
+ setApprovalSelectedIndex(0);
4698
+ return;
4699
+ }
4700
+ }
4623
4701
  if (key.ctrl && input2 === "c") {
4624
4702
  if (isProcessing) {
4625
4703
  agent.pause();
@@ -4631,6 +4709,11 @@ var App = ({ autoApprove = false, target }) => {
4631
4709
  exit();
4632
4710
  }
4633
4711
  }
4712
+ if (key.ctrl && input2 === "x") {
4713
+ const newMode = mode === "agent" ? "shell" : "agent";
4714
+ setMode(newMode);
4715
+ addMessage(MESSAGE_TYPE.SYSTEM, `Mode: ${newMode === "agent" ? "\u{1F916} Agent" : "$ Shell"}`);
4716
+ }
4634
4717
  });
4635
4718
  const getStyle = (type) => {
4636
4719
  const styles = {
@@ -4659,13 +4742,21 @@ var App = ({ autoApprove = false, target }) => {
4659
4742
  ] })
4660
4743
  ] }) }, msg.id);
4661
4744
  } }) }),
4662
- pendingApproval && /* @__PURE__ */ jsx(Box, { marginBottom: 1, children: /* @__PURE__ */ jsxs(Text, { color: THEME.status.error, bold: true, children: [
4663
- "\u26A0\uFE0F Awaiting approval for ",
4664
- pendingApproval.toolName,
4665
- " (",
4666
- pendingApproval.riskLevel,
4667
- ")"
4668
- ] }) }),
4745
+ pendingApproval && /* @__PURE__ */ jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "yellow", paddingX: 1, marginBottom: 1, children: [
4746
+ /* @__PURE__ */ jsxs(Text, { color: "yellow", bold: true, children: [
4747
+ "\u26A0\uFE0F APPROVAL NEEDED: ",
4748
+ pendingApproval.toolName,
4749
+ " (",
4750
+ pendingApproval.riskLevel,
4751
+ " risk)"
4752
+ ] }),
4753
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: Object.entries(pendingApproval.toolInput).slice(0, 2).map(([k, v]) => `${k}=${typeof v === "string" ? v.slice(0, 50) : JSON.stringify(v).slice(0, 50)}`).join(", ") }),
4754
+ /* @__PURE__ */ jsx(Box, { flexDirection: "column", marginTop: 1, children: approvalOptions.map((opt, idx) => /* @__PURE__ */ jsxs(Text, { color: idx === approvalSelectedIndex ? "cyan" : "gray", children: [
4755
+ idx === approvalSelectedIndex ? "\u2192 " : " ",
4756
+ opt.label
4757
+ ] }, opt.decision)) }),
4758
+ /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2191\u2193 to select, Enter to confirm, or type /y /n /ya" }) })
4759
+ ] }),
4669
4760
  isProcessing ? /* @__PURE__ */ jsxs(Box, { children: [
4670
4761
  /* @__PURE__ */ jsx(Text, { color: THEME.status.running, children: /* @__PURE__ */ jsx(Spinner, { type: "dots" }) }),
4671
4762
  /* @__PURE__ */ jsxs(Text, { color: THEME.text.muted, children: [
@@ -4690,7 +4781,7 @@ var App = ({ autoApprove = false, target }) => {
4690
4781
  pendingApproval ? "/y /n /ya" : ""
4691
4782
  ].filter((cmd) => cmd && cmd.toLowerCase().includes(input.toLowerCase().slice(1))).slice(0, 5).join(" \u2502 ") }) }),
4692
4783
  /* @__PURE__ */ jsxs(Box, { children: [
4693
- /* @__PURE__ */ jsx(Text, { color: THEME.status.success, children: "\u276F " }),
4784
+ /* @__PURE__ */ jsx(Text, { color: mode === "agent" ? THEME.status.success : "yellow", children: mode === "agent" ? "\u2728 " : "$ " }),
4694
4785
  /* @__PURE__ */ jsx(
4695
4786
  TextInput,
4696
4787
  {
@@ -4700,13 +4791,15 @@ var App = ({ autoApprove = false, target }) => {
4700
4791
  setShowCommandHints(val.startsWith("/") && val.length > 0);
4701
4792
  },
4702
4793
  onSubmit: handleSubmit,
4703
- placeholder: "Message or /help..."
4794
+ placeholder: mode === "agent" ? "Message or /help..." : "Shell command..."
4704
4795
  }
4705
4796
  )
4706
4797
  ] })
4707
4798
  ] }),
4708
4799
  /* @__PURE__ */ jsxs(Box, { marginTop: 1, justifyContent: "space-between", children: [
4709
4800
  /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
4801
+ mode === "agent" ? "\u{1F916}" : "$",
4802
+ " ",
4710
4803
  state.target.primary || "No target",
4711
4804
  " \u2502",
4712
4805
  state.findings.length,
@@ -4717,7 +4810,7 @@ var App = ({ autoApprove = false, target }) => {
4717
4810
  state.currentPhase !== AGENT_STATUS.IDLE && ` ${state.currentPhase} \u2502`
4718
4811
  ] }),
4719
4812
  /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
4720
- "/help \u2502 Ctrl+C ",
4813
+ "Ctrl+X mode \u2502 /help \u2502 Ctrl+C ",
4721
4814
  isProcessing ? "stop" : "exit"
4722
4815
  ] })
4723
4816
  ] })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pentesting",
3
- "version": "0.2.6",
3
+ "version": "0.3.0",
4
4
  "description": "Autonomous Penetration Testing AI Agent",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",