nx_lib_pmc_pow.nx
buildroot/runtime/nx_lib_pmc_pow.nx
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
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
| 12 | const PMC_MAGIC_16777216: i64 = 16777216 |
| 13 | const PMC_MAGIC_1024: i64 = 1024 |
| 14 | const PMC_MAGIC_2048: i64 = 2048 |
| 15 | const PMC_MAGIC_50000000: i64 = 50000000 |
| 76 | const PMC_URL: *u8 = "https://pmc.ncbi.nlm.nih.gov/articles/PMC7197042/pdf/CD004504.pdf\x00" |
functions
| 17 | func 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 } |
| 18 | func pw_wr(p: *u8, n: i64) -> i64 { sys_write(1, p, n); return 0 } |
| 19 | func pw_putn(v: i64) -> i64 |
| 29 | func pw_find_after(hay: *u8, hayn: i64, needle: *u8) -> i64 called by 1: pw_body_start |
| 45 | func pw_copy_until(hay: *u8, hayn: i64, start: i64, delim: i64, out: *u8, maxlen: i64) -> i64 called by 1: pw_body_start |
| 57 | func pw_dec_into(buf: *u8, off: i64, v: i64) -> i64 |
| 65 | func 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 |
| 67 | func pw_body_start(buf: *u8, n: i64) -> i64 |
| 78 | func main() -> i64 |