Last active
January 2, 2024 23:35
-
-
Save se7enack/d52db00bd4675d92c27d8ce2626b1f2f to your computer and use it in GitHub Desktop.
Python GUI Captcha Challenge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import random | |
import string | |
from captcha.image import ImageCaptcha | |
from captcha.audio import AudioCaptcha | |
from playsound import playsound | |
from easygui import * | |
def askbox(): | |
user = enterbox("Enter the CAPTCHA below: ", image = img) | |
if user == str(value): | |
print("CAPTCHA Matches!") | |
else: | |
print("CAPTCHA Does NOT Match!") | |
def makecaptcha(): | |
global img | |
img = 'out.png' | |
image = ImageCaptcha() | |
image.write(str(value), img) | |
def saycaptcha(): | |
wav = 'out.wav' | |
audio = AudioCaptcha() | |
audio.write(str(value), wav) | |
playsound(wav, False) | |
def generate(): | |
global value | |
value = random.randrange(1000, 9999) | |
generate() | |
makecaptcha() | |
saycaptcha() | |
askbox() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment