code wiki / (root) / nx_cf_access_probe.nx

nx_cf_access_probe.nx source

↩ module page · 65 lines · 3936 B

1// nx_cf_access_probe.nx -- neutrality/access diagnostic: can OUR sovereign crawler reach the adult-media 2// sources major engines de-rank (javdb/ukdevilz/etc.)? Tests each with (1) minimal-hello then (2) Chrome-JA3 3// (which beat Cloudflare JA3-fingerprinting for nhentai). Reports status + whether it's a Cloudflare/JS 4// challenge -> distinguishes ACCESS-blocked (Cloudflare bot-wall, affects us + Common Crawl) from a 5// neutrality issue. argv[1..] = urls. license_tier: ORIGINAL 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_4194304: i64 = 4194304 11 12func gw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 13func gn(v: i64) -> i64 { if v==0 { sys_write(1,"0" as *u8,1); return 0 } var m: i64=v; if m<0 { sys_write(1,"-" as *u8,1); m=0-m } let t: *u8=sys_mmap(24); var k: i64=0; while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } let o: *u8=sys_mmap(24); var q: i64=k-1; var x: i64=0; while q>=0 { o[x]=t[q]; x=x+1; q=q-1 } sys_write(1,o,x); return 0 } 14func has(hay: *u8, hn: i64, ndl: *u8) -> i64 { var nl: i64=0; while ndl[nl]!=(0 as u8){nl=nl+1} var i: i64=0; while i+nl<=hn { var m: i64=1; var j: i64=0; while j<nl { if hay[i+j]!=ndl[j] { m=0; j=nl } else { j=j+1 } } if m==1 { return 1 } i=i+1 } return 0 } 15// PRECISE Cloudflare-challenge detection (fix 2026-07-05: the bare word "Cloudflare" false-positived on 16// cloudflare.com's own reachable 200 homepage). A challenge is present ONLY via the interstitial title 17// ("Just a moment..." / "Attention Required! | Cloudflare") or the managed-challenge JS marker (__cf_chl / 18// cf-browser-verification) -- these appear ONLY on the actual wall, not on a page that merely mentions CF. 19func is_cf_challenge(out: *u8, n: i64) -> i64 { 20 if n <= 0 { return 0 } 21 if has(out, n, "Just a moment" as *u8) == 1 { return 1 } 22 if has(out, n, "Attention Required! | Cloudflare" as *u8) == 1 { return 1 } 23 if has(out, n, "cf-browser-verification" as *u8) == 1 { return 1 } 24 if has(out, n, "__cf_chl" as *u8) == 1 { return 1 } 25 return 0 26} 27 28func probe(url: *u8, store: *TrustStore, out: *u8, cap: i64) -> i64 { 29 let st: *i64 = sys_mmap(8) as *i64 30 gw("\n"); gw(url); gw("\n" as *u8) 31 let n0: i64 = nx_https_fetch_follow(url, store, out, cap, 8, st) 32 gw(" minimal-hello: status="); gn(st[0]); gw(" bytes="); gn(n0) 33 if is_cf_challenge(out, n0) == 1 { gw(" [Cloudflare challenge]") } 34 gw("\n" as *u8) 35 let n1: i64 = nx_https_fetch_follow_chrome(url, store, out, cap, 8, st) 36 gw(" chrome-JA3: status="); gn(st[0]); gw(" bytes="); gn(n1) 37 var cf: i64 = 0 38 if is_cf_challenge(out, n1) == 1 { cf = 1 } 39 if cf == 1 { gw(" [Cloudflare JS-challenge -- needs a browser/JS solver]") } 40 if st[0] == 200 { if cf == 0 { gw(" <= REACHABLE (indexable over our stack)") } } 41 gw("\n" as *u8) 42 let n2: i64 = nx_https_fetch_follow_12(url, store, out, cap, st) 43 gw(" TLS-1.2: status="); gn(st[0]); gw(" bytes="); gn(n2) 44 if st[0] == 200 { gw(" <= REACHABLE via TLS 1.2 (1.2-only host)") } 45 gw("\n" as *u8) 46 return 0 47} 48 49func main(argc: i64, argv: *i64) -> i64 { 50 gw("=== nx_cf_access_probe: sovereign reachability of crawler-blocked media sources ===\n" as *u8) 51 let r: i64 = nx_trust_store_load_from_certdata("data/mozilla_certdata.txt" as *u8, 512, K_MAGIC_4194304) 52 if r <= 0 { gw("trust store load failed\n" as *u8); return 1 } 53 let store: *TrustStore = r as *TrustStore 54 let cap: i64 = K_MAGIC_4194304 55 let out: *u8 = sys_mmap(cap) 56 if argc >= 2 { 57 var i: i64 = 1 58 while i < argc { probe(argv[i] as *u8, store, out, cap); i = i + 1 } 59 } else { 60 probe("https://javdb.com/" as *u8, store, out, cap) 61 probe("https://ukdevilz.com/" as *u8, store, out, cap) 62 probe("https://jable.tv/" as *u8, store, out, cap) 63 } 64 return 0 65}