Skip to main content

A professional, pluggable CAPTCHA library with image, math, and custom challenge types, token-based security, and multiple storage backends.

Project description

InnoCaptcha

PyPI Version Python Versions PyPI Status License: MIT GitHub last commit PyPI Downloads Total Downloads GitHub stars Visitors Badge API Visitors - InnoCaptcha API

InnoCaptcha is a professional, pluggable Python CAPTCHA library designed for modern web applications. It supports multiple challenge types, from traditional text and math to advanced audio, image-based grid challenges (using YOLOv11), and voice recognition challenges.


🌟 Key Features

  • 📝 Text CAPTCHA: Highly configurable image-based text challenges with anti-aliasing and distortion.
  • 🔢 Math CAPTCHA: Secure arithmetic problems (no eval()) with optional image rendering.
  • 🎧 Audio CAPTCHA: Spoken character sequences with noise injection and variable speed.
  • 🗣️ Voice CAPTCHA (STT): Speech-to-text challenges where users must speak a random phrase.
  • 🖼️ Image CAPTCHA (YOLOv11): Advanced 3×3 grid challenges using Object Detection.
  • 🔐 Security First:
    • Token-based challenge identification.
    • IP and Session binding for verification safety.
    • Automatic expiration (5 minutes) and attempt limits (5-6 attempts).
    • Background cleanup for expired challenges.
  • 🗄️ Storage: Centralized SQLite database management.

🚀 Installation

pip install InnoCaptcha

🛠️ Quick Start

1. Text CAPTCHA

Generates a distorted image containing a random string.

from InnoCaptcha.text import TextCaptcha

captcha = TextCaptcha(width=300, height=80)
captcha.create("abcd")
captcha.save("captcha.png")

print(captcha.verify("abcd")) # Returns True

2. Math CAPTCHA

Generates arithmetic challenges. Can be output as plain text or a rendered image.

from InnoCaptcha.math import MathCaptcha

# Image-based Math Challenge
math = MathCaptcha(output="image")
math.create()
math.get_question().show() # Returns a PIL Image

print(math.verify("Answer"))

3. Audio CAPTCHA

Generates a WAV file where a voice reads out characters.

from InnoCaptcha.audio import AudioCaptcha

audio = AudioCaptcha()
audio.create("x123")
audio.save("output.wav")

print(audio.verify("x123"))

4. Voice CAPTCHA (New!)

A speech-to-text challenge. The user is given a phrase and must submit a recording of them speaking it.

from InnoCaptcha.voice import VoiceCaptcha

vc = VoiceCaptcha(language='en-US')
id = vc.create() # Generates a random phrase
# ... User records audio and sends bytes ...
audio_bytes = open("user_speech.wav", "rb").read()
is_correct = vc.verify(audio_bytes)

5. Image CAPTCHA (YOLOv11)

Uses YOLOv11 to detect objects in an image and asks the user to select the grid cells (1-9).

from InnoCaptcha.image import ImageCaptcha

img_cap = ImageCaptcha()
img_cap.create()
img_cap.save("grid_image.png")

# User inputs cell numbers, e.g., "1,2,5"
print(img_cap.verify("1,2,5"))

💎 API Reference

Component Description
TextCaptcha Classic image-text challenges. Supports custom colors/scaling.
MathCaptcha Arithmetic challenges (+, -, *). Supports text or image output.
AudioCaptcha Generates character-based audio files for auditory verification.
VoiceCaptcha Speech-to-text verification using speech_recognition.
ImageCaptcha AI-powered grid identification using YOLOv11.

🆙 Latest Updates (v2.2.x)

  • New Module: Added VoiceCaptcha for speech-to-text challenges.
  • Security:
    • Implemented IP and Session binding to prevent cross-session replay attacks.
    • Centralized database management in InnoCaptcha/data/dbs/.
  • Performance: Optimized background cleanup threads.
  • Improvements: Standardized indentation (2 spaces) and removed insecure functions.

📜 Requirements

  • Python 3.9+
  • Dependencies: Pillow, numpy, scipy, ultralytics, opencv-python, pydub, SpeechRecognition, etc.

📄 License

MIT © InnoSoft Company

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

innocaptcha-2.3.0.tar.gz (7.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

innocaptcha-2.3.0-py3-none-any.whl (7.3 MB view details)

Uploaded Python 3

File details

Details for the file innocaptcha-2.3.0.tar.gz.

File metadata

  • Download URL: innocaptcha-2.3.0.tar.gz
  • Upload date:
  • Size: 7.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for innocaptcha-2.3.0.tar.gz
Algorithm Hash digest
SHA256 2471c931bd3388d82b6de34bbe85d1a227af7fdb6eaf3f5814e8b8b2f5bb1f61
MD5 1961a39d528f9d1e6a6d5b45fc23ce93
BLAKE2b-256 958a10eadb70b9bd71a12294dd5eef70baa712cb30b648cd3465f52314f589c5

See more details on using hashes here.

File details

Details for the file innocaptcha-2.3.0-py3-none-any.whl.

File metadata

  • Download URL: innocaptcha-2.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for innocaptcha-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be8109748a1370983fc742f5a1db786c204c425da4a6e04eabf00a884b97cc0a
MD5 60e3c74c08a85ecb11de94fd04511e5e
BLAKE2b-256 1f7ea67a9b59ea0eb6dfe9e0aa65c74766e3f554cd7f974abddaa8690ca5b919

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page