joeamm/security-scanner
GitHub: joeamm/security-scanner
一款自动化 Python 安全审计工具,通过扫描 HTTPS 配置、安全响应头、信息泄露等五类常见问题并生成可操作的评分报告,帮助网站快速排查安全配置缺陷。
Stars: 0 | Forks: 0
# 🛡️ 网站安全清单扫描器
一款自动化的 Python 工具,可审计任何网站的常见安全配置错误——缺失的 header、暴露的后台管理面板、服务器版本泄露等——并输出按优先级排序的纯文本报告。
## 作为网络安全自由职业作品集的一部分而开发。
## 功能介绍
在 30 秒内对任何 URL 运行 5 类安全检查:
| 检查项目 | 检查内容 |
|-------|------------------|
| ✅ HTTPS 强制执行 | 网站是否加密?HTTP 是否重定向到 HTTPS? |
| ✅ Security headers | 大多数小型网站缺失的 6 个关键 HTTP headers |
| ✅ 服务器信息泄露 | 服务器是否向攻击者泄露了其软件版本? |
| ✅ 暴露的后台管理面板 | `/wp-admin` 或 `/phpmyadmin` 等登录页面是否可公开访问? |
| ✅ Cookie 安全性 | 会话 cookie 是否受 Secure 和 HttpOnly 标志保护? |
输出**满分 100 分的安全评分**,并附带按优先级排序、可操作的建议,您的客户可以直接将其交给他们的开发人员。
## 输出示例
```
Security Checklist Scanner
Target: https://example.com
Fetching homepage... OK (HTTP 200)
Running security checks...
Checking 10 admin paths... done
──────────────────────────────────────────────────────────────
SECURITY CHECKLIST REPORT
──────────────────────────────────────────────────────────────
Target : https://example.com
Scanned : 2026-06-10 14:45:12
Duration : 8.34s
Results : 6 passed 5 failed 1 warnings
Security score: 54/100
HTTPS
✓ HTTPS in use
✗ HTTP does not redirect to HTTPS
Security Headers
✓ Header present: Strict-Transport-Security
✗ Missing header: X-Frame-Options
✗ Missing header: Content-Security-Policy
✗ Missing header: X-Content-Type-Options
Server Info
✗ Server version exposed
✓ No X-Powered-By header
Admin Panels
✓ No common admin panels exposed
──────────────────────────────────────────────────────────────
RECOMMENDATIONS
1. [CRITICAL] HTTP does not redirect to HTTPS
→ Add a 301 redirect from HTTP to HTTPS in your web server config.
2. [CRITICAL] Missing header: X-Frame-Options
→ Add: X-Frame-Options: DENY (or SAMEORIGIN)
3. [CRITICAL] Server version exposed
→ In Apache: 'ServerTokens Prod'. In Nginx: 'server_tokens off'.
──────────────────────────────────────────────────────────────
```
## 快速开始
```
# Clone repo
git clone https://github.com/joeamm/security-scanner.git
cd security-scanner
# 安装唯一依赖
pip install requests
# 扫描网站
python security_scanner.py https://yourwebsite.com
```
## 工作原理
### 1. HTTPS 检查
获取 URL 的 `http://` 和 `https://` 版本。验证网站是否提供加密流量,以及未加密的请求是否会被自动重定向。
### 2. Security Headers
检查 HTTP 响应头中的 6 项浏览器安全控制:
| Header | 防御对象 |
|--------|-----------------|
| `Strict-Transport-Security` | 即使用户输入 HTTP 也强制使用 HTTPS |
| `X-Frame-Options` | 通过恶意 iframe 进行的点击劫持 |
| `X-Content-Type-Options` | MIME 类型嗅探攻击 |
| `Content-Security-Policy` | 跨站脚本攻击 (XSS) |
| `Referrer-Policy` | 向第三方网站泄露 URL |
| `Permissions-Policy` | 未经授权的摄像头/麦克风/位置访问 |
### 3. 服务器信息泄露
检查 `Server` 和 `X-Powered-By` headers 中的版本号。例如:`Server: Apache/2.4.1` 会确切地告诉攻击者应该利用哪些 CVE。
### 4. 后台管理面板暴露
向 10 个常见的后台路径发送请求,并检查是否有路径返回真实的页面(HTTP 200/401/403)。
### 5. Cookie 安全性
检查主页设置的 cookie 是否缺少 `Secure` 和 `HttpOnly` 标志。
## 环境要求
- Python 3.7+
- `requests` 库 (`pip install requests`)
## 客户使用场景
- **上线前安全审查** — 在网站正式上线前排查配置错误
- **季度安全检查** — 为包月/长期客户提供快速、定期的审计
- **合规性基线** — 提供 GDPR、PCI-DSS 尽职调查的证据
- **开发人员交接后** — 验证新网站是否已进行安全配置
## 关于
由 joseph ammoun 开发 —— 拥有 Google 网络安全专业证书的 Python 开发人员。
承接安全审计、脚本编写和自动化相关的自由职业项目。
💼 [Upwork 主页](https://www.upwork.com/freelancers/~01620d7d3c7e1378b8?mp_source=share)
🔗 [LinkedIn](https://www.linkedin.com/in/joe-ammoun-019850344)
标签:Python, Web安全, 安全基线检查, 实时处理, 密码管理, 无后门, 蓝队分析, 逆向工具