nelsonamp/pentestgpt-gemini

GitHub: nelsonamp/pentestgpt-gemini

基于Gemini AI的渗透测试CLI助手,提供从侦察到报告全流程的智能指导与多格式输出。

Stars: 1 | Forks: 0

``` ██████╗ ███████╗███╗ ██╗████████╗███████╗███████╗████████╗ ██████╗ ██████╗ ████████╗ ██╔══██╗██╔════╝████╗ ██║╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝██╔════╝ ██╔══██╗╚══██╔══╝ ██████╔╝█████╗ ██╔██╗ ██║ ██║ █████╗ ███████╗ ██║ ██║ ███╗██████╔╝ ██║ ██╔═══╝ ██╔══╝ ██║╚██╗██║ ██║ ██╔══╝ ╚════██║ ██║ ██║ ██║██╔═══╝ ██║ ██║ ███████╗██║ ╚████║ ██║ ███████╗███████║ ██║ ╚██████╔╝██║ ██║ ╚═╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ``` ### **Gemini AI 驱动的渗透测试助手** *开发者 [Nelson Abner Mendoza Pérez](https://github.com/nelsonamp) · 改编自 [PentestGPT original](https://github.com/grupooruss/PentestGPT-Cornell.git)* [![Python](https://img.shields.io/badge/Python-3.6+-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://python.org) [![Gemini AI](https://img.shields.io/badge/Gemini_AI-2.0_Flash-8E75B2?style=for-the-badge&logo=google&logoColor=white)](https://ai.google.dev) [![License](https://img.shields.io/badge/License-MIT-22c55e?style=for-the-badge)](LICENSE) [![Status](https://img.shields.io/badge/Estado-Estable-16a34a?style=for-the-badge)](https://github.com/nelsonamp/pentestgpt-gemini) [![Ethical](https://img.shields.io/badge/Uso-Solo_Ético-dc2626?style=for-the-badge&logo=shield&logoColor=white)](#-道德使用声明)
## ⚠️ 道德使用声明 ## 什么是 PentestGPT with Gemini AI? PentestGPT with Gemini AI 是一款命令行工具,旨在协助网络安全专业人员和渗透测试人员处理日常工作。它集成了 Google 的 `gemini-2.0-flash-thinking-exp` 模型,该模型具备深度推理能力,可指导安全评估的每个阶段:从侦察到最终报告的编写。 本项目是 [PentestGPT original](https://github.com/grupooruss/PentestGPT-Cornell.git) 的改编版,将 ChatGPT API 替换为 Gemini API,并在输出格式、分类支持和配置灵活性方面进行了额外改进。 ## 主要功能 | 功能 | 描述 | |---|---| | 🤖 **先进 AI 引擎** | 使用 `gemini-2.0-flash-thinking-exp`,针对复杂技术推理进行了优化 | | 💻 **命令行界面** | 支持交互模式和通过参数直接查询的模式 | | 🗂️ **专业分类** | 支持 11 个具有特定上下文的渗透测试分类 | | 📄 **多种输出格式** | 支持导出纯文本、Markdown、JSON 和 HTML 格式 | | 💾 **保存回复** | 使用单个参数即可将结果直接保存到文件中 | | ⚙️ **灵活配置** | 可通过 CLI 调整温度、最大 token 数和分类 | ## 系统要求 - **Python** 3.6 或更高版本 - **互联网连接**(用于访问 Gemini API) - **Gemini API 密钥**(默认包含在 `.env` 中) ## 安装 ### 1. 克隆仓库 ``` git clone https://github.com/nelsonamp/pentestgpt-gemini.git cd pentestgpt-gemini ``` ### 2. 安装依赖 ``` pip install -r requirements.txt ``` ### 3. 配置 API 密钥 *(可选)* 项目在 `.env` 文件中包含一个预配置的 API 密钥。如果你想使用自己的密钥: ``` # 编辑 .env 文件 nano .env # 更改以下值: GEMINI_API_KEY=tu_clave_api_aqui ``` ## 用法 ### 交互模式 以对话模式启动助手: ``` python main.py ``` 进入后,你可以自由输入查询。输入 `exit` 或 `quit` 退出。 ### 命令模式(单次查询) ``` python main.py --query "Explica cómo realizar un escaneo de puertos con nmap" # 或简写形式: python main.py -q "Explica cómo realizar un escaneo de puertos con nmap" ``` ### 参数参考 | 参数 | 缩写 | 类型 | 描述 | |---|---|---|---| | `--query` | `-q` | `string` | 对模型的直接查询 | | `--category` | `-c` | `string` | 渗透测试分类(见下方列表) | | `--temperature` | `-t` | `float` | 模型的创造力:`0.0`(精确)到 `1.0`(创造性) | | `--max-tokens` | `-m` | `int` | 回复中的最大 token 数 | | `--output-file` | `-o` | `string` | 用于保存回复的文件路径 | | `--output-format` | `-f` | `string` | 输出格式:`text`、`markdown`、`json`、`html` | ## 使用示例 ``` # 简单查询 python main.py -q "¿Cómo puedo realizar un análisis de vulnerabilidades en una red?" # 在特定 Category 中查询 python main.py -q "Mejores herramientas para recolectar información OSINT" -c reconnaissance # 将响应保存为 Markdown python main.py -q "Técnicas de evasión de IDS/IPS" -f markdown -o informe_evasion.md # 低 Temperature 的 JSON 响应(更精确) python main.py -q "Explica el ataque SQL Injection" -f json -t 0.2 -o sqli.json # 限制 Token 以获得简短响应 python main.py -q "¿Qué es un ataque de fuerza bruta?" -m 512 # 完整流程:Category + 格式 + 文件 python main.py -q "Plan de explotación para un servidor Apache desactualizado" \ -c exploitation -f markdown -o reporte_apache.md ``` ## 支持的渗透测试分类 每个分类都会调整模型的上下文,以获得更精确和相关的回复: | 分类 | 描述 | |---|---| | `reconnaissance` | 被动和主动信息收集,OSINT | | `scanning` | 端口、服务和操作系统扫描 | | `vulnerability_assessment` | 漏洞识别与评估 | | `exploitation` | 漏洞利用技术 | | `post_exploitation` | 横向移动、持久化和权限提升 | | `reporting` | 技术和执行报告撰写 | | `social_engineering` | 钓鱼、借口攻击和人为操纵 | | `web_application` | OWASP Top 10,Web 应用程序测试 | | `network` | 网络攻击与分析 | | `wireless` | Wi-Fi 网络安全(WPA2、WPS、握手) | | `mobile` | Android 和 iOS 应用程序测试 | ## 项目结构 ``` pentestgpt-gemini/ ├── main.py # Punto de entrada principal ├── requirements.txt # Dependencias del proyecto ├── .env # Configuración de la clave API ├── README.md # Documentación └── modules/ ├── gemini_client.py # Cliente de la API de Gemini ├── categories.py # Definición de categorías de pentesting └── output.py # Formateadores de salida ``` ## 安全说明与最佳实践 - 🔒 **不要公开分享你的 API 密钥**,也不要将其上传到未受保护的仓库。 - 🧪 **仅在受控环境中测试**:自己的实验室、虚拟机(TryHackMe、HackTheBox、VulnHub)。 - 📝 **始终与客户或系统所有者记录测试范围**。 - 🚫 **切勿在未经书面授权的情况下**在真实系统上使用此工具。 ## 许可证 根据 **MIT** 许可证分发。有关详细信息,请参阅 [`LICENSE`](LICENSE) 文件。
*出于教育目的制作 · 请负责任地使用*
标签:CLI 工具, DLL 劫持, PentestGPT 适配, Python, 人工智能, 大语言模型, 安全咨询, 密码管理, 插件系统, 攻击模拟, 文档结构分析, 无后门, 用户模式Hook绕过, 网络安全, 聊天机器人, 自动化报告, 逆向工具, 隐私保护, 驱动签名利用