PST MCP服务器 是一个轻量级API桥接器,旨在连接MCP客户端(如Cherry Studio、Claude Desktop)到API服务器,从而在Windows终端上执行命令。这使得AI代理或AI客户端能够无缝调用Windows环境中的各种渗透测试工具,实现AI辅助渗透测试。
这使AI能够运行终端工具如nmap、ehole等,并通过curl、gobuster等工具与Web应用程序交互,在实时解决CTF Web挑战的同时,协助解决HTB或THM上的机器。
pst_server.py: Windows API服务器(端点:/api/tools/<tool>,/api/command,/health)mcp_server.py: MCP客户端,封装工具为MCP工具并转发至API服务器目标是通过以下方式启用AI驱动的进攻性安全测试:
curl、nmap、ehole等),并接收结构化的输出。curl和其他AI需要的工具捕获旗帜。git clone https://github.com/arch3rPro/MCP-PST-Server.git
cd MCP-PST-Server
pip install -r requirements.txt
python3 pst_server.py
python3 /绝对路径/to/mcp_server.py http://WINDOWS_IP:5100编辑claude_desktop_config.json
{
"mcpServers": {
"pst_mcp": {
"command": "python3",
"args": [
"/绝对路径/to/mcp_server.py",
"--server",
"http://WINDOWS_IP:5100/"
]
}
}
}
{
"mcpServers": {
"PST-MCP": {
"name": "pst_mcp",
"type": "stdio",
"isActive": true,
"command": "python3",
"args": [
"/绝对路径/to/mcp_server.py",
"--server",
"http://localhost:5100"
]
}
}
}
scoop bucket add ar https://github.com/arch3rPro/PST-Bucketscoop install nmap httpx ffuf feroxbuster fscan hydra hackbrowserdatascoop install subfinder dnsx naabu nuclei katana bbotscoop install masscan nikto gobuster john eholescoop install metasploit(如果不可用,请参阅官方安装程序)pip install sqlmapncat(随nmap一起安装),或nc(可选)建议:使用Pentest-Windows环境镜像(带有许多工具):https://github.com/arch3rPro/Pentest-Windows
PST API服务器支持各种命令行选项用于配置:
python pst_server.py [选项]
--host 主机地址:服务器主机地址(默认:0.0.0.0)--port 端口号:服务器端口号(默认:5100)--timeout 秒数:命令执行超时时间(秒)(默认:180)--debug:启用调试模式以进行详细日志记录/绝对路径/to/MCP-PST-Serverpython pst_server.pypython pst_server.py --host 0.0.0.0 --port 15100 --timeout 300 --debugInvoke-RestMethod -Uri http://localhost:5100/health -Method GETMCP服务器支持多种传输模式,并可通过各种参数进行配置:
python mcp_server.py [选项]
--server URL:PST API服务器URL(默认:http://localhost:5100)--timeout 秒数:请求超时时间(秒)(默认:300)--host 主机地址:MCP服务器主机(默认:127.0.0.1)--port 端口号:MCP服务器端口(默认:8000)--path 路径:stdio模式下MCP服务器访问路径(默认:/mcp)--transport 模式:传输模式 - studio(stdio)、sse或http(默认:studio)--debug:启用调试日志记录STDIO模式(默认):
python3 mcp_server.py --server http://localhost:5100 --debug
SSE模式:
python3 mcp_server.py --server http://localhost:5100 --transport sse --host 0.0.0.0 --port 8000 --path /sse
HTTP模式:
python3 mcp_server.py --server http://localhost:5100 --transport http --host 0.0.0.0 --port 8000 --path /mcp
Nmap:
$body = @{ target="scanme.nmap.org"; scan_type="-sV"; ports=""; additional_args="-T4 -Pn" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/nmap -Method POST -Body $body -ContentType "application/json"
FFUF:
$body = @{ url="http://目标"; wordlist="C:\wordlists\common.txt"; additional_args="" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/ffuf -Method POST -Body $body -ContentType "application/json"
ProjectDiscovery:
# Subfinder
$body = @{ domain="example.com"; list_file=""; additional_args="-all -silent" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/subfinder -Method POST -Body $body -ContentType "application/json"
# DNSX
$body = @{ domain="example.com"; list_file=""; additional_args="-a -resp -silent" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/dnsx -Method POST -Body $body -ContentType "application/json"
# Naabu
$body = @{ host="example.com"; list_file=""; ports=""; additional_args="-silent" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/naabu -Method POST -Body $body -ContentType "application/json"
# Nuclei
$body = @{ target="http://example.com"; list_file=""; template=""; tags=""; severity=""; additional_args="-silent" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/nuclei -Method POST -Body $body -ContentType "application/json"
# Katana
$body = @{ url="http://example.com"; list_file=""; depth="3"; additional_args="-silent" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/katana -Method POST -Body $body -ContentType "application/json"
Afrog:
$body = @{ target="http://example.com"; list_file=""; pocs=""; additional_args="" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/afrog -Method POST -Body $body -ContentType "application/json"
Ehole(指纹识别):
$body = @{ target="http://example.com"; list_file=""; fingerprints=""; output=""; additional_args="" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/ehole -Method POST -Body $body -ContentType "application/json"
Nikto:
$body = @{ target="http://example.com"; port=""; ssl=$false; additional_args="" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/nikto -Method POST -Body $body -ContentType "application/json"
Gobuster(目录模式):
$body = @{ mode="dir"; url="http://example.com"; wordlist="C:\wordlists\common.txt"; additional_args="" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/gobuster -Method POST -Body $body -ContentType "application/json"
Masscan:
$body = @{ target="192.168.1.0/24"; ports="80,443"; rate="1000"; iface=""; additional_args="" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/masscan -Method POST -Body $body -ContentType "application/json"
John(破解示例):
$body = @{ hash_file="C:\hashes\passwd.txt"; wordlist="C:\wordlists\rockyou.txt"; format=""; mask=""; rules=$false; additional_args="" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/john -Method POST -Body $body -ContentType "application/json"
Metasploit(msfconsole -x):
$body = @{ msf_cmd="version; exit"; rc_file=""; additional_args="" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/metasploit -Method POST -Body $body -ContentType "application/json"
Netcat:
# 监听
$body = @{ mode="listen"; listen_port="4444"; additional_args="" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/netcat -Method POST -Body $body -ContentType "application/json"
# 连接
$body = @{ mode="client"; host="127.0.0.1"; port="4444"; additional_args="" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/netcat -Method POST -Body $body -ContentType "application/json"
BBOT(递归互联网扫描器):
# 使用预设
$body = @{ target="example.com"; preset="web-basic"; additional_args="" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/bbot -Method POST -Body $body -ContentType "application/json"
# 使用特定模块
$body = @{ target="example.com"; modules="subfinder-enum,dnsx-resolve,nmap-portscan"; additional_args="" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/bbot -Method POST -Body $body -ContentType "application/json"
# 带输出目录
$body = @{ target="example.com"; preset="cloud-enum"; output_dir="C:\bbot_output"; additional_args="" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/tools/bbot -Method POST -Body $body -ContentType "application/json"
通用命令:
$body = @{ command="whoami" } | ConvertTo-Json
Invoke-RestMethod -Uri http://localhost:5100/api/command -Method POST -Body $body -ContentType "application/json"
--timeout进行调整。afrog、ehole、fscan等)。本项目仅用于教育和道德测试目的。任何对提供的信息或工具的滥用——包括未经授权的访问、利用或恶意活动——都是严格禁止的。 作者不对任何滥用行为负责。