decryptr

Description

decryptr is an R package to break CAPTCHAs. It is also an extensible tool built in a way that enables anyone to contribute with their own CAPTCHA-breaking code.

To install decryptr, simply run the code below:

if (!require(devtools)) install.packages("devtools")
devtools::install_github("decryptr/decryptr")

It is also recommended to install decryptrModels package.

devtools::install_github("decryptr/decryptrModels")

Basic usage

decryptr has functions for downloading and breaking captchas from multiple sources, one of which is TJMG (a court in southern Brazil). Here is how one could break captchas from TJMG:

Download and visualise

library(decryptr)

# Download captchas
captcha <- download_tjmg(dest = 'img')

# Draw captcha
captcha %>% 
  read_captcha() %>% 
  plot()

Classify manually

captcha %>% 
  read_captcha() %>% 
  classify()
# plots the image and opens the console
#> Answer: 

Load model and predict

# Load model (install decryptrModels package first)
keras_tjmg <- decryptrModels::read_model('tjmg')
data('tjmg', package = 'decryptr')
tjmg$model <- keras_tjmg

captcha %>% 
  read_captcha() %>% 
  predict(tjmg, arq = .)

Performance

Once loaded to memory, Keras models are extremely fast. Also, we don't run any pre-processing on the image.

break_captcha <- function() {
  captcha %>% 
    read_captcha() %>% 
    predict(tjmg, arq = .)
}

microbenchmark::microbenchmark(break_captcha())

Extensibility

Since decryptr is built on top of S3 methods, anyone can extend its functionalities with custom packages. Simply create a download_<ext> function, a read_<ext> function, and a predict.<ext> function and you're good to go.

More information about extensibility can be found on decryptr's documentation.



marceloturim/decryptr documentation built on May 14, 2019, 5:26 p.m.