30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
import urllib.request
|
|
import ssl
|
|
import re
|
|
import sys
|
|
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
|
|
ctx = ssl.create_default_context()
|
|
ctx.check_hostname = False
|
|
ctx.verify_mode = ssl.CERT_NONE
|
|
|
|
req = urllib.request.Request("https://semaphore.snarfnet.net/", headers={"User-Agent": "Mozilla/5.0"})
|
|
html = urllib.request.urlopen(req, context=ctx).read().decode('utf-8')
|
|
print("HTML:", html[:500])
|
|
|
|
# Find script tags
|
|
scripts = re.findall(r'src="([^"]+\.js)"', html)
|
|
print("Scripts found:", scripts)
|
|
|
|
for s in scripts:
|
|
s_url = f"https://semaphore.snarfnet.net{s}" if s.startswith('/') else f"https://semaphore.snarfnet.net/{s}"
|
|
s_req = urllib.request.Request(s_url, headers={"User-Agent": "Mozilla/5.0"})
|
|
content = urllib.request.urlopen(s_req, context=ctx).read().decode('utf-8', errors='replace')
|
|
if 'oidc' in content.lower() or 'authentik' in content.lower():
|
|
print(f"\n--- Match in {s} ---")
|
|
matches = re.findall(r'.{0,100}(?:oidc|login|redirect).{0,100}', content, re.IGNORECASE)
|
|
for m in matches[:10]:
|
|
print(" ...", m.strip(), "...")
|
|
|