captchakraken 4.1.0__tar.gz → 4.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {captchakraken-4.1.0 → captchakraken-4.2.0}/PKG-INFO +1 -1
- {captchakraken-4.1.0 → captchakraken-4.2.0}/pyproject.toml +1 -1
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/__init__.py +1 -1
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/captchakraken.config.json +18 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/cli.py +34 -1
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/kinds.py +1 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/page_solver.py +72 -4
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/prompts.py +6 -2
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/tool_calls/slide_tracker.py +10 -1
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/slide_boards.py +10 -4
- captchakraken-4.2.0/tests/test_a_slider_is_shown_with_its_handle.py +107 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_every_trained_vendor_is_found.py +7 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_fetch_command.py +25 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_public_contract.py +1 -1
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_slide_tracker.py +9 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_the_legacy_model_warning_is_one_text.py +13 -2
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_the_slide_driver_steers_by_what_it_sees.py +24 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/.gitignore +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/AGENTS.md +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/Dockerfile +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/LICENSE +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/NOTICE +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/README.md +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/examples/README.md +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/examples/_harness.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/examples/demoRecaptcha.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/examples/watch_playwright.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/examples/with_local_gguf.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/examples/with_playwright.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/action_types.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/clipvideo.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/config.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/demo.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/errors.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/humanize.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/image_processor.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/keyframes.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/models.json +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/overlay.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/pinned_model.json +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/planner.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/pointer/__init__.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/pointer/detector.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/pointer/elements.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/pointer/heads.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/pointer/layout.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/pointer/marks.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/pointer/server.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/pointer/service.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/pointer/vllm_plugin.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/selectors.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/selfhost.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/server_manager.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/solver.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/timing.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/tool_calls/board_painted.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/tool_calls/fill_tracker.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/tool_calls/find_checkbox.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/tool_calls/find_grid.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/updater.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/verdicts.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/src/captchakraken/watcher.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/drawing.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fake_dom.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/checkbox/captchafox.png +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/checkbox/geetest_v4_bar.png +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/checkbox/hcaptcha_dark.png +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/checkbox/hcaptcha_light_compact_hover_1.5x.png +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/checkbox/hcaptcha_ticked.png +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/checkbox/recaptcha_dark_compact_2x.png +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/checkbox/recaptcha_light.png +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/checkbox/recaptcha_ticked_1.5x.png +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/checkbox/turnstile_dark_flexible_2x.png +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/checkbox/turnstile_light.png +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/checkbox/turnstile_passed.png +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/cursory_cross_port.json +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/grid/groceries_6x3_mac.png +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/grid/photos_3x3_offcentre.png +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/hcaptcha_enclave/challenge.html +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/hcaptcha_enclave/enclave.html +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/hcaptcha_enclave/host.html +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/fixtures/vendor_verdicts.json +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_blank_board_is_not_photographed.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_board_is_routed_and_watched_once_it_has_painted.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_board_that_never_repeats_is_animated.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_board_that_will_not_film_may_already_be_solved.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_board_with_no_answer_is_skipped.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_burst_cannot_trip_its_own_deadline.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_capture_never_clips_the_page.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_checkbox_is_clicked_not_watched.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_frame_keeps_its_colours_and_its_pixels.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_hold_is_held_until_the_widget_completes.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_missing_prompt_is_not_a_reason_to_wait.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_new_board_ends_the_film.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_pin_reads_its_own_entry.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_pointer_answer_always_carries_points.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_pointer_model_is_sent_the_bare_board.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_reask_is_a_different_sample.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_refusal_keeps_its_machine_readable_half.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_refused_clip_is_not_re_asked.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_refused_pointer_answer_moves_to_the_next.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_repeat_on_a_silent_board.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_repeated_answer_is_not_re_performed.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_replaced_board_has_not_failed_yet.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_round_that_did_nothing_waits_for_nothing.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_slow_camera_does_not_stretch_the_burst.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_slow_model_does_not_extend_the_burst.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_solved_board_is_not_lost_to_a_typed_action.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_still_board_is_not_filmed.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_still_burst_stops_at_the_floor.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_typed_captcha_is_shown_with_its_box.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_typed_code_is_read_by_the_model_and_the_letter_detector_together.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_video_generation_sends_the_clip.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_widget_inside_an_enclave_is_found.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_a_widget_is_waited_for.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_an_element_is_outlined_by_its_mask.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_an_unusable_answer_is_not_a_dead_page.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_animated_solve_budget.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_api_error_is_exported.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_api_errors.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_browser_compat.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_cli_stdout_is_the_wire_between_the_ports.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_credentials_file.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_cycling_board_waits_for_its_screen.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_detector_weights_are_fetched_once_and_checked.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_earlier_screens_are_context_before_the_board.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_empty_answer_still_submits.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_endpoint_is_dialled_once.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_every_captcha_is_asked_the_same_prompt.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_every_keyframe_write_names_its_stem.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_expert_reaches_the_wire.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_expert_routing.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_fetch_offers_only_what_loads.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_find_checkbox_rejects_what_is_not_a_checkbox.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_find_grid_reads_the_detectors_cells.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_freshness_check.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_geetest_accept_is_a_signal.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_geetest_done_needs_no_bounding_box.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_geetest_submit_button.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_grid_detection_ci.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_grid_dims_must_be_possible.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_grid_never_pairs_tiles.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_grid_round_pays_once.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_hcaptcha_badge_detection.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_hcaptcha_boards_reach_the_right_expert.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_humanizer.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_keyframes_compare_each_pair_once.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_licensed_models.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_min_pixels_upscale.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_old_config_names_still_work.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_one_ask_cannot_outlive_the_solve.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_one_prompt_answers_every_puzzle.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_our_own_gesture_is_not_animation.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_outcome_reporting.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_overlay_is_what_the_model_reads.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_page_solver.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_pinned_model.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_pixel_parser.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_private_models.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_recaptcha_chipped_board.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_recaptcha_dynamic_more_is_not_an_error.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_routing_headers.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_selected_fields.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_solver.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_stale_handle_after_submit.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_the_client_runs_without_opencv.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_the_film_outlives_the_answer.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_the_notice_travels_with_the_package.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_the_offset_head_learns.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_the_pointer_reads_its_answer_from_one_prefill.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_the_pointer_server_is_a_managed_endpoint.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_the_second_look_believes_its_recording.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_the_selector_config_is_the_table.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_the_two_ports_share_one_mouse.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_the_vendor_says_whether_the_round_was_taken.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_the_wait_gate_metric.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_the_worker_protocol_survives_a_bad_request.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_thinking_is_off_on_every_runtime.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_vendor_gates_are_not_keyed_on_unknown.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_vendor_hint_decides_the_expert.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_version_matches_manifest.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_watcher.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_your_own_selectors_find_your_captcha.py +0 -0
- {captchakraken-4.1.0 → captchakraken-4.2.0}/tests/virtual_clock.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: captchakraken
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.2.0
|
|
4
4
|
Summary: Captcha-solving engine and CLI: a v2 pointer model and CNN element detector for image grids, click and drag puzzles, sliders, distorted text and animated challenges. Hosted API or self-hosted on vLLM.
|
|
5
5
|
Project-URL: Homepage, https://captchakraken.com
|
|
6
6
|
Project-URL: Documentation, https://github.com/CaptchaKraken/CaptchaKraken#readme
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "captchakraken"
|
|
7
|
-
version = "4.
|
|
7
|
+
version = "4.2.0"
|
|
8
8
|
description = "Captcha-solving engine and CLI: a v2 pointer model and CNN element detector for image grids, click and drag puzzles, sliders, distorted text and animated challenges. Hosted API or self-hosted on vLLM."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -377,6 +377,24 @@
|
|
|
377
377
|
"iframe[src*=\"/core/v4/captcha\"]"
|
|
378
378
|
]
|
|
379
379
|
},
|
|
380
|
+
"datadome": {
|
|
381
|
+
"note": "The interstitial is one full-viewport iframe served from geo.captcha-delivery.com/captcha/, so it is the challenge itself, with no checkbox. Its visual mode is a slide-to-the-end bar; the handle is `.slider` inside `.sliderContainer`, and a pass reloads the host page. A refused session gets a 'You have been blocked' page in the same frame, under the same URL.",
|
|
382
|
+
"hosts": [
|
|
383
|
+
"captcha-delivery.com"
|
|
384
|
+
],
|
|
385
|
+
"challenge": [
|
|
386
|
+
"iframe[src*=\"captcha-delivery.com/captcha\"]"
|
|
387
|
+
],
|
|
388
|
+
"blocked": [
|
|
389
|
+
"body.dd-response-page--hard-block .captcha__human__title"
|
|
390
|
+
],
|
|
391
|
+
"slider_handle": [
|
|
392
|
+
".sliderContainer .slider"
|
|
393
|
+
],
|
|
394
|
+
"refresh": [
|
|
395
|
+
"#captcha__reload__button"
|
|
396
|
+
]
|
|
397
|
+
},
|
|
380
398
|
"unknown": {
|
|
381
399
|
"hosts": []
|
|
382
400
|
}
|
|
@@ -447,8 +447,39 @@ COMMANDS: Dict[str, Callable[[List[str]], Any]] = {
|
|
|
447
447
|
}
|
|
448
448
|
|
|
449
449
|
|
|
450
|
+
# What `captchakraken --help` leads with: the commands a person types. The rest of COMMANDS are the JS port's.
|
|
451
|
+
USER_COMMANDS = """commands:
|
|
452
|
+
fetch choose a model, a GPU and a startup mode, then install and start it
|
|
453
|
+
start start the local server (it stays on until stop)
|
|
454
|
+
stop stop the local server and keep it off
|
|
455
|
+
status show the endpoint, model and whether it is up
|
|
456
|
+
demo [site ...] solve the public demo pages with your setup
|
|
457
|
+
server ensure start the local server if it should be running
|
|
458
|
+
|
|
459
|
+
Run `captchakraken <command> --help` for a command's options.
|
|
460
|
+
Given an image path instead, it solves that one image with these options."""
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
# `<command> --help` for the commands that take no parser of their own. Asking for help must never act.
|
|
464
|
+
COMMAND_HELP = {
|
|
465
|
+
"start": "usage: captchakraken start\n\nStart the local server set up by `captchakraken fetch`. It stays on until stop.",
|
|
466
|
+
"stop": "usage: captchakraken stop\n\nStop the local server. It stays off, across reboots and solves, until start.",
|
|
467
|
+
"status": "usage: captchakraken status\n\nPrint the endpoint, the model and whether the server is up, as JSON.",
|
|
468
|
+
"demo": ("usage: captchakraken demo [--list] [--headed] [site ...]\n\n"
|
|
469
|
+
"Solve the public demo pages with your setup: all of them, or the sites named.\n"
|
|
470
|
+
" --list list the sites\n --headed show the browser"),
|
|
471
|
+
"server": "usage: captchakraken server {start,ensure,stop,status,run}\n\nManage the local server directly.",
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
|
|
450
475
|
def main():
|
|
451
476
|
argv = sys.argv[1:]
|
|
477
|
+
if not argv:
|
|
478
|
+
argv = ["--help"]
|
|
479
|
+
sys.argv.append("--help")
|
|
480
|
+
if argv[0] in COMMAND_HELP and ("-h" in argv[1:] or "--help" in argv[1:]):
|
|
481
|
+
print(COMMAND_HELP[argv[0]])
|
|
482
|
+
return
|
|
452
483
|
if argv and argv[0] in COMMANDS:
|
|
453
484
|
try:
|
|
454
485
|
result = COMMANDS[argv[0]](argv[1:])
|
|
@@ -461,7 +492,9 @@ def main():
|
|
|
461
492
|
print(json.dumps(result))
|
|
462
493
|
return
|
|
463
494
|
|
|
464
|
-
parser = argparse.ArgumentParser(
|
|
495
|
+
parser = argparse.ArgumentParser(prog="captchakraken", description=USER_COMMANDS,
|
|
496
|
+
usage="%(prog)s <command> [options]\n %(prog)s [options] image_path [model]",
|
|
497
|
+
formatter_class=argparse.RawDescriptionHelpFormatter)
|
|
465
498
|
parser.add_argument("image_path", help="Path to the captcha image or video")
|
|
466
499
|
parser.add_argument("model", nargs="?", default=None, help="Served LoRA name; defaults to models.json's latest.")
|
|
467
500
|
parser.add_argument("api_provider", nargs="?", default="captchaKrakenApi", choices=["captchaKrakenApi"],
|
|
@@ -198,6 +198,9 @@ class SolveResult:
|
|
|
198
198
|
#: A typed captcha's text box widens the shot only when it sits by the image: the union may be at most this many
|
|
199
199
|
#: times the image's area. A vendor-named box found in the enclosing form can be a whole login form away.
|
|
200
200
|
ANSWER_BOX_MAX_GROWTH = 4.0
|
|
201
|
+
#: A slider's handle widens the shot only when it sits just outside the picture: the union may be at most this many
|
|
202
|
+
#: times the picture's area. Yidun's bar is 40px under a 175px panel (x1.23).
|
|
203
|
+
SLIDER_TRACK_MAX_GROWTH = 2.0
|
|
201
204
|
|
|
202
205
|
|
|
203
206
|
class _WithAnswerBox:
|
|
@@ -208,10 +211,14 @@ class _WithAnswerBox:
|
|
|
208
211
|
strip the pointer read the image as a click puzzle (p(type) 0.46) or doubled a glyph, where the same frame
|
|
209
212
|
with its box read R9VK at p >= 0.89 per character. The answer's points are taken in this union's frame, so
|
|
210
213
|
`bounding_box` is the union everywhere the round reads it; everything else is the element's own.
|
|
214
|
+
|
|
215
|
+
The same union carries a slider's handle when the vendor draws its track outside the widget element: Yidun's
|
|
216
|
+
float layout pops `.yidun_panel` above a separate bar. Every training board shows the bar with its handle, and
|
|
217
|
+
on the bare panel the pointer had no handle to name, so it dragged the piece (which Yidun ignores) or named the hole.
|
|
211
218
|
"""
|
|
212
219
|
|
|
213
|
-
def __init__(self, element: Any, box: Any):
|
|
214
|
-
self._element, self._box = element, box
|
|
220
|
+
def __init__(self, element: Any, box: Any, max_growth: float = ANSWER_BOX_MAX_GROWTH):
|
|
221
|
+
self._element, self._box, self._max_growth = element, box, max_growth
|
|
215
222
|
|
|
216
223
|
def bounding_box(self) -> Optional[Dict[str, float]]:
|
|
217
224
|
a = self._element.bounding_box()
|
|
@@ -221,7 +228,7 @@ class _WithAnswerBox:
|
|
|
221
228
|
x0, y0 = min(a["x"], b["x"]), min(a["y"], b["y"])
|
|
222
229
|
x1 = max(a["x"] + a["width"], b["x"] + b["width"])
|
|
223
230
|
y1 = max(a["y"] + a["height"], b["y"] + b["height"])
|
|
224
|
-
if (x1 - x0) * (y1 - y0) >
|
|
231
|
+
if (x1 - x0) * (y1 - y0) > self._max_growth * max(a["width"] * a["height"], 1.0):
|
|
225
232
|
return a
|
|
226
233
|
return {"x": x0, "y": y0, "width": x1 - x0, "height": y1 - y0}
|
|
227
234
|
|
|
@@ -454,6 +461,10 @@ def _has_text(handle: Any) -> bool:
|
|
|
454
461
|
# The nudge that shows the tracker what the handle moves: enough to separate the part from still ground, little enough
|
|
455
462
|
# that a piece resting against the board's edge stays on it.
|
|
456
463
|
SLIDE_PROBE_PX = 8.0
|
|
464
|
+
# A part that moves less than this while the handle travels more than half a probe has reached the end of its
|
|
465
|
+
# track: pushing on only carries the pointer away from the handle, and a vendor may cancel a drag that strays
|
|
466
|
+
# (DataDome snapped its handle home about 110 px past the stop). Shot pixels at device scale 1.
|
|
467
|
+
SLIDE_STALL_PX = 1.0
|
|
457
468
|
|
|
458
469
|
# No prompt and no pictures both read as ready: waiting for `.prompt-text` to exist once paid the whole timeout
|
|
459
470
|
# before every board of a challenge that draws none (tower_stack: 18s a round, 2/2 -> 0/2).
|
|
@@ -478,6 +489,18 @@ _RESOURCES_JS = """() => {
|
|
|
478
489
|
}"""
|
|
479
490
|
|
|
480
491
|
|
|
492
|
+
def _offset(s: Any) -> Tuple[float, float]:
|
|
493
|
+
"""A slide travel as (dx, dy): a number runs along the track, a pair is a carried piece's own offset."""
|
|
494
|
+
return (float(s[0]), float(s[1])) if isinstance(s, (list, tuple)) else (float(s), 0.0)
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
def _stalled(before: Tuple[Any, Sequence[float]], now: Tuple[Any, Sequence[float]], k: float) -> bool:
|
|
498
|
+
"""Did the handle travel while the part stayed put? Each side is (travel, the part's point) of one look."""
|
|
499
|
+
(ax, ay), (bx, by) = _offset(before[0]), _offset(now[0])
|
|
500
|
+
moved = math.hypot(now[1][0] - before[1][0], now[1][1] - before[1][1])
|
|
501
|
+
return math.hypot(bx - ax, by - ay) > SLIDE_PROBE_PX / 2 * k and moved < SLIDE_STALL_PX * k
|
|
502
|
+
|
|
503
|
+
|
|
481
504
|
class PageSolver:
|
|
482
505
|
"""Drives one Playwright-compatible `page` through a captcha. Reusable across solves."""
|
|
483
506
|
|
|
@@ -1035,6 +1058,39 @@ class PageSolver:
|
|
|
1035
1058
|
first = next(iter(_visible(scope, selectors)), None)
|
|
1036
1059
|
return _handle_of(first) if first is not None else None
|
|
1037
1060
|
|
|
1061
|
+
def _track_outside(self, scope: Any, vendor: Any, element: Any, at: Any = None) -> Optional[Any]:
|
|
1062
|
+
"""The track of the first of the vendor's own slider handles that is visible with its centre outside the widget.
|
|
1063
|
+
|
|
1064
|
+
It is looked for in the widget, then in its parent and grandparent: Yidun's `.yidun_slider` is in
|
|
1065
|
+
`.yidun_control`, a sibling of the `.yidun_panel` the widget resolves to. A match inside the widget is passed
|
|
1066
|
+
over, not taken as the answer: Yidun lists its piece (`.yidun_jigsaw`, in the panel) as a handle too. The
|
|
1067
|
+
track (the handle's parent) is returned rather than the handle, whose box moves as it slides and would
|
|
1068
|
+
resize the frame.
|
|
1069
|
+
"""
|
|
1070
|
+
own = getattr(self._sel.selectors.get(vendor), "slider_handle", None)
|
|
1071
|
+
if not own:
|
|
1072
|
+
return None
|
|
1073
|
+
# Widening the shot is a nicety: a scope that cannot be searched (a detached frame) leaves the shot as it was.
|
|
1074
|
+
try:
|
|
1075
|
+
wheres = [scope, *((at.locator(f"xpath=ancestor::*[{k}]") for k in (1, 2)) if at is not None else ())]
|
|
1076
|
+
a = element.bounding_box()
|
|
1077
|
+
if not a:
|
|
1078
|
+
return None
|
|
1079
|
+
for where in wheres:
|
|
1080
|
+
for found in _visible(where, own):
|
|
1081
|
+
handle = _handle_of(found)
|
|
1082
|
+
b = handle.bounding_box() if handle is not None else None
|
|
1083
|
+
if not b:
|
|
1084
|
+
continue
|
|
1085
|
+
cx, cy = b["x"] + b["width"] / 2, b["y"] + b["height"] / 2
|
|
1086
|
+
if a["x"] <= cx <= a["x"] + a["width"] and a["y"] <= cy <= a["y"] + a["height"]:
|
|
1087
|
+
continue
|
|
1088
|
+
return _handle_of(found.locator("xpath=..")) or handle
|
|
1089
|
+
except Exception:
|
|
1090
|
+
return None
|
|
1091
|
+
return None
|
|
1092
|
+
return None
|
|
1093
|
+
|
|
1038
1094
|
def _answer_box(self, scope: Any, at: Any = None) -> Optional[Any]:
|
|
1039
1095
|
"""The text box inside the widget, else a vendor-named one in its enclosing fieldset/form.
|
|
1040
1096
|
|
|
@@ -1115,6 +1171,7 @@ class PageSolver:
|
|
|
1115
1171
|
handle=(handle[0] * k, handle[1] * k), bounds=(-handle[0] * k, (w - handle[0]) * k),
|
|
1116
1172
|
tol=self.config.slide_tolerance_px * k)
|
|
1117
1173
|
look, s, history, moves = probed, probe * k, [], 0
|
|
1174
|
+
last: Optional[Tuple[Any, Sequence[float]]] = None
|
|
1118
1175
|
while True:
|
|
1119
1176
|
try:
|
|
1120
1177
|
reply = slide_step(first, probed, look, s=s, history=history, **ask)
|
|
@@ -1123,6 +1180,12 @@ class PageSolver:
|
|
|
1123
1180
|
break
|
|
1124
1181
|
if look is not probed:
|
|
1125
1182
|
history.append(reply["observation"])
|
|
1183
|
+
if last is not None and _stalled(last, (s, reply["pos"]), k):
|
|
1184
|
+
_log("slider: the part stopped following the handle; releasing at the end of its track")
|
|
1185
|
+
dx, dy = _offset(last[0])
|
|
1186
|
+
self._smooth_move(page, press[0] + dx / k, press[1] + dy / k)
|
|
1187
|
+
break
|
|
1188
|
+
last = (s, reply["pos"])
|
|
1126
1189
|
_debug(f"slider: point at ({reply['pos'][0] / k:.1f}, {reply['pos'][1] / k:.1f}), "
|
|
1127
1190
|
f"{reply['error'] / k:.1f}px from its target, {reply['kind']}")
|
|
1128
1191
|
if reply["done"] or moves >= self.config.slide_max_corrections:
|
|
@@ -1130,7 +1193,7 @@ class PageSolver:
|
|
|
1130
1193
|
_log(f"slider: releasing {reply['error'] / k:.1f}px off target")
|
|
1131
1194
|
break
|
|
1132
1195
|
s = reply["next"]
|
|
1133
|
-
dx, dy = (s
|
|
1196
|
+
dx, dy = _offset(s)
|
|
1134
1197
|
self._smooth_move(page, press[0] + dx / k, press[1] + dy / k)
|
|
1135
1198
|
self._human.pause(PauseKind.PROBE)
|
|
1136
1199
|
self._screenshot(element, current, timeout_ms=timeout)
|
|
@@ -2203,6 +2266,11 @@ class PageSolver:
|
|
|
2203
2266
|
if text_mode:
|
|
2204
2267
|
_log("widget has a text box; solving as a distorted-text captcha")
|
|
2205
2268
|
element = _WithAnswerBox(element, answer_box)
|
|
2269
|
+
elif puzzle_source not in VENDORS_WITH_BESPOKE_HANDLING:
|
|
2270
|
+
track = self._track_outside(scope, puzzle_source, element, widget.at)
|
|
2271
|
+
if track is not None:
|
|
2272
|
+
_log("the slider track sits outside the widget; photographing the two as one")
|
|
2273
|
+
element = _WithAnswerBox(element, track, SLIDER_TRACK_MAX_GROWTH)
|
|
2206
2274
|
|
|
2207
2275
|
# A reCAPTCHA board is read by its grid below, not filmed.
|
|
2208
2276
|
filmable = puzzle_source != Vendor.RECAPTCHA and not text_mode
|
|
@@ -498,11 +498,15 @@ LEGACY_MODEL_WARNING = ("The hosted API answers the model name '{model}' with an
|
|
|
498
498
|
|
|
499
499
|
|
|
500
500
|
def routed_names() -> set:
|
|
501
|
-
"""Every name a current client puts on the wire to the hosted API: each routing alias and its expert arms
|
|
501
|
+
"""Every name a current client puts on the wire to the hosted API: each routing alias and its expert arms,
|
|
502
|
+
and the alias of the hosted default (`captcha-pointer` has no arms, and a client sends it unasked)."""
|
|
502
503
|
out = set()
|
|
503
|
-
|
|
504
|
+
default = hosted_default_model()
|
|
505
|
+
for alias, target in served_aliases().items():
|
|
504
506
|
if alias.startswith("_"):
|
|
505
507
|
continue
|
|
508
|
+
if default and target == default:
|
|
509
|
+
out.add(alias)
|
|
506
510
|
arms = experts(alias)
|
|
507
511
|
if arms:
|
|
508
512
|
out.add(alias)
|
|
@@ -1091,7 +1091,16 @@ def slide_step(first: Image, probe: Image, current: Image, *, probe_s: Offset, s
|
|
|
1091
1091
|
if _same(current, probe):
|
|
1092
1092
|
params, corr = measure(first, probe, seg, guess=seg.probe, reach_px=2.0, reach_deg=1.0)
|
|
1093
1093
|
else:
|
|
1094
|
-
|
|
1094
|
+
guess = predict(samples, seg, cur)
|
|
1095
|
+
try:
|
|
1096
|
+
params, corr = measure(first, current, seg, guess=guess)
|
|
1097
|
+
except TrackingError:
|
|
1098
|
+
# A part that trails its handle reads a short gain off the probe: Yidun's lags by half the travel up to
|
|
1099
|
+
# ~11px, so an 8px probe moved it 4 and the plan sent the handle twice as far as it needed. The part then
|
|
1100
|
+
# lands far outside the reach around the guess. On a rail the whole track is cheap to search.
|
|
1101
|
+
if _rail(seg) is None:
|
|
1102
|
+
raise
|
|
1103
|
+
params, corr = measure(first, current, seg, guess=guess, reach_px=float(a.shape[1]))
|
|
1095
1104
|
samples.append(Sample(cur, params))
|
|
1096
1105
|
pos = transform_point(params, seg.centroid, point)
|
|
1097
1106
|
dist = math.hypot(goal[0] - pos[0], goal[1] - pos[1])
|
|
@@ -121,17 +121,19 @@ class JigsawBoard(_Board):
|
|
|
121
121
|
"""`picture_ends` (shot px): below it the ground is flat white down to the track, the way a widget frames its
|
|
122
122
|
picture, and the piece rests `y0` from the top, so it can sit just above that flat strip. `flat_rest`: the
|
|
123
123
|
piece rests on flat sky with a flat dark block just ahead of it, as on a Yidun photo, while the slot keeps its
|
|
124
|
-
texture. `
|
|
124
|
+
texture. `lag` (px): the piece trails the handle by half the travel, up to `lag`, as Yidun's does (live
|
|
125
|
+
2026-11-12, lag 11: an 8px probe moved it 4, 139px moved it 128). `flat_face`: the piece is one flat tone inside its rim, as GeeTest draws a piece cut from a banner; a
|
|
125
126
|
colour sets that tone, and `blank_rim` draws its rim in it too. `shadow=False` draws none.
|
|
126
127
|
`decoy`: a still copy of the piece drawn `decoy` px above the slot. `pale_band`: the ground along the rail from
|
|
127
128
|
`pale_band[0]` to `pale_band[1]` (shot px) is the piece's own face tone, as a white phone screen is to a white
|
|
128
129
|
piece."""
|
|
129
130
|
|
|
130
131
|
def __init__(self, ratio=1.0, scale=1.0, badge=True, seed=3, y0=70, picture_ends=None, flat_rest=False,
|
|
131
|
-
flat_face=False, decoy=None, pale_band=None, blank_rim=False, shadow=True):
|
|
132
|
+
flat_face=False, decoy=None, pale_band=None, blank_rim=False, shadow=True, lag=0.0):
|
|
132
133
|
super().__init__(scale, badge)
|
|
133
134
|
k = scale
|
|
134
135
|
self.ratio = ratio
|
|
136
|
+
self.lag = lag * k
|
|
135
137
|
self.bg = _texture(self.h, self.w, seed)
|
|
136
138
|
if picture_ends is not None:
|
|
137
139
|
self.bg[int(picture_ends):] = 250
|
|
@@ -174,7 +176,11 @@ class JigsawBoard(_Board):
|
|
|
174
176
|
|
|
175
177
|
def centre(self, s=0.0):
|
|
176
178
|
"""The piece's centre (of its square, not its knobs) after the handle travelled s."""
|
|
177
|
-
return (self.x0 + self.knob + self.size / 2 + self.
|
|
179
|
+
return (self.x0 + self.knob + self.size / 2 + self.travel(s), self.y0 + self.knob + self.size / 2)
|
|
180
|
+
|
|
181
|
+
def travel(self, s):
|
|
182
|
+
"""How far the piece has moved when the handle has travelled s."""
|
|
183
|
+
return self.ratio * s - math.copysign(min(abs(s) / 2, self.lag), s)
|
|
178
184
|
|
|
179
185
|
@property
|
|
180
186
|
def goal(self):
|
|
@@ -184,7 +190,7 @@ class JigsawBoard(_Board):
|
|
|
184
190
|
return self.handle0
|
|
185
191
|
|
|
186
192
|
def render(self, s):
|
|
187
|
-
x = self.x0 + self.
|
|
193
|
+
x = self.x0 + self.travel(s)
|
|
188
194
|
img = self.ground.copy()
|
|
189
195
|
img = _paste(img, np.zeros_like(self.piece), self.shadow, x + 3 * self.k, self.y0 + 3 * self.k)
|
|
190
196
|
img = _paste(img, self.piece, self.alpha, x, self.y0)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"""A slider whose track sits outside the widget is photographed with it (`page_solver._track_outside`).
|
|
2
|
+
|
|
3
|
+
Yidun's float layout pops its 320x175 picture (.yidun_panel) above a separate 320x40 bar (.yidun_control) holding
|
|
4
|
+
the slide handle; the two are siblings under .yidun. Every board the pointer trained on shows the bar; on the bare
|
|
5
|
+
panel it had no handle to name and dragged the piece, which Yidun ignores (live 0/8 on 2026-11-12). The shot takes
|
|
6
|
+
the handle's track, not the handle: the handle's box moves as it slides, and a frame that changed size mid-slide
|
|
7
|
+
lost the tracker the piece.
|
|
8
|
+
"""
|
|
9
|
+
import sys
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from types import SimpleNamespace
|
|
12
|
+
|
|
13
|
+
import pytest
|
|
14
|
+
|
|
15
|
+
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
|
|
16
|
+
|
|
17
|
+
from captchakraken import page_solver
|
|
18
|
+
from captchakraken.page_solver import SLIDER_TRACK_MAX_GROWTH, PageSolver, _WithAnswerBox
|
|
19
|
+
|
|
20
|
+
# The live page, 2026-11-12
|
|
21
|
+
PANEL = {"x": 630.5, "y": 621, "width": 320, "height": 175}
|
|
22
|
+
BAR = {"x": 630.5, "y": 796, "width": 320, "height": 40}
|
|
23
|
+
SLIDER = {"x": 631.5, "y": 797, "width": 40, "height": 38}
|
|
24
|
+
PIECE = {"x": 640, "y": 690, "width": 40, "height": 40}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class _Handle:
|
|
28
|
+
"""A located element: its own handle, and `xpath=..` reads its parent."""
|
|
29
|
+
|
|
30
|
+
def __init__(self, box, parent=None):
|
|
31
|
+
self.box, self.parent = box, parent
|
|
32
|
+
|
|
33
|
+
def bounding_box(self):
|
|
34
|
+
return dict(self.box)
|
|
35
|
+
|
|
36
|
+
def element_handle(self, timeout=None):
|
|
37
|
+
return self
|
|
38
|
+
|
|
39
|
+
def locator(self, q):
|
|
40
|
+
assert q == "xpath=.."
|
|
41
|
+
return self.parent or _Gone()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class _Gone:
|
|
45
|
+
def element_handle(self, timeout=None):
|
|
46
|
+
raise RuntimeError("no such element")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class _At:
|
|
50
|
+
"""The widget's locator: its ancestors are named, so a test can say which one holds what."""
|
|
51
|
+
|
|
52
|
+
def locator(self, q):
|
|
53
|
+
return {"xpath=ancestor::*[1]": "parent", "xpath=ancestor::*[2]": "grandparent"}[q]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _solver():
|
|
57
|
+
return SimpleNamespace(_sel=SimpleNamespace(selectors={"yidun": SimpleNamespace(slider_handle=(".yidun_slider", ".yidun_jigsaw")),
|
|
58
|
+
"plain": SimpleNamespace(slider_handle=())}))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@pytest.fixture
|
|
62
|
+
def dom(monkeypatch):
|
|
63
|
+
"""`where -> [elements]`, read by the solver's own `_visible`."""
|
|
64
|
+
found = {}
|
|
65
|
+
monkeypatch.setattr(page_solver, "_visible", lambda where, sels: list(found.get(where, [])))
|
|
66
|
+
return found
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def test_the_shot_covers_the_yidun_panel_and_the_bar_under_it(dom):
|
|
70
|
+
bar = _Handle(BAR)
|
|
71
|
+
dom.update({"panel": [_Handle(PIECE)], "parent": [_Handle(SLIDER, parent=bar), _Handle(PIECE)]})
|
|
72
|
+
assert PageSolver._track_outside(_solver(), "panel", "yidun", _Handle(PANEL), _At()) is bar
|
|
73
|
+
el = _WithAnswerBox(_Handle(PANEL), bar, SLIDER_TRACK_MAX_GROWTH)
|
|
74
|
+
assert el.bounding_box() == {"x": 630.5, "y": 621, "width": 320, "height": 215}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def test_a_handle_whose_parent_cannot_be_read_is_its_own_track(dom):
|
|
78
|
+
slider = _Handle(SLIDER)
|
|
79
|
+
dom.update({"parent": [slider]})
|
|
80
|
+
assert PageSolver._track_outside(_solver(), "panel", "yidun", _Handle(PANEL), _At()) is slider
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def test_the_piece_inside_the_panel_is_not_taken_for_the_handle(dom):
|
|
84
|
+
dom.update({"panel": [_Handle(PIECE)]})
|
|
85
|
+
assert PageSolver._track_outside(_solver(), "panel", "yidun", _Handle(PANEL), _At()) is None
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def test_without_the_widgets_locator_only_the_widget_is_searched(dom):
|
|
89
|
+
dom.update({"parent": [_Handle(SLIDER)]})
|
|
90
|
+
assert PageSolver._track_outside(_solver(), "panel", "yidun", _Handle(PANEL)) is None
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def test_a_vendor_without_its_own_handle_is_not_widened(dom):
|
|
94
|
+
dom.update({"panel": [_Handle(SLIDER)]})
|
|
95
|
+
assert PageSolver._track_outside(_solver(), "panel", "plain", _Handle(PANEL), _At()) is None
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def test_a_scope_that_cannot_be_searched_leaves_the_shot_alone(monkeypatch):
|
|
99
|
+
def boom(where, sels):
|
|
100
|
+
raise RuntimeError("frame was detached")
|
|
101
|
+
monkeypatch.setattr(page_solver, "_visible", boom)
|
|
102
|
+
assert PageSolver._track_outside(_solver(), "panel", "yidun", _Handle(PANEL), _At()) is None
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def test_a_track_that_would_more_than_double_the_shot_leaves_it_alone():
|
|
106
|
+
far = {"x": 630.5, "y": 1100, "width": 320, "height": 40}
|
|
107
|
+
assert _WithAnswerBox(_Handle(PANEL), _Handle(far), SLIDER_TRACK_MAX_GROWTH).bounding_box() == PANEL
|
|
@@ -74,6 +74,13 @@ def test_proton_is_found_on_the_api_host_and_under_the_apps_own_api():
|
|
|
74
74
|
assert _detect([_frame(src)]) == (Vendor.PROTON, FrameRole.UNKNOWN), src
|
|
75
75
|
|
|
76
76
|
|
|
77
|
+
|
|
78
|
+
def test_the_datadome_interstitial_is_found_by_its_frame():
|
|
79
|
+
src = ("https://geo.captcha-delivery.com/captcha/?initialCid=REDACTED&hash=DEADBEEF&cid=REDACTED&t=fe"
|
|
80
|
+
"&referer=https%3A%2F%2Fexample.com%2F&s=1&e=deadbeef&dm=cd")
|
|
81
|
+
assert _detect([_frame(src)]) == (Vendor.DATADOME, FrameRole.CHALLENGE)
|
|
82
|
+
|
|
83
|
+
|
|
77
84
|
def test_the_aws_waf_card_is_found():
|
|
78
85
|
assert _detect([_inline(Measured("div", classes=("amzn-captcha-modal",)))]) == (Vendor.AWSWAF, FrameRole.UNKNOWN)
|
|
79
86
|
|
|
@@ -75,3 +75,28 @@ def test_cli_fetch_rejects_conflicting_flags(monkeypatch):
|
|
|
75
75
|
with pytest.raises(SystemExit) as ei:
|
|
76
76
|
cli.main()
|
|
77
77
|
assert ei.value.code == 2
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@pytest.mark.parametrize("command", ["start", "stop", "status", "demo", "server"])
|
|
81
|
+
def test_a_command_help_prints_and_never_acts(command, monkeypatch, capsys, tmp_path):
|
|
82
|
+
# `stop --help` once stopped the server and `demo --help` built a venv.
|
|
83
|
+
monkeypatch.setenv("CAPTCHA_KRAKEN_STATE_DIR", str(tmp_path / "state"))
|
|
84
|
+
monkeypatch.setattr(sys, "argv", ["captchakraken", command, "--help"])
|
|
85
|
+
for name in ("run", "Popen"):
|
|
86
|
+
monkeypatch.setattr(cli.subprocess, name, lambda *a, **k: pytest.fail("help ran a command"))
|
|
87
|
+
try:
|
|
88
|
+
cli.main()
|
|
89
|
+
except SystemExit as e:
|
|
90
|
+
assert e.code in (0, None)
|
|
91
|
+
assert command in capsys.readouterr().out
|
|
92
|
+
assert not (tmp_path / "state").exists()
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def test_bare_captchakraken_lists_the_commands(monkeypatch, capsys):
|
|
96
|
+
monkeypatch.setattr(sys, "argv", ["captchakraken"])
|
|
97
|
+
with pytest.raises(SystemExit) as ei:
|
|
98
|
+
cli.main()
|
|
99
|
+
assert ei.value.code == 0
|
|
100
|
+
out = capsys.readouterr().out
|
|
101
|
+
for name in ("fetch", "start", "stop", "status", "demo"):
|
|
102
|
+
assert name in out
|
|
@@ -73,7 +73,7 @@ def _error_codes() -> list:
|
|
|
73
73
|
|
|
74
74
|
def _solve_parser_flags() -> list:
|
|
75
75
|
src = (PKG / "cli.py").read_text()
|
|
76
|
-
tail = src[src.index('parser = argparse.ArgumentParser(
|
|
76
|
+
tail = src[src.index('parser = argparse.ArgumentParser(prog="captchakraken", description=USER_COMMANDS'):]
|
|
77
77
|
return sorted(set(re.findall(r'add_argument\(\s*\n?\s*"(--[a-z-]+|[a-z_]+)"', tail)))
|
|
78
78
|
|
|
79
79
|
|
|
@@ -385,3 +385,12 @@ def test_the_cv_worker_answers_a_slide_step_request_line(tmp_path):
|
|
|
385
385
|
reply = json.loads(out[1])
|
|
386
386
|
assert reply["id"] == 7 and reply["ok"], reply
|
|
387
387
|
assert abs(reply["result"]["pos"][0] - b.centre(8)[0]) < 0.6 and reply["result"]["kind"] == "slide"
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
@pytest.mark.parametrize("goal_dx", [73, 110, 137])
|
|
391
|
+
def test_a_piece_that_trails_its_handle_is_found_where_the_short_probe_gain_overshot(goal_dx):
|
|
392
|
+
# Yidun live, 2026-11-12: the probe reads a gain of 0.5, the first move lands the piece 50-120px past the guess
|
|
393
|
+
b = JigsawBoard(lag=11)
|
|
394
|
+
b.slot = (b.x0 + goal_dx, b.slot[1])
|
|
395
|
+
s, _, reply = _drive(b, b.centre(), b.goal)
|
|
396
|
+
assert abs(b.centre(s)[0] - b.goal[0]) <= 3
|
{captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_the_legacy_model_warning_is_one_text.py
RENAMED
|
@@ -22,13 +22,24 @@ def _fresh(monkeypatch):
|
|
|
22
22
|
monkeypatch.delenv(name, raising=False)
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
def
|
|
25
|
+
def test_the_routed_names_are_each_routing_alias_and_its_arms_and_the_default():
|
|
26
26
|
routed = prompts.routed_names()
|
|
27
|
+
default = prompts.hosted_default_model()
|
|
27
28
|
for alias in routed:
|
|
28
|
-
assert prompts.experts(alias) or any(alias in prompts.experts(a).values() for a in routed)
|
|
29
|
+
assert (prompts.experts(alias) or any(alias in prompts.experts(a).values() for a in routed)
|
|
30
|
+
or prompts.served_aliases().get(alias) == default)
|
|
29
31
|
assert not prompts.is_legacy_hosted_name(next(iter(routed)))
|
|
30
32
|
|
|
31
33
|
|
|
34
|
+
def test_a_hosted_client_with_no_pin_hears_nothing(monkeypatch, capsys):
|
|
35
|
+
# 4.0.0-4.1.0 warned on every hosted solve: the default `captcha-pointer` has no arms.
|
|
36
|
+
from captchakraken import config
|
|
37
|
+
monkeypatch.setenv("VLLM_BASE_URL", HOSTED)
|
|
38
|
+
monkeypatch.setattr(config, "selfhost", lambda: {})
|
|
39
|
+
planner.ActionPlanner(base_url=HOSTED, api_key="SYNTHETIC")
|
|
40
|
+
assert "older model" not in capsys.readouterr().err
|
|
41
|
+
|
|
42
|
+
|
|
32
43
|
def test_a_name_with_no_route_is_warned_about_once(capsys):
|
|
33
44
|
planner.ActionPlanner(model="captcha", base_url=HOSTED, api_key="SYNTHETIC")
|
|
34
45
|
planner.ActionPlanner(model="captcha", base_url=HOSTED, api_key="SYNTHETIC")
|
{captchakraken-4.1.0 → captchakraken-4.2.0}/tests/test_the_slide_driver_steers_by_what_it_sees.py
RENAMED
|
@@ -190,3 +190,27 @@ def test_a_generation_2_piece_with_no_track_is_carried_onto_its_slot():
|
|
|
190
190
|
_, s = _run(board, legacy, scope=_OneControl(board, PIECE_SELECTORS))
|
|
191
191
|
x, y = board.centre(0)
|
|
192
192
|
assert abs(x + s[0] - board.goal[0]) <= 2.0 and abs(y + s[1] - board.goal[1]) <= 2.0
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class _StoppedHandle(CarriedBoard):
|
|
197
|
+
"""A handle that is its own part, on a track that ends `stop` px to the right: past it the handle stays put,
|
|
198
|
+
wherever the pointer goes. DataDome's slide-to-the-end bar is one."""
|
|
199
|
+
|
|
200
|
+
def __init__(self, stop: float, **kw: Any) -> None:
|
|
201
|
+
super().__init__(**kw)
|
|
202
|
+
self.stop = stop
|
|
203
|
+
|
|
204
|
+
def render(self, s):
|
|
205
|
+
dx, dy = s if isinstance(s, (list, tuple)) else (s, 0.0)
|
|
206
|
+
return super().render((min(dx, self.stop), dy))
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def test_a_handle_at_the_end_of_its_track_is_let_go_not_pushed_past_it():
|
|
210
|
+
"""A goal past the stop cannot be reached; once a push moves nothing, the pointer goes back to where the push
|
|
211
|
+
began and lets go. A vendor may cancel a drag whose pointer strays: DataDome snapped its handle home."""
|
|
212
|
+
board = _StoppedHandle(stop=100.0)
|
|
213
|
+
x, y = board.centre(0)
|
|
214
|
+
pointer, s = _run(board, _slide(board, (x, y), (x + 117.0, y)))
|
|
215
|
+
assert (pointer.presses, pointer.releases) == (1, 1)
|
|
216
|
+
assert s[0] <= 120.0, f"pushed {s[0]:.0f}px past the press for a handle that stops at {board.stop:.0f}px"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|