Files
SnarfCode/scripts/test_technitium_auth_status.py

20 lines
791 B
Python

import urllib.request
import json
import sys
sys.stdout.reconfigure(encoding='utf-8')
for host, label in [('140.44.4.36', 'Aerodrome (dns1)'), ('140.44.4.65', 'Spaceport (dns2)')]:
print(f"=== Testing {label} ({host}:5380) ===")
for pwd in ['snarfnetadmin', 'admin', 'password']:
url = f"http://{host}:5380/api/user/login?user=admin&pass={pwd}"
try:
with urllib.request.urlopen(url, timeout=4) as resp:
data = json.loads(resp.read().decode('utf-8'))
tok = data.get('token')
tok_str = tok[:10] if tok else None
print(f" pass={pwd}: status={data.get('status')}, msg={data.get('errorMessage')}, token={tok_str}")
except Exception as e:
print(f" pass={pwd}: error={e}")