Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/decryptr/api
Dockerfile and plumber to break captchas
https://github.com/decryptr/api
Last synced: 8 days ago
JSON representation
Dockerfile and plumber to break captchas
- Host: GitHub
- URL: https://github.com/decryptr/api
- Owner: decryptr
- License: other
- Created: 2017-07-09T02:47:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-09-05T14:27:29.000Z (over 5 years ago)
- Last Synced: 2024-08-13T07:11:27.781Z (4 months ago)
- Language: R
- Size: 45.9 KB
- Stars: 5
- Watchers: 6
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - decryptr/api - Dockerfile and plumber to break captchas (R)
README
# decryptr/api
Dockerfile and plumber to start the api.
## Usage
To serve the API on [http://localhost:80](http://localhost:80)
with no load balancing, run the command below:```
docker build -t api .
docker run -p 80:80 api
```## Adding a new key
One can add new keys using the `key_generator` function found in `key-generator.R`.
Keys are a sequence of 64 random generated elements and their hash is saved in the `keys.yaml` file. The generated key can only be seen once.To generate a new key you need to run:
```
source("key-generator.R")
key_generator("name-of-the-endpoint")
```The function will make necessary modifications to `keys.yaml`. They generated key will be printed to the console. **Note** The key is printed only once.
## Updating the endpoint
On shell, type:
```
docker build -t dfalbel/api .
docker push dfalbel/api
gcloud compute instances create-with-container decryptr \
--project=decryptr-196601 \
--container-image dfalbel/api \
--machine-type g1-small \
--tags http-server \
--address 104.197.127.86 \
--metadata startup-script='#! /bin/bash
sudo iptables -w -A INPUT -p tcp --dport 80 -j ACCEPT
EOF
'
```You must have `gcloud` CLI installed.
## Using from R
You can use the API from with the following chunk of code:
```
library(magrittr)# parameters
arq <- "https://decryptr.netlify.com/img/sample-captcha.png"
key <- "your-api-key"# converting the image to base64
img <- arq %>%
readr::read_file_raw() %>%
base64enc::base64encode()# post request
res <- httr::POST(
"https://decryptr.now.sh/rfb",
body = list(
img = img,
key = key
),
encode = "json"
)httr::content(res)
```Please visit [decryptr.netlify.com](http://decryptr.netlify.com) fore more info and to obtain your own key.