feat: add helper scripts for infrastructure management and troubleshooting
This commit is contained in:
29
scripts/inspect_semaphore_frontend.py
Normal file
29
scripts/inspect_semaphore_frontend.py
Normal file
@@ -0,0 +1,29 @@
|
||||
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(), "...")
|
||||
|
||||
Reference in New Issue
Block a user