akbarfdlh2/Web-Vulnerability-Scanner
GitHub: akbarfdlh2/Web-Vulnerability-Scanner
一款基于 Python 异步的 Web 漏洞扫描器,提供 Streamlit 界面和 CLI,支持对十余类常见 Web 安全问题进行自动化初步审计与报告生成。
Stars: 0 | Forks: 0
# WebVulnScan
WebVulnScan 是一个基于 Python async 的 Web 漏洞扫描器,提供了 Streamlit 界面和 CLI。该工具有助于对 security headers、CORS、暴露的文件、SSL/TLS、SQL Injection、XSS、开放重定向、目录列表、CSRF token 和信息泄露进行初步审计。
公开仓库:[akbarfdlh2/Web-Vulnerability-Scanner](https://github.com/akbarfdlh2/Web-Vulnerability-Scanner)
## 功能
- 简洁的 Streamlit 界面,可用于选择目标、scope、timeout、depth 和 URL 数量限制。
- 扫描结果按严重程度分类:critical、high、medium、low 和 info。
- 根据严重程度和关键词过滤发现的问题。
- 将扫描结果导出为 JSON。
- 生成带有自动风险评分的 HTML 报告。
- 依然提供 CLI 以支持终端工作流。
## 技术栈
- Python 3.10+
- Streamlit
- httpx
- Typer
- Rich
## 项目结构
```
.
├── streamlit_app.py # Interface utama untuk Streamlit
├── main.py # CLI entry point
├── requirements.txt
├── .streamlit/
│ └── config.toml # Theme Streamlit
└── scanner/
├── __init__.py
├── checks.py # Registry metadata checks
├── engine.py # Async scanner + crawler
└── reporter.py # HTML report generator
```
## 本地安装
```
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```
## 运行界面
```
streamlit run streamlit_app.py
```
打开终端中显示的本地 URL,通常为:
```
http://localhost:8501
```
## 运行 CLI
```
# 基础扫描
python main.py scan https://example.com
# 仅显示 vulnerability,不显示信息
python main.py scan https://example.com --only-vulns
# 生成 HTML 报告
python main.py scan https://example.com --report
# 保存至 JSON
python main.py scan https://example.com --output hasil.json
# 选择特定 check
python main.py scan https://example.com --checks headers,cors,env
# 设置 depth 和 timeout
python main.py scan https://example.com --depth 3 --timeout 15
# 查看所有 checks
python main.py checks
```
## 可用的检查项
| ID | 名称 | 严重程度 | 描述 |
| --- | --- | --- | --- |
| `headers` | Security Headers | medium | 审计 HTTP security headers,如 CSP、HSTS 和 X-Frame-Options |
| `cors` | CORS 配置错误 | high | 检测过于宽松的 CORS 或 reflect origin |
| `env` | 暴露的配置文件 | critical | 检查敏感文件,如 `.env`、`.git`、config、备份和 dump |
| `sqli` | SQL Injection | critical | 向 URL 参数注入 SQL payload |
| `xss` | 跨站脚本攻击 (XSS) | high | 检测 URL 参数中的反射型 XSS |
| `redirect` | 开放重定向 | medium | 检查可能被重定向到攻击者域名的重定向参数 |
| `dirlist` | 目录列表 | low | 检测处于激活状态的目录列表 |
| `info` | 信息泄露 | low | Stack trace、调试信息、路径泄露以及服务器版本泄露 |
| `csrf` | 缺少 CSRF token | medium | 检查没有 CSRF token 的 POST 表单 |
| `ssl` | SSL/TLS 检查 | medium | 检查 HTTPS 以及 HTTP 到 HTTPS 的重定向 |
## 部署到 Streamlit Community Cloud
官方参考:
- [Streamlit Community Cloud 部署指南](https://docs.streamlit.io/deploy/streamlit-community-cloud/deploy-your-app)
- [Streamlit 应用依赖](https://docs.streamlit.io/deploy/streamlit-community-cloud/deploy-your-app/app-dependencies)
部署步骤:
1. 将此项目推送到公开的 GitHub 仓库。
2. 打开 [share.streamlit.io](https://share.streamlit.io/)。
3. 使用 GitHub 登录。
4. 点击 `Create app`。
5. 选择 `Yup, I have an app`。
6. 填写仓库、分支和主文件路径:
```
Repository: akbarfdlh2/Web-Vulnerability-Scanner
Branch: main
Main file path: streamlit_app.py
```
如果 Streamlit 仅要求提供文件路径,请填写:
```
streamlit_app.py
```
7. 确保根目录下存在 `requirements.txt`。
8. 点击 `Deploy`。
每次向使用的分支执行 `git push` 时,Streamlit Community Cloud 都会从 GitHub 拉取更新并重新部署应用程序。
## 发布到公开的 GitHub
如果尚未创建过仓库:
```
git init
git branch -M main
git add .
git commit -m "Add Streamlit interface"
gh repo create Web-Vulnerability-Scanner --public --source=. --remote=origin --push
```
如果 GitHub 仓库已存在:
```
git init
git branch -M main
git remote add origin https://github.com//Web-Vulnerability-Scanner.git
git add .
git commit -m "Add Streamlit interface"
git push -u origin main
```
## 添加新检查项
1. 在 `scanner/checks.py` 中注册检查项的 metadata。
2. 在 `scanner/engine.py` 中创建新方法,例如 `_check_new_issue()`。
3. 从 `VulnScanner.scan()` 中调用该方法。
4. 重新运行 UI 或 CLI 并验证结果。
## 安全提示
- 本工具不能替代手动渗透测试。
- 扫描结果可能包含误报或漏报。
- 未经许可和协调,请勿在生产环境的目标上过度增加 timeout、depth 或最大 URL 数量。
- 请仅将报告保存在安全的位置,因为其中可能包含敏感信息。
## 作者
由 [Akbar Fadilah](https://muhamadakbarfadilah.my.id/) 创建 · [Afda Technology Solutions](https://afdatech.com/) 创始人兼联合创始人
标签:CISA项目, DOE合作, Kubernetes, Python, Streamlit, Web漏洞扫描器, 异步编程, 无后门, 访问控制, 运行时操纵, 逆向工具