code wiki / (root) / nx_login_probe.nx

nx_login_probe.nx source

↩ module page · 67 lines · 3557 B

1// nx_login_probe.nx -- observe the LIVE nishifamily.com login + post-login flow with our OWN sovereign TLS-1.3 2// client (nx_https_fetch_follow, Mozilla trust store) -- NO curl/openssl. Answers "does login actually work?" and 3// reveals the REAL post-login behavior: an unauthenticated GET /wiki/hub.html IS the nav-bounce scenario (a top- 4// level navigation carries no X-Nishi-Session header), so its response shows whether the session-carrier bug bites. 5// license_tier: ORIGINAL expect_exit: 0 6import "nx_syscalls.nx" 7import "nx_x509_trust_store.nx" 8import "nx_trust_store_load_from_certdata.nx" 9import "nx_https_fetch_follow.nx" 10const K_MAGIC_6500: i64 = 6500 11const K_MAGIC_4194304: i64 = 4194304 12const K_MAGIC_9444: i64 = 9444 13 14func vp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 15func vpn(v: i64) -> i64 { 16 let b: *u8=sys_mmap(28); var x: i64=v; if x<0 {b[0]=45;sys_write(1,b,1);x=0-x} 17 if x==0 {b[0]=48;sys_write(1,b,1);return 0} 18 var d: i64=0; var y: i64=x; while y>0 {d=d+1;y=y/10} 19 var i: i64=d-1; y=x; while i>=0 {b[i]=(48+(y%10)) as u8; y=y/10; i=i-1} 20 sys_write(1,b,d); return 0 21} 22func contains(buf: *u8, n: i64, needle: *u8) -> i64 { 23 var nl: i64=0; while needle[nl]!=(0 as u8){nl=nl+1} 24 if nl==0 { return 0 } 25 var i: i64=0 26 while i + nl <= n { 27 var j: i64=0; var ok: i64=1 28 while j<nl { if buf[i+j]!=needle[j] { ok=0; j=nl } else { j=j+1 } } 29 if ok==1 { return 1 } 30 i=i+1 31 } 32 return 0 33} 34 35func probe(url: *u8, store: *TrustStore, out: *u8, cap: i64) -> i64 { 36 let status: *i64 = sys_mmap(8) as *i64 37 vp("=== GET " as *u8); vp(url); vp(" ===\n" as *u8) 38 let n: i64 = nx_https_fetch_follow(url, store, out, cap, 6, status) 39 vp(" HTTP status=" as *u8); vpn(status[0]); vp(" bytes=" as *u8); vpn(n); vp("\n" as *u8) 40 vp(" TEMPLATE[ board/hub-login=" as *u8); vpn(contains(out, n, "function board" as *u8)) 41 vp(" audio-login=" as *u8); vpn(contains(out, n, "Open audio" as *u8)) 42 vp(" landing=" as *u8); vpn(contains(out, n, "Nishi Family" as *u8)) 43 vp(" opaque-login-form=" as *u8); vpn(contains(out, n, "OPAQUE login" as *u8)) 44 vp(" ] has-AUTO-RECOVER/bootstrap=" as *u8); vpn(contains(out, n, "location.pathname" as *u8)) 45 vp(" has-reg-fn=" as *u8); vpn(contains(out, n, "function reg(" as *u8)) 46 vp(" has-onclick-reg=" as *u8); vpn(contains(out, n, "onclick=reg()" as *u8)) 47 vp(" registration-closed=" as *u8); vpn(contains(out, n, "closed" as *u8)) 48 vp("\n --- FULL body ---\n" as *u8) 49 var dn: i64 = n; if dn > K_MAGIC_6500 { dn = K_MAGIC_6500 } 50 if dn > 0 { sys_write(1, out, dn) } 51 vp("\n --- end ---\n\n" as *u8) 52 return 0 53} 54 55func main() -> i64 { 56 let r: i64 = nx_trust_store_load_from_certdata("data/mozilla_certdata.txt" as *u8, 512, K_MAGIC_4194304) 57 if r <= 0 { vp("certdata load failed (run from nxc2 dir)\n" as *u8); sys_exit(1); return 1 } 58 let store: *TrustStore = r as *TrustStore 59 let cap: i64 = K_MAGIC_4194304 60 let out: *u8 = sys_mmap(cap) 61 62 vp("==================== LIVE LOGIN PROBE (sovereign TLS-1.3 client) ====================\n" as *u8) 63 probe("https://nishifamily.com:9444/wiki/hub.html" as *u8, store, out, cap) // THE SOVEREIGN mTLS PROXY (:K_MAGIC_9444, no client cert = request-not-require -> serves wiki_gw) 64 probe("https://nishifamily.com/wiki/hub.html" as *u8, store, out, cap) // the live :443/DSM path, for comparison 65 vp("==================== END PROBE ====================\n" as *u8) 66 sys_exit(0); return 0 67}