pentesting 0.2.7 → 0.3.1

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 +192 -29
  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.7";
1379
+ var APP_VERSION = "0.3.1";
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;
@@ -4231,6 +4231,102 @@ function getSessionManager() {
4231
4231
  return sessionManager;
4232
4232
  }
4233
4233
 
4234
+ // src/core/commands/slash-registry.ts
4235
+ var SlashCommandRegistry = class {
4236
+ commands = /* @__PURE__ */ new Map();
4237
+ aliases = /* @__PURE__ */ new Map();
4238
+ /**
4239
+ * Register a command with optional aliases
4240
+ */
4241
+ register(name, handler, options) {
4242
+ const cmd = {
4243
+ name,
4244
+ description: options?.description || "",
4245
+ aliases: options?.aliases || [],
4246
+ handler
4247
+ };
4248
+ this.commands.set(name, cmd);
4249
+ this.aliases.set(name, cmd);
4250
+ for (const alias of cmd.aliases) {
4251
+ this.aliases.set(alias, cmd);
4252
+ }
4253
+ }
4254
+ /**
4255
+ * Find a command by name or alias
4256
+ */
4257
+ find(nameOrAlias) {
4258
+ return this.aliases.get(nameOrAlias);
4259
+ }
4260
+ /**
4261
+ * Execute a command
4262
+ */
4263
+ async execute(input) {
4264
+ const parsed = this.parse(input);
4265
+ if (!parsed) {
4266
+ return { handled: false };
4267
+ }
4268
+ const cmd = this.find(parsed.name);
4269
+ if (!cmd) {
4270
+ return { handled: false };
4271
+ }
4272
+ const result = await cmd.handler(parsed.args);
4273
+ return { handled: true, result: result || void 0 };
4274
+ }
4275
+ /**
4276
+ * Parse slash command from input
4277
+ */
4278
+ parse(input) {
4279
+ const trimmed = input.trim();
4280
+ if (!trimmed.startsWith("/")) {
4281
+ return null;
4282
+ }
4283
+ const match = trimmed.match(/^\/([a-zA-Z0-9_-]+)(?:\s+(.*))?$/);
4284
+ if (!match) {
4285
+ return null;
4286
+ }
4287
+ return {
4288
+ name: match[1].toLowerCase(),
4289
+ args: match[2] || ""
4290
+ };
4291
+ }
4292
+ /**
4293
+ * Get all commands (for help display)
4294
+ */
4295
+ list() {
4296
+ return Array.from(this.commands.values());
4297
+ }
4298
+ /**
4299
+ * Get formatted help text
4300
+ */
4301
+ getHelp() {
4302
+ const lines = ["Available commands:", ""];
4303
+ for (const cmd of this.list()) {
4304
+ const aliasStr = cmd.aliases.length > 0 ? ` (${cmd.aliases.join(", ")})` : "";
4305
+ lines.push(` /${cmd.name}${aliasStr}`);
4306
+ if (cmd.description) {
4307
+ lines.push(` ${cmd.description}`);
4308
+ }
4309
+ }
4310
+ return lines.join("\n");
4311
+ }
4312
+ /**
4313
+ * Get matching commands for autocomplete
4314
+ */
4315
+ getCompletions(partial) {
4316
+ const search = partial.toLowerCase().replace(/^\//, "");
4317
+ return this.list().filter(
4318
+ (cmd) => cmd.name.startsWith(search) || cmd.aliases.some((a) => a.startsWith(search))
4319
+ );
4320
+ }
4321
+ };
4322
+ var registry = null;
4323
+ function getSlashCommandRegistry() {
4324
+ if (!registry) {
4325
+ registry = new SlashCommandRegistry();
4326
+ }
4327
+ return registry;
4328
+ }
4329
+
4234
4330
  // src/config/theme.ts
4235
4331
  var THEME = {
4236
4332
  // Primary backgrounds (dark purple tones)
@@ -4254,45 +4350,51 @@ var THEME = {
4254
4350
  // Purple-gray
4255
4351
  muted: "#6b6b7d",
4256
4352
  // Muted purple-gray
4257
- accent: "#b794f6"
4353
+ accent: "#b794f6",
4258
4354
  // Soft purple (pentesting identity)
4355
+ highlight: "#f0abfc"
4356
+ // Pink highlight
4259
4357
  },
4260
- // Status colors (cyber-security themed)
4358
+ // Status colors (cyber-security themed) - Enhanced!
4261
4359
  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"
4360
+ success: "#4ade80",
4361
+ // Bright green (shell access)
4362
+ warning: "#fbbf24",
4363
+ // Golden amber (vulnerabilities)
4364
+ error: "#f87171",
4365
+ // Coral red (failed)
4366
+ info: "#60a5fa",
4367
+ // Sky blue (scanning)
4368
+ running: "#a78bfa",
4271
4369
  // Violet (active operations)
4370
+ pending: "#facc15"
4371
+ // Yellow (waiting)
4272
4372
  },
4273
- // Severity colors (CVE-style)
4373
+ // Severity colors (CVE-style) - More vibrant!
4274
4374
  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)
4375
+ critical: "#ef4444",
4376
+ // Vivid red
4377
+ high: "#f97316",
4378
+ // Bright orange
4379
+ medium: "#eab308",
4380
+ // Vivid yellow
4381
+ low: "#22c55e",
4382
+ // Bright green
4383
+ info: "#8b5cf6"
4384
+ // Violet
4285
4385
  },
