使用说明
mcp ldplayer
通过LDPlayer模拟器进行Android渗透测试的MCP服务器
这是什么?
A. 模型上下文协议(MCP) 将LDPlayer Android模拟器转换为完整渗透测试工作站的服务器。它暴露了 38工具 人工智能助手(Claude、Copilot等)可以通过自然语言调用来控制模拟器、运行ADB命令和执行Android安全评估。
零外部依赖。 纯Python 3.10+标准库。只需安装并运行。
建筑
┌──────────────────────────────────────────────────────────┐
│ AI Assistant (Claude, Copilot) │
│ ▼ MCP Protocol (stdio) │
├──────────────────────────────────────────────────────────┤
│ mcp-ldplayer Server │
│ ┌─────────────┐ ┌──────────────┐ ┌────────────────┐ │
│ │ LD Controller│ │Pentest Toolkit│ │ Frida Scripts │ │
│ │ (ldconsole) │ │ (22 tools) │ │ (6 built-in) │ │
│ └──────┬───────┘ └──────┬───────┘ └────────────────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌─────────────────────────────┐ │
│ │ LDPlayer 9 (ldconsole) │ │
│ │ + ADB 34.x │ │
│ └──────────┬──────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────┐ │
│ │ Android Emulator Instance │ │
│ │ (ARM/x86, rooted, ADB) │ │
│ └─────────────────────────────┘ │
└──────────────────────────────────────────────────────────┘
特性
仿真器管理(9个工具)
| 工具 | 说明 |
|---|---|
ld_list |
列出所有具有状态/PID的仿真器实例 |
ld_launch |
启动实例 |
ld_quit |
停止实例 |
ld_reboot |
重新启动实例 |
ld_create |
创建新实例 |
ld_modify |
更改CPU、内存、分辨率、根、标识 |
ld_screenshot |
截图 |
ld_backup |
完整实例备份 |
ld_restore |
恢复备份 |
ADB命令(7个工具)
| 工具 | 说明 |
|---|---|
adb_shell |
执行任何shell命令(带可选根) |
adb_install |
安装APK |
adb_pull |
从模拟器中拉取文件 |
adb_push |
将文件推送到模拟器 |
adb_packages |
列出已安装的软件包 |
adb_launch_app |
按包名打开应用程序 |
adb_kill_app |
关闭正在运行的应用程序 |
最顶级的阿森纳(22工具)
| 工具 | 说明 |
|---|---|
pt_recon |
全设备侦察(30+个属性) |
pt_network_scan |
网络扫描:接口、路由、DNS、连接、端口 |
pt_port_scan |
从仿真器进行端口扫描(不需要nmap) |
pt_apk_analyze |
深度APK分析:权限、组件、风险评分 |
pt_apk_extract |
提取APK进行本地分析(jadx,apktool) |
pt_traffic_start |
启动数据包捕获(tcpdump→ pcap) |
pt_traffic_stop |
停止捕获并下载pcap |
pt_proxy_setup |
使用iptables配置代理(Burp/mitmproxy/ZAP) |
pt_proxy_remove |
删除代理配置 |
pt_frida_inject |
注入内置Frida脚本 |
pt_frida_custom |
注入自定义JavaScript Frida脚本 |
pt_ssl_bypass |
SSL钉扎旁路(OkHttp3、TrustManager、WebView、Conscrypt) |
pt_root_bypass |
根检测旁路(File.exists、Runtime.exec、Build.TAGS) |
pt_cert_install |
在系统信任存储中安装CA证书 |
pt_cert_list |
列出已安装的CA证书 |
pt_intent_fuzz |
使用XSS、SQLi、路径遍历有效载荷进行意图模糊测试 |
pt_deeplink_test |
测试从清单中提取的深度链接 |
pt_spoof_device |
假冒身份(三星/像素/小米/华为/oneplus) |
pt_security_assessment |
Drozer式安全审计 |
pt_logcat |
日志捕获与敏感数据检测 |
pt_filesystem |
应用程序文件系统分析(根) |
pt_gps_spoof |
GPS位置欺骗 |
内置Frida脚本
| 脚本 | 它的作用 |
|---|---|
ssl_bypass |
绕过SSL固定(TrustManager、OkHttp3、WebView、Conscrypt) |
root_bypass |
旁路根检测(su检查、Build.TAGS、SystemProperties) |
keylogger |
监视所有EditText输入事件 |
crypto_hook |
拦截密码加密/解密+共享引用读取 |
network_hook |
监控OkHttp3请求和URL.openConnection |
anti_debug |
绕过Debug.isDebugger已连接和TracerPid检查 |
安装
先决条件
- Python 3.10+
- LDPlayer 9 已安装(在公共路径上自动检测)
- 视窗 (LDPlayer仅适用于Windows)
设置
# Clone
git clone https://github.com/ThiagoFrag/mcp-ldplayer.git
cd mcp-ldplayer
# Install (optional, can run directly)
pip install -e .
在VS代码中配置
添加到您的 .vscode/mcp.json:
{
"mcpServers": {
"pt-ldplayer": {
"command": "python",
"args": ["path/to/mcp-ldplayer/mcp_ldplayer/mcp_server.py"]
}
}
}
或者,如果通过pip安装:
{
"mcpServers": {
"pt-ldplayer": {
"command": "mcp-ldplayer"
}
}
}
在Claude桌面中配置
添加 claude_desktop_config.json:
{
"mcpServers": {
"pt-ldplayer": {
"command": "python",
"args": ["C:/path/to/mcp-ldplayer/mcp_ldplayer/mcp_server.py"]
}
}
}
用法
通过AI助手
配置后,自然地问:
“列出我的LDPlayer实例”
“在com.example.app上运行完整的安全评估”
“使用SSL旁路在10.0.2.2:8080上设置Burp Suite代理”
“这款模拟器冒充三星Galaxy S21”
“捕获网络流量60秒并下载pcap”
“Fuzz导出了com.target.app的所有意图”
通过CLI
# List all 38 tools
python -m mcp_ldplayer.mcp_server --list-tools
# Run as MCP server (stdio)
python -m mcp_ldplayer.mcp_server
# Specify LDPlayer path manually
python -m mcp_ldplayer.mcp_server --ldplayer-path "D:\LDPlayer\LDPlayer9"
通过Python
from mcp_ldplayer import LDController, PentestToolkit
# Auto-detect LDPlayer
ld = LDController()
# List instances
for instance in ld.list_instances():
print(f"{instance.name}: {instance.status}")
# Pentest toolkit
pt = PentestToolkit(ld)
# Device reconnaissance
recon = pt.device_recon("LDPlayer")
# Security assessment
audit = pt.security_assessment("LDPlayer", "com.target.app")
# SSL bypass
bypass = pt.inject_frida_script("LDPlayer", "ssl_bypass", "com.target.app")
最重要的工作流程
完整应用程序评估
1. pt_recon → Device info + security posture
2. pt_apk_analyze → Permissions, components, risk
3. pt_security_assessment → Drozer-style audit
4. pt_intent_fuzz → Test exported activities
5. pt_deeplink_test → Test URI schemes
6. pt_logcat → Check for sensitive data leaks
7. pt_filesystem → Analyze app data directory
交通拦截
1. pt_proxy_setup → Configure Burp/mitmproxy
2. pt_cert_install → Install CA cert in system store
3. pt_ssl_bypass → Bypass SSL pinning
4. pt_traffic_start → Start packet capture
5. [interact with app]
6. pt_traffic_stop → Download pcap for Wireshark
隐身模式
1. pt_spoof_device → Change IMEI, MAC, model
2. pt_root_bypass → Hide root from apps
3. pt_gps_spoof → Fake location
4. pt_frida_inject anti_debug → Bypass debugger detection
MCP资源
| URI | 描述 |
|---|---|
pt-ldplayer://status |
服务器状态、LDPlayer路径、实例 |
pt-ldplayer://frida-scripts |
可用的Frida脚本及其预览 |
MCP提示
| 提示 | 描述 |
|---|---|
pentest_app |
应用程序的完整渗透测试工作流程 |
setup_intercept |
配置拦截环境 |
stealth_mode |
配置模拟器隐身 |
项目结构
mcp-ldplayer/
├── mcp_ldplayer/
│ ├── __init__.py # Package exports
│ ├── ld_controller.py # LDPlayer interface (ldconsole + ADB)
│ ├── pentest_toolkit.py # Pentest arsenal (22 tools)
│ └── mcp_server.py # MCP protocol server (38 tools)
├── frida_scripts/
│ ├── ssl_bypass.js # SSL Pinning bypass
│ ├── root_bypass.js # Root detection bypass
│ ├── keylogger.js # Input monitoring
│ ├── crypto_hook.js # Crypto + SharedPrefs interception
│ ├── network_hook.js # HTTP/HTTPS monitoring
│ └── anti_debug.js # Anti-debug bypass
├── examples/
│ ├── quick_test.py # Quick connectivity test
│ ├── pentest_workflow.py # Full pentest example
│ └── intercept_setup.py # Traffic interception setup
├── tests/
│ ├── test_controller.py # LDController unit tests
│ ├── test_toolkit.py # PentestToolkit unit tests
│ └── test_mcp_protocol.py # MCP protocol compliance tests
├── pyproject.toml
├── requirements.txt
├── LICENSE
└── README.md
LDPlayer路径自动检测
服务器按顺序搜索这些路径:
C:\LDPlayer\LDPlayer9C:\LDPlayer\LDPlayer4.0C:\Program Files\LDPlayer\LDPlayer9C:\Program Files (x86)\LDPlayer\LDPlayer9%LOCALAPPDATA%\LDPlayer\LDPlayer9D:\LDPlayer\LDPlayer9
覆盖 --ldplayer-path 如果安装在其他地方。
协议遵从
根据MCP规范进行测试 2024-11-05:
| 测试 | 状态 |
|---|---|
initialize 握手 |
好 |
tools/list (38个工具) |
好 |
resources/list (2个资源) |
好 |
prompts/list (3个提示) |
确定 |
resources/read (两个URI) |
好 |
tools/call 发货 |
好 |
| 错误处理(-32601、-32603) | 正常 |
| 未知方法拒绝 | 正常 |
CLI --list-tools 好的 |
安全通知
此工具专为 仅限授权安全测试。负责任地使用,仅在您有权测试的系统上使用。作者不对误用负责。
许可证
作者
蒂亚戈弗拉格 - GitHub