SoFunction
Updated on 2024-11-19

Python implementation of sliding puzzle CAPTCHA to get rid of the annoying CAPTCHA input!

preamble

Explore the world of sliding puzzles! Let's unravel the mystery behind Sliding Puzzle CAPTCHA and share how to deal with this fun and challenging verification method. Sliding Puzzle CAPTCHA has become a part of our interaction with the digital world, helping to secure websites and apps. Let's discuss how to tackle the challenges of Sliding Puzzle CAPTCHA with ease!

Have you recently encountered a headache with CAPTCHAs? Why not make sliding puzzles your new favorite option? Verify your identity by completing a fun sliding puzzle that exercises your brain and protects your privacy.

HTML code

<script src=""></script>
<script>
({
    // Bind element, validation box display area
    bind: "#captchaBox",
    // Authentication success transaction
    success: function(e) {
        (e);
    },
    // Authentication failure transactions
    failure: function(e) {
        (e);
    },
    // Triggered when the refresh button is clicked
    refresh: function(e) {
        (e);
    }
});
</script>
<div >loading ...</div>

Python Code

from wsgiref.simple_server import make_server
from KgCaptchaSDK import KgCaptcha
def start(environ, response):
    # Fill in your AppId, get it in the app manager
    AppID = "AppID"
    # Fill in your AppSecret, get it in the app management
    AppSecret = "AppSecret"
    request = KgCaptcha(AppID, AppSecret)
    # Fill in the application service domain name, available in the application manager
     = ""
    # Request timeout in seconds
     = 10
    # User id/login name/mobile phone number, etc., must be filled in when the prevention and control level in the security policy is 3.
     = "kgCaptchaDemo"
    # When using other WEB frameworks, please remove , use the methods provided by the framework to obtain the following relevant parameters
    parseEnviron = (environ)
    # Token issued by the front-end after successful authentication, valid for two minutes
     = parseEnviron["post"].get("kgCaptchaToken", "")  # frontend _POST["kgCaptchaToken"]
    # Client IP address
     = parseEnviron["ip"]
    # Client browser information
     = parseEnviron["browser"]
    # Incoming domain names
     = parseEnviron["domain"]
    # Send request
    requestResult = ()
    if  == 0:
        # Authentication pass logic processing
        html = "Verified."
    else:
        # Authentication failure logic handling
        html = f"{} - {}"
    response("200 OK", [("Content-type", "text/html; charset=utf-8")])
    return [bytes(str(html), encoding="utf-8")]
httpd = make_server("0.0.0.0", 8088, start)  # Set the debug port http://localhost:8088/
httpd.serve_forever()

ultimate

SDK open source address:/KgCaptcha

Did a demo by the way:/demo/

The above is python implementation of sliding puzzle CAPTCHA to get rid of the annoying CAPTCHA input details, more information about python sliding puzzle CAPTCHA please pay attention to my other related articles!