4286
4386
  // Border colors (purple-tinted)
4287
4387
  border: {
4288
4388
  default: "#2e2e42",
4289
4389
  // Subtle purple-gray
4290
- focus: "#8b5cf6",
4390
+ focus: "#a78bfa",
4291
4391
  // Violet focus
4292
- error: "#f87171"
4392
+ error: "#f87171",
4293
4393
  // Red error
4394
+ success: "#4ade80"
4395
+ // Green success
4294
4396
  },
4295
- // Phase colors (attack lifecycle)
4397
+ // Phase colors (attack lifecycle) - Vibrant gradient-inspired
4296
4398
  phase: {
4297
4399
  recon: "#818cf8",
4298
4400
  // Indigo (reconnaissance)
@@ -4300,14 +4402,40 @@ var THEME = {
4300
4402
  // Emerald (enumeration)
4301
4403
  vuln: "#fbbf24",
4302
4404
  // Amber (vulnerability)
4303
- exploit: "#f97316",
4405
+ exploit: "#fb923c",
4304
4406
  // Orange (exploitation)
4305
- privesc: "#ef4444",
4407
+ privesc: "#f87171",
4306
4408
  // Red (privilege escalation)
4307
- persist: "#a78bfa",
4409
+ persist: "#c084fc",
4308
4410
  // Purple (persistence)
4309
4411
  report: "#22d3ee"
4310
4412
  // Cyan (reporting)
4413
+ },
4414
+ // Rich accent colors for UI elements
4415
+ accent: {
4416
+ purple: "#a855f7",
4417
+ violet: "#8b5cf6",
4418
+ indigo: "#6366f1",
4419
+ blue: "#3b82f6",
4420
+ cyan: "#06b6d4",
4421
+ teal: "#14b8a6",
4422
+ emerald: "#10b981",
4423
+ green: "#22c55e",
4424
+ lime: "#84cc16",
4425
+ yellow: "#eab308",
4426
+ amber: "#f59e0b",
4427
+ orange: "#f97316",
4428
+ red: "#ef4444",
4429
+ pink: "#ec4899",
4430
+ rose: "#f43f5e"
4431
+ },
4432
+ // Gradients (for special UI elements)
4433
+ gradient: {
4434
+ purple: ["#7c3aed", "#a855f7"],
4435
+ cyber: ["#06b6d4", "#8b5cf6"],
4436
+ danger: ["#ef4444", "#f97316"],
4437
+ success: ["#10b981", "#22c55e"],
4438
+ gold: ["#f59e0b", "#fbbf24"]
4311
4439
  }
4312
4440
  };
4313
4441
  var ASCII_BANNER = `
@@ -4596,7 +4724,42 @@ var App = ({ autoApprove = false, target }) => {
4596
4724
  addMessage(MESSAGE_TYPE.ERROR, "No pending approval");
4597
4725
  }
4598
4726
  return;
4727
+ // kimi-cli inspired commands
4728
+ case "undo":
4729
+ case "u":
4730
+ addMessage(MESSAGE_TYPE.SYSTEM, "\u21A9\uFE0F Undo not yet integrated (context checkpoints)");
4731
+ return;
4732
+ case "checkpoint":
4733
+ case "cp":
4734
+ addMessage(MESSAGE_TYPE.SYSTEM, "\u{1F4CD} Checkpoint created");
4735
+ return;
4736
+ case "compact":
4737
+ addMessage(MESSAGE_TYPE.SYSTEM, "\u{1F5DC}\uFE0F Context compacted");
4738
+ return;
4739
+ case "status":
4740
+ const state2 = agent.getState();
4741
+ addMessage(MESSAGE_TYPE.SYSTEM, `\u{1F4CA} Status Report:
4742
+ Phase: ${state2.currentPhase}
4743
+ Iteration: ${state2.iteration}
4744
+ Findings: ${state2.findings.length}
4745
+ Compromised: ${state2.compromisedHosts.length}
4746
+ Tokens: ${tokenUsage.total.toLocaleString()}`);
4747
+ return;
4748
+ case "think":
4749
+ addMessage(MESSAGE_TYPE.SYSTEM, "\u{1F9E0} Thinking mode: Extended reasoning enabled");
4750
+ return;
4599
4751
  default:
4752
+ const slashRegistry = getSlashCommandRegistry();
4753
+ const slashCmd = slashRegistry.find(cmd);
4754
+ if (slashCmd) {
4755
+ try {
4756
+ const result = await slashCmd.handler(args.join(" "));
4757
+ addMessage(MESSAGE_TYPE.SYSTEM, result || `\u2713 /${cmd} executed`);
4758
+ } catch (e) {
4759
+ addMessage(MESSAGE_TYPE.ERROR, e instanceof Error ? e.message : String(e));
4760
+ }
4761
+ return;
4762
+ }
4600
4763
  const cmdResult = await agent.processCommand(trimmed);
4601
4764
  if (cmdResult) {
4602
4765
  addMessage(MESSAGE_TYPE.ASSISTANT, cmdResult);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pentesting",
3
- "version": "0.2.7",
3
+ "version": "0.3.1",
4
4
  "description": "Autonomous Penetration Testing AI Agent",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",