### Encrypt Payload with AES and RSA using Signer Source: https://context7.com/xkiian/geekedtest/llms.txt Encrypts a payload using AES-CBC and RSA. It first generates a random AES key, encrypts the payload with it, and then encrypts the AES key using RSA. This is used for secure payload transmission. ```python from geeked.sign import Signer # Encrypt payload with AES-CBC + RSA random_key = Signer.rand_uid() # Generate 16-char random key encrypted_data = Signer.encrypt_symmetrical_1('{"userresponse": 156}', random_key) encrypted_key = Signer.encrypt_asymmetric_1(random_key) # Full w parameter generation (called internally by Geeked.submit_captcha) w_param = Signer.encrypt_w('{"payload": "data"}', pt="1") ``` -------------------------------- ### Generate Proof-of-Work Hash with Signer Source: https://context7.com/xkiian/geekedtest/llms.txt Generates a proof-of-work hash required by Geetest's anti-bot system. It takes parameters like lot number, captcha ID, hash function, and difficulty bits. The output includes a message and a signature hash. ```python from geeked.sign import Signer # Generate proof-of-work hash (required by Geetest anti-bot) pow_result = Signer.generate_pow( lot_number_pow="abc123", captcha_id_pow="54088bb07d2df3c46b79f80300b0abbe", hash_func="md5", # Can be: md5, sha1, sha256 hash_version="1", bits=16, # Difficulty level date="1704067200000", empty="" ) print(pow_result) # Output: # { # 'pow_msg': '1|16|md5|1704067200000|54088bb07d2df3c46b79f80300b0abbe|abc123||randomhex', # 'pow_sign': 'hash_starting_with_0000' # } ``` -------------------------------- ### Solve Icon Matching Captcha with IconSolver (Python) Source: https://context7.com/xkiian/geekedtest/llms.txt The `IconSolver` class utilizes ddddocr for AI-based OCR to solve icon matching captchas. It takes the main captcha image URL and a list of question icon URLs, returning the coordinates to click each icon in the correct sequence. ```python from geeked.icon import IconSolver # Icon captcha requires matching arrows in the correct order # imgs: URL path to the main captcha image # ques: List of question icon URLs to match solver = IconSolver( imgs="captcha_v4/policy/xxx/icon/xxx/image.jpg", ques=[ "nerualpic/original_icon_pic/icon_20201215/315ce8665e781dabcd1eb09d3e604803.png", # left arrow "nerualpic/original_icon_pic/icon_20201215/38bd9dda695098c7dfad74c921923a7d.png", # left-up arrow "nerualpic/original_icon_pic/icon_20201215/cb0eaa639b2117a69a81af3d8c1496a1.png" # down arrow ] ) positions = solver.find_icon_position() print(positions) # Output: [[x1, y1], [x2, y2], [x3, y3]] # Coordinates for clicking each icon in order # Supported icon directions: # 'u' (up), 'd' (down), 'l' (left), 'r' (right) ``` -------------------------------- ### Detect and Classify Icons with DdddService OCR Source: https://context7.com/xkiian/geekedtest/llms.txt Utilizes the DdddService class, which wraps ddddocr, for icon detection and classification using a custom ONNX model for Geetest icon recognition. It can detect bounding boxes of icons and classify cropped icon images. ```python from geeked.dddd_server import DdddService import requests # Initialize the OCR service (loads ONNX model) dddd = DdddService() # Load an image img_bytes = requests.get("https://example.com/captcha.jpg").content # Detect bounding boxes of icons in image bboxes = dddd.detection(img_bytes) print(bboxes) # Output: [[x1, y1, x2, y2], [x1, y1, x2, y2], ...] # Classify a cropped icon image icon_crop = img_bytes # Cropped icon region direction = dddd.classification(icon_crop) print(direction) # Output: "arrow_lu" (left-up arrow) ``` -------------------------------- ### Solve Gobang (Five-in-a-Row) Captcha with GobangSolver (Python) Source: https://context7.com/xkiian/geekedtest/llms.txt The `GobangSolver` class solves the five-in-a-row game captcha by analyzing a 2D board representation. It identifies the optimal move to complete a line of four pieces by finding an empty space adjacent to a line of three. ```python from geeked.gobang import GobangSolver # Board is represented as a 2D list where: # - 0 represents empty space # - Other numbers represent different colored pieces board = [ [1, 2, 1, 2, 1], [2, 1, 0, 1, 2], # Row 1 has a gap (0) that could complete a line [1, 2, 1, 2, 1], [2, 1, 2, 1, 2], [1, 1, 1, 1, 2] # Row 4 has four 1s - needs one more ] solver = GobangSolver(board) result = solver.find_four_in_line() print(result) # Output: [[source_row, source_col], [target_row, target_col]] # Example: [[4, 4], [1, 2]] - Move piece from (4,4) to (1,2) # The solver: # 1. Iterates through all rows, columns, and diagonals # 2. Finds lines with n-1 matching pieces and one empty space # 3. Identifies which piece to move to complete the line ``` -------------------------------- ### Update Solver Constants with deobfuscate.py Source: https://context7.com/xkiian/geekedtest/llms.txt A utility script to extract updated constants from Geetest's JavaScript. This is crucial when solver functionality breaks due to Geetest version changes. The script outputs updated values for mapping, abo dictionary, and device ID. ```python # Run the deobfuscation script to get updated constants # python deobfuscate.py # Output: # [~] Version: v0.4.8 # [+] abo: {"fwjn":"DJkH"} # [+] mappings (n[11:14])+.+(n[12:14]+n[6:8])'n[21:28] # [+] device_id: "" (probably empty) # Update these values in sign.py: # - self.mapping in LotParser class # - abo dictionary in Signer.generate_w() # - device_id in the em payload ``` -------------------------------- ### Solve Slide Puzzle Captcha with SlideSolver (Python) Source: https://context7.com/xkiian/geekedtest/llms.txt The `SlideSolver` class uses OpenCV for image processing, specifically edge detection and template matching, to determine the correct position for sliding puzzle pieces. It takes the puzzle piece and background images as input. ```python from geeked.slide import SlideSolver import requests # Load puzzle images from Geetest CDN puzzle_piece = requests.get( "https://static.geetest.com/captcha_v4/xxx/slice/image.png" ).content background = requests.get( "https://static.geetest.com/captcha_v4/xxx/bg/image.png" ).content # Create solver and find puzzle position solver = SlideSolver(puzzle_piece, background) position = solver.find_puzzle_piece_position() print(f"Slide to position: {position}") # Output: Slide to position: 156 # The solver uses Canny edge detection and template matching: # 1. Applies edge detection to both images # 2. Uses cv2.matchTemplate with TM_CCOEFF_NORMED # 3. Returns the x-coordinate where the piece should be placed ``` -------------------------------- ### Solve Geetest v4 CAPTCHA using Python Source: https://github.com/xkiian/geekedtest/blob/main/readme.md This Python code snippet demonstrates how to use the 'Geeked' class to solve a Geetest v4 CAPTCHA. It requires the 'captcha_id' and 'risk_type' to be provided. The output includes CAPTCHA solution details such as 'lot_number', 'pass_token', and 'captcha_output'. ```python from geeked import Geeked # Replace with your own captcha_id captcha_id = "54088bb07d2df3c46b79f80300b0abbe" # Instantiate the solver with captcha_id and risk_type geeked = Geeked(captcha_id, risk_type="slide") # Solve the captcha sec_code = geeked.solve() # Output the solution print(sec_code) # Output will be in the following format: # { # 'captcha_id': '...', # 'lot_number': '...', # 'pass_token': '...', # 'gen_time': '...', # 'captcha_output': '...' # } ``` -------------------------------- ### Solve Geetest v4 Captcha with Geeked Class (Python) Source: https://context7.com/xkiian/geekedtest/llms.txt The `Geeked` class is the primary interface for solving various Geetest v4 captcha types. It manages the HTTP session, loads challenges, and orchestrates the solving process. Supports basic usage and proxy configurations. ```python from geeked import Geeked # Basic usage - solve a slide captcha captcha_id = "54088bb07d2df3c46b79f80300b0abbe" geeked = Geeked(captcha_id, risk_type="slide") sec_code = geeked.solve() print(sec_code) # Output: # { # 'captcha_id': '54088bb07d2df3c46b79f80300b0abbe', # 'lot_number': 'a1b2c3d4e5f6g7h8i9j0', # 'pass_token': 'token_string_here', # 'gen_time': '1704067200', # 'captcha_output': 'encrypted_output_string' # } # With proxy support geeked = Geeked( captcha_id="54088bb07d2df3c46b79f80300b0abbe", risk_type="slide", proxy="http://127.0.0.1:8050", verify=False # Disable SSL verification if needed ) sec_code = geeked.solve() # Supported risk_type values: # - "slide": Slide puzzle captcha # - "gobang" or "winlinze": Five-in-a-row game captcha # - "icon": Icon matching captcha # - "ai" or "invisible": Invisible captcha (no user interaction) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.