All Projects → Gregwar → Captcha

Gregwar / Captcha

Licence: mit
PHP Captcha library

Projects that are alternatives of or similar to Captcha

Sneakerbot App
App that scrapes the Footlocker website to construct URLs for upcoming sneaker releases and adds the shoe to your cart if it is available. Uses Python and Selenium Webdriver. *Chrome and Chromedriver must be installed and Chromedriver must be on main path
Stars: ✭ 54 (-96.09%)
Mutual labels:  bots
Ai Reading Materials
Some of the ML and DL related reading materials, research papers that I've read
Stars: ✭ 79 (-94.28%)
Mutual labels:  bots
Tensorflow Demos
all kinds of demos of tensorflow code
Stars: ✭ 89 (-93.56%)
Mutual labels:  captcha
Captcha break keras
keras theano 验证码破解 字母+数字
Stars: ✭ 60 (-95.66%)
Mutual labels:  captcha
Katana
Deno Discord API primarily based on Discord.JS ▬▬ι═══════ﺤ
Stars: ✭ 76 (-94.5%)
Mutual labels:  bots
Svg Captcha
generate svg captcha in node
Stars: ✭ 1,276 (-7.67%)
Mutual labels:  captcha
Base64captcha
captcha of base64 and diversity
Stars: ✭ 1,050 (-24.02%)
Mutual labels:  captcha
Captcha
Go package captcha implements generation and verification of image and audio CAPTCHAs.
Stars: ✭ 1,321 (-4.41%)
Mutual labels:  captcha
Captcha Breaker
High Accuracy Captcha Breaker with Tensorflow and Node.js
Stars: ✭ 76 (-94.5%)
Mutual labels:  captcha
12306 captcha
基于深度学习识别12306验证码
Stars: ✭ 89 (-93.56%)
Mutual labels:  captcha
Django Simple Captcha
Django Simple Captcha is an extremely simple, yet highly customizable Django application to add captcha images to any Django form.
Stars: ✭ 1,151 (-16.71%)
Mutual labels:  captcha
Happy Captcha
Happy Captcha是一款易于使用的Java验证码软件包,旨在花最短的时间,最少的代码量,实现Web站点的验证码功能。Happy Captcha完全遵循Apache 2.0开源许可协议,你可以自由使用该软件,如您在使用Happy Captcha时发现软件的任何缺陷,欢迎随时与我联系。
Stars: ✭ 75 (-94.57%)
Mutual labels:  captcha
Slidercaptcha
Slider captcha support mobile
Stars: ✭ 88 (-93.63%)
Mutual labels:  captcha
Easycaptcha
Java图形验证码,支持gif、中文、算术等类型,可用于Java Web、JavaSE等项目。
Stars: ✭ 1,084 (-21.56%)
Mutual labels:  captcha
Bot Followers
🍊 Find out how many bots follow any given Twitter acount
Stars: ✭ 91 (-93.42%)
Mutual labels:  bots
Slack Ruby Bot
The easiest way to write a Slack bot in Ruby.
Stars: ✭ 1,066 (-22.87%)
Mutual labels:  bots
Hooman
http interceptor to hoomanize cloudflare requests
Stars: ✭ 82 (-94.07%)
Mutual labels:  captcha
Fondbot
Chatbot framework
Stars: ✭ 102 (-92.62%)
Mutual labels:  bots
Botpress
🤖 Dev tools to reliably understand text and automate conversations. Built-in NLU. Connect & deploy on any messaging channel (Slack, MS Teams, website, Telegram, etc).
Stars: ✭ 9,486 (+586.4%)
Mutual labels:  bots
Botbuilder Community Js
Part of the Bot Builder Community Project. Repository for extensions for the Bot Builder JavaScript SDK, including middleware, dialogs, recognizers and more.
Stars: ✭ 88 (-93.63%)
Mutual labels:  bots

Captcha

Captchas examples paypal

Installation

With composer :

{
    ...
    "require": {
        "gregwar/captcha": "1.*"
    }
}

Usage

You can create a captcha with the CaptchaBuilder :

<?php

use Gregwar\Captcha\CaptchaBuilder;

$builder = new CaptchaBuilder;
$builder->build();

You can then save it to a file :

<?php

$builder->save('out.jpg');

Or output it directly :

<?php

header('Content-type: image/jpeg');
$builder->output();

Or inline it directly in the HTML page:

<img src="<?php echo $builder->inline(); ?>" />

You'll be able to get the code and compare it with a user input :

<?php

// Example: storing the phrase in the session to test for the user 
// input later
$_SESSION['phrase'] = $builder->getPhrase();

You can compare the phrase with user input:

if($builder->testPhrase($userInput)) {
    // instructions if user phrase is good
}
else {
    // user phrase is wrong
}

API

You can use theses functions :

  • __construct($phrase = null), constructs the builder with the given phrase, if the phrase is null, a random one will be generated
  • getPhrase(), allow you to get the phrase contents
  • setDistortion($distortion), enable or disable the distortion, call it before build()
  • isOCRReadable(), returns true if the OCR can be read using the ocrad software, you'll need to have shell_exec enabled, imagemagick and ocrad installed
  • buildAgainstOCR($width = 150, $height = 40, $font = null), builds a code until it is not readable by ocrad
  • build($width = 150, $height = 40, $font = null), builds a code with the given $width, $height and $font. By default, a random font will be used from the library
  • save($filename, $quality = 80), saves the captcha into a jpeg in the $filename, with the given quality
  • get($quality = 80), returns the jpeg data
  • output($quality = 80), directly outputs the jpeg code to a browser
  • setBackgroundColor($r, $g, $b), sets the background color to force it (this will disable many effects and is not recommended)
  • setBackgroundImages(array($imagepath1, $imagePath2)), Sets custom background images to be used as captcha background. It is recommended to disable image effects when passing custom images for background (ignore_all_effects). A random image is selected from the list passed, the full paths to the image files must be passed.
  • setInterpolation($interpolate), enable or disable the interpolation (enabled by default), disabling it will be quicker but the images will look uglier
  • setIgnoreAllEffects($ignoreAllEffects), disable all effects on the captcha image. Recommended to use when passing custom background images for the captcha.
  • testPhrase($phrase), returns true if the given phrase is good
  • setMaxBehindLines($lines), sets the maximum number of lines behind the code
  • setMaxFrontLines($lines), sets the maximum number of lines on the front of the code

If you want to change the number of character, you can call the phrase builder directly using extra parameters:

use Gregwar\Captcha\CaptchaBuilder;
use Gregwar\Captcha\PhraseBuilder;

// Will build phrases of 3 characters
$phraseBuilder = new PhraseBuilder(4)

// Will build phrases of 5 characters, only digits
$phraseBuilder = new PhraseBuilder(5, '0123456789');

// Pass it as first argument of CaptchaBuilder, passing it the phrase
// builder
$captcha = new CaptchaBuilder(null, $phraseBuilder);

You can also pass directly the wanted phrase to the builder:

// Building a Captcha with the "hello" phrase
$captcha = new CaptchaBuilder('hello');

Complete example

If you want to see an example you can have a look at he demo/form.php, which uses demo/session.php to render a captcha and check it after the submission

Symfony Bundle

You can have a look at the following repository to enjoy the Symfony 2 bundle packaging this captcha generator : https://github.com/Gregwar/CaptchaBundle

Yii2 Extension

You can use the following extension for integrating with Yii2 Framework : https://github.com/juliardi/yii2-captcha

License

This library is under MIT license, have a look to the LICENSE file

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].