All Projects → vincenting → campto

vincenting / campto

Licence: other
Captcha package for nodejs.

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to campto

Decryptr
An extensible API for breaking captchas
Stars: ✭ 154 (+633.33%)
Mutual labels:  captcha
Cintruder
Captcha Intruder (CIntrud3r) is an automatic pentesting tool to bypass captchas.
Stars: ✭ 192 (+814.29%)
Mutual labels:  captcha
Imageocr
PHP验证码识别[PHP CAPTCHA Recognition]
Stars: ✭ 241 (+1047.62%)
Mutual labels:  captcha
Captcha
Captcha for Laravel 5/6/7/8
Stars: ✭ 1,985 (+9352.38%)
Mutual labels:  captcha
Sinesp Client
Consulta de placas de veículos na base de dados do SINESP Cidadão sem a necessidade do preenchimento de captchas
Stars: ✭ 181 (+761.9%)
Mutual labels:  captcha
Captcha Recognizer
基于C#.NET异步图形验证码识别组件(集成了若快、优优云、打码兔、云打码等平台,准确率95%,速度2-6秒)采用策略设计模式
Stars: ✭ 213 (+914.29%)
Mutual labels:  captcha
Captcha solver
Universal python API to captcha solving services
Stars: ✭ 152 (+623.81%)
Mutual labels:  captcha
JDMemberCloseAccount
学习python操作selenium的一个🌰 ,也是一种京东全自动退会方案
Stars: ✭ 1,235 (+5780.95%)
Mutual labels:  captcha
Decaptcha
Recognize captcha by machine learning. 机器学习识别图片验证码(专门应付本科毕业设计)
Stars: ✭ 192 (+814.29%)
Mutual labels:  captcha
Easy12306
使用机器学习算法完成对12306验证码的自动识别
Stars: ✭ 2,674 (+12633.33%)
Mutual labels:  captcha
Hei.captcha
一个跨平台的图形验证码生成工具包/.net core
Stars: ✭ 172 (+719.05%)
Mutual labels:  captcha
Captcha break
验证码识别
Stars: ✭ 2,268 (+10700%)
Mutual labels:  captcha
Rnn ctc
Recurrent Neural Network and Long Short Term Memory (LSTM) with Connectionist Temporal Classification implemented in Theano. Includes a Toy training example.
Stars: ✭ 220 (+947.62%)
Mutual labels:  captcha
Gocaptcha
A captcha library written in golang
Stars: ✭ 154 (+633.33%)
Mutual labels:  captcha
12306 Captcha
基于深度学习的12306验证码识别
Stars: ✭ 254 (+1109.52%)
Mutual labels:  captcha
Captcha
Captcha image generator server in Go
Stars: ✭ 152 (+623.81%)
Mutual labels:  captcha
Friendly Challenge
The widget and docs for the proof of work challenge used in Friendly Captcha. Protect your websites and online services from spam and abuse with Friendly Captcha, a privacy-first anti-bot solution.
Stars: ✭ 207 (+885.71%)
Mutual labels:  captcha
cs-wordpress-bouncer
CrowdSec is an open-source cyber security tool. This plugin blocks detected attackers or display them a captcha to check they are not bots.
Stars: ✭ 25 (+19.05%)
Mutual labels:  captcha
rotate-captcha
Rotate image captcha,旋转图片验证码
Stars: ✭ 50 (+138.1%)
Mutual labels:  captcha
Tlg joincaptchabot
Telegram Bot to verify if users that join a group, are humans. The Bot send an image captcha for each new user, and kick any of them that can't solve the captcha in a specified time.
Stars: ✭ 226 (+976.19%)
Mutual labels:  captcha

Campto

NPM Downloads Build Status Test Coverage Windows Tests

Campto

(从做到右 topic 依次为 alphabet, number, math

特色功能

  1. 可配置验证码的生成难度;
  2. 可配置验证码宽高颜色字体以及背景;
  3. 多种预设 Topic(验证码内容生成器),同时可以引入自定义的内容。

快速上手

首先需要安装 GraphicsMagick.

  • Mac OS X: brew install graphicsmagick
  • Debian Linux: apt-get install graphicsmagick
  • 其他系统请至官网下载 官网链接

同时请确保您的 nodejs 版本为 >= 4.0.0,0.x 版本都将于今年年底前停止支持,参考 Nodejs LTS 现状

1. 无缓存方案使用

该方案的优势是简单,并且可以针对每张验证码单独使用配置。但是由于每张验证码都需要实时生成,所以无法满足秒杀等并发较高的场景。

npm install campto --save

代码示例:

const campto = require('campto')
campto(options).then(captcha => {
  // captcha.buffer 为验证码图片的 buffer,express 中可以直接 res.send(buffer) 返回图片(png)
  // captcha.result 为当前验证码的结果,建议放入 session 中,int10 类型。
})

这里的 options 为可选参数,和 campto.[json|js] 基本一致,例如 options 可以指定当前生成验证码的识别难度 [easy|normal|hard]

const campto = require('campto')
campto({
  recognitionDifficulty: 'hard'
}).then(...)

使用参考 https://github.com/vincenting/campto/blob/master/examples/simple-server/server.js 。 更多参数请参考 campto.[json|js] 配置文件详细介绍

2. campto.[json|js] 配置文件详细介绍

{
  "captchaHeight": Int, 验证码高度,默认 50,
  "captchaWidth": Int, 验证码宽度,默认 285,
  "randColorSet": []String, 随机颜色集,用于文字和线条,默认 ['#000000', ...],
  "backgroundSet": []String,随机背景图片路径集合,建议高度宽度与验证码一致,
  "fontFileSet": []String,随机验证码字体文件路径集合,
  "topic:: [String|Promise|Function],验证码内容选项,默认为 "math",可选 math|number|alphabet,同时支持直接传入自定义 topic,
  "recognitionDifficulty": String, 验证码识别难度,默认为 "normal",可选 easy|normal|hard
}

topic 参数详细介绍:除了可以传入上述文档中涉及到 String 类型内容外,还可以传入 Promise 以及 Function,用于自定义生成验证码内容,其中前者多用于有异步操作的情况。 如果是 Function,最终需要返回 {subject: []String, result: Any},如果是 Promise,最终也需要确保可以通过 .then 得到相同的数据结构,subject 中每个 String 为基本等宽的内容,例如可以认为一个汉字和两个阿拉伯数字等宽。

例如用于最终可以生成六个数字的验证码的代码:

{
  topic: _ => {
    const t = String(Math.random()).substr(2, 6)
    return {
      subject: t.split(''),
      result: t
    }
  }
}
{
  topic: _ => {
    return Promise((resolve, reject) => {
      // ... some async code
      return resolve({
        subject: t.split(''),
        result: t
      })
    })
  }
}

3. 高并发下的缓存方案

即将到来。

4. API 介绍

即将到来。

开发调试

git clone [email protected]:vincenting/campto.git
npm install

运行测试

npm test
npm run test-cov

进入 /examples/simple-server 运行 node server.js 启动测试服务器

TODO

  1. 完善高并发下缓存方案的设计;
  2. lib/builder 中目前由于对 gm 熟悉度有限,通过临时文件拼接产生验证码的方式需要整体改进。
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].