code wiki / _hdl_build / nx_netscope_capture.nx

nx_netscope_capture.nx

buildroot/runtime/_hdl_build/nx_netscope_capture.nx

4199 B80 linesdepth 3pulls 5 transitivereach 0 importersview sourcekind tooltopic netscope
docsdependenciesstructsconstsfunctions

about

nx_netscope_capture.nx -- NX-NETSCOPE L-CAPTURE: the SOVEREIGN raw-wire capture front-end (the "wireshark" tap, in-ecosystem, NO tcpdump). Opens an AF_PACKET raw socket, reads frames, and feeds each to the EXISTING pure dissector nx_packet_dissect (nx_netscope_dissect.nx). Filters inbound TCP SYN (no ACK) to a chosen dest port and prints src-ip -> dst-ip:port -- so we can SEE which NAS interface/IP a public :443 connection actually lands on (answering "where does external ingress go" with a capture, not a guess). Bounded: per-recv timeout + wall-clock deadline, so it NEVER hangs. usage: nx_netscope_capture [dport=443] [seconds=90] [maxrows=200] Needs CAP_NET_RAW (run as root). license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_netscope_dissect.nx nx_netscope_capture.nx

imports: nx_syscalls.nxnx_netscope_dissect.nx

imported by: nobody (leaf or entry point)

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

main c_atoi c_puts sys_write c_n sys_mmap sys_write ↻ sys_socket sys_set_socket_timeout sys_mmap ↻ sys_setsockopt sys_munmap sys_mmap ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real sys_recvfrom nx_packet_dissect nx_dns_get_u16_be nxd_be32 c_ip c_n ↻ c_puts ↻ sys_close

structs

none

consts

11const NXC_MAGIC_65536: i64 = 65536
13const NXC_AF_PACKET: i64 = 17
14const NXC_SOCK_RAW: i64 = 3
15const NXC_ETH_P_ALL_BE: i64 = 768 // htons(0x0003) = 0x0300

functions

17func c_puts(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: c_ipmain calls 1: sys_write
18func c_n(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} 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{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 }
called by 2: c_ipmain calls 2: sys_mmapsys_write
19func c_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
20func c_atoi(s: *u8) -> i64 { var v: i64=0; var i: i64=0; while s[i]!=(0 as u8){ let c: i64=s[i] as i64; if c>=48 { if c<=57 { v=v*10+(c-48) } } i=i+1 } return v }
called by 1: main
22func c_ip(p: i64) -> i64
called by 1: main calls 2: c_nc_puts
27func main(argc: i64, argv: *i64) -> i64