KeyHunter parser v10 + 18 scanners + tests (synthetic fixtures only, no keys/db/tokens)

This commit is contained in:
2026-10-20 07:50:07 +00:00
commit a5008d837b
178 changed files with 36909 additions and 0 deletions

39
feed_tokens.py Executable file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/env python3
"""Feed harvested PATs into KeyHunter gh_tokens.txt + verify each token live."""
import json, urllib.request, urllib.error
POOL = r'C:\Users\User\tmp\gh_pats_pool.json'
TOKENS = r'C:\Users\User\Desktop\keyhunter\gh_tokens.txt'
def verify(token):
req = urllib.request.Request('https://api.github.com/user',
headers={'Authorization': f'token {token}', 'User-Agent': 'kh'})
try:
with urllib.request.urlopen(req, timeout=15) as r:
return r.status == 200
except Exception:
return False
pool = json.load(open(POOL, encoding='utf-8'))
live = []
for a in pool:
if verify(a['pat']):
live.append(a['pat'])
else:
print('DEAD:', a['login'])
# Read existing tokens (skip comments), merge
existing = []
try:
for l in open(TOKENS, encoding='utf-8'):
l = l.strip()
if l and not l.startswith('#'):
existing.append(l)
except FileNotFoundError:
pass
alltok = list(dict.fromkeys(existing + live))
with open(TOKENS, 'w', encoding='utf-8') as f:
f.write('# GitHub PAT pool — harvested from account farm\n')
for t in alltok:
f.write(t + '\n')
print(f'pool={len(pool)} live={len(live)} written={len(alltok)}')