All Projects → zueve → django-rest-captcha

zueve / django-rest-captcha

Licence: MIT license
No description or website provided.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to django-rest-captcha

CapMonsterCloud
a C# wrapper for CapMonster Cloud API
Stars: ✭ 17 (-32%)
Mutual labels:  captcha
mCaptcha
A no-nonsense CAPTCHA system with seamless UX | Backend component
Stars: ✭ 473 (+1792%)
Mutual labels:  captcha
shellfirm
Intercept any risky patterns (default or defined by you) and prompt you a small challenge for double verification
Stars: ✭ 159 (+536%)
Mutual labels:  captcha
scp-079-captcha
Provide challenges for newly joined members
Stars: ✭ 52 (+108%)
Mutual labels:  captcha
captcha-solver
Library and CLI for automating captcha verification across multiple providers.
Stars: ✭ 101 (+304%)
Mutual labels:  captcha
captcha.js
Captcha in Node.js
Stars: ✭ 23 (-8%)
Mutual labels:  captcha
wayang
Remote Chrome Headless , bypass reCAPTCHA dan anything that needs to be done by human
Stars: ✭ 32 (+28%)
Mutual labels:  captcha
captcha-ios
iOS Captcha Solver
Stars: ✭ 33 (+32%)
Mutual labels:  captcha
Raid-Protect-Discord-Bot
A Discord Bot that allows you to protect your Discord server with captcha, anti profanity, anti nudity image, anti spam, account age required, logs...
Stars: ✭ 182 (+628%)
Mutual labels:  captcha
captcha-recognition
End-to-end captcha image recognition using PyTorch and CTC loss binding.
Stars: ✭ 29 (+16%)
Mutual labels:  captcha
EasyShiro
基于 RBAC 模型功能全面的 Shiro 安全集成&简化&扩展组件。Shiro integration & simplifies & Extension component based RBAC
Stars: ✭ 47 (+88%)
Mutual labels:  captcha
ocr api server
使用ddddocr的最简api搭建项目,支持docker
Stars: ✭ 222 (+788%)
Mutual labels:  captcha
Captcha
.net core Captcha Service
Stars: ✭ 38 (+52%)
Mutual labels:  captcha
Server-Captcha
Protect Your Server From Automated Bots With Captcha Now !
Stars: ✭ 18 (-28%)
Mutual labels:  captcha
rest-framework-latex
A LaTeX renderer for Django REST Framework
Stars: ✭ 30 (+20%)
Mutual labels:  rest-framework
DNTCaptcha.Core
DNTCaptcha.Core is a captcha generator and validator for ASP.NET Core applications
Stars: ✭ 181 (+624%)
Mutual labels:  captcha
esaj
Scrapers for many e-SAJ systems
Stars: ✭ 35 (+40%)
Mutual labels:  captcha
opensea automatic uploader
(Bypass reCAPTCHAs) A Selenium Python bot to automatically and bulky upload and list your NFTs on OpenSea (all metadata integrated - Ethereum and Polygon supported); reCAPTCHA solver & bypasser included.
Stars: ✭ 205 (+720%)
Mutual labels:  captcha
captcha-generator
An NPM package to generate captcha images that can be used in Discord bots or various other projects
Stars: ✭ 45 (+80%)
Mutual labels:  captcha
CAPTCHA Reader
🐝 PHP 验证码识别与训练 脚手架
Stars: ✭ 142 (+468%)
Mutual labels:  captcha

Django rest captcha

Lightweight version of django-simple-captcha for work with django-rest-framework.

Features

  • Speed: use cache instead of database
  • Safety: union methods for generate key and image. (You can't generate many images for one key)
  • Easy: only one rest api (for generate, refresh image).

Usage

Add RestCaptchaSerializer to your protected request validator:

from rest_captcha serializer import RestCaptchaSerializer
class HumanOnlyDataSerializer(RestCaptchaSerializer):
    pass

This code add to your serializer two required fields (captcha_key, captcha_value)

For provide this fields client(js code) should generate key:

> curl -X POST http:localhost:8000/api/captcha/ | python -m json.tool
{
    'image_type': 'image/png',
    'image_decode': 'base64',
    'captcha_key': 'de67e7f3-72d9-42d8-9677-ea381610363d',
    'captcha_value': '... image encoded in base64'
}

captcha_value - is base64 encoded PNG image, client should decode and show this image to human for validation and send letters from captcha to protected api. If human have mistake - client should re generate your image.

Note: See also trottling for protect public api

Install

> pip install django-rest-captcha

Add to your settings.py

Add to installed apps:

INSTALLED_APPS = (
    ...
    'rest_captcha',
)

Set rest_captcha settings (if you want), see defaults:

REST_CAPTCHA = {
    'CAPTCHA_CACHE': 'default',
    'CAPTCHA_TIMEOUT': 300,  # 5 minutes
    'CAPTCHA_LENGTH': 4,
    'CAPTCHA_FONT_SIZE': 22,
    'CAPTCHA_IMAGE_SIZE': (90, 40),
    'CAPTCHA_LETTER_ROTATION': (-35, 35),
    'CAPTCHA_FOREGROUND_COLOR': '#001100',
    'CAPTCHA_BACKGROUND_COLOR': '#ffffff',
    'CAPTCHA_FONT_PATH': FONT_PATH,
    'CAPTCHA_CACHE_KEY': 'rest_captcha_{key}.{version}',
    'FILTER_FUNCTION': 'rest_captcha.captcha.filter_default',
    'NOISE_FUNCTION': 'rest_captcha.captcha.noise_default'
}

We recommend using redis or local memory as cache with set parameter, with bigger value of MAX_ENTRIES:

CACHES={
    'default': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
        'LOCATION': 'rest-captcha',
        'MAX_ENTRIES': 10000,
    }
}

Add hooks to your app router (urls.py):

urlpatterns = [
    ...
    url(r'api/captcha/', include('rest_captcha.urls')),
]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].