-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhashkiller.py
180 lines (136 loc) · 6.2 KB
/
hashkiller.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
import requests
import cStringIO
import PIL
from Functions import *
from PIL import ImageTk
import Tkinter as TK
from Tkinter import *
import threading
__author__ = 'Lambasoft'
__website__ = "www.aymanabiaoun.com"
threadLock = threading.Lock()
class BColors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
isFirstPop = 0
class PopCaptcha(Frame):
def __init__(self, img):
def onok(event=None):
self.captchaText = self.entry1.get()
self.captchaThread = 1
self.master.destroy()
global isFirstPop
self.captchaThread = 0
self.captchaText = ""
TK.Frame.__init__(self)
isFirstPop += 1
self.pack()
self.master.title("Enter Captcha")
image1 = PIL.Image.open(img)
tkpi = ImageTk.PhotoImage(image1)
self.picture1 = Label(self, image=tkpi)
self.picture1.image = tkpi
self.picture1.grid(row=1)
self.entry1 = Entry(self, font=('Helvetica', '14'))
self.entry1.grid(row=2)
self.button1 = Button(self, text="SUBMIT", width=25, command=onok)
self.button1.grid(row=3)
self.master.bind('<Return>', onok)
self.master.protocol("WM_DELETE_WINDOW", self.on_closing)
def on_closing(self):
self.captchaThread = 1
self.master.destroy()
class HashKiller:
def __init__(self, hashs):
self.hashs = hashs
self.hashQueue = Queue.Queue
self.error = ""
self.status = ""
self.captchaTries = 0
self.Session = {'view_state': '', 'event_validation': '', 'Captcha': ''}
def CheckMD5(self):
pattern = re.compile(r"([a-fA-F\d]{32})")
m = pattern.match(self.hash)
if m:
return True
return False
def CrackMd5(self, WorkingHashs, captchaObj, SaveTo, DeathByCaptchaClient = None):
self.status = ""
self.error = ""
hr = requests.get('http://hashkiller.co.uk/md5-decrypter.aspx')
self.Session['view_state'] = ParseFormNameText(hr.text, "__VIEWSTATE")
self.Session['event_validation'] = ParseFormNameText(hr.text, "__EVENTVALIDATION")
self.Session['Cookies'] = hr.cookies
captchaurl = ParseFormIdSrc(hr.text, "content1_imgCaptcha", "img")
captchaurl = "http://hashkiller.co.uk" + str(captchaurl)
hr = requests.get(captchaurl, cookies=self.Session['Cookies'])
captchafile = cStringIO.StringIO(hr.content)
while self.status is not "OK" or self.error == "WrongCaptcha":
if not DeathByCaptchaClient == None:
hr = requests.get(captchaurl, cookies=self.Session['Cookies'])
captchafile = cStringIO.StringIO(hr.content)
captcha = DeathByCaptchaClient.decode(captchafile, 100)
if captcha:
# The CAPTCHA was solved; captcha["captcha"] item holds its
# numeric ID, and captcha["text"] item its text.
self.Session['Captcha'] = captcha["text"]
else:
self.captchaTries += 1
if (self.captchaTries > 3):
hr = requests.get(captchaurl, cookies=self.Session['Cookies'])
captchafile = cStringIO.StringIO(hr.content)
self.captchaTries = 0
threadLock.acquire()
# captcha = PopCaptcha(captchafile)
captcha = captchaObj(captchafile)
print "Enter the Captcha..."
captcha.mainloop()
threadLock.release()
while captcha.captchaThread == 0:
pass
self.Session['Captcha'] = captcha.captchaText
PostData = {
'ctl00$ScriptMan1' : 'ctl00$content1$updDecrypt|ctl00$content1$btnSubmit',
'ctl00$content1$txtInput' : "\r\n".join(self.hashs),
'__EVENTTARGET' : '',
'__EVENTARGUMENT' : '',
'__VIEWSTATE' : self.Session['view_state'],
'__EVENTVALIDATION' : self.Session['event_validation'],
'__ASYNCPOST' : 'true',
'ctl00$content1$btnSubmit' : 'Submit',
'ctl00$content1$txtCaptcha' : self.Session['Captcha']
}
headers = {
'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0',
'X-Requested-With': 'XMLHttpRequest',
'X-MicrosoftAjax' : 'Delta=true',
'Pragma' : 'no-cache',
'content-type': 'application/x-www-form-urlencoded; charset=utf-8',
'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'Accept-Language' : 'en-US,en;q=0.5'
}
r = requests.post("http://hashkiller.co.uk/md5-decrypter.aspx", data=PostData, headers=headers, cookies=self.Session['Cookies'])
self.status = ParseContent(r.text, 'content1_lblStatus', 'span' ,'id').getText()
if self.status and not "Please find them below..." in self.status and not "Failed to find any hashes!" in self.status:
print ("Error: " + BColors.FAIL + "{0}" + BColors.ENDC).format(self.status)
if "The CAPTCHA code you specifed is wrong" in self.status:
self.error = "WrongCaptcha"
else:
result = ParseAllContent(r.text , 'text-green', "span" , "class")
if result:
for hashed in ParseMD5Content(r.text ):
WorkingHashs.append(hashed[0] + ":" + hashed[1])
with open(SaveTo, "a") as myfile:
myfile.write("%s\n" % (hashed[0] + ":" + hashed[1]))
print ("Hash [{0}] found: " + BColors.OKGREEN + hashed[1] + BColors.ENDC).format(hashed[0])
else:
print ("Hash " + BColors.WARNING + "not found" + BColors.ENDC).format("TODO")
self.error = "NoError"
self.status = "OK"