1. 항상 통과의례같은 요청 빨리보내기 문제.
# -*- encoding: cp949 -*- import urllib2,re req = urllib2.Request('http://www.dareyourmind.net/prog1.php') req.add_header('cookie','PHPSESSID=ee20pn4vmdh97melrb0mh6ei64') password = re.findall(": '(.*?)'",urllib2.urlopen(req).read())[0] print password req = urllib2.Request('http://www.dareyourmind.net/menu.php?page=programming1&checked='+password) req.add_header('cookie','PHPSESSID=ee20pn4vmdh97melrb0mh6ei64') print urllib2.urlopen(req).read()
2. ?? 이건 맞는거같은데 왜 답인증이 안되지;
# -*- encoding: cp949 -*- import urllib2,re req = urllib2.Request('http://www.dareyourmind.net/prog2.php') req.add_header('cookie','PHPSESSID=ee20pn4vmdh97melrb0mh6ei64') password = re.findall("Here it is :\s+(.*?)",urllib2.urlopen(req).read())[0] print password req = urllib2.Request('http://www.dareyourmind.net/menu.php?page=programming2&checked='+password) req.add_header('cookie','PHPSESSID=ee20pn4vmdh97melrb0mh6ei64') print urllib2.urlopen(req).read()
5. 답을 찾으려고 소스를 보면 이상한 태그가 잔뜩 있는데, 정규식으로 >와 <noboot사이의 값을 찾아서 보내면 됨.
# -*- encoding: cp949 -*- import urllib2, re req = urllib2.Request('http://www.dareyourmind.net/prog3.php') req.add_header('cookie','PHPSESSID=h2tv0o4htj65bg2smmdbrgm5t5') answer = re.findall('>(.*)<noboot',urllib2.urlopen(req).read())[0] req = urllib2.Request('http://www.dareyourmind.net/menu.php?page=programming5&checked='+answer) req.add_header('cookie','PHPSESSID=h2tv0o4htj65bg2smmdbrgm5t5') print urllib2.urlopen(req).read()
9.
# -*- encoding: cp949 -*- import Image import urllib2 import pytesser def download_photo(filename): file_path = "%s%s" % ("C:\\Users\\Ko\\Documents\\Visual Studio 2012\\Projects\\PythonApplication37\\", filename) downloaded_image = file(file_path, "wb") req = urllib2.Request('http://www.dareyourmind.net/Challenge/antiflood.php') req.add_header('Cookie','PHPSESSID=h2tv0o4htj65bg2smmdbrgm5t5') image_on_web = urllib2.urlopen(req) while True: buf = image_on_web.read() if len(buf) == 0: break downloaded_image.write(buf) downloaded_image.close() image_on_web.close() return file_path download_photo('image.png') im = Image.open('image.png') for i in range(im.size[1]): for j in range(im.size[0]): #print im.getpixel((j,i)), if im.getpixel((j,i))[0] >200: im.putpixel((j,i),(255,255,255)) else: im.putpixel((j,i),(0,0,0)) im.save('image1.png') x=2 im.transform((im.size[0]*x,im.size[1]*x),Image.EXTENT,(0,0,im.size[0],im.size[1])).save('image.png') answer = pytesser.image_to_string( Image.open('image.png') ).replace('\n','') req = urllib2.Request('http://www.dareyourmind.net/menu.php?page=programming9&checked='+answer) req.add_header('Cookie','PHPSESSID=h2tv0o4htj65bg2smmdbrgm5t5') print urllib2.urlopen(req).read()
'Python > 2.7 simple coding(+ c++)' 카테고리의 다른 글
hack this site Programming missions : Parse an XML file (0) | 2015.04.10 |
---|---|
hackthis Coding 1~2 (0) | 2015.02.12 |
hack this site Programming missions : String manipulation (0) | 2015.01.21 |
hack this site Programming missions : Reverse Ascii Shift (0) | 2015.01.20 |
TheBlackSheep Programming 1~3 (0) | 2015.01.14 |