-
Notifications
You must be signed in to change notification settings - Fork 0
/
CaptchaKiller.py
64 lines (46 loc) · 1.8 KB
/
CaptchaKiller.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from burp import (
IBurpExtender,
IIntruderPayloadGeneratorFactory,
IIntruderPayloadGenerator,
IIntruderAttack
)
from java.io import PrintWriter
import pytesseract
# https://pypi.org/project/pytesseract/
# python3-imaging
# https://github.com/tesseract-ocr/tesseract
try:
from PIL import Image
except ImportError:
import Image
pytesseract.pytesseract.tesseract_cmd = r'C:\Users\sondrioma\AppData\Local\Programs\Tesseract-OCR\tesseract.exe'
# https://github.com/PortSwigger/burp-extender-api/blob/master/src/main/java/burp/IIntruderPayloadGeneratorFactory.java
# https://github.com/PortSwigger/burp-extender-api/blob/master/src/main/java/burp/IIntruderPayloadGenerator.java
class BurpExtender(IBurpExtender):
def registerExtenderCallbacks(self, callbacks):
callbacks.setExtensionName ("Captcha Killah")
helpers = callbacks.getHelpers()
class IntruderPayloadGeneratorFactory(IIntruderPayloadGeneratorFactory):
def getGeneratorName(self):
return "Captcha Killah"
def createNewInstance(attack):
return IntruderPayloadGenerator()
class IntruderPayloadGenerator(IIntruderPayloadGenerator):
MAX_REQUESTS = 10
number_of_requests = 0
def hasMorePayloads(self):
return number_of_requests < MAX_REQUESTS
def getNextPayload(self, baseValue):
captcha_url = ''
captcha = requests.get(captcha_url).content
try:
solution = pytesseract.image_to_string(captcha)
except RunTimeError as timeout_error:
pass
stdout = PrintWriter(callbacks.getStdout(), True)
stdout.println(solution)
return bytearray(solution)
def reset(self):
pass
callbacks.registerIntruderPayloadGeneratorFactory(IntruderPayloadGeneratorFactory())
return