风险扫描器
一个合规和安全扫描程序,用于检测GitHub存储库、文件或目录中的秘密、令牌和不安全代码模式。\ 包括a WEB应用程序 使用PDF报告和 CLI工具 供当地使用。
______________________________________________________________________
🚀 现场演示
web应用程序部署在Render上:\ 👉 https://risk-scanner.onrender.com/
______________________________________________________________________
✨ 特性
- 扫描 GitHub 仓库, 本地文件,或 目录
- 检测常见秘密(AWS密钥、GitHub令牌、Slack令牌等)
- 识别调试语句和弱模式
- 严重性细分 风险评分
- 出口A 格式整洁的PDF报告
- Web应用程序(Flask+Gunicorn)和CLI模式
- 可部署到 渲染 只需单击一下
______________________________________________________________________
📦 本地设置
1.克隆存储库
git clone https://github.com/yourusername/risk-scanner.git
cd risk-scanner2.安装依赖项
pip install -r requirements.txt3.设置GitHub令牌(可选但推荐)
如果没有令牌,您每小时只能收到60个GitHub API请求。\ 使用令牌,您每小时会收到5000个请求。
- Windows(命令提示符):
set GITHUB_TOKEN=ghp_yourtokenhere- Windows(PowerShell):
$env:GITHUB_TOKEN="ghp_yourtokenhere"- Linux/macOS(Bash/Zsh):
export GITHUB_TOKEN=ghp_yourtokenhere______________________________________________________________________
🖥️ CLI使用情况
扫描a GitHub存储库:
python cli_wrapper.py scan-repo https://github.com/GitGuardian/sample_secrets扫描a 本地文件:
python cli_wrapper.py scan-file path/to/file.py扫描a 目录:
python cli_wrapper.py scan-dir ./src将结果保存为JSON格式:
python cli_wrapper.py scan-repo https://github.com/GitGuardian/sample_secrets --output results.json______________________________________________________________________
🌐 Web应用程序(本地)
在本地运行Flask应用程序:
python app.py然后打开 http://localhost:8000 在您的浏览器中。
特征:
- 输入GitHub仓库URL并扫描
- 查看摘要和调查结果
- 出口A 格式整洁的PDF报告
______________________________________________________________________
🔎 示例
尝试使用测试密钥扫描此仓库:
python cli_wrapper.py scan-repo https://github.com/GitGuardian/sample_secrets______________________________________________________________________
📄 许可证
麻省理工学院
