The LibreCaptcha framework, for self-hosted, privacy respecting CAPTCHAs
Go to file
Rahul Rudragoudar 5c3bdfeb83
GC, Seed and User management (#52)
* Update sql to map uuid to token

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Fix millis to secs conversion

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add synchronisation to media enpoint DB access

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Change error code for rate limiter

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* move prepared statements to Thread Local Storage

* Change test end points

* init GC

* Add GC

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Change status return

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Auto generate token in db

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Remove user management and rate limiting

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add seed for random number generator

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Store random instance as class member

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Update locustfile

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add API documentation

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Move updateTimeStamp to getChallenge methdod
Remove user tables for the DB

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Update Timestamp when creating mapId entry

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add request method type

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Minor fixes

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2020-09-23 22:58:42 +05:30
.github/workflows Create .github action for CI 2020-07-04 16:23:58 +05:30
client Conflict resolution 2019-06-09 14:04:25 +05:30
lib updated h2 to latest version 2020-07-04 17:26:19 +05:30
project bump sbt version 2020-07-16 17:58:36 +05:30
samples added some sample captcha images 2019-06-08 11:42:29 +05:30
scripts modularise the test 2020-07-05 00:48:20 +05:30
src/main GC, Seed and User management (#52) 2020-09-23 22:58:42 +05:30
tests GC, Seed and User management (#52) 2020-09-23 22:58:42 +05:30
.gitignore git ignore samples and project files 2020-07-03 20:57:55 +05:30
.travis.yml bumped scala version in travis config 2020-06-30 00:19:52 +05:30
LICENSE Initial commit 2018-01-02 10:57:01 +05:30
README.md GC, Seed and User management (#52) 2020-09-23 22:58:42 +05:30
build.sbt bump scala version 2020-07-16 17:56:16 +05:30

README.md

LibreCaptcha

LibreCaptcha is a framework that allows developers to create their own CAPTCHAs. It allows developers to easily create new types of CAPTCHAs by defining a structure for them. Mundane details are handled by the framework itself. Details such as:

  • Background workers to render CAPTCHAs and to store them in a database
  • Providing an HTTP interface for serving CAPTCHAs
  • Managing secrets for the CAPTCHAs (tokens, expected answers, etc)
  • Safe re-impressions of CAPTCHA images (by creating unique tokens for every impression)
  • Sandboxed plugin architecture (To be done)

Some sample CAPTCHA generators are included in the distribution. We will continue adding more samples to the list. For quick deployments the samples themselves might be sufficient. Projects with more resources could create their own CAPTCHAs and use the samples as inspiration.

Why LibreCaptcha?

Eliminate dependency on a third-party

An open-source CAPTCHA framework will allow anyone to host their own CAPTCHA service and thus avoid dependencies on third-parties.

Respecting user privacy

A self-hosted service prevents user information from leaking to other parties.

More variety of CAPTCHAs

Ain't it boring to identify photos of buses, store-fronts and traffic signals? With LibreCaptcha, developers can create CAPTCHAs that suit their application and audience, with matching themes and looks.

And, the more the variety of CAPTCHAS, the harder it is for bots to crack CAPTCHAs.

Sample CAPTCHAs

FilterCaptcha

FilterCaptcha Sample

An image of a random string of alphabets is created. Then a series of image filters that add effecs such as Smear, Diffuse, and Ripple are applied to the image to make it less readable.

RainDropsCaptcha

RaindDrops Sample

BlurCaptcha

An image of a word is blurred before being shown to the user.

LabelCaptcha

An image that has a pair of words is created. The answer to one of the words is known and to that of the other is unknown. The user is tested on the known word, and their answer to the unknown word is recorded. If a sufficient number of users agree on their answer to the unknown word, it is transferred to the list of known words.


HTTP API

- /captcha: POST

  • Parameters:

    • level: String - The difficulty level of a captcha
      • easy
      • medium
      • hard
    • input_type: String - The type of input option for a captcha
      • text
      • click (choose)
    • media: String - The type of media of a captcha
      • image
      • audio
      • gif
    • size: dict - The dimensions of a captcha (Optional). It needs two more fields nested in this parameter
      • height: Int
      • width: Int
  • Return type:

    • id: String - The uuid of the captcha generated

- /media: POST,GET

  • Parameters:

    • id: String - The uuid of the captcha
  • Return type:

    • image: Array[Byte] - The requested media as bytes

- /answer: POST

  • Parameter:

    • id: String - The uuid of the captcha that needs to be solved
    • answer: String - The answer to the captcha that needs to be validated
  • Return Type:

    • result: String - The result after validation/checking of the answer
      • True - If the answer is correct
      • False - If the answer is incorrect
      • Expired - If the time limit to solve the captcha exceeds

Roadmap

Things to do in the future:

  • Sandboxed plugin architecture
  • Audio CAPTCHA samples
  • Interactive CAPTCHA samples