面向漏洞赏金猎人、渗透测试人员与红队的个人访问令牌(PAT)侦察工具

你是否曾经发现过 GitHub 或 NPM 的个人访问令牌(PAT),并好奇「这个有效吗?」或「我想知道坏人能用它做什么?」如果答案是肯定的,那么我为你准备了这款工具!
隆重推出 gimmePatz——一款全面的 PAT 侦察工具。gimmePATz 会告诉你某个 PAT 是否有效,以及它是哪种类型的 PAT。它会提供创建该 PAT 的用户账户信息,包括该用户加入了哪些组织,以及有多少关注者。gimmePATz 会展示某个 PAT 拥有哪些作用域,以及该 PAT 可以访问哪些变量或机密。gimmePATz 还会列出该 PAT 关联的仓库、NPM 软件包或 GitHub 组织,并准确告诉你该 PAT 对每个资源拥有哪些权限。这款工具专为进攻性安全从业人员设计,例如漏洞赏金猎人、渗透测试人员和红队。使用此工具即表示你同意在合法的情况下使用它。
你可以让 gimmePATz 指向一个文件,它会找出该文件中的所有 PAT,并告诉你它们是否有效。gimmepatz 还支持 JSON 输出,因此你可以将输出保存为 JSON,和/或将 gimmePATz 的输出通过管道传递给 jq 等其他工具。你可以在下面的「高级用法」部分看到使用 gimmePATz 的不同方式示例。
gimmepatz.py TOKEN
requests 库 # pip install requestsgit(用于下载仓库)# Discover secrets and variables
gimmepatz.py TOKEN --variables
# Include organization repositories
gimmepatz.py TOKEN --org GITHUB_ORGANIZATION
# JSON output for scripting
gimmepatz.py TOKEN --json
# Combined: organization repos + JSON output
gimmepatz.py TOKEN --org GITHUB_ORGANIZATION --json
# Save the output of gimmePATz in JSON output to a file
gimmepatz.py TOKEN --variables --org target-org --json > assessment.json
# Download all accessible repositories
gimmepatz.py TOKEN --download
# Download only private repositories
gimmepatz.py TOKEN --download --download-type private
# Custom download location
gimmepatz.py TOKEN --download --download-path ./target-repos
# Scan a file to see if it has any PATs in it
gimmepatz.py --scan ./example-file.json
克隆或下载脚本
git clone https://github.com/6mile/gimmepatz.git
cd ./gimmepatz/ && chmod u+x ./gimmepatz.py
_ ______ ___ _____
(_) | ___ \/ _ \_ _|
__ _ _ _ __ ___ _ __ ___ ___| |_/ / /_\ \| |____
/ _` | | '_ ` _ \| '_ ` _ \ / _ \ __/| _ || |_ /
| (_| | | | | | | | | | | | | __/ | | | | || |/ /
\__, |_|_| |_| |_|_| |_| |_|\___\_| \_| |_/\_/___|
__/ |
|___/ "Personal Access Token recon tool"
----------------------------------------------------
by @6mile
✅ 令牌有效
👤 认证用户:octocat 姓名:Octocat Maclean 账户类型:用户 公共仓库数:4 私有仓库数:3 关注者:9714 正在关注:731
🏢 组织成员身份(共 2 个): 👤 Space-Force-Beta(成员) 名称:Space-Force-Beta 描述:为太空打造酷炫的东西 公共仓库数:2 私有仓库数:1 URL:https://github.com/Space-Force-Beta
👑 ThrifyBank(管理员) 描述:堪萨斯州最节俭的新银行! 公共仓库数:1 私有仓库数:5 URL:https://github.com/thrifybank-kansas
🔑 令牌作用域(共 14 个): • codespace:secrets • notifications • read:audit_log • read:discussion • read:enterprise • read:org • read:packages • read:project • read:public_key • read:repo_hook • read:user • repo • user:email • workflow
repo:完全访问仓库 user:访问用户个人资料信息 notifications:访问通知
📊 速率限制状态: 限制:5000 剩余:4999 重置时间:1234567890
📁 可访问的仓库: 发现 25 个可访问的仓库: • 15 个私有仓库 • 10 个公共仓库
🔒 私有仓库(9 个):
📂 octocat(3 个私有仓库): • octocat/internal-api(管理员) • octocat/database(管理员) • octocat/external-api(管理员)
📂 Space-Force-Beta(1 个私有仓库): • Space-Force-Beta/destrukto-beam(管理员)
📂 ThriftyBank(5 个私有仓库): • thriftybank-kansas/web(管理员) • thriftybank-kansas/docker(管理员) • thriftybank-kansas/database-int(管理员) • thriftybank-kansas/bank-vault(管理员) • thriftybank-kansas/SAAS-PORTAL(管理员)
🔓 公共仓库(7 个):
📂 octocat(4 个公共仓库): • octocat/sdk(管理员) • octocat/helpdesk-docs(管理员) • octocat/aws-sdk-helpers(管理员) • octocat/stinkyCaptain(管理员)
📂 Space-Force-Beta(1 个公共仓库): • Space-Force-Beta/destrukto-beam(管理员)
📂 thrifybank-kansas(1 个公共仓库): • thrifybank-kansas/node-restify(管理员)
{
"token_valid": true,
"user_info": {
"login": "octocat",
"name": "The Octocat",
"type": "User",
"id": 1
},
"scopes": ["repo", "user", "notifications"],
"rate_limit": {
"limit": 5000,
"remaining": 4999,
"reset": 1234567890
},
"repositories": {
"total": 25,
"private": [
{
"name": "mycompany/internal-api",
"owner": "mycompany",
"permissions": {
"admin": true,
"push": true,
"pull": true
},
"url": "https://github.com/mycompany/internal-api"
}
],
"public": [
{
"name": "octocat/awesome-project",
"owner": "octocat",
"permissions": {
"admin": true,
"push": true,
"pull": true
},
"url": "https://github.com/octocat/awesome-project"
}
]
},
"summary": {
"total_repos": 25,
"private_count": 15,
"public_count": 10,
"owners": ["mycompany", "octocat"]
}
}
export TOKEN="your_token_here"
gimmepatz.py "$TOKEN"
"无效的令牌或网络错误"
"未找到仓库"
--org 包含组织仓库超出速率限制
200:成功401:凭据错误(令牌无效)403:超出速率限制或权限不足404:资源未找到(用户/组织不存在)欢迎贡献!请随时提交 Pull Request。对于重大更改,请先打开一个 issue 讨论你想要更改的内容。
本项目采用 MIT 许可证授权 - 详情请参阅 LICENSE 文件。
由 @6mile 用 ❤️ 为我的 offsec 伙伴们制作
| 选项 | 说明 |
|---|
--json | 以 JSON 格式输出结果 |
--variables, --var | 枚举 GitHub 变量和机密 |
--var-target | 目标作用域:all、user、repo、org |
--var-name | 指定的仓库或组织名称 |
--download | 下载所有可访问的仓库 |
--download-path | 自定义下载目录(默认:repos) |
--download-type | 筛选:all、private、public |
--org | 包含特定 GitHub 组织分析 |
--debug | 启用详细调试输出 |
--scan | 扫描本地文件中的 PAT |
| 作用域 | 说明 |
|---|
repo | 完全访问仓库 |
public_repo | 仅访问公共仓库 |
repo:status | 访问提交状态 |
repo_deployment | 访问部署状态 |
user | 访问用户个人资料信息 |
user:email | 访问用户电子邮件地址 |
user:follow | 关注/取消关注用户 |
admin:org | 完全访问组织、团队和成员身份 |
write:org | 对组织和团队的写入权限 |
read:org | 对组织和团队的读取权限 |
gist | 写入 gist 的权限 |
notifications | 访问通知 |
workflow | 访问 GitHub Actions 工作流 |
write:packages | 写入 GitHub 软件包的权限 |
read:packages | 读取 GitHub 软件包的权限 |
delete_repo | 删除仓库的权限 |