Files
keyhunter-parser/dbg_commits.py

26 lines
1.1 KiB
Python

"""Debug: commits search payloads for key-prefix dorks."""
import json
import requests
TOKENS = [l.strip() for l in open('gh_tokens.txt', encoding='utf-8')
if l.strip().startswith('ghp_')][:3]
for q in ("sk-ant-api03-", "OPENAI_API_KEY update", "DEEPSEEK key"):
r = requests.get(
"https://api.github.com/search/commits",
params={"q": q, "per_page": 5, "sort": "committer-date", "order": "desc"},
headers={"Authorization": f"Bearer {TOKENS[0]}",
"Accept": "application/vnd.github.text-match+json",
"User-Agent": "keyfarm"},
timeout=30)
data = r.json()
print(f"Q={q!r} HTTP {r.status_code} total={data.get('total_count')}")
for it in data.get("items", [])[:3]:
repo = (it.get("repository") or {}).get("full_name", "?")
msg = ((it.get("commit") or {}).get("message") or "")[:70]
tm = len(it.get("text_matches", []))
print(f" {repo} | tm={tm} | {msg!r}")
for t in it.get("text_matches", [])[:1]:
print(" frag:", (t.get("fragment") or "")[:110].replace("\n", " "))
print()