Issue
I am using python to solve Captcha level 1 on http://hackthis.co.uk
here is the code
from PIL import Image
import pytesseract
import requests
from StringIO import StringIO
url = "https://www.hackthis.co.uk/levels/captcha/1"
login = "https://www.hackthis.co.uk/?login"
payload = {"username": "user", "password": "pass"}
def solve(captcha):
pytesseract.image_to_string(Image.open(captcha))
# other code needs to be writted
return "abc";
s = requests.Session() # Start a session
s.post(login, data=payload) # Login
response = s.get(url).text # Get problem data
captcha = s.get("https://www.hackthis.co.uk/levels/extras/captcha1.php")
captcha = Image.open(StringIO(captcha.content))
captcha.save("E:/captcha1.png")
solution = solve("E:/captcha1.png")
payload = {"answer": solution}
s.post(url, data=payload) # Post data
But i am getting an error
Complete log is here http://pastebin.com/7T9aKnPN
If required, here is subprocess.py http://pastebin.com/zmkbhgj6
I tried every other solutions on other forums but none helped
Thanks in advance :)
EDIT : The problem only occurs when i use the pytesseract.image_to_string() method
Solution
Well the problem was, tesserect wasn't installed! i downloaded this Tesserect OCR executables from the download page
then added the downloaded directory to PATH
variable
Installed VC2015 x86 redist (required)
Worked for me :D
Answered By - ArmaGeddON
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.