KeyHunter parser v10 + 18 scanners + tests (synthetic fixtures only, no keys/db/tokens)
This commit is contained in:
27
dbg_gist2.py
Normal file
27
dbg_gist2.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import re
|
||||
|
||||
import requests
|
||||
|
||||
INTERESTING = re.compile(
|
||||
r'(^|/)(\.?env|config|settings|secret|credential|token|key|api|'
|
||||
r'auth|\.bash|\.zsh|profile|keys?)', re.I)
|
||||
|
||||
tok = open(r"C:/Users/User/Desktop/keyhunter/gh_tokens.txt").readline().strip()
|
||||
H = {"Authorization": f"Bearer {tok}", "User-Agent": "keyfarm"}
|
||||
|
||||
interesting, total = 0, 0
|
||||
samples = []
|
||||
for page in (1, 2, 3):
|
||||
r = requests.get("https://api.github.com/gists/public",
|
||||
params={"per_page": 100, "page": page}, headers=H, timeout=20)
|
||||
for g in r.json():
|
||||
total += 1
|
||||
files = g.get("files") or {}
|
||||
fname = " ".join(files.keys())
|
||||
if INTERESTING.search(fname):
|
||||
interesting += 1
|
||||
if len(samples) < 10:
|
||||
samples.append(fname[:80])
|
||||
print(f"total={total} interesting={interesting} ({interesting*100//max(total,1)}%)")
|
||||
for s in samples:
|
||||
print(" -", s)
|
||||
Reference in New Issue
Block a user