Skip to content

Instantly share code, notes, and snippets.

@cokia
Created November 19, 2019 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cokia/390729b4fa1b4fa2feb04bfcabcdf5a5 to your computer and use it in GitHub Desktop.
Save cokia/390729b4fa1b4fa2feb04bfcabcdf5a5 to your computer and use it in GitHub Desktop.
#-*- coding: utf-8 -*-
from flask import Flask, request
import os
import base64
import urllib.parse
import json
import subprocess
app = Flask(__name__)
@app.route("/captcha", methods=["GET"])
def captcha1():
base164 = request.args.get('image') #title
data = urllib.parse.unquote(base164)
#data = json.loads(base64)
png_recovered = base64.b64decode(data)
x = subprocess.check_output(['tesseract temp.png a.txt -c tessedit_char_whitelist=0123456789'])
f = open("a.txt", "r")
fi = f.read()
f.close()
print(fi)
return str(fi)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment