code wiki / _hdl_build / nx_vroom_probe_stage.nx

nx_vroom_probe_stage.nx source

↩ module page · 29 lines · 2542 B

1// nx_vroom_probe_stage.nx -- stage the READ-ONLY NAS investigation for the /video/ deploy-wiring 2// (operator 2026-06-23 chose "find it + auto-deploy hook"). Sovereign: recovers the vault credential 3// to /tmp/nxpw (size-only verify, NEVER printed) and writes the read-only probe command to /tmp/nxcmd, 4// so nx_ssh_cmd can run it -- NO shell staging of the password or the command. The probe is READ-ONLY 5// (find/ps/grep only -- zero writes to the live NAS): locate the served /video/ dir (by the served 6// 29583-byte app.js signature), the sites daemon, and the Gitea bare repo + hooks dir (where the 7// post-receive deploy hook will go). Run AFTER: nx_machine_key + _offc/nx_vault.elf open nas.nv. 8// Caller shreds /tmp/{nxpass,nxsecret.out,nxpw,nxcmd} when the deploy-wiring is done. license_tier: ORIGINAL 9import "nx_syscalls.nx" 10 11const PROBE_CMD: *u8 = "echo CHECK_TIME:; date; echo STATE_NOW:; cat /volume1/homes/elderwesto/nishihost/.nx_video_deploy.state 2>/dev/null; echo; echo DEPLOY_LOG:; tail -3 /volume1/homes/elderwesto/nishihost/nx_video_deploy.log 2>/dev/null; echo MARKERS_LIVE:; grep -c 'tile self' /volume1/homes/elderwesto/nishihost/sites/nishifamily/video/app.js; grep -c 'scaleX(-1)' /volume1/homes/elderwesto/nishihost/sites/nishifamily/video/index.html; echo END\n" 12 13func slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } 14func pw(s: *u8) -> i64 { sys_write(1,s,slen(s)); return 0 } 15func pn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 } 16 17func main() -> i64 { 18 let box: *i64 = sys_mmap(16) as *i64 19 let sec: *u8 = sys_read_file("/tmp/nxsecret.out" as *u8, box) 20 if (sec as i64)==0 { pw("STAGE: no /tmp/nxsecret.out -- run nx_machine_key + _offc/nx_vault.elf open first\n"); sys_exit(1); return 1 } 21 let pf: i64 = sys_openat_wr("/tmp/nxpw" as *u8, 0x180) 22 if pf<0 { pw("STAGE: cannot write /tmp/nxpw\n"); sys_exit(1); return 1 } 23 sys_write(pf, sec, box[0]); sys_close(pf) 24 let cf: i64 = sys_openat_wr("/tmp/nxcmd" as *u8, 0x180) 25 if cf<0 { pw("STAGE: cannot write /tmp/nxcmd\n"); sys_exit(1); return 1 } 26 sys_write(cf, PROBE_CMD, slen(PROBE_CMD)); sys_close(cf) 27 pw("STAGE: credential recovered to /tmp/nxpw ("); pn(box[0]); pw(" bytes, size-only verify -- never printed) + /tmp/nxcmd read-only probe staged. Run nx_ssh_cmd next.\n") 28 sys_exit(0); return 0 29}