Skip to content

Instantly share code, notes, and snippets.

@se7enack
Last active January 2, 2024 23:35
Show Gist options
  • Save se7enack/d52db00bd4675d92c27d8ce2626b1f2f to your computer and use it in GitHub Desktop.
Save se7enack/d52db00bd4675d92c27d8ce2626b1f2f to your computer and use it in GitHub Desktop.
Python GUI Captcha Challenge
#!/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