#!/usr/bin/env python3 """Off-LAN check for the PS auto-service deploy (2026-10-09), via the Midhurst troublebox. Verifies 200 + marker + served files carry the auto-service feature: app.js → psServiceOverride ; i18n.js → FR auto hint string ; engine/pspension.js → autoServiceYears. Writes audit/ps-auto-offlan-check.json, prints OFFLAN-OK/FAIL.""" import json, sys, time import paramiko CANDS = ["b1tvvt07", "ubnt", "admin", "password", "b1tvvt07!", "1234", "root", "glinet"] URL = "https://retire.krisforbes.ca/" def main(): conn = None for pw in CANDS: c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) try: c.connect("100.96.20.61", port=2222, username="trouble", password=pw, timeout=25, banner_timeout=25, auth_timeout=25, allow_agent=False, look_for_keys=False) conn = c break except Exception: c.close() if conn is None: print("OFFLAN-FAIL: no auth to troublebox") sys.exit(1) def run(cmd): _, out, _ = conn.exec_command(cmd, timeout=60) return out.read().decode("utf-8", "replace").strip() code = run(f"curl -s -o /dev/null -w '%{{http_code}}' {URL} --max-time 30") html = run(f"curl -s {URL} --max-time 30 | head -c 200000") app = run(f"curl -s {URL}app.js --max-time 30 | head -c 500000") i18n = run(f"curl -s {URL}i18n.js --max-time 30 | head -c 500000") ps = run(f"curl -s {URL}engine/pspension.js --max-time 30 | head -c 500000") conn.close() checks = { "http_code": code, "has_marker": "retire-planner v1" in html, "app_has_override_state": "psServiceOverride" in app, "app_has_usecalc_button": "ps-usecalc" in app, "i18n_has_fr_auto_hint": "entr" in i18n and "ann" in i18n and "de service. " in i18n and "Calcul" in i18n, "engine_has_autoServiceYears": "autoServiceYears" in ps, "sizes": {"app": len(app), "i18n": len(i18n), "ps": len(ps)}, "checked_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), "vantage": "trouble@100.96.20.61 (Midhurst, off-LAN)", } checks["all_ok"] = (code == "200" and checks["has_marker"] and checks["app_has_override_state"] and checks["app_has_usecalc_button"] and checks["i18n_has_fr_auto_hint"] and checks["engine_has_autoServiceYears"]) with open("audit/ps-auto-offlan-check.json", "w") as f: json.dump(checks, f, indent=2, ensure_ascii=False) print(json.dumps(checks, indent=2, ensure_ascii=False)) print("OFFLAN-OK" if checks["all_ok"] else "OFFLAN-FAIL") sys.exit(0 if checks["all_ok"] else 1) if __name__ == "__main__": main()