KeyHunter parser v10 + 18 scanners + tests (synthetic fixtures only, no keys/db/tokens)
This commit is contained in:
26
dbg_commits.py
Normal file
26
dbg_commits.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""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()
|
||||
Reference in New Issue
Block a user