Skip to content

Commit 06e9a90

Browse files
KeyCode17claude
andcommitted
test(px-camoufox): diagnose probe — Camoufox beats CF on pedidosya
Ignored probe gated behind DIAGNOSE_CAMOUFOX=1. Dumps user-agent, cookies, html title, and presence of _px3 / _pxhd / cf_clearance / __cf_bm so the operator can verify a Camoufox harvest end-to-end. Empirical results from this session (2026-05-16, residential IDN IP): - haven (PX-direct): 40 cookies including _px3 + _pxhd, real page content, no block markers. Regression-clean against the chromiumoxide baseline. - pedidosya (CF + PX): 21 cookies including cf_clearance, __cf_bm, _px3, _pxhd, _pxvid, pxcts, plus the real Argentine session cookies (peyas.sid, dhhPerseus*). 142KB real page, no "Just a moment..." block. CF Bot Management is defeated silently (no Turnstile widget needed). The exact case ADR-0018 reclassified to R5 as "unreachable without residential proxy" is now reachable in pure-Rust through Camoufox. ADR-0018 may be amended in a future R5 commit to add pedidosya back to the canary set once a longer soak confirms stability. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e9ccbca commit 06e9a90

1 file changed

Lines changed: 89 additions & 0 deletions

File tree

px-camoufox/tests/diagnose.rs

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#![allow(clippy::expect_used, clippy::unwrap_used, clippy::panic)]
2+
//! Camoufox harvester probe.
3+
//!
4+
//! Run with:
5+
//! DIAGNOSE_CAMOUFOX=1 [DIAGNOSE_URL=https://...] [DIAGNOSE_WAIT_MS=10000]
6+
//! cargo test -q -p px-camoufox --test diagnose -- --ignored --nocapture
7+
8+
use px_camoufox::{CamoufoxConfig, CamoufoxPool};
9+
use px_harvester::{HarvestRequest, Harvester};
10+
use std::time::Duration;
11+
12+
#[tokio::test]
13+
#[ignore]
14+
async fn diagnose_camoufox_harvest() {
15+
if std::env::var("DIAGNOSE_CAMOUFOX").ok().as_deref() != Some("1") {
16+
eprintln!("set DIAGNOSE_CAMOUFOX=1 to run");
17+
return;
18+
}
19+
let url =
20+
std::env::var("DIAGNOSE_URL").unwrap_or_else(|_| "https://www.havenwellwithin.com/".into());
21+
let wait_ms: u64 = std::env::var("DIAGNOSE_WAIT_MS")
22+
.ok()
23+
.and_then(|s| s.parse().ok())
24+
.unwrap_or(10_000);
25+
26+
let mut cfg = CamoufoxConfig::from_env();
27+
cfg.headless = std::env::var("DIAGNOSE_HEADLESS")
28+
.ok()
29+
.as_deref()
30+
.map(|v| v == "1" || v.eq_ignore_ascii_case("true"))
31+
.unwrap_or(true);
32+
cfg.navigate_timeout = Duration::from_secs(60);
33+
eprintln!(
34+
"camoufox_bin = {}\ngeckodriver_bin = {}\nheadless = {}",
35+
cfg.camoufox_bin.display(),
36+
cfg.geckodriver_bin.display(),
37+
cfg.headless
38+
);
39+
40+
let pool = CamoufoxPool::new(cfg).expect("pool");
41+
let mut req = HarvestRequest::new(&url);
42+
req.wait_ms = wait_ms;
43+
44+
let result = tokio::time::timeout(Duration::from_secs(90), pool.harvest(req))
45+
.await
46+
.expect("timeout")
47+
.expect("harvest");
48+
49+
eprintln!("\n=== DIAGNOSE_CAMOUFOX: {url} ===");
50+
eprintln!("user_agent: {}", result.user_agent);
51+
eprintln!("cookies ({}):", result.cookies.len());
52+
for c in &result.cookies {
53+
let v: String = c.value.chars().take(40).collect();
54+
eprintln!(
55+
" - {} = {}{} (domain={}, path={})",
56+
c.name,
57+
v,
58+
if c.value.len() > 40 { "..." } else { "" },
59+
c.domain,
60+
c.path
61+
);
62+
}
63+
eprintln!("html length: {}", result.html.len());
64+
if let Some(i) = result.html.find("<title>") {
65+
let rest = &result.html[i + 7..];
66+
if let Some(j) = rest.find("</title>") {
67+
eprintln!("title: {:?}", &rest[..j]);
68+
}
69+
}
70+
for m in [
71+
"Access to this page has been denied",
72+
"Just a moment",
73+
"__cf_chl_jschl",
74+
"Verify you are human",
75+
"cf-browser-verification",
76+
] {
77+
if result.html.contains(m) {
78+
eprintln!("MARKER FOUND: {m}");
79+
}
80+
}
81+
let has_px3 = result.cookies.iter().any(|c| c.name == "_px3");
82+
let has_pxhd = result.cookies.iter().any(|c| c.name == "_pxhd");
83+
let has_cf_clear = result.cookies.iter().any(|c| c.name == "cf_clearance");
84+
let has_cf_bm = result.cookies.iter().any(|c| c.name == "__cf_bm");
85+
eprintln!("has _px3: {has_px3}");
86+
eprintln!("has _pxhd: {has_pxhd}");
87+
eprintln!("has cf_clearance: {has_cf_clear}");
88+
eprintln!("has __cf_bm: {has_cf_bm}");
89+
}

0 commit comments

Comments
 (0)