stealthhttp 0.6.2__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/PKG-INFO +1 -1
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/pyproject.toml +1 -1
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/__init__.py +1 -1
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/_fallback.py +2 -3
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/bypasses/__init__.py +12 -12
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/bypasses/flow.py +6 -2
- stealthhttp-0.7.0/python/stealthhttp/bypasses/perimeterx.py +367 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/clienthints.py +4 -2
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/collectors/perimeterx.py +5 -2
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/cookies.py +7 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/session.py +25 -3
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/session_ext.py +22 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_bypasses.py +9 -1
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_fingerprint.py +7 -4
- stealthhttp-0.6.2/python/stealthhttp/bypasses/perimeterx.py +0 -269
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/.cargo/config.toml +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/.github/workflows/release.yml +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/.gitignore +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/CHANGELOG.md +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/Cargo.lock +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/Cargo.toml +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/LICENSE +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/README.md +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/benchmarks/bench.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/benchmarks/bench_native.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/examples/basic.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/_loader.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/_rotation.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/adaptive_persona.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/ambient.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/antidetect.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/async_session.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/auto_bypass.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/auto_profile.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/backends/__init__.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/backends/base.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/backends/curl_backend.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/backends/native_backend.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/backends/wreq_backend.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/behavior.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/browser_cookies.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/browser_fsm.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/browser_pool.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/browsing.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/bypasses/akamai.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/bypasses/captcha.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/bypasses/cloudflare.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/bypasses/datadome.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/bypasses/imperva.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/bypasses/kasada.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/bypasses/shape.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/bypasses/solver.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/canvas_webgl_sim.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/capabilities.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/captcha.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/captcha_farm.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/cdp_solver.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/cdp_transport.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/challenge.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/challenge_vm.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/coherence.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/collectors/__init__.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/collectors/akamai.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/collectors/datadome.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/collectors/imperva.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/collectors/kasada.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/collectors/shape.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/consistency.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/cookie_intel.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/cover_traffic.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/detection.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/device_db.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/dns_intel.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/dns_tunnel.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/doh.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/entropy_mask.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/error_analysis.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/exceptions.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/fingerprint_diff.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/forms.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/geo.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/graphql.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/h2_frames.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/har.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/header_canon.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/health_monitor.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/honeypot_oracle.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/hooks.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/hsts.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/httpcache.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/humanize.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/identity.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/immortal.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/js_sandbox.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/jsdb.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/jsenv.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/lifecycle.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/lint.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/mesh.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/middleware.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/multipart.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/parsing.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/poison_detect.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/pow.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/predictive_rate.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/prepare.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/proto_chameleon.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/proxy.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/proxy_scoring.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/quic_fingerprint.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/record_replay.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/redirect_intel.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/replay_attack.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/request_graph.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/resp_diff.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/response.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/response_decoder.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/response_intel.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/retry.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/rhythm.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/rotation.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/self_audit.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/selfcheck.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/sensors.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/session_coord.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/session_dna.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/site_recipes.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/smart_proxy.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/smart_retry.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/solving/__init__.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/solving/audio.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/solving/base.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/solving/browser.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/solving/local.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/solving/orchestrator.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/solving/providers.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/solving/vision.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/stealth_audit.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/strategy.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/synth_fingerprint.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/tcp_tuning.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/tests/test_cdp_solver.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/tests/test_features_v3.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/tests/test_features_v3_live.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/tests/test_v030_features.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/tests/test_v040_features.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/tests/test_v050_batch1.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/tests/test_v050_batch2.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/tests/test_v050_integrations.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/tests/test_v050_live.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/tls_clone.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/tls_ext.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/tls_intel.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/tls_session.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/traffic.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/traffic_morph.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/waf_recon.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/websocket.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/python/stealthhttp/ws_tunnel.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/src/fingerprint/headers.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/src/fingerprint/ja3.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/src/fingerprint/ja4.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/src/fingerprint/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/src/fingerprint/profile.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/src/lib.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/src/pow.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/src/proxypool.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/src/rotation.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/src/transport/decode.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/src/transport/engine.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/src/transport/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/src/transport/tls.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/conftest.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_audio.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_bypass.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_bypasses_live.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_emulation.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_features_v2.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_features_v2_live.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_humanize.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_jsemu.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_jsemu_live.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_live_bypass.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_live_detection.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_live_trust.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_new_features.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_policies.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_routing.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_session.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_solving.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/tests/test_vision.py +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/.github/FUNDING.yml +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/.github/workflows/CI.yml +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/.gitignore +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/CHANGELOG.md +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/CONTRIBUTING.md +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/Cargo.toml +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/LICENSE +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/README.md +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/benches/main.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/examples/akamai.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/examples/client.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/examples/server.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/client.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/codec/error.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/codec/framed_read.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/codec/framed_write.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/codec/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/error.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/ext.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/frame/data.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/frame/go_away.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/frame/head.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/frame/headers.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/frame/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/frame/ping.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/frame/priority.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/frame/reason.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/frame/reset.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/frame/settings.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/frame/stream_id.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/frame/util.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/frame/window_update.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/fuzz_bridge.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/hpack/decoder.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/hpack/encoder.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/hpack/header.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/hpack/huffman/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/hpack/huffman/table.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/hpack/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/hpack/table.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/hpack/test/fixture.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/hpack/test/fuzz.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/hpack/test/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/lib.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/connection.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/error.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/go_away.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/peer.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/ping_pong.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/settings.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/streams/buffer.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/streams/counts.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/streams/flow_control.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/streams/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/streams/prioritize.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/streams/recv.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/streams/send.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/streams/state.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/streams/store.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/streams/stream.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/proto/streams/streams.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/server.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/h2/src/share.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/Cargo.toml +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/LICENSE +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/README.md +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/body/incoming.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/body/length.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/body/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/cfg.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/client/conn/http1.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/client/conn/http2.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/client/conn/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/client/dispatch.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/client/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/client/tests.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/common/buf.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/common/date.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/common/either.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/common/future.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/common/io/compat.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/common/io/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/common/io/rewind.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/common/lock.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/common/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/common/task.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/common/time.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/common/watch.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/error.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/ext/h1_reason_phrase.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/ext/informational.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/ext/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/ffi/body.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/ffi/client.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/ffi/error.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/ffi/http_types.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/ffi/io.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/ffi/macros.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/ffi/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/ffi/task.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/headers.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/lib.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/mock.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/proto/h1/conn.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/proto/h1/decode.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/proto/h1/dispatch.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/proto/h1/encode.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/proto/h1/io.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/proto/h1/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/proto/h1/role.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/proto/h2/client.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/proto/h2/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/proto/h2/ping.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/proto/h2/server.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/proto/h2/upgrade.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/proto/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/rt/bounds.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/rt/io.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/rt/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/rt/timer.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/server/conn/http1.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/server/conn/http2.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/server/conn/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/server/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/service/http.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/service/mod.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/service/service.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/service/util.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/trace.rs +0 -0
- {stealthhttp-0.6.2 → stealthhttp-0.7.0}/vendor/hyper/src/upgrade.rs +0 -0
|
@@ -155,7 +155,7 @@ from .replay_attack import ReplayAttackDetector, RequestMutator, ReplayProtectio
|
|
|
155
155
|
from .browser_fsm import BrowserStateMachine, NavigationFSM, BrowserState, StateTransition
|
|
156
156
|
from .quic_fingerprint import QUICProfile, AltSvcTracker, QUICFingerprint, H3Negotiator, quic_fingerprint, parse_alt_svc, should_use_h3
|
|
157
157
|
|
|
158
|
-
__version__ = "0.
|
|
158
|
+
__version__ = "0.7.0"
|
|
159
159
|
|
|
160
160
|
__all__ = [
|
|
161
161
|
"Session", "Response", "ProxyPool", "CookieJar", "Cookie",
|
|
@@ -165,19 +165,18 @@ def _h2_priority(family: str) -> tuple[int, int, bool]:
|
|
|
165
165
|
# --------------------------------------------------------------------------
|
|
166
166
|
|
|
167
167
|
_GREASE_CHARS = [" ", "(", ")", "-", ".", "/", ":", ";", "=", "?", "_"]
|
|
168
|
-
_GREASE_VERSIONS = ["8", "99", "24"]
|
|
169
168
|
_BRAND_ORDERS = [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]]
|
|
170
169
|
|
|
171
170
|
_BRAND_NAME = {"edge": "Microsoft Edge", "opera": "Opera", "chrome": "Google Chrome"}
|
|
172
171
|
|
|
173
172
|
|
|
174
173
|
def sec_ch_ua(family: str, major: int) -> str | None:
|
|
175
|
-
"""Reproduce Chromium's sec-ch-ua brand list."""
|
|
174
|
+
"""Reproduce Chromium's sec-ch-ua brand list (matches user_agent_utils.cc)."""
|
|
176
175
|
if family not in _CHROMIUM:
|
|
177
176
|
return None
|
|
178
177
|
i = major % 11
|
|
179
178
|
greasey = f"Not{_GREASE_CHARS[i]}A{_GREASE_CHARS[(i + 1) % 11]}Brand"
|
|
180
|
-
greasey_version =
|
|
179
|
+
greasey_version = str(major % 16)
|
|
181
180
|
brand = _BRAND_NAME.get(family, "Google Chrome")
|
|
182
181
|
|
|
183
182
|
order = _BRAND_ORDERS[major % 6]
|
|
@@ -149,7 +149,8 @@ class BypassEngine:
|
|
|
149
149
|
|
|
150
150
|
from urllib.parse import urlsplit
|
|
151
151
|
host = urlsplit(url).netloc
|
|
152
|
-
if self.warm_cookies and
|
|
152
|
+
if self.warm_cookies and vendor != "perimeterx" \
|
|
153
|
+
and host not in self._warmed:
|
|
153
154
|
self._warmed.add(host)
|
|
154
155
|
try:
|
|
155
156
|
from .captcha import warm_cookies as _warm
|
|
@@ -161,7 +162,8 @@ class BypassEngine:
|
|
|
161
162
|
last_resp = resp
|
|
162
163
|
last_detail = vendor
|
|
163
164
|
|
|
164
|
-
|
|
165
|
+
vendor_max = 1 if vendor == "perimeterx" else self.max_attempts
|
|
166
|
+
for attempt_num in range(vendor_max):
|
|
165
167
|
self._record_attempt(vendor)
|
|
166
168
|
|
|
167
169
|
try:
|
|
@@ -198,7 +200,7 @@ class BypassEngine:
|
|
|
198
200
|
self._record_failure(vendor)
|
|
199
201
|
else:
|
|
200
202
|
self._record_failure(vendor)
|
|
201
|
-
if attempt_num <
|
|
203
|
+
if attempt_num < vendor_max - 1:
|
|
202
204
|
try:
|
|
203
205
|
fresh = http_func("GET", url, **retry_kwargs)
|
|
204
206
|
if fresh.status_code < 400:
|
|
@@ -220,12 +222,14 @@ class BypassEngine:
|
|
|
220
222
|
|
|
221
223
|
return BypassResult(
|
|
222
224
|
success=False, vendor=last_detail,
|
|
223
|
-
attempts=
|
|
225
|
+
attempts=vendor_max, response=last_resp,
|
|
224
226
|
)
|
|
225
227
|
|
|
226
228
|
def _try_fallback(self, http_func, url, resp, jsenv, vendor,
|
|
227
229
|
user_agent="", **kw) -> BypassResult | None:
|
|
228
230
|
"""Vendor-specific fallback strategies after main bypass fails."""
|
|
231
|
+
if vendor == "perimeterx":
|
|
232
|
+
return None
|
|
229
233
|
from .captcha import (
|
|
230
234
|
analyze_challenge, cf_challenge_flow,
|
|
231
235
|
dd_interstitial_flow, px_multi_phase,
|
|
@@ -253,12 +257,7 @@ class BypassEngine:
|
|
|
253
257
|
final)
|
|
254
258
|
|
|
255
259
|
elif vendor == "perimeterx" and not info.has_captcha:
|
|
256
|
-
|
|
257
|
-
http_func, url, resp, jsenv)
|
|
258
|
-
if ok:
|
|
259
|
-
self._record_success(vendor)
|
|
260
|
-
return BypassResult(True, detail, self.max_attempts + 1,
|
|
261
|
-
final)
|
|
260
|
+
pass
|
|
262
261
|
except Exception:
|
|
263
262
|
pass
|
|
264
263
|
|
|
@@ -296,7 +295,8 @@ class BypassEngine:
|
|
|
296
295
|
profile = kw.pop("profile", "chrome138")
|
|
297
296
|
|
|
298
297
|
try:
|
|
299
|
-
with StealthBrowser(profile=profile, proxy=proxy
|
|
298
|
+
with StealthBrowser(profile=profile, proxy=proxy,
|
|
299
|
+
timeout=15.0) as browser:
|
|
300
300
|
cookies = browser.solve(url)
|
|
301
301
|
except Exception:
|
|
302
302
|
self._record_failure(vendor)
|
|
@@ -319,7 +319,7 @@ class BypassEngine:
|
|
|
319
319
|
try:
|
|
320
320
|
from ..cdp_solver import StealthBrowser as SB
|
|
321
321
|
from ..response import Response
|
|
322
|
-
with SB(profile=profile, proxy=proxy) as browser:
|
|
322
|
+
with SB(profile=profile, proxy=proxy, timeout=15.0) as browser:
|
|
323
323
|
result = browser.solve_and_fetch(url)
|
|
324
324
|
if result and result.get("s", 0) < 400:
|
|
325
325
|
final = Response(
|
|
@@ -117,7 +117,8 @@ def parse_subresources(body: bytes, base_url: str, *,
|
|
|
117
117
|
|
|
118
118
|
def load_subresources(http_func, body: bytes, page_url: str, *,
|
|
119
119
|
rng: random.Random | None = None,
|
|
120
|
-
skip_external: bool = True
|
|
120
|
+
skip_external: bool = True,
|
|
121
|
+
timeout: float = 8) -> int:
|
|
121
122
|
"""Fetch challenge page subresources like a real browser would.
|
|
122
123
|
|
|
123
124
|
Returns the number of resources loaded.
|
|
@@ -136,6 +137,7 @@ def load_subresources(http_func, body: bytes, page_url: str, *,
|
|
|
136
137
|
headers={"referer": page_url},
|
|
137
138
|
kind=kind,
|
|
138
139
|
allow_redirects=True,
|
|
140
|
+
timeout=timeout,
|
|
139
141
|
)
|
|
140
142
|
loaded += 1
|
|
141
143
|
except Exception:
|
|
@@ -146,7 +148,8 @@ def load_subresources(http_func, body: bytes, page_url: str, *,
|
|
|
146
148
|
|
|
147
149
|
|
|
148
150
|
def fetch_vendor_script(http_func, script_url: str, page_url: str,
|
|
149
|
-
*, rng: random.Random | None = None
|
|
151
|
+
*, rng: random.Random | None = None,
|
|
152
|
+
timeout: float = 8):
|
|
150
153
|
"""Load a vendor's challenge JS — the step most bypasses skip.
|
|
151
154
|
|
|
152
155
|
This is the single biggest tell: the server knows its script was
|
|
@@ -163,6 +166,7 @@ def fetch_vendor_script(http_func, script_url: str, page_url: str,
|
|
|
163
166
|
headers={"referer": page_url},
|
|
164
167
|
kind="script",
|
|
165
168
|
allow_redirects=True,
|
|
169
|
+
timeout=timeout,
|
|
166
170
|
)
|
|
167
171
|
return resp
|
|
168
172
|
except Exception:
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
"""PerimeterX (HUMAN Security) stealth bypass.
|
|
2
|
+
|
|
3
|
+
PX applies stricter risk scoring to Chrome-branded requests (bots
|
|
4
|
+
overwhelmingly impersonate Chrome). Edge uses the same Chromium TLS
|
|
5
|
+
stack but gets a lower risk baseline — so identity swap to Edge is
|
|
6
|
+
a stable bypass, not a hack.
|
|
7
|
+
|
|
8
|
+
Strategy (priority order):
|
|
9
|
+
1. Identity swap — replay the original request with Edge sec-ch-ua/UA
|
|
10
|
+
on the same session (same TLS, same cookies).
|
|
11
|
+
2. Fresh-session probe — new Session with Edge profile if identity
|
|
12
|
+
swap fails (covers cookie/IP-bound blocks).
|
|
13
|
+
3. Collector flow — multi-round device probe via /_px/xhr/api/v2/collector.
|
|
14
|
+
4. CDP fallback — system Chrome headless solve for captcha pages.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import random
|
|
20
|
+
import re
|
|
21
|
+
from urllib.parse import urlsplit
|
|
22
|
+
|
|
23
|
+
from ..collectors.perimeterx import PerimeterXCollector
|
|
24
|
+
from .flow import (
|
|
25
|
+
extract_scripts_by_vendor,
|
|
26
|
+
fetch_vendor_script,
|
|
27
|
+
generate_progressive_events,
|
|
28
|
+
load_subresources,
|
|
29
|
+
stealth_delay,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
_PX_APP_ID_RE = re.compile(rb'["\']appId["\']\s*:\s*["\']([A-Za-z0-9]+)["\']')
|
|
33
|
+
_PX_APP_ID_ASSIGN = re.compile(rb'_pxAppId\s*[=:]\s*["\']?(PX[A-Za-z0-9]{6,12})["\']?')
|
|
34
|
+
_PX_APP_ID_ALT = re.compile(rb'PX([A-Za-z0-9]{6,12})')
|
|
35
|
+
_PX_CAPTCHA_RE = re.compile(rb'px-captcha|captcha\.px-cdn')
|
|
36
|
+
_PX_BLOCK_RE = re.compile(rb'_pxhd|perimeterx|/_px/')
|
|
37
|
+
_PX_BODY_RE = re.compile(
|
|
38
|
+
rb'_pxAppId|window\._pxVid|_px_block_id|px-cdn|human\.security',
|
|
39
|
+
re.I,
|
|
40
|
+
)
|
|
41
|
+
_PX_INIT_RE = re.compile(
|
|
42
|
+
rb'src=["\']([^"\']*(?:/_px/|perimeterx/|PX[A-Z0-9]{6,12})[^"\']*\.js)["\']',
|
|
43
|
+
re.I,
|
|
44
|
+
)
|
|
45
|
+
_PX_JS_SRC_RE = re.compile(rb'_pxJsClientSrc\s*=\s*["\']([^"\']+)["\']')
|
|
46
|
+
_PX_HOST_URL_RE = re.compile(rb'_pxHostUrl\s*=\s*["\']([^"\']+)["\']')
|
|
47
|
+
_PX_FP_PATH_RE = re.compile(rb'["\'](/[^"\']*(?:perimeterx|_px)/xhr[^"\']*)["\']')
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def detect(status_code: int, headers: dict[str, str], body: bytes) -> bool:
|
|
51
|
+
for k, v in headers.items():
|
|
52
|
+
lk = k.lower()
|
|
53
|
+
if lk == "x-px-blocked":
|
|
54
|
+
return True
|
|
55
|
+
if lk == "set-cookie" and "_pxhd=" in v and status_code >= 400:
|
|
56
|
+
return True
|
|
57
|
+
if status_code >= 400:
|
|
58
|
+
if _PX_BLOCK_RE.search(body):
|
|
59
|
+
return True
|
|
60
|
+
if _PX_CAPTCHA_RE.search(body):
|
|
61
|
+
return True
|
|
62
|
+
if _PX_BODY_RE.search(body):
|
|
63
|
+
return True
|
|
64
|
+
for k, v in headers.items():
|
|
65
|
+
if k.lower() == "set-cookie" and "_px3=" in v:
|
|
66
|
+
return True
|
|
67
|
+
return False
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _is_captcha(body: bytes) -> bool:
|
|
71
|
+
return bool(_PX_CAPTCHA_RE.search(body))
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _extract_app_id(body: bytes) -> str:
|
|
75
|
+
m = _PX_APP_ID_ASSIGN.search(body)
|
|
76
|
+
if m:
|
|
77
|
+
return m.group(1).decode("ascii", "replace")
|
|
78
|
+
m = _PX_APP_ID_RE.search(body)
|
|
79
|
+
if m:
|
|
80
|
+
return m.group(1).decode("ascii", "replace")
|
|
81
|
+
m = _PX_APP_ID_ALT.search(body)
|
|
82
|
+
if m:
|
|
83
|
+
return "PX" + m.group(1).decode("ascii", "replace")
|
|
84
|
+
return ""
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _find_init_url(body: bytes, base_url: str) -> str:
|
|
88
|
+
parts = urlsplit(base_url)
|
|
89
|
+
origin = f"{parts.scheme}://{parts.netloc}"
|
|
90
|
+
m = _PX_JS_SRC_RE.search(body)
|
|
91
|
+
if not m:
|
|
92
|
+
m = _PX_INIT_RE.search(body)
|
|
93
|
+
if m:
|
|
94
|
+
src = m.group(1).decode("ascii", "replace")
|
|
95
|
+
if src.startswith("//"):
|
|
96
|
+
return f"{parts.scheme}:{src}"
|
|
97
|
+
if src.startswith("/"):
|
|
98
|
+
return f"{origin}{src}"
|
|
99
|
+
if src.startswith("http"):
|
|
100
|
+
return src
|
|
101
|
+
return f"{origin}/_px/init.js"
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def _find_first_party_path(body: bytes) -> str:
|
|
105
|
+
"""Extract first-party XHR path (e.g. /HYx10rg3/xhr or /_px/xhr)."""
|
|
106
|
+
m = _PX_HOST_URL_RE.search(body)
|
|
107
|
+
if m:
|
|
108
|
+
return m.group(1).decode("ascii", "replace")
|
|
109
|
+
m = _PX_FP_PATH_RE.search(body)
|
|
110
|
+
if m:
|
|
111
|
+
return m.group(1).decode("ascii", "replace")
|
|
112
|
+
return ""
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def _extract_uuid(body: bytes) -> str:
|
|
116
|
+
m = re.search(rb"_pxUuid\s*=\s*'([^']+)'", body)
|
|
117
|
+
return m.group(1).decode("ascii", "replace") if m else ""
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _extract_js_src(body: bytes) -> str:
|
|
121
|
+
m = re.search(rb"_pxJsClientSrc\s*=\s*'([^']+)'", body)
|
|
122
|
+
return m.group(1).decode("ascii", "replace") if m else ""
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def _submit_collector(http_func, collector_url: str, collector, payload_json: str,
|
|
126
|
+
origin: str, page_url: str, *, timeout: float = 10):
|
|
127
|
+
body = collector.encode_body(payload_json)
|
|
128
|
+
hdrs = collector.headers()
|
|
129
|
+
hdrs["origin"] = origin
|
|
130
|
+
hdrs["referer"] = page_url
|
|
131
|
+
return http_func(
|
|
132
|
+
"POST", collector_url, data=body, headers=hdrs,
|
|
133
|
+
kind="xhr", allow_redirects=False, timeout=timeout,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def _collect_px_cookies(resp, px_cookies: dict[str, str],
|
|
138
|
+
collector, cookie_names=("_pxvid", "_px3", "_pxhd")):
|
|
139
|
+
parsed = collector.parse_response(
|
|
140
|
+
resp.text if hasattr(resp, "text") else "")
|
|
141
|
+
px_cookies.update(parsed)
|
|
142
|
+
for sc in getattr(resp, "set_cookie_all", []):
|
|
143
|
+
for cn in cookie_names:
|
|
144
|
+
marker = f"{cn}="
|
|
145
|
+
if marker in sc:
|
|
146
|
+
px_cookies[cn] = sc.split(marker)[1].split(";")[0]
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def _edge_headers(chromium_ver: int = 138) -> tuple[str, str]:
|
|
150
|
+
"""Build Edge sec-ch-ua and UA for a given Chromium version."""
|
|
151
|
+
from .._fallback import sec_ch_ua as _build_ch_ua
|
|
152
|
+
ch = _build_ch_ua("edge", chromium_ver)
|
|
153
|
+
if not ch:
|
|
154
|
+
ch = (f'"Not A;Brand";v="8", "Chromium";v="{chromium_ver}", '
|
|
155
|
+
f'"Microsoft Edge";v="{chromium_ver}"')
|
|
156
|
+
ua = (f"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
|
|
157
|
+
f"AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
158
|
+
f"Chrome/{chromium_ver}.0.0.0 Safari/537.36 Edg/{chromium_ver}.0.0.0")
|
|
159
|
+
return ch, ua
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def _identity_swap(http_func, url: str, jsenv=None, **kwargs):
|
|
163
|
+
"""Replay the request on the same session with Edge identity headers."""
|
|
164
|
+
ver = getattr(jsenv, "version", 138) if jsenv else 138
|
|
165
|
+
ch_ua, ua = _edge_headers(ver)
|
|
166
|
+
|
|
167
|
+
retry_kw = dict(kwargs)
|
|
168
|
+
hdrs = dict(retry_kw.pop("headers", None) or {})
|
|
169
|
+
hdrs["sec-ch-ua"] = ch_ua
|
|
170
|
+
hdrs["user-agent"] = ua
|
|
171
|
+
retry_kw["headers"] = hdrs
|
|
172
|
+
try:
|
|
173
|
+
r = http_func("GET", url, **retry_kw)
|
|
174
|
+
if r.status_code < 400:
|
|
175
|
+
return True, r, "perimeterx-identity-swap"
|
|
176
|
+
except Exception:
|
|
177
|
+
pass
|
|
178
|
+
return False, None, "perimeterx-identity-swap-fail"
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def _fresh_session(url: str, resp, jsenv=None, **kwargs):
|
|
182
|
+
"""Try a fresh Edge session when identity swap fails."""
|
|
183
|
+
try:
|
|
184
|
+
from .. import Session
|
|
185
|
+
except ImportError:
|
|
186
|
+
return False, resp, "perimeterx-no-session"
|
|
187
|
+
|
|
188
|
+
proxy = kwargs.get("proxy") or kwargs.get("proxies")
|
|
189
|
+
if isinstance(proxy, dict):
|
|
190
|
+
proxy = proxy.get("https") or proxy.get("http")
|
|
191
|
+
|
|
192
|
+
ver = getattr(jsenv, "version", 138) if jsenv else 138
|
|
193
|
+
profile = f"edge{ver}"
|
|
194
|
+
try:
|
|
195
|
+
with Session(browser=profile, proxy=proxy) as alt:
|
|
196
|
+
r = alt.get(url, timeout=10)
|
|
197
|
+
if r.status_code < 400:
|
|
198
|
+
return True, r, f"perimeterx-fresh-{profile}"
|
|
199
|
+
except Exception:
|
|
200
|
+
pass
|
|
201
|
+
return False, resp, "perimeterx-fresh-exhausted"
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def _persist_edge_identity(jsenv):
|
|
205
|
+
"""Switch jsenv to Edge so subsequent requests auto-generate Edge headers."""
|
|
206
|
+
if jsenv is None:
|
|
207
|
+
return
|
|
208
|
+
ver = getattr(jsenv, "version", 138)
|
|
209
|
+
_, ua = _edge_headers(ver)
|
|
210
|
+
jsenv.family = "edge"
|
|
211
|
+
jsenv._px_edge_ua = ua
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def attempt(http_func, url: str, resp, jsenv, **kwargs):
|
|
215
|
+
"""PX bypass — identity swap, fresh session, collector, CDP."""
|
|
216
|
+
import time as _time
|
|
217
|
+
_attempt_deadline = _time.monotonic() + 45
|
|
218
|
+
|
|
219
|
+
captcha = _is_captcha(resp.content)
|
|
220
|
+
|
|
221
|
+
# Strategy 1: identity swap (fastest — same session, Edge headers)
|
|
222
|
+
if http_func is not None:
|
|
223
|
+
ok, final, detail = _identity_swap(http_func, url, jsenv=jsenv, **kwargs)
|
|
224
|
+
if ok:
|
|
225
|
+
_persist_edge_identity(jsenv)
|
|
226
|
+
return True, final, detail
|
|
227
|
+
|
|
228
|
+
# Captcha pages: skip HTTP strategies, go to CDP
|
|
229
|
+
if captcha:
|
|
230
|
+
return _cdp_fallback(http_func, url, resp, kwargs)
|
|
231
|
+
|
|
232
|
+
# Strategy 2: fresh Edge session
|
|
233
|
+
if _time.monotonic() < _attempt_deadline:
|
|
234
|
+
ok, final, detail = _fresh_session(url, resp, jsenv=jsenv, **kwargs)
|
|
235
|
+
if ok:
|
|
236
|
+
_persist_edge_identity(jsenv)
|
|
237
|
+
return True, final, detail
|
|
238
|
+
|
|
239
|
+
# Strategy 3: collector flow
|
|
240
|
+
if _time.monotonic() >= _attempt_deadline:
|
|
241
|
+
return False, resp, "perimeterx-attempt-timeout"
|
|
242
|
+
ok, final, detail = _collector_flow(http_func, url, resp, jsenv, **kwargs)
|
|
243
|
+
if ok:
|
|
244
|
+
_persist_edge_identity(jsenv)
|
|
245
|
+
return True, final, detail
|
|
246
|
+
|
|
247
|
+
return False, final or resp, detail or "perimeterx-no-validation"
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def _collector_flow(http_func, url: str, resp, jsenv, **kwargs):
|
|
251
|
+
"""Multi-round collector flow against PX."""
|
|
252
|
+
import time as _time
|
|
253
|
+
_deadline = _time.monotonic() + 30
|
|
254
|
+
rng = random.Random()
|
|
255
|
+
page_url = resp.url or url
|
|
256
|
+
parts = urlsplit(page_url)
|
|
257
|
+
origin = f"{parts.scheme}://{parts.netloc}"
|
|
258
|
+
app_id = _extract_app_id(resp.content)
|
|
259
|
+
px_uuid = _extract_uuid(resp.content)
|
|
260
|
+
js_src = _extract_js_src(resp.content)
|
|
261
|
+
|
|
262
|
+
def _expired():
|
|
263
|
+
return _time.monotonic() > _deadline
|
|
264
|
+
|
|
265
|
+
stealth_delay("page_load", rng=rng)
|
|
266
|
+
if _expired():
|
|
267
|
+
return False, resp, "perimeterx-collector-timeout"
|
|
268
|
+
load_subresources(http_func, resp.content, page_url, rng=rng)
|
|
269
|
+
|
|
270
|
+
if _expired():
|
|
271
|
+
return False, resp, "perimeterx-collector-timeout"
|
|
272
|
+
stealth_delay("script_load", rng=rng)
|
|
273
|
+
if js_src:
|
|
274
|
+
init_url = f"{origin}{js_src}"
|
|
275
|
+
else:
|
|
276
|
+
init_url = _find_init_url(resp.content, page_url)
|
|
277
|
+
px_scripts = extract_scripts_by_vendor(resp.content, "perimeterx", page_url)
|
|
278
|
+
if px_scripts:
|
|
279
|
+
for script_url in px_scripts[:2]:
|
|
280
|
+
if _expired():
|
|
281
|
+
break
|
|
282
|
+
fetch_vendor_script(http_func, script_url, page_url, rng=rng)
|
|
283
|
+
else:
|
|
284
|
+
fetch_vendor_script(http_func, init_url, page_url, rng=rng)
|
|
285
|
+
|
|
286
|
+
if _expired():
|
|
287
|
+
return False, resp, "perimeterx-collector-timeout"
|
|
288
|
+
stealth_delay("script_init", rng=rng)
|
|
289
|
+
collector = PerimeterXCollector(app_id=app_id)
|
|
290
|
+
if px_uuid:
|
|
291
|
+
collector._vid = px_uuid
|
|
292
|
+
fp_path = _find_first_party_path(resp.content)
|
|
293
|
+
collector_url = collector.post_url(page_url, first_party_path=fp_path)
|
|
294
|
+
|
|
295
|
+
if _expired():
|
|
296
|
+
return False, resp, "perimeterx-collector-timeout"
|
|
297
|
+
events_r0 = generate_progressive_events(jsenv, page_url, 0, rng=rng)
|
|
298
|
+
payload_r0 = collector.generate(jsenv, events_r0, page_url)
|
|
299
|
+
r1 = _submit_collector(http_func, collector_url, collector, payload_r0,
|
|
300
|
+
origin, page_url)
|
|
301
|
+
px_cookies: dict[str, str] = {}
|
|
302
|
+
_collect_px_cookies(r1, px_cookies, collector)
|
|
303
|
+
|
|
304
|
+
if _expired():
|
|
305
|
+
return False, resp, "perimeterx-collector-timeout"
|
|
306
|
+
stealth_delay("interaction", rng=rng)
|
|
307
|
+
events_r1 = generate_progressive_events(jsenv, page_url, 1, rng=rng)
|
|
308
|
+
payload_r1 = collector.generate(jsenv, events_r1, page_url)
|
|
309
|
+
r2 = _submit_collector(http_func, collector_url, collector, payload_r1,
|
|
310
|
+
origin, page_url)
|
|
311
|
+
_collect_px_cookies(r2, px_cookies, collector)
|
|
312
|
+
|
|
313
|
+
if "_px3" not in px_cookies:
|
|
314
|
+
if _expired():
|
|
315
|
+
return False, resp, "perimeterx-collector-timeout"
|
|
316
|
+
stealth_delay("between_rounds", rng=rng)
|
|
317
|
+
events_r2 = generate_progressive_events(jsenv, page_url, 2, rng=rng)
|
|
318
|
+
payload_r2 = collector.generate(jsenv, events_r2, page_url)
|
|
319
|
+
r3 = _submit_collector(http_func, collector_url, collector, payload_r2,
|
|
320
|
+
origin, page_url)
|
|
321
|
+
_collect_px_cookies(r3, px_cookies, collector)
|
|
322
|
+
|
|
323
|
+
if _expired():
|
|
324
|
+
return False, resp, "perimeterx-collector-timeout"
|
|
325
|
+
stealth_delay("before_retry", rng=rng)
|
|
326
|
+
retry_kw = dict(kwargs)
|
|
327
|
+
if px_cookies:
|
|
328
|
+
merged = {**(retry_kw.get("cookies") or {}), **px_cookies}
|
|
329
|
+
retry_kw["cookies"] = merged
|
|
330
|
+
final = http_func("GET", url, **retry_kw)
|
|
331
|
+
|
|
332
|
+
if final.status_code < 400:
|
|
333
|
+
return True, final, "perimeterx-collector"
|
|
334
|
+
|
|
335
|
+
return False, final, "perimeterx-collector-fail"
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
def _cdp_fallback(http_func, url: str, resp, kwargs):
|
|
339
|
+
"""Fall back to CDP browser solve for PX captcha / persistent blocks."""
|
|
340
|
+
proxy = kwargs.get("proxy") or kwargs.get("proxies")
|
|
341
|
+
if isinstance(proxy, dict):
|
|
342
|
+
proxy = proxy.get("https") or proxy.get("http")
|
|
343
|
+
if proxy:
|
|
344
|
+
return False, resp, "perimeterx-captcha-proxy-skip"
|
|
345
|
+
try:
|
|
346
|
+
from ..cdp_solver import StealthBrowser
|
|
347
|
+
from ..cdp_solver import find_chrome
|
|
348
|
+
except ImportError:
|
|
349
|
+
return False, resp, "perimeterx-captcha"
|
|
350
|
+
if not find_chrome():
|
|
351
|
+
return False, resp, "perimeterx-captcha-no-chrome"
|
|
352
|
+
try:
|
|
353
|
+
with StealthBrowser(timeout=15.0) as b:
|
|
354
|
+
result = b.solve_navigate(url)
|
|
355
|
+
if result.get("status") == 200:
|
|
356
|
+
from ..response import Response as Resp
|
|
357
|
+
final = Resp(
|
|
358
|
+
status_code=200,
|
|
359
|
+
headers={"content-type": "text/html"},
|
|
360
|
+
content=result.get("html", "").encode(),
|
|
361
|
+
url=result.get("url", url),
|
|
362
|
+
elapsed=0.0,
|
|
363
|
+
)
|
|
364
|
+
return True, final, "perimeterx-cdp"
|
|
365
|
+
except Exception:
|
|
366
|
+
pass
|
|
367
|
+
return False, resp, "perimeterx-captcha"
|
|
@@ -95,9 +95,11 @@ class HintStore:
|
|
|
95
95
|
with self._lock:
|
|
96
96
|
policy = self._origins.get(origin)
|
|
97
97
|
|
|
98
|
-
# Always send low-entropy
|
|
98
|
+
# Always send low-entropy — use corrected Python GREASE algorithm
|
|
99
|
+
from ._fallback import sec_ch_ua as _correct_sec_ch_ua
|
|
99
100
|
out: dict[str, str] = {}
|
|
100
|
-
|
|
101
|
+
corrected = _correct_sec_ch_ua(jsenv.family, jsenv.version)
|
|
102
|
+
out["sec-ch-ua"] = corrected or profile.sec_ch_ua or ""
|
|
101
103
|
out["sec-ch-ua-mobile"] = "?1" if jsenv.form_factor == "Mobile" else "?0"
|
|
102
104
|
out["sec-ch-ua-platform"] = f'"{_platform_name(jsenv.platform)}"'
|
|
103
105
|
|
|
@@ -188,8 +188,11 @@ class PerimeterXCollector:
|
|
|
188
188
|
return f"{parts.scheme}://{parts.netloc}/_px/xhr/api/v2/collector"
|
|
189
189
|
|
|
190
190
|
def headers(self, *, cloud: bool = False) -> dict[str, str]:
|
|
191
|
-
ct = "application/x-www-form-urlencoded" if cloud else "application/json"
|
|
192
191
|
return {
|
|
193
|
-
"content-type":
|
|
192
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
194
193
|
"x-px-authorization": "3",
|
|
195
194
|
}
|
|
195
|
+
|
|
196
|
+
def encode_body(self, payload_json: str) -> bytes:
|
|
197
|
+
from urllib.parse import quote
|
|
198
|
+
return f"payload={quote(payload_json)}".encode()
|
|
@@ -187,6 +187,13 @@ class CookieJar:
|
|
|
187
187
|
for k in [k for k in bucket if k[1] == d or k[1].endswith("." + d)]:
|
|
188
188
|
del bucket[k]
|
|
189
189
|
|
|
190
|
+
def clear_px(self) -> None:
|
|
191
|
+
"""Remove all PerimeterX tracking cookies."""
|
|
192
|
+
with self._lock:
|
|
193
|
+
for bucket in self._store.values():
|
|
194
|
+
for k in [k for k in bucket if k[0].startswith("_px")]:
|
|
195
|
+
del bucket[k]
|
|
196
|
+
|
|
190
197
|
def sweep_expired(self) -> int:
|
|
191
198
|
"""Drop expired cookies. Returns how many were removed."""
|
|
192
199
|
now = time.time()
|
|
@@ -208,6 +208,7 @@ class Session(SessionExtMixin):
|
|
|
208
208
|
# Automatic antibot bypass engine
|
|
209
209
|
self.bypass = BypassEngine(enabled=auto_bypass)
|
|
210
210
|
self._bypass_depth = threading.local()
|
|
211
|
+
self._px_hosts: set[str] = set()
|
|
211
212
|
|
|
212
213
|
# JS emulation: HSTS enforcement, Client Hints negotiation, environment
|
|
213
214
|
self.hsts = HstsStore()
|
|
@@ -261,6 +262,13 @@ class Session(SessionExtMixin):
|
|
|
261
262
|
# HSTS: upgrade HTTP→HTTPS for preloaded and learned domains
|
|
262
263
|
url = self.hsts.upgrade(url)
|
|
263
264
|
host = _host(url)
|
|
265
|
+
|
|
266
|
+
# PX-protected hosts: fresh Edge session per request
|
|
267
|
+
bypass_depth = getattr(self._bypass_depth, "value", 0)
|
|
268
|
+
if (host in self._px_hosts and bypass_depth == 0
|
|
269
|
+
and _interstitial_depth == 0):
|
|
270
|
+
return self._px_fresh_request(url, host, proxy=proxy,
|
|
271
|
+
timeout=timeout)
|
|
264
272
|
kind_obj = resolve_kind(kind or self.default_kind)
|
|
265
273
|
use_verify = self.verify if verify is None else verify
|
|
266
274
|
use_resolve = {**self.resolve, **(resolve or {})}
|
|
@@ -378,7 +386,8 @@ class Session(SessionExtMixin):
|
|
|
378
386
|
self.proxies.report_failure(req.proxy)
|
|
379
387
|
self.circuit.record_failure(host)
|
|
380
388
|
self.hooks.run("error", exc, request=req)
|
|
381
|
-
if self.retry.should_retry(
|
|
389
|
+
if bypass_depth == 0 and self.retry.should_retry(
|
|
390
|
+
attempt, req.method, None, exc):
|
|
382
391
|
self._sleep_before_retry(attempt, None, req, host)
|
|
383
392
|
attempt += 1
|
|
384
393
|
continue
|
|
@@ -449,7 +458,15 @@ class Session(SessionExtMixin):
|
|
|
449
458
|
resp = self.hooks.run("response", resp)
|
|
450
459
|
|
|
451
460
|
retry_after = parse_retry_after(resp.headers.get("retry-after"))
|
|
452
|
-
|
|
461
|
+
bypass_can_handle = (
|
|
462
|
+
self.bypass.enabled and resp.status_code >= 400
|
|
463
|
+
and bypass_depth == 0 and _interstitial_depth == 0
|
|
464
|
+
and self.bypass.detect_vendor(
|
|
465
|
+
resp.status_code, resp.headers, resp.content,
|
|
466
|
+
cookies=getattr(resp, "cookies", None)) is not None
|
|
467
|
+
)
|
|
468
|
+
if not bypass_can_handle and bypass_depth == 0 \
|
|
469
|
+
and self.retry.should_retry(
|
|
453
470
|
attempt, req.method, resp.status_code, None, banned=bool(ban_reason)
|
|
454
471
|
):
|
|
455
472
|
self._sleep_before_retry(attempt, retry_after, req, host)
|
|
@@ -479,9 +496,14 @@ class Session(SessionExtMixin):
|
|
|
479
496
|
user_agent=profile.user_agent,
|
|
480
497
|
headers=headers, timeout=timeout, kind="navigate",
|
|
481
498
|
verify=verify, resolve=resolve,
|
|
482
|
-
browser=profile_name,
|
|
499
|
+
browser=profile_name, proxy=chosen_proxy,
|
|
483
500
|
)
|
|
484
501
|
if bypass_result.success and bypass_result.response is not None:
|
|
502
|
+
edge_ua = getattr(self.jsenv, "_px_edge_ua", None)
|
|
503
|
+
if edge_ua:
|
|
504
|
+
self.headers["user-agent"] = edge_ua
|
|
505
|
+
self.cookies.clear_px()
|
|
506
|
+
self._px_hosts.add(host)
|
|
485
507
|
return bypass_result.response
|
|
486
508
|
|
|
487
509
|
return resp
|
|
@@ -109,6 +109,28 @@ class SessionExtMixin:
|
|
|
109
109
|
finally:
|
|
110
110
|
self._bypass_depth.value = depth
|
|
111
111
|
|
|
112
|
+
def _px_fresh_request(self, url: str, host: str, *,
|
|
113
|
+
proxy=None, timeout=None):
|
|
114
|
+
"""Route requests to known PX-protected hosts via fresh Edge sessions."""
|
|
115
|
+
from . import Session
|
|
116
|
+
px_proxy = proxy
|
|
117
|
+
if px_proxy is None:
|
|
118
|
+
try:
|
|
119
|
+
px_proxy = self.proxies.acquire(host)
|
|
120
|
+
except Exception:
|
|
121
|
+
px_proxy = None
|
|
122
|
+
ver = getattr(self.jsenv, "version", 138)
|
|
123
|
+
profile = f"edge{ver}"
|
|
124
|
+
try:
|
|
125
|
+
with Session(browser=profile, proxy=px_proxy) as alt:
|
|
126
|
+
r = alt.get(url, timeout=timeout or self.timeout or 20)
|
|
127
|
+
if r.status_code < 400:
|
|
128
|
+
return r
|
|
129
|
+
except Exception:
|
|
130
|
+
pass
|
|
131
|
+
self._px_hosts.discard(host)
|
|
132
|
+
return self.request("GET", url, proxy=proxy, timeout=timeout)
|
|
133
|
+
|
|
112
134
|
def _maybe_interstitial(self, resp: Response, url: str, depth: int):
|
|
113
135
|
if not self.follow_interstitials or depth >= self.max_interstitials:
|
|
114
136
|
return None
|