SumitSonkusale/vulnerability-scanner-python

GitHub: SumitSonkusale/vulnerability-scanner-python

一款基于 Python 的命令行网络安全扫描器,集成了端口扫描、HTTP 安全标头检测和依赖包 CVE 查询功能,帮助用户高效完成基础漏洞评估与安全审计。

Stars: 1 | Forks: 0

# vulnerability-scanner-python 一个用 Python 编写的模块化、基于 CLI 的漏洞扫描器。执行 TCP 端口扫描、HTTP 安全标头分析,并通过调用 OSV.dev API 对已安装的 Python 包进行 CVE 查询。 ![CI](https://static.pigsec.cn/wp-content/uploads/repos/cas/ad/ad5834178f7599af9fdda11629d49cae07f2997beec49821b2920eff5bfd50e7.svg) ## 功能 - **端口扫描器** — 跨可配置端口范围的 TCP connect 扫描 - **标头检查器** — 检测缺失或配置错误的 HTTP 安全标头(CSP、HSTS、X-Frame-Options 等) - **CVE 查询** — 通过查询 [OSV.dev](https://osv.dev) API 获取 Python 包的已知漏洞 - **扫描引擎** — 将所有模块协调到单一的扫描 pipeline 中 - **CLI 接口** — 支持从命令行运行全面扫描,并支持 JSON 输出 - **严重性分类** — 扫描结果按 INFO / LOW / MEDIUM / HIGH / CRITICAL 级别进行排名 ## 项目结构 ``` vulnerability-scanner-python/ ├── vuln_scanner/ │ ├── __init__.py │ ├── models.py # Dataclasses: Severity, PortResult, HeaderFinding, CveFinding, ScanResult │ ├── port_scanner.py # TCP port scanning │ ├── header_checker.py # HTTP security header analysis │ ├── cve_lookup.py # OSV.dev CVE lookup │ └── engine.py # Scan orchestration ├── tests/ │ ├── __init__.py │ ├── test_models.py # Unit tests for data models │ └── test_scanner.py # Unit tests for scanner modules ├── .github/ │ └── workflows/ │ └── test.yml # GitHub Actions CI ├── main.py # CLI entry point ├── requirements.txt ├── .gitignore └── LICENSE ``` ## 安装说明 ``` git clone https://github.com/SumitSonkusale/vulnerability-scanner-python.git cd vulnerability-scanner-python pip install -r requirements.txt ``` ## 使用说明 ``` # 使用默认设置扫描目标 python main.py --target example.com # 扫描特定端口 python main.py --target example.com --ports 22 80 443 8080 # 将结果输出为 JSON python main.py --target example.com --json # 检查 requirements 文件中的包的 CVE python main.py --target example.com --packages requirements.txt ``` ## 示例输出 ``` Scan Target : example.com Open Ports : 80/tcp (http), 443/tcp (https) Header Findings: [HIGH] Missing Content-Security-Policy [MEDIUM] Missing X-Frame-Options CVE Findings: [CRITICAL] CVE-2021-44228 in log4j (CVSS 10.0) Scan Duration: 4.21s ``` ## 运行测试 ``` pytest tests/ -v ``` ## 依赖项 - `requests` — 用于标头检查和 OSV API 的 HTTP 请求 - `pytest` — 测试框架 ## 许可证 MIT — 请参阅 [LICENSE](LICENSE)
标签:Python, 加密, 动态分析, 安全规则引擎, 密码管理, 插件系统, 文档结构分析, 无后门, 漏洞扫描器, 逆向工具