pCAPTCHA is an interactive CAPTCHA solution that challenges users to drag a puzzle piece to its designated spot, protecting against bots.
- Dynamic puzzle generation: Each CAPTCHA instance creates a new puzzle piece on a background image.
- Interactive interface: Users can drag and drop a puzzle piece to verify their actions.
- Verify captchas have been completed using JWT
- Analytics gathering (sessions that include captchas made, solved, failed, regenerated, along with attempts to solve which include time created, time solved, if success or not, and mouse movements while dragging)
- Analytics dashboard
- Add rate limits
- Flask: A lightweight web framework for Python.
- SQLite: A simple database to store CAPTCHA instances.
- Pillow: Python Imaging Library for creating and manipulating images.
- JavaScript: For dynamic interaction and handling user events.
-
Clone the repository:
git clone https://github.com/KittleCodes/pCAPTCHA.git
-
Navigate to the project directory:
cd pCAPTCHA
-
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install Flask requests Pillow
-
Start the Flask application:
python app.py
-
Add the required elements to website needed for a pCAPTCHA
<div id="captchaContainer"></div>
<script src="<your-web-server-url>/pCaptcha.js"></script>
-
Start the Flask application:
python dashboard.py
-
Visit the provided url
127.0.0.1:5010
- GET /: Serves an example HTML page using pCAPTCHA.
- GET /pCaptcha.js: Serves the JavaScript file for handling CAPTCHA interactions.
- POST /generate_puzzle_piece: Generates a new puzzle piece and returns the image URL and CAPTCHA ID.
- POST /check_position: Checks if the dragged puzzle piece is in the correct position and returns the result.
Contributions are welcome! Please open an issue or submit a pull request if you'd like to contribute to this project.
This project is licensed under the MIT License. See the LICENSE file for details.
- Picsum Photos for random images.