code wiki / (root) / nx_port_audit.nx

nx_port_audit.nx

buildroot/runtime/nx_port_audit.nx

7879 B142 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_port_audit.nx -- SOVEREIGN LISTENING_VS_CLAIMED audit (the capability nx_daemon_health_audit lists as MISSING). Parses /proc/net/tcp (no ss/netstat/shell) for sockets in LISTEN state (st=0A), extracts their local ports, and checks each KNOWN Nishi daemon port: is something ACTUALLY listening, or does the daemon merely CLAIM up (pidfile UP, port unbound -- the exact torrent :8097 restart-wedge symptom)? Run: nx_port_audit. license_tier: ORIGINAL module: nishi-core.perception.port_audit capability: PERCEPTION (daemon health)

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_port_audit.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main pa_p sys_write sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ pa_scan_file sys_openat_rd sys_mmap ↻ sys_read sys_close pa_hv pa_n sys_mmap ↻ sys_write ↻ pa_audit_conf sys_openat_rd ↻ sys_mmap ↻ sys_read ↻ sys_close ↻ pa_eol pa_tabpos pa_check pa_p ↻ pa_n ↻ sys_exit ↻

structs

none

consts

8const PA_MAGIC_1048576: i64 = 1048576
9const PA_MAGIC_8097: i64 = 8097
10const PA_MAGIC_18090: i64 = 18090
11const PA_MAGIC_7702: i64 = 7702
12const PA_MAGIC_8446: i64 = 8446
13const PA_MAGIC_8447: i64 = 8447
14const PA_MAGIC_8443: i64 = 8443
15const PA_MAGIC_8080: i64 = 8080
17const PA_CAP: i64 = 1024
71const PA_CONF: *u8 = "knowledge/status/portmap.conf"
72const PA_CONFCAP: i64 = 65536
73const PA_HASH: i64 = 35
74const PA_TABC: i64 = 9
75const PA_LF: i64 = 10

functions

19func pa_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 2: pa_checkmain calls 1: sys_write
20func pa_n(v: i64) -> i64 { let t: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} 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} let b: *u8=sys_mmap(28); var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 }
called by 2: pa_checkmain calls 2: sys_mmapsys_write
21func pa_hv(c: i64) -> i64 { if c>=48 { if c<=57 { return c-48 } } if c>=65 { if c<=70 { return c-55 } } if c>=97 { if c<=102 { return c-87 } } return 0-1 }
called by 1: pa_scan_file
25func pa_scan_file(path: *u8, out: *i64, start: i64, cap: i64) -> i64
58func pa_check(ports: *i64, np: i64, port: i64, name: *u8) -> i64
called by 1: pa_audit_conf calls 2: pa_ppa_n
77func pa_eol(buf: *u8, from: i64, total: i64) -> i64
called by 1: pa_audit_conf
82func pa_tabpos(buf: *u8, from: i64, eol: i64) -> i64
called by 1: pa_audit_conf
89func pa_audit_conf(ports: *i64, np: i64, down_out: *i64) -> i64
121func main() -> i64