使用说明
🔐 KaliBot-基于人工智能的渗透测试助手
Conversational AI assistant for Kali Linux security tools via Telegram
Features • Installation • Usage • Architecture • Extending
概述
KaliBotMCP将Kali Linux渗透测试工具的强大功能与OpenAI的GPT模型和模型上下文协议(MCP)相结合,创建了一个可通过Telegram访问的智能会话安全助手。
用户可以使用哥伦比亚西班牙语的自然语言与安全工具进行交互,而不是记忆复杂的命令语法,这使得渗透测试更容易访问,同时保持了原生Kali工具的全部功能。
特性
🤖 自然语言接口
- 自然地说话以执行复杂的安全工具
- GPT-4驱动的哥伦比亚西班牙语会话AI
- 情境意识维护对话历史
- 安全概念的教育解释
🛠️ 渗透测试工具集
- 网络扫描 -马萨诸塞州nmap
- 网站分析 -nikto、gobuster、sqlmap、whatweb
- 密码破解 -九头蛇、约翰、哈士猫
- 无线安全 -爱尔兰航空公司
- 剥削 -msfvenom,元绘图
- 侦察 -谁,挖,收割者
📦 系统操作
- 下载文件和克隆存储库
- 通过apt、pip、gem、npm、cargo安装软件包
- 读取、移动和复制系统文件
- 可选的sudo密码集成
💬 电报集成
- 移动优先接口
- 交互式命令按钮
- 用户访问控制
- 长输出分页
安装
先决条件
- Kali Linux/Dian/Ubuntu
- Python 3.10+
- Telegram Bot令牌(从@BotFather获取)
- OpenAI API密钥(从platform.openai.com获取)
设置
克隆存储库:
git clone https://github.com/3p1c0w3nd/kali-linux-mcp.git
cd kali-linux-mcp/v2
创建虚拟环境:
python3 -m venv .venv
source .venv/bin/activate
安装依赖项:
pip install -r requirements.txt
配置环境:
cp .env.example .env
nano .env
在中设置您的凭据 .env:
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_ALLOWED_USERS=your_user_id_here
OPENAI_API_KEY=sk-your_api_key_here
OPENAI_MODEL=gpt-4o-mini
从以下位置获取您的Telegram用户ID @用户信息机器人
运行机器人:
python3 main.py
用法
自然语言示例
User: hola
Bot: ¡Qué más parce! 👋 Soy Blizzacjk, your pentesting assistant...
User: scan google.com for open ports
Bot: Scanning ports 1-1000 on google.com with Nmap...
[Executes: nmap -p 1-1000 google.com]
User: download seclists
Bot: Downloading complete SecLists repository (~1GB)...
[Clones: https://github.com/danielmiessler/SecLists.git]
User: install hashcat
Bot: Installing hashcat via apt...
[Executes: sudo apt install hashcat]
User: read /etc/hosts
Bot: Reading /etc/hosts...
[Displays file contents]
直接命令
| 命令 | 描述 |
|---|---|
/tools |
列出所有已安装的工具 |
/categories |
按类别浏览工具 |
/status |
系统状态(AI、工具) |
/clear |
清晰的AI背景 |
/help |
完整帮助菜单 |
建筑
┌─────────────────┐
│ Telegram │
│ Interface │
└────────┬────────┘
│
▼
┌─────────────────┐
│ telegram_bot │ ← User validation, routing
└────────┬────────┘
│
▼
┌─────────────────┐
│ ai_assistant │ ← OpenAI GPT-4, NLP
└────────┬────────┘
│
▼
┌─────────────────┐
│ tool_executor │ ← Command execution
└────────┬────────┘
│
┌────┴────┐
▼ ▼
┌─────────┐ ┌──────────────┐
│tool_sys │ │tool_discovery│
│• DL │ │• Detection │
│• PKG │ │• Cataloging │
└─────────┘ └──────────────┘
核心模块
| 文件 | 责任 |
|---|---|
main.py |
入口点,机器人初始化 |
telegram_bot.py |
电报接口、消息处理 |
ai_assistant.py |
OpenAI集成,JSON解析 |
tool_executor.py |
Kali Linux工具执行 |
tool_system.py |
系统操作(下载、安装) |
tool_discovery.py |
自动刀具检测 |
config.py |
集中配置 |
延伸
添加新工具
1.注册 tool_discovery.py
添加到 common_kali_tools 字典:
self.common_kali_tools = {
# ...
"subfinder": {
"category": "info_gathering",
"description": "Subdomain discovery tool"
},
}
可用类别: reconnaissance, scanning, web_scan, exploitation, password, wireless, sniffing, forensics, info_gathering
2.在中创建执行器 tool_executor.py
async def execute_subfinder(self, params: Dict) -> str:
"""Execute subfinder for subdomain discovery"""
domain = params["domain"]
output = params.get("output", f"{domain}_subdomains.txt")
command = f"subfinder -d {domain} -o {output}"
if params.get("silent"):
command += " -silent"
result = await self.run_command(command, timeout=300)
if result.get("success") and os.path.exists(output):
lines = open(output).readlines()
result["subdomains_found"] = len(lines)
result["output_file"] = output
return self._format_result(result)
3.登记执行人
在 execute_tool 方法,添加到 tool_methods:
tool_methods = {
"nmap": self.execute_nmap,
"subfinder": self.execute_subfinder,
# ...
}
4.更新AI提示
添加示例至 prompts/ai_assistant.txt:
Usuario: "busca subdominios de example.com"
{"tool": "subfinder", "parameters": {"domain": "example.com"}, "explanation": "Buscando subdominios de example.com con subfinder"}
5.重启机器人
pkill -f main.py
python3 main.py
移除工具
1.删除 tool_discovery.py
从以下位置移除工具入口 common_kali_tools
2.删除执行器(如果存在)
删除 execute_* 方法从 tool_executor.py
3.从映射中删除
从中删除 tool_methods 词典
4.更新提示
从中删除示例 prompts/ai_assistant.txt
安全
⚠️ 警告: 这是一个仅用于受控测试环境的实验项目。
最佳实践
- 仅在授权的测试环境中使用
- 通过以下方式限制用户访问
TELEGRAM_ALLOWED_USERS - 避免储存
ROOT_PASSWORD生产中 - 仅在专用Kali Linux系统上运行
- 在渗透测试之前,始终获得书面授权
ROOT_PASSWORD配置
对于开发,您可以设置:
ROOT_PASSWORD=your_password
推荐: 改为配置无密码sudo:
sudo visudo
# Add:
your_username ALL=(ALL) NOPASSWD: ALL
资源
贡献
欢迎投稿!感兴趣的领域:
- 其他工具执行器(Burp Suite CLI、高级SQLMap等)
- 输入净化改进
- 限速实施
- Web界面替代方案
- 文档和教程
流程:
- 分叉存储库
- 创建特征分支(
git checkout -b feature/new-tool) - 提交更改(
git commit -am 'Add new tool') - 推送到分支(
git push origin feature/new-tool) - 打开拉取请求
许可证
这个项目是开源的,可以在MIT许可证下使用。
免责声明
这个项目是 仅用于教育和研究目的未经明确书面授权使用渗透测试工具 非法的 在大多数司法管辖区。
作者不对误用此软件负责。始终践行道德黑客行为并获得适当的认证(OSCP、CEH等)。
仅在以下情况下使用KaliBotMCP:
- 您自己的系统
- 授权测试环境(HackTheBox、TryHackMe)
- 合法签约的安全审计
致谢
- 进攻性安全 -Kali Linux
- 开放人工智能 -GPT模型
- python电报机器人 -电报API
Made with ❤️ by 3p1c0w3nd