imxde-code/ghostscan
GitHub: imxde-code/ghostscan
一款面向红队的轻量级侦察框架,集成子域名枚举、HTTP 安全标头审计与 TCP 端口扫描于一体,帮助安全人员在渗透前期快速完成目标信息收集。
Stars: 0 | Forks: 0
```
██████ ██░ ██ ▒█████ ██████ ▄▄▄█████▓ ██████ ▄████▄ ▄▄▄ ███▄ █
▒██ ▒ ▓██░ ██▒▒██▒ ██▒▒██ ▒ ▓ ██▒ ▓▒▒██ ▒ ▒██▀ ▀█ ▒████▄ ██ ▀█ █
░ ▓██▄ ▒██▀▀██░▒██░ ██▒░ ▓██▄ ▒ ▓██░ ▒░░ ▓██▄ ▒▓█ ▄ ▒██ ▀█▄ ▓██ ▀█ ██▒
▒ ██▒░▓█ ░██ ▒██ ██░ ▒ ██▒░ ▓██▓ ░ ▒ ██▒▒▓▓▄ ▄██▒░██▄▄▄▄██ ▓██▒ ▐▌██▒
▒██████▒▒░▓█▒░██▓░ ████▓▒░▒██████▒▒ ▒██▒ ░ ▒██████▒▒▒ ▓███▀ ░ ▓█ ▓██▒▒██░ ▓██░
```
**红队侦察框架**
[](https://python.org)
[](https://opensource.org/licenses/MIT)
[](https://github.com/ghostscan/ghostscan)
[](https://github.com/Textualize/rich)
*子域名枚举 · HTTP 标头分析 · TCP 端口扫描 — 集于一款工具之中。*
## 功能
| 模块 | 描述 |
|---|---|
| `subdomain` | 使用 115+ 字典条目进行 DNS 暴力破解,并发解析 |
| `headers` | 针对 10 个常见安全控制的 HTTP 安全标头审计 |
| `portscan` | 带服务识别的并发 TCP 连接扫描 |
## 安装
### 从源码安装(推荐)
```
git clone https://github.com/ghostscan/ghostscan
cd ghostscan
# 创建并激活虚拟环境
python3 -m venv .venv
source .venv/bin/activate # macOS / Linux
# .venv\Scripts\activate # Windows
pip install -e .
```
### 直接使用 pip 安装
```
pip install ghostscan
```
## 使用
### 全局帮助
```
$ ghostscan --help
██████ ██░ ██ ▒█████ ██████ ...
Red Team Recon Framework v1.0.0
Usage: ghostscan [OPTIONS] COMMAND [ARGS]...
ghostscan — Red team reconnaissance tool.
Options:
--version Show the version and exit.
--help Show this message and exit.
Commands:
headers Check HTTP security headers for URL.
portscan TCP connect port scan against HOST.
subdomain Brute-force subdomains for DOMAIN using a built-in wordlist.
```
### `ghostscan subdomain`
使用内置的 115 条字典通过 DNS 解析暴力破解子域名。
```
ghostscan subdomain
[OPTIONS]
```
| 标志 | 默认值 | 描述 |
|---|---|---|
| `-w`, `--workers` | `50` | 并发 DNS 线程 |
| `-t`, `--timeout` | `3.0` | DNS 解析超时(秒) |
| `-o`, `--output` | — | 将结果保存到文本文件 |
**示例:**
```
ghostscan subdomain example.com
ghostscan subdomain example.com --workers 100 --timeout 2 --output found.txt
```
**演示输出:**
```
[*] Starting subdomain enumeration for: example.com
Wordlist size: 115 | Workers: 50 | Timeout: 3.0s
╭─────────────────────────────────────────────────────────────────╮
│ Subdomain Scan Results — example.com │
├─────────────────────────────────┬─────────────────┬────────────┤
│ Subdomain │ IP Address │ Status │
├─────────────────────────────────┼─────────────────┼────────────┤
│ api.example.com │ 93.184.216.34 │ FOUND │
│ mail.example.com │ 93.184.216.50 │ FOUND │
│ staging.example.com │ 93.184.216.99 │ FOUND │
│ www.example.com │ 93.184.216.34 │ FOUND │
╰─────────────────────────────────┴─────────────────┴────────────╯
[+] Found 4 live subdomain(s) out of 115 probed.
```
### `ghostscan headers`
审计 HTTP 安全标头并报告存在/缺失的控制项。
```
ghostscan headers [OPTIONS]
```
| 标志 | 默认值 | 描述 |
|---|---|---|
| `-t`, `--timeout` | `10.0` | HTTP 请求超时(秒) |
| `--no-redirect` | — | 禁用重定向跟随 |
**示例:**
```
ghostscan headers https://example.com
ghostscan headers https://example.com --no-redirect
```
**演示输出:**
```
[*] Analysing security headers for: https://example.com
HTTP Status: 200 OK Server: ECS X-Powered-By: —
╭───────────────────────────────────────────────────────────────────────────────────╮
│ Security Header Analysis — https://example.com │
├──────────────────────────────────┬──────────────┬──────────────────────────────────┤
│ Header │ Status │ Value / Notes │
├──────────────────────────────────┼──────────────┼──────────────────────────────────┤
│ Strict-Transport-Security │ PRESENT │ max-age=31536000 │
│ │ │ Forces HTTPS; prevents protocol │
│ │ │ downgrade attacks. │
├──────────────────────────────────┼──────────────┼──────────────────────────────────┤
│ Content-Security-Policy │ MISSING │ Mitigates XSS and data injection │
│ │ │ attacks. │
├──────────────────────────────────┼──────────────┼──────────────────────────────────┤
│ X-Frame-Options │ PRESENT │ DENY │
├──────────────────────────────────┼──────────────┼──────────────────────────────────┤
│ X-Content-Type-Options │ PRESENT │ nosniff │
├──────────────────────────────────┼──────────────┼──────────────────────────────────┤
│ Referrer-Policy │ MISSING │ Controls how much referrer info │
│ │ │ is included with requests. │
├──────────────────────────────────┼──────────────┼──────────────────────────────────┤
│ Permissions-Policy │ MISSING │ Controls access to browser │
│ │ │ features (camera, mic, etc.). │
├──────────────────────────────────┼──────────────┼──────────────────────────────────┤
│ X-XSS-Protection │ DEPRECATED │ 1; mode=block │
╰──────────────────────────────────┴──────────────┴──────────────────────────────────╯
Security Score: 4/9 headers present (44%) — Poor
Missing headers:
• Content-Security-Policy
• Referrer-Policy
• Permissions-Policy
• Cross-Origin-Opener-Policy
• Cross-Origin-Resource-Policy
• Cache-Control
```
### `ghostscan portscan`
并发 TCP 连接扫描。识别开放端口及其关联服务。
```
ghostscan portscan [OPTIONS]
```
| 标志 | 默认值 | 描述 |
|---|---|---|
| `-p`, `--ports` | top-100 | 端口范围(`1-1024`)、列表(`80,443`)或省略以使用 top-100 |
| `-t`, `--timeout` | `1.0` | TCP 连接超时(秒) |
| `-w`, `--workers` | `100` | 并发扫描线程 |
**示例:**
```
ghostscan portscan 192.168.1.1
ghostscan portscan example.com -p 1-1024 --timeout 0.5
ghostscan portscan 10.0.0.1 -p 22,80,443,8080,8443
ghostscan portscan 10.0.0.1 -p 1-65535 -w 500 -t 0.3
```
**演示输出:**
```
[*] Starting port scan against: example.com (93.184.216.34)
Ports: 100 | Workers: 100 | Timeout: 1.0s
╭──────────────────────────────────────────────╮
│ Port Scan Results — example.com (93.…) │
├──────────┬────────────────────┬──────────────┤
│ Port │ Service │ Status │
├──────────┼────────────────────┼──────────────┤
│ 80 │ HTTP │ OPEN │
│ 443 │ HTTPS │ OPEN │
╰──────────┴────────────────────┴──────────────╯
[+] Found 2 open port(s) out of 100 scanned.
```
## 架构
```
ghostscan/
├── ghostscan/
│ ├── __init__.py # Package metadata
│ ├── cli.py # Click entry point & subcommand definitions
│ ├── subdomain.py # DNS brute-force with ThreadPoolExecutor
│ ├── headers.py # HTTP security header auditor
│ └── portscan.py # Concurrent TCP connect scanner
├── pyproject.toml # PEP 517/518 packaging
├── requirements.txt
└── README.md
```
## 许可证
MIT — 详见 [LICENSE](LICENSE)。
仅供授权安全测试构建。
标签:C++17, GraphQL安全矩阵, HTTP头分析, Python, 侦察工具, 命令行界面, 子域名枚举, 安全基线检测, 安全扫描器, 密码管理, 并发扫描, 插件系统, 数据展示, 数据统计, 无后门, 端口扫描, 系统安全, 红队, 网络安全, 逆向工具, 隐私保护