sec-netexec-mcp
An MCP server that enables AI assistants to execute NetExec network penetration testing commands via SSH to a Kali Linux machine, supporting protocols like SMB, WinRM, SSH, LDAP, and more.
README
NetExec MCP Server
A Model Context Protocol (MCP) server that provides AI assistants with access to NetExec (nxc), the powerful network execution and penetration testing tool formerly known as CrackMapExec.
Features
This MCP server enables AI assistants to execute NetExec commands via SSH to a Kali Linux machine, supporting:
| Protocol | Capabilities |
|---|---|
| SMB | Windows enumeration, credential dumping (SAM/LSA/NTDS), command execution, pass-the-hash |
| WinRM | Remote Windows management, PowerShell execution, credential dumping |
| SSH | Linux/Unix authentication, key-based auth, remote command execution |
| LDAP | Active Directory enumeration, Kerberoasting, ASREPRoast, BloodHound collection |
| MSSQL | SQL Server queries, xp_cmdshell execution, login enumeration |
| RDP | Credential validation, screenshot capture |
| WMI | Windows Management Instrumentation command execution |
Additional features:
- Password spraying across all protocols
- Module management and execution
- SMB share enumeration and file operations
- NetExec credential database queries
Prerequisites
- Node.js 18+
- SSH access to a Kali Linux machine with NetExec installed
- SSH key-based authentication (recommended) or password
Installation
# Clone the repository
git clone https://github.com/schwarztim/sec-netexec-mcp.git
cd sec-netexec-mcp
# Install dependencies
npm install
# Build the project
npm run build
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
KALI_HOST |
SSH hostname or IP for Kali machine | kali |
SSH_USER |
SSH username | (none) |
SSH_KEY |
Path to SSH private key file | (none) |
SSH_TIMEOUT |
Command timeout in seconds | 300 |
Claude Desktop Configuration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"netexec": {
"command": "node",
"args": ["/path/to/sec-netexec-mcp/dist/index.js"],
"env": {
"KALI_HOST": "your-kali-host",
"SSH_USER": "kali",
"SSH_KEY": "/path/to/ssh/key"
}
}
}
}
Available Tools
nxc_smb
SMB protocol operations including enumeration, share listing, user/group/session enumeration, credential dumping (SAM, LSA, NTDS), and command execution.
nxc_winrm
WinRM remote management for authentication testing, cmd/PowerShell execution, and credential dumping.
nxc_ssh
SSH protocol for authentication testing, key-based auth, and remote command execution.
nxc_ldap
LDAP/Active Directory operations including user/group/computer enumeration, Kerberoasting, ASREPRoast, BloodHound collection, and trust enumeration.
nxc_mssql
SQL Server operations including queries, xp_cmdshell execution, and login enumeration.
nxc_rdp
RDP credential validation and screenshot capture.
nxc_wmi
WMI-based command execution on Windows targets.
nxc_modules
List and query available NetExec modules for each protocol.
nxc_spray
Password spraying with configurable options including user/password lists, jitter, and continue-on-success.
nxc_shares
SMB share enumeration and file operations (spider, get, put).
nxc_raw
Execute raw NetExec commands for advanced scenarios not covered by other tools.
nxc_database
Query the NetExec credential database for stored hosts and credentials.
Usage Examples
Enumerate SMB Hosts
{
"tool": "nxc_smb",
"arguments": {
"target": "192.168.1.0/24"
}
}
List Shares with Credentials
{
"tool": "nxc_smb",
"arguments": {
"target": "192.168.1.10",
"username": "admin",
"password": "P@ssw0rd",
"domain": "CORP",
"action": "shares"
}
}
Pass-the-Hash Attack
{
"tool": "nxc_smb",
"arguments": {
"target": "192.168.1.10",
"username": "admin",
"hash": "aad3b435b51404eeaad3b435b51404ee:5fbc3d5fec8206a30f4b6c473d68ae76",
"domain": "CORP",
"action": "shares"
}
}
Password Spray
{
"tool": "nxc_spray",
"arguments": {
"protocol": "smb",
"target": "192.168.1.0/24",
"userList": "/tmp/users.txt",
"password": "Summer2024!",
"domain": "CORP",
"continueOnSuccess": true
}
}
BloodHound Collection
{
"tool": "nxc_ldap",
"arguments": {
"target": "dc01.corp.local",
"username": "user",
"password": "password",
"domain": "CORP",
"action": "bloodhound",
"bloodhoundCollection": "All"
}
}
Dump NTDS from Domain Controller
{
"tool": "nxc_smb",
"arguments": {
"target": "dc01.corp.local",
"username": "admin",
"password": "P@ssw0rd",
"domain": "CORP",
"action": "ntds"
}
}
Security Considerations
This tool is intended for authorized security testing only. Always ensure you have:
- Written authorization to test target systems
- Proper scope definition for penetration testing engagements
- Compliance with applicable laws and regulations
Never use this tool against systems you do not have explicit permission to test.
Development
# Watch mode for development
npm run dev
# Build for production
npm run build
# Start the server
npm start
Architecture
┌─────────────────┐ ┌──────────────────┐ ┌────────────────┐
│ AI Assistant │────▶│ NetExec MCP │────▶│ Kali Linux │
│ (Claude, etc.) │ │ Server (Node.js)│ SSH │ (nxc) │
└─────────────────┘ └──────────────────┘ └────────────────┘
│
│ stdio
▼
┌──────────────┐
│ MCP Protocol │
└──────────────┘
References
- NetExec Official Wiki
- NetExec GitHub Repository
- Model Context Protocol
- NetExec Cheat Sheet
- Kali Linux NetExec
License
This project is licensed under the MIT License - see the LICENSE file for details.
Disclaimer
This software is provided for educational and authorized security testing purposes only. The authors are not responsible for any misuse or damage caused by this program. Users are responsible for ensuring compliance with all applicable laws and regulations.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。