byoniq/jsleaks

GitHub: byoniq/jsleaks

jsleaks 是一个零依赖的 Python 工具,用于在 JavaScript 文件中检测 API 密钥和敏感令牌的泄露问题。

Stars: 0 | Forks: 0

# jsleaks 在 JavaScript 文件中查找 API 密钥、令牌和秘密。 单一 Python 文件。零依赖项。支持 URL、本地文件或标准输入。 ## 安装 ``` curl -O https://raw.githubusercontent.com/byoniq/jsleaks/main/jsleaks.py ``` ## 使用方法 ``` # 爬取 URL — 获取所有关联的 JS 文件并进行扫描 python3 jsleaks.py https://target.com # 深度 2 扫描(跟踪 HTML 中引用的 JS 包) python3 jsleaks.py https://target.com -d 2 # 扫描本地文件 python3 jsleaks.py --file bundle.js # 通过管道接收其他工具的输出 cat js_urls.txt | xargs -I{} python3 jsleaks.py {} # 用于 jq/管道的 JSON 输出 python3 jsleaks.py https://target.com --out json | jq '.[] | select(.type == "AWS Access Key")' ``` ## 查找内容 | 模式 | 示例 | |---|---| | AWS 访问密钥 | `AKIA...`, `ASIA...` | | GitHub 令牌 | `ghp_...`, `gho_...`, `ghs_...` | | Google API 密钥 | `AIza...` | | Stripe 密钥 | `sk_live_...`, `sk_test_...` | | Slack 令牌/网页钩子 | `xoxb-...`, `https://hooks.slack.com/...` | | JWT | `eyJ...` | | Bearer / Basic 认证 | 内联令牌值 | | 通用秘密 | `api_key=`, `password=`, `secret=` | | 私钥 | `-----BEGIN RSA PRIVATE KEY-----` | | NPM, SendGrid, Twilio, Mailgun | 各种模式 | | Firebase URL | 暴露的实时数据库 URL | | S3 存储桶 URL | 配置错误的公共存储桶端点 | 共 25 种模式类别。 ## 示例输出 ``` ============================================================ jsleaks — 3 finding(s) ============================================================ [AWS Access Key] Source : https://target.com/static/js/main.abc123.js:4821 Match : AKIAIOSFODNN7EXAMPLE Context: const AWS_KEY = "AKIAIOSFODNN7EXAMPLE" [JWT] Source : https://target.com/static/js/main.abc123.js:9043 Match : eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... Context: const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... ``` ## 管道接入漏洞赏金流程 ``` # Subfinder → httpx → jsleaks subfinder -d target.com -silent | httpx -silent | xargs -P5 -I{} python3 jsleaks.py {} # katana 爬取 → jsleaks 扫描所有 JS 端点 katana -u https://target.com -f url | grep '\.js$' | xargs -I{} python3 jsleaks.py --file <(curl -s {}) ``` ## 法律声明 仅限用于授权的安全测试和漏洞赏金计划。请负责任地使用。 ## 许可证 MIT
标签:AMSI绕过, API安全, API安全, Bug Bounty工具, JSON输出, JSON输出, Web安全, Web爬取, 二进制发布, 代码安全, 代码生成, 令牌扫描, 凭证泄露检测, 动态分析, 单文件工具, 威胁检测, 安全扫描, 开源工具, 文件扫描, 时序注入, 泄露检查, 渗透测试工具, 漏洞枚举, 秘密检测, 管道工具, 网络安全, 蓝队分析, 逆向工具, 隐私保护, 零依赖