DavidJara1998/PenScope
GitHub: DavidJara1998/PenScope
一个用 Python 编写的 Web 渗透测试工具包,将侦察、漏洞扫描、目录爆破和子域名枚举整合为一条命令自动完成,并可导出结构化报告。
Stars: 0 | Forks: 0
# PenScope — Web 渗透测试工具包
```
____ _____ _ _ ____ ____ ___ ____ _____
| _ \| ____| \ | / ___| / ___/ _ \| _ \| ____|
| |_) | _| | \| \___ \| | | | | | |_) | _|
| __/| |___| |\ |___) | |__| |_| | __/| |___
|_| |_____|_| \_|____/ \____\___/|_| |_____|
Web Pentesting Toolkit v1.0
```
## 功能简介
PenScope 自动化执行 Web 渗透测试的**初始侦察和扫描阶段**。指定目标后,它将按顺序运行四个模块:
| 模块 | 发现内容 |
|--------|--------------|
| **Recon** | 服务器信息、技术栈、SSL、安全头部配置错误 |
| **Vuln Scan** | GET 参数中的 SQL Injection 和 XSS |
| **Dir Bruteforce** | 隐藏目录、备份文件、暴露的配置 |
| **Subdomain Enum** | 包含 IP、HTTP 状态和页面标题的活动子域名 |
最后,它会打印清晰的摘要,并可以导出 HTML 或 JSON 报告。
## 安装
```
git clone https://github.com/YOUR_USERNAME/PenScope.git
cd PenScope
pip install -r requirements.txt
```
**要求:** Python 3.8+
## 用法
```
# 完整扫描
python penstool.py http://target.com
# 测试 SQLi / XSS 的特定参数
python penstool.py "http://target.com/page.php?id=1&name=test"
# 导出 HTML 报告
python penstool.py http://target.com --output html
# 跳过目录爆破 (更快)
python penstool.py http://target.com --no-dirs
# 仅侦察
python penstool.py http://target.com --only-recon
# 自定义线程和超时
python penstool.py http://target.com --threads 25 --timeout 15
```
### 参数标志
```
url Target URL
--no-recon Skip recon module
--no-scan Skip vulnerability scan
--no-dirs Skip directory bruteforce
--no-subs Skip subdomain enumeration
--only-recon Run recon module only
--output {html,json,both}
Export report to file
--threads, -t Threads for dir/sub scan (default: 15)
--timeout Request timeout in seconds (default: 10)
```
## 示例输出
```
[*] Target: http://testphp.vulnweb.com
[*] Domain: testphp.vulnweb.com
=== MODULE 1: RECON ===
[+] Status: 200 | Server: nginx/1.19.0
[!] Informational headers:
Server: nginx/1.19.0
X-Powered-By: PHP/5.6.40
[+] Technologies detected: PHP, jQuery, Bootstrap
Security Headers:
+-----------------------------------------------------+
| Header | Status | Severity |
|---------------------------+------------+------------|
| Strict-Transport-Security | MISSING | HIGH |
| Content-Security-Policy | MISSING | HIGH |
| X-Frame-Options | MISSING | MEDIUM |
...
=== MODULE 2: VULNERABILITY SCAN ===
[+] GET parameters found: id, cat
[!] SQL INJECTION — 2 vulnerable parameter(s)
-> Param: id
Payload: '
Evidence: you have an error in your sql syntax
-> Param: cat
Payload: ' OR 1=1--
Evidence: warning: mysql
[!] XSS — 1 vulnerable parameter(s)
-> Param: searchFor (Reflected XSS)
Payload:
=== MODULE 3: DIRECTORY BRUTEFORCE ===
[+] 8 path(s) found
http://target.com/admin 200
http://target.com/login.php 200
http://target.com/.git 403
http://target.com/backup 403
...
=== MODULE 4: SUBDOMAINS ===
[+] 4 subdomain(s) found
mail.target.com 1.2.3.4 200 Webmail Login
dev.target.com 1.2.3.5 200 Development Server
api.target.com 1.2.3.6 200 API v2
admin.target.com 1.2.3.7 403 -
──────────────────── SUMMARY ────────────────────
[!] SQL Injection: 2 vulnerable parameter(s)
[!] XSS: 1 vulnerable parameter(s)
[!] Headers: 5 missing (2 critical)
[i] Stack: PHP, nginx, jQuery, Bootstrap
[i] Directories: 8 found (4 accessible, 4 forbidden)
[i] Subdomains: 4 found
```
## 报告导出
使用 `--output html` 生成完整的暗色主题报告:
- 包含计数器的执行摘要
- 带有 payload 和证据的漏洞详情
- 安全头部表格
- 带有状态码的目录列表
- 带有 IP 和标题的子域名表格
## 模块
```
PenScope/
├── penstool.py # CLI entry point
├── requirements.txt
└── modules/
├── recon.py # Headers, tech detection, SSL
├── scanner.py # SQLi, XSS, directory bruteforce
├── subdomain.py # DNS-based subdomain enumeration
└── reporter.py # Terminal summary + HTML/JSON export
```
### Recon 模块
- 检测 15+ 种技术(WordPress, Laravel, Django, React, Vue, Angular, Apache, Nginx, IIS, PHP, ASP.NET...)
- 检查 7 个安全头部并进行严重性评级(HIGH / MEDIUM / LOW)
- SSL/TLS 版本和过期日期
- 标记泄漏服务器信息的信息性头部(`X-Powered-By`, `X-Runtime`, `X-Backend-Server`...)
### 漏洞扫描器
**SQL Injection** — 使用 11 个 payload 测试基于错误的 SQLi,检测来自 MySQL, PostgreSQL, MSSQL, Oracle, SQLite 和 DB2 的错误。
**XSS** — 使用 6 个 payload 测试所有 GET 参数的反射型 XSS。检查 payload 是否未经编码地出现在响应中。
**目录暴破** — 100+ 条路径:管理面板、备份文件、`.env`, `.git`, `phpinfo.php`, API 端点、CMS 特定路径。使用多线程提升速度。
### 子域名枚举器
- 包含 60+ 个常见子域名的字典(`api`, `dev`, `staging`, `mail`, `vpn`, `admin`, `jenkins`, `grafana`...)
- 通过 `socket.gethostbyname` 进行 DNS 解析
- HTTP 探测以获取状态码和页面标题
- 多线程实现快速枚举
## 法律免责声明
此工具仅用于**授权的安全测试**。在没有明确书面许可的情况下对系统运行此工具是违法的。作者不对任何滥用行为负责。
仅在以下情况下使用 PenScope:
- 您自己的系统
- 您已获得书面授权进行测试的系统
- CTF / 实验室环境(HackTheBox, TryHackMe, DVWA, WebGoat)
## 测试对象
- [DVWA](https://github.com/digininja/DVWA) (Damn Vulnerable Web Application)
- [WebGoat](https://github.com/WebGoat/WebGoat)
- [HackTheBox](https://www.hackthebox.com) 机器
- [TryHackMe](https://tryhackme.com) 房间
## 作者
本工具作为 Web 渗透测试作品集的一部分构建。
欢迎提交 Issue 或 PR。
标签:CISA项目, HTML报告, JSON报告, Maven, Python, URL发现, Web安全, Web应用防火墙绕过, XSS, 二进制发布, 子域名枚举, 安全检测, 实时处理, 密码管理, 开源工具, 攻击模拟, 无后门, 漏洞情报, 漏洞验证, 目录爆破, 系统安全, 网络安全, 蓝队分析, 逆向工具, 隐私保护, 驱动签名利用