cfsolve 0.1.2 → 0.1.4
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 +22 -0
- data/README.md +8 -3
- 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 +14 -6
- 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/chrome-157-macos/answers.json +4777 -0
- data/lib/cfsolve/profiles/chrome-157-macos.json +613 -0
- data/lib/cfsolve/profiles/safari-26-ios/answers.json +266 -265
- data/lib/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +312 -312
- data/lib/cfsolve/profiles/safari-26-ios.json +106 -152
- data/lib/cfsolve/version.rb +2 -2
- data/lib/cfsolve.rb +1 -1
- data/vendor/cfsolve/Cargo.lock +561 -1729
- data/vendor/cfsolve/Cargo.toml +26 -8
- data/vendor/cfsolve/README.md +57 -5
- data/vendor/cfsolve/examples/check_answers.rs +2 -2
- data/vendor/cfsolve/examples/compare_session.rs +1 -2
- 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 +2 -2
- data/vendor/cfsolve/examples/tls_echo.rs +3 -3
- data/vendor/cfsolve/examples/turnstile_smoke.rs +58 -0
- data/vendor/cfsolve/examples/vm_snapshot.rs +32 -33
- data/vendor/cfsolve/profiles/chrome-157-macos/answers.json +4777 -0
- data/vendor/cfsolve/profiles/chrome-157-macos.json +613 -0
- data/vendor/cfsolve/profiles/safari-26-ios/answers.json +266 -265
- data/vendor/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +312 -312
- data/vendor/cfsolve/profiles/safari-26-ios.json +106 -152
- 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/proxy/tests.rs +1 -1
- data/vendor/cfsolve/src/capture/proxy.rs +44 -13
- 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 +11 -10
- data/vendor/cfsolve/src/challenge/installed.rs +13 -6
- 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 +69 -31
- 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 +180 -148
- 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 +198 -203
- data/vendor/cfsolve/src/deobfuscate/function_lengths.rs +32 -38
- data/vendor/cfsolve/src/deobfuscate/helper_objects.rs +338 -513
- 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 +353 -327
- 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 +132 -24
- data/vendor/cfsolve/src/embedding_page/page.rs +41 -1
- 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 +7 -10
- data/vendor/cfsolve/src/http/requests.rs +2 -2
- data/vendor/cfsolve/src/js/ast.rs +479 -263
- data/vendor/cfsolve/src/lib.rs +1 -0
- data/vendor/cfsolve/src/listing/fold.rs +19 -9
- data/vendor/cfsolve/src/listing/query.rs +1 -47
- 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 +12 -11
- data/vendor/cfsolve/src/session/probes.rs +1 -0
- 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.rs +1 -1
- data/vendor/cfsolve/src/solver.rs +3 -1
- data/vendor/cfsolve/src/stage2/analysis/analyze.rs +33 -4
- data/vendor/cfsolve/src/stage2/analysis/audit.rs +4 -2
- data/vendor/cfsolve/src/stage2/analysis/discovery.rs +13 -2
- data/vendor/cfsolve/src/stage2/analysis/envelope.rs +2 -1
- data/vendor/cfsolve/src/stage2/audit_globals.rs +142 -74
- data/vendor/cfsolve/src/stage2/benchmark.rs +113 -41
- data/vendor/cfsolve/src/stage2/call_stack.rs +1564 -1041
- data/vendor/cfsolve/src/stage2/challenge_page.rs +3 -2
- data/vendor/cfsolve/src/stage2/fixtures/encoded_benchmark_worker.js +1 -0
- 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/plan.rs +5 -4
- data/vendor/cfsolve/src/stage2/payload/recover.rs +2 -2
- data/vendor/cfsolve/src/stage2/probes/clock.rs +1 -3
- data/vendor/cfsolve/src/stage2/probes/dates.rs +44 -0
- data/vendor/cfsolve/src/stage2/probes/parent_info_array.rs +326 -0
- data/vendor/cfsolve/src/stage2/probes/performance.rs +12 -8
- data/vendor/cfsolve/src/stage2/probes/stack.rs +117 -4
- data/vendor/cfsolve/src/stage2/probes/websocket_echo.rs +80 -2
- data/vendor/cfsolve/src/stage2/probes.rs +1 -0
- data/vendor/cfsolve/src/stage2/queries.rs +50 -0
- data/vendor/cfsolve/src/stage2/reference.rs +5 -0
- data/vendor/cfsolve/src/stage2/registry.rs +8 -2
- data/vendor/cfsolve/src/stage2/replay.rs +34 -3
- data/vendor/cfsolve/src/stage2/stylesheets.rs +35 -0
- data/vendor/cfsolve/src/stage2/syntax.rs +88 -0
- data/vendor/cfsolve/src/stage2/trace.rs +134 -108
- data/vendor/cfsolve/src/stage2/value_labels.rs +185 -0
- data/vendor/cfsolve/src/stage2/vocabulary.rs +112 -17
- data/vendor/cfsolve/src/stage2.rs +3 -0
- data/vendor/cfsolve/src/vm/disassemble.rs +75 -7
- data/vendor/cfsolve/src/vm/dispatch.rs +93 -65
- data/vendor/cfsolve/src/vm/encoded_names.rs +635 -0
- data/vendor/cfsolve/src/vm/extract.rs +550 -250
- data/vendor/cfsolve/src/vm/fixtures/free_functions/README.md +9 -0
- data/vendor/cfsolve/src/vm/fixtures/free_functions/machine.js +7438 -0
- data/vendor/cfsolve/src/vm/fixtures/free_functions/program.base64 +1 -0
- data/vendor/cfsolve/src/vm/interpret/access.rs +71 -50
- data/vendor/cfsolve/src/vm/interpret/builtin.rs +10 -10
- data/vendor/cfsolve/src/vm/interpret/call.rs +116 -52
- data/vendor/cfsolve/src/vm/interpret/compile.rs +79 -62
- data/vendor/cfsolve/src/vm/interpret/copies.rs +2 -2
- data/vendor/cfsolve/src/vm/interpret/evaluate/tests.rs +63 -42
- data/vendor/cfsolve/src/vm/interpret/evaluate.rs +65 -575
- data/vendor/cfsolve/src/vm/interpret/explore.rs +7 -10
- data/vendor/cfsolve/src/vm/interpret/formula.rs +131 -0
- data/vendor/cfsolve/src/vm/interpret/frozen.rs +3 -5
- data/vendor/cfsolve/src/vm/interpret/intrinsic.rs +160 -58
- 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 +1765 -0
- data/vendor/cfsolve/src/vm/interpret/plan.rs +586 -338
- data/vendor/cfsolve/src/vm/interpret/register_helpers.rs +392 -0
- data/vendor/cfsolve/src/vm/interpret/run.rs +120 -45
- 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 +9 -1
- data/vendor/cfsolve/src/vm/machine.rs +116 -51
- data/vendor/cfsolve/src/vm/output.rs +19 -6
- data/vendor/cfsolve/src/vm/packed_names.rs +11 -7
- data/vendor/cfsolve/src/vm/registers.rs +35 -21
- data/vendor/cfsolve/src/vm/session.rs +189 -121
- data/vendor/cfsolve/src/vm/value.rs +22 -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
- metadata +106 -178
- 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/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
|
@@ -4,6 +4,7 @@ use anyhow::{Context, Result};
|
|
|
4
4
|
use chrono::{DateTime, Local, NaiveDate, NaiveTime, TimeZone, Utc};
|
|
5
5
|
use indexmap::IndexMap;
|
|
6
6
|
use serde::{Deserialize, Serialize};
|
|
7
|
+
use std::collections::BTreeMap;
|
|
7
8
|
|
|
8
9
|
use crate::engine::Engine;
|
|
9
10
|
use crate::js::{JsObject, json};
|
|
@@ -13,6 +14,30 @@ use crate::stage2::reference;
|
|
|
13
14
|
/// The historical years the probe parses.
|
|
14
15
|
const YEARS: [i32; 5] = [999, 1060, 1937, 1945, 1989];
|
|
15
16
|
|
|
17
|
+
/// The three current-date outputs follow the last historical year. Newer programs move API
|
|
18
|
+
/// names into captured decoder cells, so reference alignment alone can mispair these fields.
|
|
19
|
+
pub(crate) fn names(
|
|
20
|
+
features: &[String],
|
|
21
|
+
writes: &[String],
|
|
22
|
+
) -> Option<BTreeMap<String, &'static str>> {
|
|
23
|
+
let year = features.iter().position(|text| text == "1989")?;
|
|
24
|
+
let [today, offset, method, zone] = features.get(year + 1..year + 5)? else {
|
|
25
|
+
return None;
|
|
26
|
+
};
|
|
27
|
+
if method != "getTimezoneOffset"
|
|
28
|
+
|| ![today, offset, zone]
|
|
29
|
+
.iter()
|
|
30
|
+
.all(|field| writes.contains(field))
|
|
31
|
+
{
|
|
32
|
+
return None;
|
|
33
|
+
}
|
|
34
|
+
Some(BTreeMap::from([
|
|
35
|
+
(today.clone(), reference::DATES_TODAY),
|
|
36
|
+
(offset.clone(), reference::DATES_OFFSET),
|
|
37
|
+
(zone.clone(), reference::DATES_ZONE),
|
|
38
|
+
]))
|
|
39
|
+
}
|
|
40
|
+
|
|
16
41
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
17
42
|
pub struct Fields {
|
|
18
43
|
/// The field reporting each historical year's parsing difference, in program order.
|
|
@@ -105,6 +130,25 @@ mod tests {
|
|
|
105
130
|
use super::*;
|
|
106
131
|
use crate::js::{self, JsValue};
|
|
107
132
|
|
|
133
|
+
#[test]
|
|
134
|
+
fn pins_date_outputs_after_the_historical_years() {
|
|
135
|
+
let features = [
|
|
136
|
+
"last_year",
|
|
137
|
+
"1989",
|
|
138
|
+
"today",
|
|
139
|
+
"offset",
|
|
140
|
+
"getTimezoneOffset",
|
|
141
|
+
"zone",
|
|
142
|
+
]
|
|
143
|
+
.map(str::to_owned);
|
|
144
|
+
let writes = ["last_year", "today", "offset", "zone"].map(str::to_owned);
|
|
145
|
+
let names = names(&features, &writes).unwrap();
|
|
146
|
+
assert_eq!(names["today"], reference::DATES_TODAY);
|
|
147
|
+
assert_eq!(names["offset"], reference::DATES_OFFSET);
|
|
148
|
+
assert_eq!(names["zone"], reference::DATES_ZONE);
|
|
149
|
+
assert!(super::names(&features, &writes[..3]).is_none());
|
|
150
|
+
}
|
|
151
|
+
|
|
108
152
|
fn fields() -> Fields {
|
|
109
153
|
js::from_value(json!({"years": {"legacy": 999, "old": 1060, "winter": 1989}})).unwrap()
|
|
110
154
|
}
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
//! Parent-page probes reading the loader's positional `wPr` array.
|
|
2
|
+
|
|
3
|
+
use std::collections::{BTreeMap, BTreeSet};
|
|
4
|
+
|
|
5
|
+
use serde::{Deserialize, Serialize};
|
|
6
|
+
|
|
7
|
+
use crate::embedding_page::page::PageSignals;
|
|
8
|
+
use crate::js::{self, JsObject, JsValue, json};
|
|
9
|
+
use crate::listing::Index;
|
|
10
|
+
use crate::stage2::analysis::recognize::ProbeView;
|
|
11
|
+
use crate::vm::{Constant, Effect, Term};
|
|
12
|
+
|
|
13
|
+
/// Output names and their source positions in the loader's page-signals array.
|
|
14
|
+
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
15
|
+
pub struct Fields {
|
|
16
|
+
pub properties: BTreeMap<String, usize>,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
impl Fields {
|
|
20
|
+
pub(crate) fn collect(&self, signals: &PageSignals) -> JsObject {
|
|
21
|
+
let values = signals.positional();
|
|
22
|
+
self.properties
|
|
23
|
+
.iter()
|
|
24
|
+
.filter_map(|(field, &slot)| {
|
|
25
|
+
let value = values.get(slot)?.clone();
|
|
26
|
+
let value = match slot {
|
|
27
|
+
22 => json!(signals.parent.reasons.join("~")),
|
|
28
|
+
2 | 15 | 17 | 20 | 21 | 25 if !js::truthy(&value) => json!(""),
|
|
29
|
+
// Absent optional properties are undefined in the loader's message and
|
|
30
|
+
// omitted from the probe's JSON object.
|
|
31
|
+
7 | 8 if value == JsValue::Null => return None,
|
|
32
|
+
_ => value,
|
|
33
|
+
};
|
|
34
|
+
Some((field.clone(), value))
|
|
35
|
+
})
|
|
36
|
+
.collect()
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
pub(crate) fn recognize(probe: &ProbeView<'_>) -> Option<Fields> {
|
|
41
|
+
if !["_cf_chl_opt", "length", "join", "~"]
|
|
42
|
+
.iter()
|
|
43
|
+
.all(|marker| probe.session_features.iter().any(|text| text == marker))
|
|
44
|
+
{
|
|
45
|
+
return None;
|
|
46
|
+
}
|
|
47
|
+
let code = probe.index.reachable(probe.entry);
|
|
48
|
+
let sources = Sources::new(probe.index, &code);
|
|
49
|
+
let mut properties = BTreeMap::new();
|
|
50
|
+
let mut options = BTreeSet::new();
|
|
51
|
+
for store in probe
|
|
52
|
+
.index
|
|
53
|
+
.stores()
|
|
54
|
+
.iter()
|
|
55
|
+
.filter(|store| code.contains(&store.pc) && probe.writes.fields.contains(&store.key))
|
|
56
|
+
{
|
|
57
|
+
let mut reads = sources.reads(store.pc, &store.value);
|
|
58
|
+
let Some((slot, option)) = reads.pop_first() else {
|
|
59
|
+
continue;
|
|
60
|
+
};
|
|
61
|
+
if !reads.is_empty() {
|
|
62
|
+
return None;
|
|
63
|
+
}
|
|
64
|
+
options.insert(option);
|
|
65
|
+
properties.insert(store.key.clone(), slot);
|
|
66
|
+
}
|
|
67
|
+
// All these reads must come from the same `_cf_chl_opt` array. This distinguishes the
|
|
68
|
+
// probe from unrelated indexed fingerprint data and fails closed on changed layouts.
|
|
69
|
+
let expected: BTreeSet<usize> = [
|
|
70
|
+
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 19, 20, 21, 22, 23, 25, 27, 28,
|
|
71
|
+
]
|
|
72
|
+
.into();
|
|
73
|
+
let found: BTreeSet<usize> = properties.values().copied().collect();
|
|
74
|
+
(options.len() == 1 && found == expected && properties.len() == expected.len())
|
|
75
|
+
.then_some(Fields { properties })
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/// Trace reaching register definitions through control flow, including both sides of an
|
|
79
|
+
/// empty-string fallback. The nearest earlier assignment can belong to a branch that never
|
|
80
|
+
/// reaches the call, notably `reasons && reasons.join ? reasons.join("~") : ""`.
|
|
81
|
+
struct Sources<'index, 'listing> {
|
|
82
|
+
index: &'index Index<'listing>,
|
|
83
|
+
incoming: BTreeMap<u32, Vec<(u32, usize)>>,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
impl<'index, 'listing> Sources<'index, 'listing> {
|
|
87
|
+
fn new(index: &'index Index<'listing>, code: &BTreeSet<u32>) -> Self {
|
|
88
|
+
let mut incoming: BTreeMap<u32, Vec<(u32, usize)>> = BTreeMap::new();
|
|
89
|
+
for &pc in code {
|
|
90
|
+
for (path, body) in index.listing().instructions[&pc].paths.iter().enumerate() {
|
|
91
|
+
if let Some(next) = body.exit.continues_at() {
|
|
92
|
+
incoming.entry(next.pc).or_default().push((pc, path));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
Self { index, incoming }
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
fn definitions(&self, pc: u32, register: u8) -> Vec<(u32, Term)> {
|
|
100
|
+
let mut pending = vec![pc];
|
|
101
|
+
let mut visited = BTreeSet::new();
|
|
102
|
+
let mut definitions = Vec::new();
|
|
103
|
+
while let Some(next) = pending.pop() {
|
|
104
|
+
if !visited.insert(next) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
for &(at, path) in self.incoming.get(&next).into_iter().flatten() {
|
|
108
|
+
let effects = &self.index.listing().instructions[&at].paths[path].effects;
|
|
109
|
+
if let Some((position, value)) =
|
|
110
|
+
effects
|
|
111
|
+
.iter()
|
|
112
|
+
.enumerate()
|
|
113
|
+
.rev()
|
|
114
|
+
.find_map(|(i, effect)| match effect {
|
|
115
|
+
Effect::Set(target, value) if *target == register => Some((i, value)),
|
|
116
|
+
_ => None,
|
|
117
|
+
})
|
|
118
|
+
{
|
|
119
|
+
let value = if let Term::Temp(temporary) = value {
|
|
120
|
+
effects[..position]
|
|
121
|
+
.iter()
|
|
122
|
+
.rev()
|
|
123
|
+
.find_map(|effect| match effect {
|
|
124
|
+
Effect::Let(target, value) if target == temporary => Some(value),
|
|
125
|
+
_ => None,
|
|
126
|
+
})
|
|
127
|
+
.unwrap_or(value)
|
|
128
|
+
} else {
|
|
129
|
+
value
|
|
130
|
+
};
|
|
131
|
+
if !definitions.contains(&(at, value.clone())) {
|
|
132
|
+
definitions.push((at, value.clone()));
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
pending.push(at);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
definitions
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
fn reads(&self, pc: u32, value: &Term) -> BTreeSet<(usize, String)> {
|
|
143
|
+
let mut reads = BTreeSet::new();
|
|
144
|
+
let mut pending = vec![(pc, value.clone())];
|
|
145
|
+
let mut visited = BTreeSet::new();
|
|
146
|
+
while let Some((at, value)) = pending.pop() {
|
|
147
|
+
match value {
|
|
148
|
+
Term::Reg(register) => {
|
|
149
|
+
if visited.insert((at, register)) {
|
|
150
|
+
pending.extend(self.definitions(at, register));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
Term::Get(object, key) => {
|
|
154
|
+
if let Some((_, Term::Const(Constant::Number(slot)))) =
|
|
155
|
+
self.index.dereference(at, &key)
|
|
156
|
+
&& slot >= 0.0
|
|
157
|
+
&& slot.fract() == 0.0
|
|
158
|
+
&& let Some(option) = self.index.member(at, &object)
|
|
159
|
+
&& self.index.reads(option.pc, &option.object, "_cf_chl_opt")
|
|
160
|
+
{
|
|
161
|
+
reads.insert((slot as usize, option.key));
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
Term::Call { callee, this, .. } => {
|
|
165
|
+
if let Some(member) = self.index.member(at, &callee)
|
|
166
|
+
&& member.key == "join"
|
|
167
|
+
{
|
|
168
|
+
pending.push((at, this.map_or(member.object, |value| *value)));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
_ => {}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
reads
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
#[cfg(test)]
|
|
179
|
+
mod tests {
|
|
180
|
+
use super::*;
|
|
181
|
+
use crate::embedding_page::page::{Layout, RenderedPage};
|
|
182
|
+
use crate::vm::{Exit, Instruction, Listing, Path};
|
|
183
|
+
use url::Url;
|
|
184
|
+
|
|
185
|
+
fn text(text: &str) -> Term {
|
|
186
|
+
Term::Const(Constant::String(text.to_owned()))
|
|
187
|
+
}
|
|
188
|
+
fn get(object: Term, key: Term) -> Term {
|
|
189
|
+
Term::Get(Box::new(object), Box::new(key))
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
#[test]
|
|
193
|
+
fn follows_both_sides_of_fallbacks_without_using_an_unreachable_assignment() {
|
|
194
|
+
let option = get(get(Term::Reg(100), text("_cf_chl_opt")), text("page"));
|
|
195
|
+
let mut listing = Listing::default();
|
|
196
|
+
let body = |effects, next| Path {
|
|
197
|
+
effects,
|
|
198
|
+
conditions: vec![],
|
|
199
|
+
exit: Exit::Next { pc: next, key: 0 },
|
|
200
|
+
};
|
|
201
|
+
for (pc, paths) in [
|
|
202
|
+
(0, vec![body(vec![Effect::Set(1, option)], 1)]),
|
|
203
|
+
(
|
|
204
|
+
1,
|
|
205
|
+
vec![body(
|
|
206
|
+
vec![Effect::Set(
|
|
207
|
+
2,
|
|
208
|
+
get(Term::Reg(1), Term::Const(Constant::Number(22.0))),
|
|
209
|
+
)],
|
|
210
|
+
2,
|
|
211
|
+
)],
|
|
212
|
+
),
|
|
213
|
+
(2, vec![body(vec![], 3), body(vec![], 4)]),
|
|
214
|
+
(3, vec![body(vec![Effect::Set(2, text(""))], 6)]),
|
|
215
|
+
(4, vec![body(vec![Effect::Set(3, Term::Reg(2))], 5)]),
|
|
216
|
+
(
|
|
217
|
+
5,
|
|
218
|
+
vec![body(
|
|
219
|
+
vec![
|
|
220
|
+
Effect::Let(
|
|
221
|
+
0,
|
|
222
|
+
Term::Call {
|
|
223
|
+
callee: Box::new(get(Term::Reg(3), text("join"))),
|
|
224
|
+
this: None,
|
|
225
|
+
arguments: vec![text("~")],
|
|
226
|
+
},
|
|
227
|
+
),
|
|
228
|
+
Effect::Set(2, Term::Temp(0)),
|
|
229
|
+
],
|
|
230
|
+
6,
|
|
231
|
+
)],
|
|
232
|
+
),
|
|
233
|
+
(6, vec![]),
|
|
234
|
+
] {
|
|
235
|
+
listing.instructions.insert(
|
|
236
|
+
pc,
|
|
237
|
+
Instruction {
|
|
238
|
+
pc,
|
|
239
|
+
key: 0,
|
|
240
|
+
opcode: 0,
|
|
241
|
+
paths,
|
|
242
|
+
},
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
let index = Index::new(&listing);
|
|
246
|
+
let sources = Sources::new(&index, &(0..=6).collect());
|
|
247
|
+
assert_eq!(
|
|
248
|
+
sources.reads(6, &Term::Reg(2)),
|
|
249
|
+
BTreeSet::from([(22, "page".to_owned())])
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
#[test]
|
|
254
|
+
fn source_walk_has_no_chain_limit_and_terminates_on_cycles() {
|
|
255
|
+
let mut listing = Listing::default();
|
|
256
|
+
for pc in 0..=40 {
|
|
257
|
+
listing.instructions.insert(
|
|
258
|
+
pc,
|
|
259
|
+
Instruction {
|
|
260
|
+
pc,
|
|
261
|
+
key: 0,
|
|
262
|
+
opcode: 0,
|
|
263
|
+
paths: vec![Path {
|
|
264
|
+
conditions: vec![],
|
|
265
|
+
effects: vec![Effect::Set(
|
|
266
|
+
1,
|
|
267
|
+
if pc == 0 {
|
|
268
|
+
get(
|
|
269
|
+
get(get(Term::Reg(100), text("_cf_chl_opt")), text("page")),
|
|
270
|
+
Term::Const(Constant::Number(22.0)),
|
|
271
|
+
)
|
|
272
|
+
} else {
|
|
273
|
+
Term::Reg(1)
|
|
274
|
+
},
|
|
275
|
+
)],
|
|
276
|
+
exit: Exit::Next { pc: pc + 1, key: 0 },
|
|
277
|
+
}],
|
|
278
|
+
},
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
let index = Index::new(&listing);
|
|
282
|
+
let sources = Sources::new(&index, &(0..=40).collect());
|
|
283
|
+
assert_eq!(
|
|
284
|
+
sources.reads(41, &Term::Reg(1)),
|
|
285
|
+
BTreeSet::from([(22, "page".to_owned())])
|
|
286
|
+
);
|
|
287
|
+
listing.instructions.get_mut(&0).unwrap().paths[0]
|
|
288
|
+
.effects
|
|
289
|
+
.clear();
|
|
290
|
+
listing.instructions.get_mut(&40).unwrap().paths[0].exit = Exit::Next { pc: 0, key: 0 };
|
|
291
|
+
let index = Index::new(&listing);
|
|
292
|
+
let sources = Sources::new(&index, &(0..=40).collect());
|
|
293
|
+
assert!(sources.reads(40, &Term::Reg(1)).is_empty());
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
#[test]
|
|
297
|
+
fn collects_positional_fields_and_applies_the_probes_fallbacks() {
|
|
298
|
+
let page = RenderedPage::render(
|
|
299
|
+
"<html><body><div class=\"cf-turnstile\" data-sitekey=\"k\"></div></body></html>",
|
|
300
|
+
Url::parse("https://example.com/").unwrap(),
|
|
301
|
+
"w",
|
|
302
|
+
None,
|
|
303
|
+
)
|
|
304
|
+
.unwrap();
|
|
305
|
+
let mut signals = page.signals(&Layout::default(), None);
|
|
306
|
+
signals.parent.reasons = vec!["one".into(), "two".into()];
|
|
307
|
+
signals.parent.pad = None;
|
|
308
|
+
let fields = Fields {
|
|
309
|
+
properties: BTreeMap::from([
|
|
310
|
+
("mode".into(), 20),
|
|
311
|
+
("reasons".into(), 22),
|
|
312
|
+
("hidden".into(), 23),
|
|
313
|
+
("visibility".into(), 25),
|
|
314
|
+
("pad".into(), 8),
|
|
315
|
+
]),
|
|
316
|
+
};
|
|
317
|
+
assert_eq!(
|
|
318
|
+
json!(fields.collect(&signals)),
|
|
319
|
+
json!({
|
|
320
|
+
"mode":"", "reasons":"one~two", "hidden":false, "visibility":"visible",
|
|
321
|
+
})
|
|
322
|
+
);
|
|
323
|
+
assert_eq!(signals.positional().as_array().unwrap().len(), 30);
|
|
324
|
+
assert_eq!(signals.positional()[19], true);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
@@ -5,8 +5,8 @@ use std::convert::Infallible;
|
|
|
5
5
|
use std::ops::ControlFlow;
|
|
6
6
|
|
|
7
7
|
use anyhow::{Result, bail};
|
|
8
|
+
use oxc::syntax::operator::{BinaryOperator, UnaryOperator};
|
|
8
9
|
use serde::{Deserialize, Serialize};
|
|
9
|
-
use swc_core::ecma::ast::{BinaryOp, UnaryOp};
|
|
10
10
|
|
|
11
11
|
use crate::engine::Engine;
|
|
12
12
|
use crate::js::{JsObject, JsValue, json};
|
|
@@ -376,13 +376,17 @@ fn marked(columns: &[RowWrite]) -> Option<(&str, &[RowWrite])> {
|
|
|
376
376
|
/// negations.
|
|
377
377
|
fn equality(condition: &Term, holds: bool) -> Option<(&Term, &Term)> {
|
|
378
378
|
match condition {
|
|
379
|
-
Term::Unary(
|
|
380
|
-
Term::Binary(
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
Term::Binary(BinaryOp::NotEqEq | BinaryOp::NotEq, left, right) if !holds => {
|
|
379
|
+
Term::Unary(UnaryOperator::LogicalNot, inner) => equality(inner, !holds),
|
|
380
|
+
Term::Binary(BinaryOperator::StrictEquality | BinaryOperator::Equality, left, right)
|
|
381
|
+
if holds =>
|
|
382
|
+
{
|
|
384
383
|
Some((left, right))
|
|
385
384
|
}
|
|
385
|
+
Term::Binary(
|
|
386
|
+
BinaryOperator::StrictInequality | BinaryOperator::Inequality,
|
|
387
|
+
left,
|
|
388
|
+
right,
|
|
389
|
+
) if !holds => Some((left, right)),
|
|
386
390
|
_ => None,
|
|
387
391
|
}
|
|
388
392
|
}
|
|
@@ -414,11 +418,11 @@ fn evaluate(frame: &Frame<Held>, term: &Term) -> Option<Known<Held>> {
|
|
|
414
418
|
(None, Some(Known::Literal(JsValue::String(name)))) => Known::Ext(Held::Field(name)),
|
|
415
419
|
_ => return None,
|
|
416
420
|
},
|
|
417
|
-
Term::Binary(
|
|
421
|
+
Term::Binary(BinaryOperator::Addition, left, _) => match frame.resolve(left)? {
|
|
418
422
|
Known::Literal(JsValue::String(prefix)) => Known::Ext(Held::Prefixed(prefix)),
|
|
419
423
|
_ => return None,
|
|
420
424
|
},
|
|
421
|
-
Term::Binary(
|
|
425
|
+
Term::Binary(BinaryOperator::Subtraction, left, right) => {
|
|
422
426
|
match (frame.resolve(left)?, frame.resolve(right)?) {
|
|
423
427
|
(Known::Ext(Held::Property(end)), Known::Ext(Held::Property(start)))
|
|
424
428
|
if end == "responseEnd" && start == "requestStart" =>
|
|
@@ -11,7 +11,7 @@ use crate::listing::Index;
|
|
|
11
11
|
use crate::stage2::analysis::recognize::ProbeView;
|
|
12
12
|
use crate::stage2::call_stack::ProbeCalls;
|
|
13
13
|
use crate::stage2::vocabulary;
|
|
14
|
-
use crate::vm::Term;
|
|
14
|
+
use crate::vm::{Effect, Exit, Term};
|
|
15
15
|
|
|
16
16
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
17
17
|
pub struct Fields {
|
|
@@ -61,6 +61,50 @@ fn construction(index: &Index<'_>, entry: u32) -> Option<u8> {
|
|
|
61
61
|
})
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/// Some builds put the property read in a one-argument getter. Accept that getter only
|
|
65
|
+
/// when every return path returns `stack`, rather than an unrelated read in its body.
|
|
66
|
+
fn stack_value(index: &Index<'_>, pc: u32, value: &Term) -> bool {
|
|
67
|
+
if index.reads(pc, value, "stack") {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
let Some((
|
|
71
|
+
at,
|
|
72
|
+
Term::Call {
|
|
73
|
+
callee, arguments, ..
|
|
74
|
+
},
|
|
75
|
+
)) = index.dereference(pc, value)
|
|
76
|
+
else {
|
|
77
|
+
return false;
|
|
78
|
+
};
|
|
79
|
+
if arguments.len() != 1 {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
let Some((_, Term::Closure { pc: getter, .. })) = index.dereference(at, &callee) else {
|
|
83
|
+
return false;
|
|
84
|
+
};
|
|
85
|
+
let mut returns = 0;
|
|
86
|
+
for instruction in index
|
|
87
|
+
.listing()
|
|
88
|
+
.instructions
|
|
89
|
+
.range(index.function_at(getter))
|
|
90
|
+
.map(|(_, instruction)| instruction)
|
|
91
|
+
{
|
|
92
|
+
for path in &instruction.paths {
|
|
93
|
+
if path.exit != Exit::Return {
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
let Some(Effect::Set(_, returned)) = path.effects.first() else {
|
|
97
|
+
return false;
|
|
98
|
+
};
|
|
99
|
+
if !index.reads(instruction.pc, returned, "stack") {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
returns += 1;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
returns > 0
|
|
106
|
+
}
|
|
107
|
+
|
|
64
108
|
/// Finds the output field hidden by base64 encoding and a two-byte XOR key. A name that decodes to
|
|
65
109
|
/// `stack` identifies the key. The output field is the remaining name after excluding `stack` and
|
|
66
110
|
/// the record counter from the header. Builds with hex names encode only `stack`.
|
|
@@ -142,17 +186,86 @@ fn result_field(features: &[String], header: &BTreeSet<String>) -> Option<String
|
|
|
142
186
|
}
|
|
143
187
|
|
|
144
188
|
pub(crate) fn recognize(probe: &ProbeView<'_>) -> Option<Fields> {
|
|
189
|
+
let calls = calls(probe.index, probe.entry);
|
|
145
190
|
result_field(probe.session_features, probe.header)
|
|
146
191
|
.or_else(|| encoded_result_field(probe.session_features, probe.header))
|
|
147
|
-
.
|
|
148
|
-
|
|
149
|
-
|
|
192
|
+
.or_else(|| {
|
|
193
|
+
calls?;
|
|
194
|
+
let code = probe.index.reachable(probe.entry);
|
|
195
|
+
let fields: BTreeSet<_> = probe
|
|
196
|
+
.index
|
|
197
|
+
.stores()
|
|
198
|
+
.iter()
|
|
199
|
+
.filter(|store| {
|
|
200
|
+
code.contains(&store.pc) && stack_value(probe.index, store.pc, &store.value)
|
|
201
|
+
})
|
|
202
|
+
.map(|store| store.key.clone())
|
|
203
|
+
.collect();
|
|
204
|
+
candidates::exactly_one(fields, "stack result field").ok()
|
|
150
205
|
})
|
|
206
|
+
.map(|result| Fields { result, calls })
|
|
151
207
|
}
|
|
152
208
|
|
|
153
209
|
#[cfg(test)]
|
|
154
210
|
mod tests {
|
|
155
211
|
use super::*;
|
|
212
|
+
use crate::vm::{Constant, Instruction, Listing, Path, Position};
|
|
213
|
+
|
|
214
|
+
#[test]
|
|
215
|
+
fn follows_stack_getters_but_rejects_other_return_values() {
|
|
216
|
+
let text = |value: &str| Term::Const(Constant::String(value.into()));
|
|
217
|
+
let mut listing = Listing {
|
|
218
|
+
functions: vec![Position::new(0, 0), Position::new(10, 0)],
|
|
219
|
+
..Listing::default()
|
|
220
|
+
};
|
|
221
|
+
let mut insert = |pc, effects, exit| {
|
|
222
|
+
listing.instructions.insert(
|
|
223
|
+
pc,
|
|
224
|
+
Instruction {
|
|
225
|
+
pc,
|
|
226
|
+
key: 0,
|
|
227
|
+
opcode: 0,
|
|
228
|
+
paths: vec![Path {
|
|
229
|
+
conditions: vec![],
|
|
230
|
+
effects,
|
|
231
|
+
exit,
|
|
232
|
+
}],
|
|
233
|
+
},
|
|
234
|
+
);
|
|
235
|
+
};
|
|
236
|
+
insert(
|
|
237
|
+
0,
|
|
238
|
+
vec![Effect::Set(
|
|
239
|
+
2,
|
|
240
|
+
Term::Closure {
|
|
241
|
+
pc: 10,
|
|
242
|
+
key: 0,
|
|
243
|
+
parameters: vec![1],
|
|
244
|
+
arity: 1,
|
|
245
|
+
},
|
|
246
|
+
)],
|
|
247
|
+
Exit::Next { pc: 1, key: 0 },
|
|
248
|
+
);
|
|
249
|
+
insert(1, vec![], Exit::Return);
|
|
250
|
+
insert(
|
|
251
|
+
10,
|
|
252
|
+
vec![Effect::Set(
|
|
253
|
+
3,
|
|
254
|
+
Term::Get(Box::new(Term::Reg(1)), Box::new(text("stack"))),
|
|
255
|
+
)],
|
|
256
|
+
Exit::Next { pc: 11, key: 0 },
|
|
257
|
+
);
|
|
258
|
+
insert(11, vec![Effect::Set(225, Term::Reg(3))], Exit::Return);
|
|
259
|
+
let call = Term::Call {
|
|
260
|
+
callee: Box::new(Term::Reg(2)),
|
|
261
|
+
this: None,
|
|
262
|
+
arguments: vec![Term::Reg(4)],
|
|
263
|
+
};
|
|
264
|
+
assert!(stack_value(&Index::new(&listing), 1, &call));
|
|
265
|
+
listing.instructions.get_mut(&11).unwrap().paths[0].effects =
|
|
266
|
+
vec![Effect::Set(225, text("unrelated"))];
|
|
267
|
+
assert!(!stack_value(&Index::new(&listing), 1, &call));
|
|
268
|
+
}
|
|
156
269
|
|
|
157
270
|
/// String-table fixtures from `oct07` and `auto07`, with reversed entries, different
|
|
158
271
|
/// separators, record counter `MpnR7`, and output `KtSk9` among checksums.
|
|
@@ -170,12 +170,15 @@ pub(crate) fn recognize(probe: &ProbeView<'_>) -> Option<Fields> {
|
|
|
170
170
|
received: received.clone(),
|
|
171
171
|
opened: opened.clone(),
|
|
172
172
|
round_trips: before(&["JSON", "stringify"])?,
|
|
173
|
-
elapsed: before(&["String", "Date", "now"])
|
|
173
|
+
elapsed: before(&["String", "Date", "now"])
|
|
174
|
+
.or_else(|| before(&["String", "now"]))
|
|
175
|
+
.or_else(|| before(&["now"]))?,
|
|
174
176
|
statuses: Statuses {
|
|
175
177
|
complete: complete.clone(),
|
|
176
178
|
incomplete: incomplete.clone(),
|
|
177
179
|
timed_out: before(&["String", "Math", "round"])
|
|
178
|
-
.or_else(|| before(&["String", "round"]))
|
|
180
|
+
.or_else(|| before(&["String", "round"]))
|
|
181
|
+
.or_else(|| before(&["round"]))?,
|
|
179
182
|
failed_before_open: failed_before_open.clone(),
|
|
180
183
|
failed_after_open: failed_after_open.clone(),
|
|
181
184
|
closed: closed.clone(),
|
|
@@ -200,6 +203,81 @@ pub(crate) fn recognize(probe: &ProbeView<'_>) -> Option<Fields> {
|
|
|
200
203
|
mod tests {
|
|
201
204
|
use super::*;
|
|
202
205
|
|
|
206
|
+
#[test]
|
|
207
|
+
fn recognizes_builtins_loaded_from_the_header() {
|
|
208
|
+
use crate::listing::Index;
|
|
209
|
+
use crate::stage2::analysis::recognize::Strings;
|
|
210
|
+
use crate::stage2::records::WriteOrder;
|
|
211
|
+
use crate::stage2::vocabulary::Vocabulary;
|
|
212
|
+
use crate::vm::Listing;
|
|
213
|
+
use std::collections::BTreeSet;
|
|
214
|
+
|
|
215
|
+
let features: Vec<String> = [
|
|
216
|
+
"rtts",
|
|
217
|
+
"JSON",
|
|
218
|
+
"stringify",
|
|
219
|
+
"elapsed",
|
|
220
|
+
"now",
|
|
221
|
+
"readyState",
|
|
222
|
+
"close",
|
|
223
|
+
"status",
|
|
224
|
+
"sent",
|
|
225
|
+
"received",
|
|
226
|
+
"opened",
|
|
227
|
+
"error",
|
|
228
|
+
"length",
|
|
229
|
+
"complete",
|
|
230
|
+
"incomplete",
|
|
231
|
+
"send",
|
|
232
|
+
"performance",
|
|
233
|
+
"now",
|
|
234
|
+
"timeout",
|
|
235
|
+
"round",
|
|
236
|
+
"performance",
|
|
237
|
+
"now",
|
|
238
|
+
"isFinite",
|
|
239
|
+
"",
|
|
240
|
+
"after",
|
|
241
|
+
"before",
|
|
242
|
+
"closed",
|
|
243
|
+
"WebSocket",
|
|
244
|
+
"platform",
|
|
245
|
+
"/w",
|
|
246
|
+
"onopen",
|
|
247
|
+
"onmessage",
|
|
248
|
+
"onclose",
|
|
249
|
+
]
|
|
250
|
+
.map(str::to_owned)
|
|
251
|
+
.to_vec();
|
|
252
|
+
let writes = WriteOrder {
|
|
253
|
+
fields: ["status", "sent", "received", "opened", "rtts", "elapsed"]
|
|
254
|
+
.map(str::to_owned)
|
|
255
|
+
.to_vec(),
|
|
256
|
+
..WriteOrder::default()
|
|
257
|
+
};
|
|
258
|
+
let listing = Listing::default();
|
|
259
|
+
let index = Index::new(&listing);
|
|
260
|
+
let vocabulary = Vocabulary::infer(&[&features]);
|
|
261
|
+
let empty = BTreeSet::new();
|
|
262
|
+
let fields = recognize(&ProbeView {
|
|
263
|
+
index: &index,
|
|
264
|
+
vocabulary: &vocabulary,
|
|
265
|
+
position: 0,
|
|
266
|
+
header: &empty,
|
|
267
|
+
wrapper: &empty,
|
|
268
|
+
pool: "",
|
|
269
|
+
entry: 0,
|
|
270
|
+
session_features: &features,
|
|
271
|
+
writes: &writes,
|
|
272
|
+
strings: Strings::new(&features, &empty),
|
|
273
|
+
})
|
|
274
|
+
.unwrap();
|
|
275
|
+
assert_eq!(fields.elapsed, "elapsed");
|
|
276
|
+
assert_eq!(fields.round_trips, "rtts");
|
|
277
|
+
assert_eq!(fields.statuses.timed_out, "timeout");
|
|
278
|
+
assert_eq!(fields.statuses.failed_after_open, "after");
|
|
279
|
+
}
|
|
280
|
+
|
|
203
281
|
fn fields() -> Fields {
|
|
204
282
|
Fields {
|
|
205
283
|
platform: "ppebL7".into(),
|