cfsolve 0.1.1 → 0.1.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +10 -9
- data/THIRD_PARTY_LICENSES/README.md +71 -254
- data/THIRD_PARTY_LICENSES/{derive_builder_macro-0.20.2/LICENSE-APACHE → bytecount-0.6.9/LICENSE.Apache2} +0 -1
- data/THIRD_PARTY_LICENSES/{darling-0.20.11/LICENSE → bytecount-0.6.9/LICENSE.MIT} +1 -3
- data/THIRD_PARTY_LICENSES/{ident_case-1.0.1/LICENSE → cobs-0.3.0/LICENSE-MIT} +1 -1
- data/THIRD_PARTY_LICENSES/cow-utils-0.1.3/LICENSE +21 -0
- data/THIRD_PARTY_LICENSES/{hashbrown-0.14.5 → embedded-io-0.4.0}/LICENSE-MIT +1 -1
- data/THIRD_PARTY_LICENSES/{ahash-0.8.12 → embedded-io-0.6.1}/LICENSE-MIT +1 -1
- data/THIRD_PARTY_LICENSES/{browserslist-data-0.1.4 → escape-simd-0.1.1}/LICENSE +1 -1
- data/THIRD_PARTY_LICENSES/escape-simd-0.1.1/NOTICE +62 -0
- data/THIRD_PARTY_LICENSES/json-escape-simd-3.1.3/LICENSE +21 -0
- data/THIRD_PARTY_LICENSES/{miette-7.6.0/LICENSE → json-escape-simd-3.1.3/LICENSE-APACHE} +0 -1
- data/THIRD_PARTY_LICENSES/json-escape-simd-3.1.3/NOTICE +62 -0
- data/THIRD_PARTY_LICENSES/memchr-2.8.3/UNLICENSE +24 -0
- data/THIRD_PARTY_LICENSES/{derive_builder_core-0.20.2 → nonmax-0.5.5}/LICENSE-APACHE +1 -2
- data/THIRD_PARTY_LICENSES/{dashmap-5.5.3/LICENSE → nonmax-0.5.5/LICENSE-MIT} +2 -4
- data/THIRD_PARTY_LICENSES/{rand-0.8.5 → num-bigint-0.5.1}/LICENSE-MIT +0 -1
- data/THIRD_PARTY_LICENSES/oxc-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/{browserslist-rs-0.19.0 → oxc-browserslist-5.0.1}/LICENSE +1 -0
- data/THIRD_PARTY_LICENSES/oxc_allocator-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_allocator-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ast-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ast-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_macros-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_macros-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_visit-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_visit-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_codegen-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_codegen-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_compat-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_compat-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_data_structures-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_data_structures-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_diagnostics-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_diagnostics-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ecmascript-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ecmascript-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_estree-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_estree-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_index-5.0.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_parser-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_parser-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_regular_expression-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_regular_expression-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_semantic-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_semantic-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_span-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_span-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_str-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_str-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_syntax-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_syntax-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/{fixedbitset-0.5.7 → postcard-1.1.3}/LICENSE-MIT +1 -1
- data/THIRD_PARTY_LICENSES/{bytes-str-0.2.7/LICENSE → self_cell-1.3.0/LICENSE-APACHE} +1 -2
- data/THIRD_PARTY_LICENSES/self_cell-1.3.0/LICENSE-GPLv2 +339 -0
- data/THIRD_PARTY_LICENSES/{darling_core-0.20.11 → smawk-0.3.3}/LICENSE +1 -1
- data/UPSTREAM.md +10 -8
- data/ext/cfsolve/Cargo.lock +534 -1727
- data/ext/cfsolve/Cargo.toml +4 -0
- data/ext/cfsolve/src/main.rs +1 -1
- data/lib/cfsolve/profiles/safari-26-ios/answers.json +2570 -1894
- data/lib/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +1867 -1192
- data/lib/cfsolve/profiles/safari-26-ios.json +102 -156
- data/lib/cfsolve/version.rb +2 -2
- data/vendor/cfsolve/Cargo.lock +561 -1729
- data/vendor/cfsolve/Cargo.toml +26 -8
- data/vendor/cfsolve/README.md +4 -35
- data/vendor/cfsolve/examples/build_profile.rs +17 -15
- data/vendor/cfsolve/examples/capture_session.rs +37 -0
- data/vendor/cfsolve/examples/check_answers.rs +66 -0
- data/vendor/cfsolve/examples/compare_session.rs +189 -0
- data/vendor/cfsolve/examples/solver_profile.rs +84 -0
- data/vendor/cfsolve/examples/solver_smoke.rs +9 -8
- data/vendor/cfsolve/examples/stage2_snapshot.rs +6 -3
- data/vendor/cfsolve/examples/tls_echo.rs +3 -3
- data/vendor/cfsolve/examples/vm_snapshot.rs +32 -33
- data/vendor/cfsolve/profiles/safari-26-ios/answers.json +2570 -1894
- data/vendor/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +1867 -1192
- data/vendor/cfsolve/profiles/safari-26-ios.json +102 -156
- data/vendor/cfsolve/scripts/capture_cssom.mjs +42 -0
- data/vendor/cfsolve/scripts/serve_cssom.py +111 -0
- data/vendor/cfsolve/src/bin/capture-proxy/main.rs +3 -2
- data/vendor/cfsolve/src/bin/challenge/cli.rs +8 -2
- data/vendor/cfsolve/src/bin/challenge/main.rs +7 -2
- data/vendor/cfsolve/src/capture/profile.rs +7 -18
- data/vendor/cfsolve/src/capture/proxy/tests.rs +1 -1
- data/vendor/cfsolve/src/capture/proxy.rs +44 -13
- data/vendor/cfsolve/src/capture/recorded.rs +42 -7
- data/vendor/cfsolve/src/capture/sessions.rs +4 -3
- data/vendor/cfsolve/src/capture/upstream.rs +1 -1
- data/vendor/cfsolve/src/challenge/codec.rs +4 -2
- data/vendor/cfsolve/src/challenge/expression.rs +161 -117
- data/vendor/cfsolve/src/challenge/installed/audit.rs +132 -0
- data/vendor/cfsolve/src/challenge/installed.rs +127 -269
- data/vendor/cfsolve/src/challenge/merge.rs +120 -80
- data/vendor/cfsolve/src/challenge/orchestrator.rs +57 -44
- data/vendor/cfsolve/src/challenge/payload.rs +175 -35
- data/vendor/cfsolve/src/challenge/program.rs +197 -178
- data/vendor/cfsolve/src/challenge/reduced_timing.rs +55 -40
- data/vendor/cfsolve/src/challenge/source.rs +151 -96
- data/vendor/cfsolve/src/challenge/state.rs +236 -122
- data/vendor/cfsolve/src/challenge/tally.rs +64 -50
- data/vendor/cfsolve/src/challenge.rs +1 -0
- data/vendor/cfsolve/src/deobfuscate/analysis/bindings.rs +187 -185
- data/vendor/cfsolve/src/deobfuscate/analysis/effects.rs +42 -51
- data/vendor/cfsolve/src/deobfuscate/analysis/hoisting.rs +147 -228
- data/vendor/cfsolve/src/deobfuscate/analysis/properties.rs +250 -425
- data/vendor/cfsolve/src/deobfuscate/analysis/unconditional.rs +79 -0
- data/vendor/cfsolve/src/deobfuscate/analysis.rs +259 -41
- data/vendor/cfsolve/src/deobfuscate/argument_arrays.rs +70 -73
- data/vendor/cfsolve/src/deobfuscate/arrow_blocks.rs +91 -104
- data/vendor/cfsolve/src/deobfuscate/ast.rs +383 -0
- data/vendor/cfsolve/src/deobfuscate/bitwise.rs +44 -54
- data/vendor/cfsolve/src/deobfuscate/blocks.rs +36 -29
- data/vendor/cfsolve/src/deobfuscate/call_helpers.rs +80 -131
- data/vendor/cfsolve/src/deobfuscate/control_flow.rs +239 -297
- data/vendor/cfsolve/src/deobfuscate/copy_propagation.rs +114 -135
- data/vendor/cfsolve/src/deobfuscate/dead_branches.rs +62 -61
- data/vendor/cfsolve/src/deobfuscate/dead_properties.rs +197 -214
- data/vendor/cfsolve/src/deobfuscate/dispatch.rs +238 -298
- data/vendor/cfsolve/src/deobfuscate/encoded_strings.rs +201 -205
- data/vendor/cfsolve/src/deobfuscate/function_lengths.rs +32 -38
- data/vendor/cfsolve/src/deobfuscate/helper_objects.rs +346 -536
- data/vendor/cfsolve/src/deobfuscate/hygiene.rs +197 -0
- data/vendor/cfsolve/src/deobfuscate/int32_helpers.rs +121 -155
- data/vendor/cfsolve/src/deobfuscate/literals.rs +116 -67
- data/vendor/cfsolve/src/deobfuscate/loops.rs +43 -43
- data/vendor/cfsolve/src/deobfuscate/memoized_strings.rs +127 -131
- data/vendor/cfsolve/src/deobfuscate/merged_functions.rs +262 -220
- data/vendor/cfsolve/src/deobfuscate/pipeline.rs +199 -244
- data/vendor/cfsolve/src/deobfuscate/register_arrays.rs +361 -322
- data/vendor/cfsolve/src/deobfuscate/removal.rs +83 -52
- data/vendor/cfsolve/src/deobfuscate/simplify.rs +147 -0
- data/vendor/cfsolve/src/deobfuscate/state_machines.rs +88 -110
- data/vendor/cfsolve/src/deobfuscate/statements.rs +228 -228
- data/vendor/cfsolve/src/deobfuscate/static_members.rs +46 -31
- data/vendor/cfsolve/src/deobfuscate/testing.rs +49 -59
- data/vendor/cfsolve/src/deobfuscate/unused_bindings.rs +92 -102
- data/vendor/cfsolve/src/deobfuscate.rs +15 -11
- data/vendor/cfsolve/src/embedding_page/extra_params.rs +23 -32
- data/vendor/cfsolve/src/embedding_page/page.rs +28 -2
- data/vendor/cfsolve/src/embedding_page/render_sample.rs +184 -147
- data/vendor/cfsolve/src/error.rs +40 -5
- data/vendor/cfsolve/src/fingerprint.rs +8 -2
- data/vendor/cfsolve/src/http/client.rs +9 -1
- data/vendor/cfsolve/src/http/requests.rs +2 -2
- data/vendor/cfsolve/src/js/ast.rs +479 -254
- data/vendor/cfsolve/src/js/objects.rs +9 -2
- data/vendor/cfsolve/src/lib.rs +1 -0
- data/vendor/cfsolve/src/listing/fold.rs +19 -92
- data/vendor/cfsolve/src/listing/query.rs +26 -291
- data/vendor/cfsolve/src/listing.rs +0 -1
- data/vendor/cfsolve/src/performance_clock.rs +20 -1
- data/vendor/cfsolve/src/profiling.rs +49 -0
- data/vendor/cfsolve/src/script.rs +35 -24
- data/vendor/cfsolve/src/session/challenge_page.rs +41 -21
- data/vendor/cfsolve/src/session/channel.rs +2 -2
- data/vendor/cfsolve/src/session/initial.rs +19 -10
- data/vendor/cfsolve/src/session/probes.rs +160 -125
- data/vendor/cfsolve/src/session/sink.rs +26 -1
- data/vendor/cfsolve/src/session/tests/challenge_page.rs +36 -1
- data/vendor/cfsolve/src/session/timing.rs +58 -53
- data/vendor/cfsolve/src/session/widget.rs +5 -6
- data/vendor/cfsolve/src/session.rs +1 -1
- data/vendor/cfsolve/src/solver.rs +3 -1
- data/vendor/cfsolve/src/stage2/analysis/analyze.rs +50 -33
- data/vendor/cfsolve/src/stage2/analysis/audit.rs +4 -2
- data/vendor/cfsolve/src/stage2/analysis/discovery.rs +61 -66
- data/vendor/cfsolve/src/stage2/analysis/envelope.rs +33 -22
- data/vendor/cfsolve/src/stage2/analysis/recognize.rs +3 -5
- data/vendor/cfsolve/src/stage2/analysis.rs +0 -1
- data/vendor/cfsolve/src/stage2/audit_globals.rs +378 -0
- data/vendor/cfsolve/src/stage2/benchmark.rs +66 -38
- data/vendor/cfsolve/src/stage2/call_stack.rs +1463 -1017
- data/vendor/cfsolve/src/stage2/challenge_page.rs +3 -2
- data/vendor/cfsolve/src/stage2/interaction/checkbox.rs +202 -150
- data/vendor/cfsolve/src/stage2/interaction/click.rs +2 -2
- data/vendor/cfsolve/src/stage2/interaction/native.rs +2 -1
- data/vendor/cfsolve/src/stage2/interaction/plan.rs +5 -7
- data/vendor/cfsolve/src/stage2/payload/recover.rs +56 -25
- data/vendor/cfsolve/src/stage2/probes/clock.rs +1 -3
- data/vendor/cfsolve/src/stage2/probes/ice.rs +11 -10
- data/vendor/cfsolve/src/stage2/probes/media.rs +47 -33
- data/vendor/cfsolve/src/stage2/probes/performance.rs +13 -8
- data/vendor/cfsolve/src/stage2/probes/rects.rs +12 -17
- data/vendor/cfsolve/src/stage2/probes/stack.rs +50 -103
- data/vendor/cfsolve/src/stage2/probes/websocket_echo.rs +17 -86
- data/vendor/cfsolve/src/stage2/probes.rs +0 -1
- data/vendor/cfsolve/src/stage2/queries.rs +50 -0
- data/vendor/cfsolve/src/stage2/records.rs +4 -13
- data/vendor/cfsolve/src/stage2/reference.json +1 -1
- data/vendor/cfsolve/src/stage2/reference.rs +98 -100
- data/vendor/cfsolve/src/stage2/registry.rs +41 -34
- data/vendor/cfsolve/src/stage2/replay.rs +182 -254
- data/vendor/cfsolve/src/stage2/stylesheets.rs +176 -0
- data/vendor/cfsolve/src/stage2/syntax.rs +88 -0
- data/vendor/cfsolve/src/stage2/trace.rs +152 -108
- data/vendor/cfsolve/src/stage2/vocabulary.rs +103 -403
- data/vendor/cfsolve/src/stage2.rs +4 -1
- data/vendor/cfsolve/src/vm/disassemble.rs +46 -13
- data/vendor/cfsolve/src/vm/dispatch.rs +93 -65
- data/vendor/cfsolve/src/vm/extract.rs +347 -250
- data/vendor/cfsolve/src/vm/interpret/access.rs +67 -68
- data/vendor/cfsolve/src/vm/interpret/builtin.rs +16 -63
- data/vendor/cfsolve/src/vm/interpret/call.rs +192 -51
- data/vendor/cfsolve/src/vm/interpret/compile.rs +643 -0
- data/vendor/cfsolve/src/vm/interpret/copies.rs +232 -120
- data/vendor/cfsolve/src/vm/interpret/evaluate/tests.rs +149 -40
- data/vendor/cfsolve/src/vm/interpret/evaluate.rs +189 -572
- data/vendor/cfsolve/src/vm/interpret/explore.rs +159 -46
- data/vendor/cfsolve/src/vm/interpret/formula.rs +131 -0
- data/vendor/cfsolve/src/vm/interpret/frozen.rs +169 -0
- data/vendor/cfsolve/src/vm/interpret/intrinsic.rs +414 -0
- data/vendor/cfsolve/src/vm/interpret/mix32.rs +189 -0
- data/vendor/cfsolve/src/vm/interpret/native_dispatch.rs +220 -0
- data/vendor/cfsolve/src/vm/interpret/pattern.rs +1736 -0
- data/vendor/cfsolve/src/vm/interpret/plan.rs +605 -330
- data/vendor/cfsolve/src/vm/interpret/register_helpers.rs +384 -0
- data/vendor/cfsolve/src/vm/interpret/run.rs +314 -54
- data/vendor/cfsolve/src/vm/interpret/semantics.rs +71 -46
- data/vendor/cfsolve/src/vm/interpret/setup.rs +80 -45
- data/vendor/cfsolve/src/vm/interpret/string_decoder.rs +482 -0
- data/vendor/cfsolve/src/vm/interpret.rs +16 -3
- data/vendor/cfsolve/src/vm/machine.rs +58 -47
- data/vendor/cfsolve/src/vm/output.rs +13 -5
- data/vendor/cfsolve/src/vm/packed_names.rs +311 -0
- data/vendor/cfsolve/src/vm/session.rs +197 -110
- data/vendor/cfsolve/src/vm/value.rs +35 -19
- data/vendor/cfsolve/src/vm.rs +3 -1
- data/vendor/cfsolve/vendor/btls-sys/Cargo.toml +3 -0
- data/vendor/cfsolve/vendor/btls-sys/build/main.rs +20 -0
- data/vendor/cfsolve/vendor/btls-sys/src/lib.rs +3 -0
- metadata +106 -183
- data/THIRD_PARTY_LICENSES/Inflector-0.11.4/LICENSE.md +0 -22
- data/THIRD_PARTY_LICENSES/arrayvec-0.7.6/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/ascii-1.1.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/ascii-1.1.0/LICENSE-MIT +0 -22
- data/THIRD_PARTY_LICENSES/ast_node-5.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/better_scoped_tls-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/bitvec-1.0.1/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/bstr-1.12.1/COPYING +0 -8
- data/THIRD_PARTY_LICENSES/bstr-1.12.1/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/cargo-platform-0.1.9/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/cargo_metadata-0.19.2/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/darling_macro-0.20.11/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/debugid-0.8.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/derive_builder-0.20.2/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/derive_builder_core-0.20.2/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/derive_builder_macro-0.20.2/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/foldhash-0.1.5/LICENSE +0 -19
- data/THIRD_PARTY_LICENSES/from_variant-3.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/funty-2.0.0/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/hashbrown-0.16.1/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/heck-0.5.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/hermit-abi-0.5.2/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/hermit-abi-0.5.2/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/hstr-3.0.3/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/if_chain-1.0.3/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/if_chain-1.0.3/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/is-macro-0.3.7/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/itoa-1.0.17/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/jsonc-parser-0.26.3/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/lazy_static-1.5.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/lazy_static-1.5.0/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/lru-0.16.2/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/memchr-2.7.6/COPYING +0 -3
- data/THIRD_PARTY_LICENSES/memchr-2.7.6/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/miette-derive-7.6.0/LICENSE +0 -229
- data/THIRD_PARTY_LICENSES/normpath-0.2.0/COPYRIGHT +0 -7
- data/THIRD_PARTY_LICENSES/normpath-0.2.0/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/normpath-0.2.0/LICENSE-THIRD-PARTY +0 -210
- data/THIRD_PARTY_LICENSES/num_cpus-1.17.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/num_cpus-1.17.0/LICENSE-MIT +0 -20
- data/THIRD_PARTY_LICENSES/owo-colors-4.2.3/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/par-core-2.0.0/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/par-iter-2.0.0/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/path-clean-0.1.0/LICENSE-APACHE +0 -13
- data/THIRD_PARTY_LICENSES/path-clean-0.1.0/LICENSE-MIT +0 -18
- data/THIRD_PARTY_LICENSES/path-clean-1.0.1/LICENSE-APACHE +0 -13
- data/THIRD_PARTY_LICENSES/path-clean-1.0.1/LICENSE-MIT +0 -18
- data/THIRD_PARTY_LICENSES/pathdiff-0.2.3/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/pathdiff-0.2.3/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/petgraph-0.7.1/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/precomputed-map-0.2.0/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/preset_env_base-6.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/radium-0.7.0/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/radix_fmt-1.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/rand-0.8.5/COPYRIGHT +0 -12
- data/THIRD_PARTY_LICENSES/rand-0.8.5/LICENSE-APACHE +0 -176
- data/THIRD_PARTY_LICENSES/rand_core-0.6.4/COPYRIGHT +0 -12
- data/THIRD_PARTY_LICENSES/rand_core-0.6.4/LICENSE-APACHE +0 -187
- data/THIRD_PARTY_LICENSES/rand_core-0.6.4/LICENSE-MIT +0 -26
- data/THIRD_PARTY_LICENSES/regress-0.10.5/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/regress-0.10.5/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/ryu-1.0.22/LICENSE-APACHE +0 -176
- data/THIRD_PARTY_LICENSES/ryu-1.0.22/LICENSE-BOOST +0 -23
- data/THIRD_PARTY_LICENSES/scoped-tls-1.0.1/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/scoped-tls-1.0.1/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/siphasher-0.3.11/COPYING +0 -7
- data/THIRD_PARTY_LICENSES/smallvec-1.15.1/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/smartstring-1.0.1/LICENCE.md +0 -355
- data/THIRD_PARTY_LICENSES/st-map-0.2.4/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/static-map-macro-0.3.4/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/string_enum-1.0.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/strsim-0.11.1/LICENSE +0 -23
- data/THIRD_PARTY_LICENSES/swc-52.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_allocator-4.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_atoms-9.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_common-18.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_compiler_base-45.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_config-3.1.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_config_macro-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_core-54.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_ast-19.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_codegen-21.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_codegen_macros-2.0.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_bugfixes-39.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_common-30.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2015-39.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2016-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2017-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2018-36.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2019-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2020-37.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2021-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2022-37.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es3-26.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_ext_transforms-25.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_hooks-0.3.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_loader-18.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_minifier-42.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_parser-32.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_preset_env-45.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transformer-6.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms-44.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_base-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_classes-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_compat-40.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_macros-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_module-38.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_optimization-37.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_proposal-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_react-38.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_typescript-38.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_usage_analyzer-27.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_utils-25.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_visit-19.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_eq_ignore_macros-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_error_reporters-20.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_macros_common-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_node_comments-18.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_timer-1.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_trace_macro-2.0.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_transform_common-12.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_visit-2.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/tap-1.0.1/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/tracing-0.1.44/LICENSE +0 -25
- data/THIRD_PARTY_LICENSES/tracing-attributes-0.1.31/LICENSE +0 -25
- data/THIRD_PARTY_LICENSES/tracing-core-0.1.36/LICENSE +0 -25
- data/THIRD_PARTY_LICENSES/triomphe-0.1.15/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/triomphe-0.1.15/LICENSE-MIT +0 -27
- data/THIRD_PARTY_LICENSES/unicode-width-0.1.14/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/unicode-width-0.1.14/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/uuid-1.19.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/uuid-1.19.0/LICENSE-MIT +0 -26
- data/THIRD_PARTY_LICENSES/vergen-9.0.6/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/vergen-9.0.6/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/vergen-lib-0.1.6/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/vergen-lib-0.1.6/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/wyz-0.5.1/LICENSE.txt +0 -21
- data/vendor/cfsolve/src/deobfuscate/analysis/globals.rs +0 -33
- data/vendor/cfsolve/src/deobfuscate/analysis/names.rs +0 -52
- data/vendor/cfsolve/src/listing/normalize.rs +0 -264
- data/vendor/cfsolve/src/stage2/analysis/outputs.rs +0 -327
- data/vendor/cfsolve/src/stage2/probes/stylesheets.rs +0 -249
- data/vendor/cfsolve/src/stage2/reference-expanded.json +0 -42
- data/vendor/cfsolve/src/stage2/session_names.rs +0 -470
- /data/THIRD_PARTY_LICENSES/{derive_builder-0.20.2 → cobs-0.3.0}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{compact_str-0.7.1 → compact_str-0.10.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{ahash-0.8.12 → embedded-io-0.4.0}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{arrayvec-0.7.6 → embedded-io-0.6.1}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{normpath-0.2.0 → escape-simd-0.1.1}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{bstr-1.12.1 → itertools-0.15.0}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{petgraph-0.7.1 → itertools-0.15.0}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{itoa-1.0.17 → itoa-1.0.19}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{camino-1.2.2 → itoa-1.0.19}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{globset-0.4.18 → memchr-2.8.3}/COPYING +0 -0
- /data/THIRD_PARTY_LICENSES/{globset-0.4.18 → memchr-2.8.3}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{camino-1.2.2 → num-bigint-0.5.1}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{swc_sourcemap-9.3.4 → oxc_sourcemap-9.0.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf-0.11.3 → phf-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf_generator-0.11.3 → phf_generator-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf_macros-0.11.3 → phf_macros-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf_shared-0.11.3 → phf_shared-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{fixedbitset-0.5.7 → postcard-1.1.3}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{hashbrown-0.14.5 → smallvec-1.16.5}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{smallvec-1.15.1 → smallvec-1.16.5}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{unicode-width-0.1.14 → unicode-segmentation-1.13.3}/COPYRIGHT +0 -0
- /data/THIRD_PARTY_LICENSES/{hashbrown-0.16.1 → unicode-segmentation-1.13.3}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{heck-0.5.0 → unicode-segmentation-1.13.3}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{cargo-platform-0.1.9 → zmij_ecma-1.0.23}/LICENSE-MIT +0 -0
data/vendor/cfsolve/Cargo.toml
CHANGED
|
@@ -6,6 +6,10 @@ license = "MIT"
|
|
|
6
6
|
default-run = "cfsolve"
|
|
7
7
|
autotests = false
|
|
8
8
|
|
|
9
|
+
[[example]]
|
|
10
|
+
name = "solver_profile"
|
|
11
|
+
required-features = ["internals"]
|
|
12
|
+
|
|
9
13
|
# Without default features, the library is the solver alone: `Browser`, `Options`, `Outcome`
|
|
10
14
|
# and `Error`. The tools in this repository use the rest.
|
|
11
15
|
[features]
|
|
@@ -33,9 +37,11 @@ html5ever = "0.39.0"
|
|
|
33
37
|
# Payload fields keep the order the challenge program builds them in.
|
|
34
38
|
indexmap = { version = "2", features = ["serde"] }
|
|
35
39
|
iana-time-zone = "0.1.64"
|
|
36
|
-
# `CLOCK_MONOTONIC`, the time base Chrome's `performance.now()` is derived from.
|
|
37
|
-
libc = "0.2.189"
|
|
38
40
|
num-bigint = "0.4.6"
|
|
41
|
+
# Deobfuscation, extraction, and the VM use Oxc's arena AST, semantic symbols, visitors, and
|
|
42
|
+
# constant evaluator.
|
|
43
|
+
oxc = { version = "0.157.0", features = ["ast_visit", "codegen", "semantic"] }
|
|
44
|
+
oxc_ecmascript = { version = "0.157.0", features = ["constant_evaluation"] }
|
|
39
45
|
# A returned program's payload can hold a capture of `RegExp(...).exec(...)`.
|
|
40
46
|
regex = "1.12.2"
|
|
41
47
|
ryu-js = "1.0.2"
|
|
@@ -47,12 +53,9 @@ scraper = { version = "0.27.0", features = ["deterministic"] }
|
|
|
47
53
|
serde = { version = "1.0.228", features = ["derive"] }
|
|
48
54
|
# Browser measurements must retain the exact doubles produced by JSON.parse.
|
|
49
55
|
serde_json = { version = "1.0.151", features = ["float_roundtrip", "preserve_order"] }
|
|
56
|
+
# Parsed scripts own the arena their Oxc tree borrows.
|
|
57
|
+
self_cell = "1.2.0"
|
|
50
58
|
sha2 = "0.10.9"
|
|
51
|
-
# No default features: the linter and TypeScript declaration emit are unused.
|
|
52
|
-
swc = { version = "52.0.0", default-features = false }
|
|
53
|
-
swc_core = { version = "54.0.0", features = ["common", "ecma_ast", "ecma_visit", "ecma_codegen", "ecma_parser"] }
|
|
54
|
-
swc_ecma_transforms = "44.0.0"
|
|
55
|
-
swc_ecma_utils = "25.0.0"
|
|
56
59
|
tokio = { version = "1.53.1", features = ["macros", "net", "rt-multi-thread", "sync", "time", "io-util", "signal"] }
|
|
57
60
|
url = "2.5.8"
|
|
58
61
|
# `Url` leaves an upstream proxy's credentials percent-encoded.
|
|
@@ -74,6 +77,15 @@ rustls = { version = "0.23", default-features = false, features = ["std", "tls12
|
|
|
74
77
|
tokio-rustls = { version = "0.26", default-features = false, features = ["logging", "tls12", "ring"], optional = true }
|
|
75
78
|
rcgen = { version = "0.14", features = ["x509-parser"], optional = true }
|
|
76
79
|
|
|
80
|
+
# `CLOCK_MONOTONIC`, the time base Chrome's `performance.now()` is derived from.
|
|
81
|
+
[target.'cfg(unix)'.dependencies]
|
|
82
|
+
libc = "0.2.189"
|
|
83
|
+
|
|
84
|
+
# `QueryPerformanceCounter`, the time base Chrome's `performance.now()` is derived from on
|
|
85
|
+
# Windows.
|
|
86
|
+
[target.'cfg(windows)'.dependencies]
|
|
87
|
+
windows-sys = { version = "0.61", features = ["Win32_System_Performance"] }
|
|
88
|
+
|
|
77
89
|
# Chrome 154's ClientHello: ML-DSA and GREASE signature algorithms and the
|
|
78
90
|
# trust_anchors extension, which the published crates cannot send. See the
|
|
79
91
|
# "cfsolve patch" comments in vendor/.
|
|
@@ -82,10 +94,16 @@ btls-sys = { path = "vendor/btls-sys" }
|
|
|
82
94
|
wreq = { path = "vendor/wreq" }
|
|
83
95
|
http2 = { path = "vendor/http2" }
|
|
84
96
|
|
|
85
|
-
# Full debug info
|
|
97
|
+
# Full dependency debug info dominates link time and target/ size. Line tables
|
|
86
98
|
# keep file:line in this crate's backtraces; dependencies get none.
|
|
87
99
|
[profile.dev]
|
|
88
100
|
debug = "line-tables-only"
|
|
89
101
|
|
|
90
102
|
[profile.dev.package."*"]
|
|
91
103
|
debug = false
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# The interpreter and deobfuscator are split across many modules; one codegen unit lets LLVM
|
|
107
|
+
# inline across them. Dependencies keep their default settings and cached artifacts.
|
|
108
|
+
[profile.release.package.cfsolve]
|
|
109
|
+
codegen-units = 1
|
data/vendor/cfsolve/README.md
CHANGED
|
@@ -21,41 +21,6 @@ set to the address of a running `capture-proxy`, which records the decoded
|
|
|
21
21
|
payloads sent to Cloudflare. Currently only Safari and Chrome(ium) profile
|
|
22
22
|
types are supported.
|
|
23
23
|
|
|
24
|
-
Newer builds also rename values embedded in probe answers, namespace properties,
|
|
25
|
-
and stylesheet selectors on every session. Rebuild the answers with
|
|
26
|
-
`cargo run --release --example build_profile -- capture.json > answers.json`
|
|
27
|
-
to include the source evidence needed to refresh those values. Existing answer
|
|
28
|
-
files remain readable, but do not contain this additional evidence.
|
|
29
|
-
|
|
30
|
-
For builds that vary stylesheet selectors, record the profile browser's CSSOM
|
|
31
|
-
formatting once. In the challenge iframe's execution context, save the JSON
|
|
32
|
-
result of:
|
|
33
|
-
|
|
34
|
-
```javascript
|
|
35
|
-
JSON.stringify(Array.from(document.styleSheets, sheet =>
|
|
36
|
-
Array.from(sheet.cssRules, rule => rule.cssText)))
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Pass that file as the second argument to `build_profile`. The answers then store
|
|
40
|
-
the stylesheet source alongside its browser formatting. At solve time cfsolve
|
|
41
|
-
checks that only randomized names have changed, substitutes the current names,
|
|
42
|
-
and recomputes the stylesheet measurements without a browser. If the stylesheet
|
|
43
|
-
structure changes, capture the new revision; the solver rejects an unmatched
|
|
44
|
-
revision instead of sending an obsolete digest. The `stylesheets` array can hold
|
|
45
|
-
multiple captured revisions for the same browser profile. Keep captures and
|
|
46
|
-
device profiles private; they are not needed in bug reports or pull requests.
|
|
47
|
-
|
|
48
|
-
Replay keeps browser measurements while deriving field names, namespace functions
|
|
49
|
-
and trace frames from the current program. Function declaration order and function
|
|
50
|
-
counts may change between builds. Trace frames come from the current program;
|
|
51
|
-
captured frames are not replayed. Unmapped fields and ambiguous stylesheet
|
|
52
|
-
markers are errors, rather than guessed answers.
|
|
53
|
-
|
|
54
|
-
The internal `Replay::new` constructor now takes the current `Source` and
|
|
55
|
-
`Installed` facts and returns a `Result`. It validates the profile and field
|
|
56
|
-
mapping before use; there is no separate unchecked replay constructor. Stylesheet
|
|
57
|
-
updates use the same replay path, preserving field order and late callback fields.
|
|
58
|
-
|
|
59
24
|
## Building
|
|
60
25
|
|
|
61
26
|
You need the Rust version pinned in `rust-toolchain.toml`, plus CMake, a C/C++
|
|
@@ -236,6 +201,10 @@ implement `Sink` and set `options.sink` to `Some(Arc::new(your_sink))`.
|
|
|
236
201
|
| `Error::Config` | Invalid profile or options. | No |
|
|
237
202
|
| `Error::Unsupported` | Any other failure, such as a new challenge build or a page with no widget. | No |
|
|
238
203
|
|
|
204
|
+
## Contributions (new policy as of 2026-11-07)
|
|
205
|
+
|
|
206
|
+
Thank you to everyone who has contributed via pull requests. Unfortunately, there has been a very large volume of them, which I lack the time to meaningfully review. For that reason I would encourage you to fork the project instead. I will not be maintaining this a few weeks from now, so forking will become necessary regardless. If you think an exception should be made in the mean time, please email me.
|
|
207
|
+
|
|
239
208
|
## License
|
|
240
209
|
|
|
241
210
|
MIT, except for the patched dependencies in `vendor/`, which keep their own
|
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
//! Store a real browser's probe answers for a device profile.
|
|
2
|
-
//! Usage: build_profile <capture.json> [cssom
|
|
2
|
+
//! Usage: build_profile <capture.json> [cssom.json] > answers.json
|
|
3
3
|
//!
|
|
4
4
|
//! The capture is a session's `capture.json` from the capture proxy, or what
|
|
5
5
|
//! `scripts/cdp_capture.mjs` writes: the iframe's HTML, its POSTs with their
|
|
6
6
|
//! responses, and the plaintext payloads. Each probe's record from the second
|
|
7
7
|
//! payload is stored under the reference build's names; see
|
|
8
|
-
//! `cfsolve::stage2::replay`.
|
|
8
|
+
//! `cfsolve::stage2::replay`. An adjacent `iframe.deobfuscated.js` (from
|
|
9
|
+
//! `capture_session`) is used instead of deobfuscating the capture's script.
|
|
9
10
|
|
|
10
|
-
use std::env;
|
|
11
11
|
use std::path::Path;
|
|
12
|
+
use std::{env, fs};
|
|
12
13
|
|
|
13
14
|
use anyhow::{Context, Result};
|
|
14
15
|
use cfsolve::capture::CapturedSession;
|
|
15
|
-
use cfsolve::stage2::replay::
|
|
16
|
+
use cfsolve::stage2::replay::Answers;
|
|
16
17
|
|
|
17
18
|
fn main() -> Result<()> {
|
|
18
|
-
let
|
|
19
|
+
let mut arguments = env::args().skip(1);
|
|
20
|
+
let path = arguments.next().context("supply a capture JSON file")?;
|
|
19
21
|
let capture = CapturedSession::read(Path::new(&path))?;
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
let source = capture.source_beside(Path::new(&path))?;
|
|
23
|
+
let program = capture.program()?;
|
|
24
|
+
let mut answers = Answers::capture(&source, &program, capture.probe_payload()?)?;
|
|
25
|
+
if let Some(path) = arguments.next() {
|
|
26
|
+
answers.measure_stylesheets(
|
|
27
|
+
&source,
|
|
28
|
+
&program,
|
|
29
|
+
capture.iframe_html(),
|
|
30
|
+
serde_json::from_str(&fs::read_to_string(path)?)?,
|
|
31
|
+
)?;
|
|
30
32
|
}
|
|
31
33
|
println!("{}", serde_json::to_string_pretty(&answers)?);
|
|
32
34
|
Ok(())
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//! Write a capture as a session directory, for `stage2_snapshot` and other tools that read the
|
|
2
|
+
//! challenge CLI's output.
|
|
3
|
+
//! Usage: capture_session <capture.json> <output-directory>
|
|
4
|
+
//!
|
|
5
|
+
//! Writes `iframe.js`, `iframe.deobfuscated.js`, and each POST response's program as
|
|
6
|
+
//! `response.decoded.txt`, `second-response.decoded.txt` and `third-response.decoded.txt`.
|
|
7
|
+
|
|
8
|
+
use std::path::Path;
|
|
9
|
+
use std::{env, fs};
|
|
10
|
+
|
|
11
|
+
use anyhow::{Context, Result};
|
|
12
|
+
use base64::Engine;
|
|
13
|
+
use base64::engine::general_purpose::STANDARD;
|
|
14
|
+
use cfsolve::capture::CapturedSession;
|
|
15
|
+
|
|
16
|
+
fn main() -> Result<()> {
|
|
17
|
+
let mut arguments = env::args().skip(1);
|
|
18
|
+
let capture = arguments.next().context("supply a capture.json")?;
|
|
19
|
+
let directory = arguments.next().context("supply an output directory")?;
|
|
20
|
+
let capture = CapturedSession::read(Path::new(&capture))?;
|
|
21
|
+
let directory = Path::new(&directory);
|
|
22
|
+
fs::create_dir_all(directory)?;
|
|
23
|
+
let javascript = capture.javascript()?;
|
|
24
|
+
fs::write(directory.join("iframe.js"), &javascript)?;
|
|
25
|
+
fs::write(
|
|
26
|
+
directory.join("iframe.deobfuscated.js"),
|
|
27
|
+
cfsolve::deobfuscate(javascript)?.text,
|
|
28
|
+
)?;
|
|
29
|
+
let names = ["response", "second-response", "third-response"];
|
|
30
|
+
for (name, program) in names.iter().zip(capture.programs()?) {
|
|
31
|
+
fs::write(
|
|
32
|
+
directory.join(format!("{name}.decoded.txt")),
|
|
33
|
+
STANDARD.encode(program),
|
|
34
|
+
)?;
|
|
35
|
+
}
|
|
36
|
+
Ok(())
|
|
37
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//! Check stored answers against captured sessions of the current build.
|
|
2
|
+
//! Usage: check_answers <answers.json> <capture.json>...
|
|
3
|
+
//!
|
|
4
|
+
//! Translates each replayed probe's stored record into the session's names, as a solve does,
|
|
5
|
+
//! and compares its fields with the record the browser sent. Prints the fields only one side
|
|
6
|
+
//! has; a field the stored record keeps under a name the session lacks means the vocabulary
|
|
7
|
+
//! could not translate it.
|
|
8
|
+
|
|
9
|
+
use std::collections::BTreeSet;
|
|
10
|
+
use std::path::Path;
|
|
11
|
+
use std::{env, fs};
|
|
12
|
+
|
|
13
|
+
use anyhow::{Context, Result, ensure};
|
|
14
|
+
use cfsolve::capture::CapturedSession;
|
|
15
|
+
use cfsolve::js::JsValue;
|
|
16
|
+
use cfsolve::stage2::analysis;
|
|
17
|
+
use cfsolve::stage2::replay::Answers;
|
|
18
|
+
|
|
19
|
+
fn main() -> Result<()> {
|
|
20
|
+
let mut arguments = env::args().skip(1);
|
|
21
|
+
let answers = arguments.next().context("supply answers.json")?;
|
|
22
|
+
let answers: Answers = serde_json::from_str(&fs::read_to_string(&answers)?)?;
|
|
23
|
+
let mut mismatched = 0;
|
|
24
|
+
for path in arguments {
|
|
25
|
+
let capture = CapturedSession::read(Path::new(&path))?;
|
|
26
|
+
let analysis = analysis::analyze(&capture.source()?, &capture.program()?)?;
|
|
27
|
+
let plan = analysis.plan();
|
|
28
|
+
let vocabulary = plan.vocabulary();
|
|
29
|
+
let envelope = plan.record_fields.names();
|
|
30
|
+
let payload = capture.probe_payload()?;
|
|
31
|
+
let (mut checked, mut differing) = (0, 0);
|
|
32
|
+
for probe in plan.probes() {
|
|
33
|
+
let position = probe.position();
|
|
34
|
+
let Some(stored) = vocabulary
|
|
35
|
+
.partner(position)
|
|
36
|
+
.and_then(|partner| answers.probes.get(&partner))
|
|
37
|
+
else {
|
|
38
|
+
continue;
|
|
39
|
+
};
|
|
40
|
+
let mut fields = stored.fields.clone();
|
|
41
|
+
vocabulary.rewrite_to_session(position, &mut fields);
|
|
42
|
+
let ours: BTreeSet<&String> = fields.keys().collect();
|
|
43
|
+
let sent: BTreeSet<&String> = payload
|
|
44
|
+
.get(&probe.index.to_string())
|
|
45
|
+
.and_then(JsValue::as_object)
|
|
46
|
+
.into_iter()
|
|
47
|
+
.flat_map(|record| record.keys())
|
|
48
|
+
.filter(|name| !envelope.contains(&name.as_str()))
|
|
49
|
+
.collect();
|
|
50
|
+
checked += 1;
|
|
51
|
+
if ours != sent {
|
|
52
|
+
differing += 1;
|
|
53
|
+
println!(
|
|
54
|
+
"{path} probe {}: only stored {:?}, only sent {:?}",
|
|
55
|
+
probe.index,
|
|
56
|
+
ours.difference(&sent).collect::<Vec<_>>(),
|
|
57
|
+
sent.difference(&ours).collect::<Vec<_>>(),
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
println!("{path}: {checked} replayed records, {differing} differ");
|
|
62
|
+
mismatched += differing;
|
|
63
|
+
}
|
|
64
|
+
ensure!(mismatched == 0, "{mismatched} records differ");
|
|
65
|
+
Ok(())
|
|
66
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
//! Compare a solve's payloads with a browser capture of the same build.
|
|
2
|
+
//! Usage: compare_session <session-directory> <capture.json> [--values]
|
|
3
|
+
//!
|
|
4
|
+
//! The session directory is one the challenge CLI writes. Probe records are compared in the
|
|
5
|
+
//! reference build's names, by key and JSON type; the other payload fields, whose names the
|
|
6
|
+
//! vocabulary does not cover, by count and type. Timing values are ignored. `--values` also
|
|
7
|
+
//! prints each probe field whose value differs.
|
|
8
|
+
|
|
9
|
+
use std::collections::BTreeMap;
|
|
10
|
+
use std::path::Path;
|
|
11
|
+
use std::{env, fs};
|
|
12
|
+
|
|
13
|
+
use anyhow::{Context, Result};
|
|
14
|
+
use base64::Engine;
|
|
15
|
+
use base64::engine::general_purpose::STANDARD;
|
|
16
|
+
use cfsolve::capture::CapturedSession;
|
|
17
|
+
use cfsolve::js::{JsObject, JsValue};
|
|
18
|
+
use cfsolve::script::Source;
|
|
19
|
+
use cfsolve::stage2::analysis::{self, Analysis};
|
|
20
|
+
|
|
21
|
+
fn main() -> Result<()> {
|
|
22
|
+
let mut arguments = env::args().skip(1);
|
|
23
|
+
let directory = arguments.next().context("supply a session directory")?;
|
|
24
|
+
let capture_path = arguments.next().context("supply a capture.json")?;
|
|
25
|
+
let directory = Path::new(&directory);
|
|
26
|
+
let read = |name: &str| fs::read_to_string(directory.join(name));
|
|
27
|
+
let read_payload = |name: &str| -> Result<JsObject> { Ok(serde_json::from_str(&read(name)?)?) };
|
|
28
|
+
|
|
29
|
+
let ours = analysis::analyze(
|
|
30
|
+
&Source::try_new(&read("iframe.deobfuscated.js")?)?,
|
|
31
|
+
&STANDARD.decode(read("response.decoded.txt")?.trim())?,
|
|
32
|
+
)?;
|
|
33
|
+
let capture = CapturedSession::read(Path::new(&capture_path))?;
|
|
34
|
+
let theirs = analysis::analyze(&capture.source()?, &capture.program()?)?;
|
|
35
|
+
|
|
36
|
+
let our_second = read_payload("second-payload.json")?;
|
|
37
|
+
let their_second: &JsObject = capture.probe_payload()?;
|
|
38
|
+
let our_values = values(&ours, &our_second);
|
|
39
|
+
let their_values = values(&theirs, their_second);
|
|
40
|
+
if env::args().any(|argument| argument == "--values") {
|
|
41
|
+
for (probe, their_record) in &their_values {
|
|
42
|
+
let Some(our_record) = our_values.get(probe) else {
|
|
43
|
+
continue;
|
|
44
|
+
};
|
|
45
|
+
for (name, their_value) in their_record {
|
|
46
|
+
let our_value = our_record.get(name).map_or("<missing>".to_owned(), short);
|
|
47
|
+
let their_value = short(their_value);
|
|
48
|
+
if our_value != their_value {
|
|
49
|
+
println!("{probe} {name}\n ours {our_value}\n theirs {their_value}");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
let our_records = records(&our_values);
|
|
55
|
+
let their_records = records(&their_values);
|
|
56
|
+
let only = |a: &BTreeMap<String, String>, b: &BTreeMap<String, String>| -> Vec<String> {
|
|
57
|
+
a.iter()
|
|
58
|
+
.filter(|(key, kind)| b.get(*key) != Some(*kind))
|
|
59
|
+
.map(|(key, kind)| format!("{key}:{kind}"))
|
|
60
|
+
.collect()
|
|
61
|
+
};
|
|
62
|
+
for (probe, theirs) in &their_records {
|
|
63
|
+
match our_records.get(probe) {
|
|
64
|
+
None => println!("{probe}: only in the capture"),
|
|
65
|
+
Some(ours) if ours != theirs => {
|
|
66
|
+
println!(
|
|
67
|
+
"{probe}: ours {:?} theirs {:?}",
|
|
68
|
+
only(ours, theirs),
|
|
69
|
+
only(theirs, ours)
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
Some(_) => {}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
for probe in our_records.keys() {
|
|
76
|
+
if !their_records.contains_key(probe) {
|
|
77
|
+
println!("{probe}: only in ours");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
println!(
|
|
82
|
+
"second payload top level: {}",
|
|
83
|
+
top_level(&our_second, their_second)
|
|
84
|
+
);
|
|
85
|
+
if let (Ok(ours), Some(theirs)) = (read_payload("third-payload.json"), capture.last_payload()) {
|
|
86
|
+
println!("third payload top level: {}", top_level(&ours, theirs));
|
|
87
|
+
if let (Some(ours), Some(theirs)) = (last_record(&ours), last_record(theirs)) {
|
|
88
|
+
println!(
|
|
89
|
+
"checkbox record: ours {} theirs {}",
|
|
90
|
+
shape(ours),
|
|
91
|
+
shape(theirs)
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if let (Ok(ours), Ok(theirs)) = (read_payload("payload.json"), capture.first_payload()) {
|
|
96
|
+
println!("first payload top level: {}", top_level(&ours, theirs));
|
|
97
|
+
}
|
|
98
|
+
Ok(())
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/// Each probe's record in reference names, keyed by the reference probe or, for unpaired
|
|
102
|
+
/// probes, the family.
|
|
103
|
+
fn values(analysis: &Analysis, payload: &JsObject) -> BTreeMap<String, JsObject> {
|
|
104
|
+
let plan = analysis.plan();
|
|
105
|
+
let vocabulary = plan.vocabulary();
|
|
106
|
+
let envelope = plan.record_fields.names();
|
|
107
|
+
plan.probes()
|
|
108
|
+
.iter()
|
|
109
|
+
.filter_map(|probe| {
|
|
110
|
+
let mut record = payload.get(&probe.index.to_string())?.as_object()?.clone();
|
|
111
|
+
record.retain(|name, _| !envelope.contains(&name.as_str()));
|
|
112
|
+
vocabulary.rewrite_to_reference(probe.position(), &mut record);
|
|
113
|
+
let key = match (vocabulary.partner(probe.position()), &probe.operation) {
|
|
114
|
+
(Some(reference), _) => format!("reference {reference:02}"),
|
|
115
|
+
(None, Some(operation)) => format!("unpaired {}", operation.kind()),
|
|
116
|
+
(None, None) => "unpaired ?".to_owned(),
|
|
117
|
+
};
|
|
118
|
+
Some((key, record))
|
|
119
|
+
})
|
|
120
|
+
.collect()
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/// Each record from [`values`] with its fields' JSON types.
|
|
124
|
+
fn records(values: &BTreeMap<String, JsObject>) -> BTreeMap<String, BTreeMap<String, String>> {
|
|
125
|
+
values
|
|
126
|
+
.iter()
|
|
127
|
+
.map(|(probe, record)| {
|
|
128
|
+
let types = record
|
|
129
|
+
.iter()
|
|
130
|
+
.map(|(name, value)| (name.clone(), kind(value)))
|
|
131
|
+
.collect();
|
|
132
|
+
(probe.clone(), types)
|
|
133
|
+
})
|
|
134
|
+
.collect()
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/// The record under the highest numeric key, which in the third payload is the checkbox's.
|
|
138
|
+
fn last_record(payload: &JsObject) -> Option<&JsObject> {
|
|
139
|
+
payload
|
|
140
|
+
.iter()
|
|
141
|
+
.filter_map(|(key, value)| Some((key.parse::<usize>().ok()?, value)))
|
|
142
|
+
.max_by_key(|(index, _)| *index)
|
|
143
|
+
.and_then(|(_, value)| value.as_object())
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
fn short(value: &JsValue) -> String {
|
|
147
|
+
value.to_string().chars().take(240).collect()
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
fn kind(value: &JsValue) -> String {
|
|
151
|
+
match value {
|
|
152
|
+
JsValue::Null => "null".into(),
|
|
153
|
+
JsValue::Bool(_) => "bool".into(),
|
|
154
|
+
JsValue::Number(_) => "number".into(),
|
|
155
|
+
JsValue::String(text) if text.is_empty() => "empty".into(),
|
|
156
|
+
JsValue::String(_) => "string".into(),
|
|
157
|
+
JsValue::Array(items) => format!("array{}", items.len()),
|
|
158
|
+
JsValue::Object(object) => format!("object{}", object.len()),
|
|
159
|
+
JsValue::Undefined => "undefined".into(),
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/// Non-record fields: count and multiset of types on each side.
|
|
164
|
+
fn top_level(ours: &JsObject, theirs: &JsObject) -> String {
|
|
165
|
+
let mut counts: BTreeMap<String, [usize; 2]> = BTreeMap::new();
|
|
166
|
+
for (side, payload) in [ours, theirs].into_iter().enumerate() {
|
|
167
|
+
for (key, value) in payload {
|
|
168
|
+
if key.parse::<usize>().is_err() {
|
|
169
|
+
counts.entry(kind(value)).or_default()[side] += 1;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
let differing: Vec<String> = counts
|
|
174
|
+
.iter()
|
|
175
|
+
.filter(|(_, [ours, theirs])| ours != theirs)
|
|
176
|
+
.map(|(kind, [ours, theirs])| format!("{kind} {ours}/{theirs}"))
|
|
177
|
+
.collect();
|
|
178
|
+
let total = |side: usize| counts.values().map(|count| count[side]).sum::<usize>();
|
|
179
|
+
format!(
|
|
180
|
+
"ours {} theirs {} fields; differing types (ours/theirs): {differing:?}",
|
|
181
|
+
total(0),
|
|
182
|
+
total(1),
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
fn shape(record: &JsObject) -> String {
|
|
187
|
+
let kinds: Vec<String> = record.values().map(kind).collect();
|
|
188
|
+
format!("{} fields {kinds:?}", record.len())
|
|
189
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
//! Replays CPU work from a saved solve without network requests or expired challenges.
|
|
2
|
+
//!
|
|
3
|
+
//! `cargo run --release --example solver_profile -- /tmp/solve [deobfuscate|analyze|orchestrator]`
|
|
4
|
+
//!
|
|
5
|
+
//! Without a mode, deobfuscates `iframe.js`, writing `profile.deobfuscated.js`, and analyzes the
|
|
6
|
+
//! result, writing `profile.stage2.json`. `deobfuscate` stops after deobfuscation; `analyze`
|
|
7
|
+
//! analyzes the script the solve deobfuscated. `orchestrator` deobfuscates the saved
|
|
8
|
+
//! orchestrator script and disassembles its first returned program, writing
|
|
9
|
+
//! `profile.orchestrator.js` and `profile.orchestrator-listing.txt`.
|
|
10
|
+
|
|
11
|
+
use std::path::Path;
|
|
12
|
+
use std::time::Instant;
|
|
13
|
+
use std::{env, fs};
|
|
14
|
+
|
|
15
|
+
use anyhow::{Result, bail};
|
|
16
|
+
use base64::Engine as _;
|
|
17
|
+
use base64::engine::general_purpose::STANDARD;
|
|
18
|
+
use cfsolve::script::Source;
|
|
19
|
+
|
|
20
|
+
const USAGE: &str = "usage: solver_profile <session directory> [deobfuscate|analyze|orchestrator]";
|
|
21
|
+
|
|
22
|
+
fn main() -> Result<()> {
|
|
23
|
+
let arguments: Vec<String> = env::args().skip(1).collect();
|
|
24
|
+
let (directory, mode) = match &arguments[..] {
|
|
25
|
+
[directory] => (Path::new(directory), None),
|
|
26
|
+
[directory, mode] => (Path::new(directory), Some(mode.as_str())),
|
|
27
|
+
_ => bail!(USAGE),
|
|
28
|
+
};
|
|
29
|
+
match mode {
|
|
30
|
+
None | Some("deobfuscate") => {
|
|
31
|
+
let text = deobfuscate(&directory.join("iframe.js"))?;
|
|
32
|
+
fs::write(directory.join("profile.deobfuscated.js"), &text)?;
|
|
33
|
+
if mode.is_none() {
|
|
34
|
+
analyze(directory, &text)?;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
Some("analyze") => {
|
|
38
|
+
let text = fs::read_to_string(directory.join("iframe.deobfuscated.js"))?;
|
|
39
|
+
analyze(directory, &text)?;
|
|
40
|
+
}
|
|
41
|
+
Some("orchestrator") => {
|
|
42
|
+
let text = deobfuscate(&directory.join("orchestrator.js"))?;
|
|
43
|
+
fs::write(directory.join("profile.orchestrator.js"), &text)?;
|
|
44
|
+
let program = STANDARD.decode(fs::read(
|
|
45
|
+
directory.join("orchestrator-response.decoded.txt"),
|
|
46
|
+
)?)?;
|
|
47
|
+
let began = Instant::now();
|
|
48
|
+
let listing = Source::try_new(&text)?.disassemble(&program)?;
|
|
49
|
+
eprintln!("disassemble: {:?}", began.elapsed());
|
|
50
|
+
fs::write(
|
|
51
|
+
directory.join("profile.orchestrator-listing.txt"),
|
|
52
|
+
format!("{listing:#?}"),
|
|
53
|
+
)?;
|
|
54
|
+
}
|
|
55
|
+
Some(_) => bail!(USAGE),
|
|
56
|
+
}
|
|
57
|
+
Ok(())
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
fn deobfuscate(path: &Path) -> Result<String> {
|
|
61
|
+
let javascript = fs::read_to_string(path)?;
|
|
62
|
+
let began = Instant::now();
|
|
63
|
+
let deobfuscated = cfsolve::deobfuscate(javascript)?;
|
|
64
|
+
eprintln!("deobfuscate: {:?}", began.elapsed());
|
|
65
|
+
if let Some(unconverged) = deobfuscated.unconverged {
|
|
66
|
+
eprintln!("warning: {unconverged}");
|
|
67
|
+
}
|
|
68
|
+
Ok(deobfuscated.text)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
fn analyze(directory: &Path, javascript: &str) -> Result<()> {
|
|
72
|
+
let program = STANDARD.decode(fs::read(directory.join("response.decoded.txt"))?)?;
|
|
73
|
+
let began = Instant::now();
|
|
74
|
+
let source = Source::try_new(javascript)?;
|
|
75
|
+
eprintln!("parse: {:?}", began.elapsed());
|
|
76
|
+
let began = Instant::now();
|
|
77
|
+
let analysis = cfsolve::stage2::analysis::analyze(&source, &program)?;
|
|
78
|
+
eprintln!("analyze: {:?}", began.elapsed());
|
|
79
|
+
fs::write(
|
|
80
|
+
directory.join("profile.stage2.json"),
|
|
81
|
+
serde_json::to_vec_pretty(&analysis.artifact())?,
|
|
82
|
+
)?;
|
|
83
|
+
Ok(())
|
|
84
|
+
}
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
use std::path::Path;
|
|
6
6
|
use std::sync::{Arc, Mutex};
|
|
7
7
|
|
|
8
|
-
use anyhow::{Context, Result, bail, ensure};
|
|
8
|
+
use anyhow::{Context, Result, anyhow, bail, ensure};
|
|
9
9
|
use cfsolve::fingerprint::Transport;
|
|
10
10
|
use cfsolve::{
|
|
11
|
-
Browser, Error, FetchedPage, Options, Outcome, PageSource, Sink, Turnstile, Url,
|
|
11
|
+
Browser, Clearance, Error, FetchedPage, Options, Outcome, PageSource, Sink, Turnstile, Url,
|
|
12
|
+
Widget,
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
const PROFILE: &str = "profiles/safari-26-ios.json";
|
|
@@ -38,7 +39,7 @@ async fn main() -> Result<()> {
|
|
|
38
39
|
let under_attack: Url = UNDER_ATTACK.parse()?;
|
|
39
40
|
|
|
40
41
|
// The managed page's HTML and sitekey, loaded as the profile's browser.
|
|
41
|
-
let client = Transport::read(Path::new(PROFILE))?.client(None)?;
|
|
42
|
+
let client = Transport::read(Path::new(PROFILE))?.client(None, None)?;
|
|
42
43
|
let html = cfsolve::http::navigate(&client, &managed).await?.html;
|
|
43
44
|
let sitekey = html
|
|
44
45
|
.split("data-sitekey=\"")
|
|
@@ -127,7 +128,7 @@ async fn main() -> Result<()> {
|
|
|
127
128
|
"solve(managed)",
|
|
128
129
|
match browser.solve(&managed, &options).await {
|
|
129
130
|
Ok(Outcome::Token(token)) => Ok(format!("token of {} bytes", token.len())),
|
|
130
|
-
Ok(Outcome::Cleared(_)) => Err(anyhow
|
|
131
|
+
Ok(Outcome::Cleared(_)) => Err(anyhow!("cleared instead of a token")),
|
|
131
132
|
Err(error) => Err(error.into()),
|
|
132
133
|
},
|
|
133
134
|
);
|
|
@@ -135,15 +136,15 @@ async fn main() -> Result<()> {
|
|
|
135
136
|
"solve(under-attack)",
|
|
136
137
|
match browser.solve(&under_attack, &options).await {
|
|
137
138
|
Ok(Outcome::Cleared(cleared)) => Ok(format!("cf_clearance={}", cleared.clearance)),
|
|
138
|
-
Ok(Outcome::Token(_)) => Err(anyhow
|
|
139
|
+
Ok(Outcome::Token(_)) => Err(anyhow!("a token instead of a clearance")),
|
|
139
140
|
Err(error) => Err(error.into()),
|
|
140
141
|
},
|
|
141
142
|
);
|
|
142
143
|
|
|
143
144
|
let sink = Arc::new(IframeUrl::default());
|
|
144
145
|
let recording = Options {
|
|
145
|
-
proxy: None,
|
|
146
146
|
sink: Some(sink.clone()),
|
|
147
|
+
..Options::default()
|
|
147
148
|
};
|
|
148
149
|
check(
|
|
149
150
|
"send_first_payload(managed, widget)",
|
|
@@ -171,7 +172,7 @@ async fn main() -> Result<()> {
|
|
|
171
172
|
|
|
172
173
|
/// Loads `url` the way a caller of `clear_fetched` would: as the profile's browser.
|
|
173
174
|
async fn fetch(url: &Url) -> Result<FetchedPage> {
|
|
174
|
-
let client = Transport::read(Path::new(PROFILE))?.client(None)?;
|
|
175
|
+
let client = Transport::read(Path::new(PROFILE))?.client(None, None)?;
|
|
175
176
|
let document = cfsolve::http::navigate(&client, url).await?;
|
|
176
177
|
let set_cookies = client
|
|
177
178
|
.cookies(&document.url)
|
|
@@ -193,7 +194,7 @@ fn token(result: Result<String, Error>) -> Result<String> {
|
|
|
193
194
|
Ok(format!("token of {} bytes", token.len()))
|
|
194
195
|
}
|
|
195
196
|
|
|
196
|
-
fn clearance(result: Result<
|
|
197
|
+
fn clearance(result: Result<Clearance, Error>) -> Result<String> {
|
|
197
198
|
let cleared = result?;
|
|
198
199
|
ensure!(
|
|
199
200
|
cleared
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
use std::path::Path;
|
|
12
12
|
use std::{env, fs};
|
|
13
13
|
|
|
14
|
-
use anyhow::{Context, Result};
|
|
14
|
+
use anyhow::{Context, Result, anyhow};
|
|
15
15
|
use base64::Engine;
|
|
16
16
|
use base64::engine::general_purpose::STANDARD;
|
|
17
17
|
use cfsolve::challenge::program::PreparedSession;
|
|
@@ -54,7 +54,10 @@ fn main() -> Result<()> {
|
|
|
54
54
|
let frames = fields
|
|
55
55
|
.calls
|
|
56
56
|
.context("the stack probe's calls have an unrecognized shape")
|
|
57
|
-
.and_then(|calls|
|
|
57
|
+
.and_then(|calls| {
|
|
58
|
+
let resumed = call_stack::Resumption::WorkerMessage;
|
|
59
|
+
call_stack::recover_probe(&original, &cases, calls, resumed)
|
|
60
|
+
})
|
|
58
61
|
.map(|geometry| {
|
|
59
62
|
json!({
|
|
60
63
|
"frames": geometry.frames,
|
|
@@ -82,7 +85,7 @@ fn main() -> Result<()> {
|
|
|
82
85
|
"forwarded": state.forwarded,
|
|
83
86
|
})
|
|
84
87
|
}),
|
|
85
|
-
Err(error) => Err(anyhow
|
|
88
|
+
Err(error) => Err(anyhow!("{error:#}")),
|
|
86
89
|
};
|
|
87
90
|
snapshot.insert("first_payload".into(), record(first_payload));
|
|
88
91
|
let installed = session.map(|session| {
|
|
@@ -8,7 +8,7 @@ use std::path::Path;
|
|
|
8
8
|
|
|
9
9
|
use anyhow::{Context, Result};
|
|
10
10
|
use cfsolve::fingerprint::Transport;
|
|
11
|
-
use cfsolve::http
|
|
11
|
+
use cfsolve::http;
|
|
12
12
|
use url::Url;
|
|
13
13
|
|
|
14
14
|
#[tokio::main]
|
|
@@ -18,9 +18,9 @@ async fn main() -> Result<()> {
|
|
|
18
18
|
let url = args
|
|
19
19
|
.next()
|
|
20
20
|
.unwrap_or_else(|| "https://tls.peet.ws/api/all".to_owned());
|
|
21
|
-
let browser = Transport::read(Path::new(&path))?.client(None)?;
|
|
21
|
+
let browser = Transport::read(Path::new(&path))?.client(None, None)?;
|
|
22
22
|
// Opened the way the solver opens an embedding page.
|
|
23
|
-
let document = navigate(&browser, &Url::parse(&url)?).await?;
|
|
23
|
+
let document = http::navigate(&browser, &Url::parse(&url)?).await?;
|
|
24
24
|
print!("{}", document.html);
|
|
25
25
|
Ok(())
|
|
26
26
|
}
|