feat: add diagnostic and inspection utility scripts for infrastructure and services

This commit is contained in:
2026-11-06 00:08:53 -05:00
parent 47acedb455
commit 00f22f33af
28 changed files with 204 additions and 0 deletions

25
scripts/test_npm_login.py Normal file
View File

@@ -0,0 +1,25 @@
import urllib.request
import json
passwords = ['snarfnetadmin', 'SnarfNet2024!', 'SnarfNet2026!', 'admin', 'changeme']
for host in ['140.44.4.70', '140.44.4.71']:
print(f"Testing NPM on {host}:81 ...")
for pwd in passwords:
url = f"http://{host}:81/api/tokens"
payload = json.dumps({"identity": "snarf@snarfnet.net", "secret": pwd}).encode('utf-8')
req = urllib.request.Request(url, data=payload, headers={"Content-Type": "application/json"}, method="POST")
try:
with urllib.request.urlopen(req, timeout=3) as resp:
data = json.loads(resp.read().decode('utf-8'))
if "token" in data:
print(f" SUCCESS! Password: '{pwd}', token: {data['token'][:20]}...")
break
except urllib.error.HTTPError as e:
if e.code == 400:
pass # Invalid password
else:
print(f" HTTP {e.code} on {pwd}")
except Exception as e:
print(f" Conn error on {host}: {e}")
break