code wiki / (root) / nx_lib_pmc_pow.nx

nx_lib_pmc_pow.nx

buildroot/runtime/nx_lib_pmc_pow.nx

7027 B155 linesdepth 21pulls 137 transitivereach 0 importersview sourcekind orphan librarytopic lib
docsdependenciesstructsconstsfunctions

about

nx_lib_pmc_pow.nx -- solve NCBI PMC's JS proof-of-work anti-bot gate, all sovereign. One run: fetch the interstitial over TLS-1.3 -> extract the FRESH POW_CHALLENGE + ncbi_sid -> hashcash solve (SHA-256(challenge+nonce) hex must start with "0000" = first two digest bytes zero; the exact algorithm from NCBI's pow.js) -> refetch with cookie cloudpmc-viewer-pow=<challenge>,<nonce> -> the real PDF -> extract its text. No browser, no JS engine, no python.

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_lib_fetch.nx nx_lib_fetch_cookie.nx nx_sha256_wasm.nx nx_lib_pdf.nx nx_lib_pmc_pow.nx

imports: nx_syscalls.nxnx_lib_fetch.nxnx_lib_fetch_cookie.nxnx_sha256_wasm.nxnx_lib_pdf.nx

imported by: nobody (leaf or entry point)

structs

none

consts

12const PMC_MAGIC_16777216: i64 = 16777216
13const PMC_MAGIC_1024: i64 = 1024
14const PMC_MAGIC_2048: i64 = 2048
15const PMC_MAGIC_50000000: i64 = 50000000
76const PMC_URL: *u8 = "https://pmc.ncbi.nlm.nih.gov/articles/PMC7197042/pdf/CD004504.pdf\x00"

functions

17func pw_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 1: pw_body_start calls 1: sys_write
18func pw_wr(p: *u8, n: i64) -> i64 { sys_write(1, p, n); return 0 }
called by 1: pw_body_start calls 1: sys_write
19func pw_putn(v: i64) -> i64
called by 1: pw_body_start calls 2: sys_mmapsys_write
29func pw_find_after(hay: *u8, hayn: i64, needle: *u8) -> i64
called by 1: pw_body_start
45func pw_copy_until(hay: *u8, hayn: i64, start: i64, delim: i64, out: *u8, maxlen: i64) -> i64
called by 1: pw_body_start
57func pw_dec_into(buf: *u8, off: i64, v: i64) -> i64
called by 1: pw_body_start calls 1: sys_mmap
65func pw_str_into(buf: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { buf[off+i] = s[i]; i = i + 1 } return off + i }
called by 1: pw_body_start
67func pw_body_start(buf: *u8, n: i64) -> i64
78func main() -> i64