본문 바로가기

wargame/pythonchallenge.com

http://www.pythonchallenge.com/pc/def/oxygen.html import re, Image i = Image.open("oxygen.png") row = [i.getpixel((x, 45)) for x in range(0, i.size[0], 7)] AS_list = [r for r, g, b, a in row if r == g == b] result = "".join(map(chr,AS_list)) print "".join(map(chr,map(int,re.findall("\d+",result)))) 더보기
http://www.pythonchallenge.com/pc/def/channel.html import re, zipfilezip = zipfile.ZipFile("C:\\Users\\sec\\Downloads\\channel.zip")result = ""file = "90052" result = "" while 1: text = zip.read(file+".txt") file = re.findall("Next nothing is (\d+)",text) #read the next file name if file : file = "".join(file) result+=zip.getinfo(file+".txt").comment #collect the comments else : #if contents are not "Next nothing..." print result exit(0) 더보기
http://www.pythonchallenge.com/pc/def/peak.html import pickle f = open("C:\\Users\\sec\\Downloads\\banner.p","rb") result = pickle.load(f) for lst in result: line = "" for tu_ch,tu_cnt in lst: line += tu_ch*tu_cnt print line f.close() 더보기
http://www.pythonchallenge.com/pc/def/linkedlist.php 문제는 아무 글없이 다음과 같이 사진이 한장 있다. 사진을 클릭해보니 아래와 같은 화면이 나왔다. 문제의 url과 같이 linkedlist의 성질을 응용해서 문제를 출제한거 같다. nothing이라는 파라미터에 웹페이지의 숫자를 넣으면 다음페이지가 나온다. 그래서 자동화시키기위해 파이썬으로 코딩해보았다.import urllib,re s='12345' while(True): file = urllib.urlopen("http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing="+s) print s solve=file.read() s = "".join(re.findall("(\d+)",solve)) if s=='': if solve[:3]!='Yes': pri.. 더보기
http://www.pythonchallenge.com/pc/def/equality.html 하단의 글을 해석해보면 하나의 작은글자가, 정확히 3개의 큰 보디가드에게 그것의 주변에 둘러싸여있다. 라고 해석할수 있는데, 일단 무슨말인지 잘모르겟으니 소스를 한번 봐 보자. One small letter, surrounded by EXACTLY three big bodyguards oneach of its sides. To see the solutions to the previous level, replace pc with pcc, i.e. goto: http://www.pythonchallenge.com/pcc/def/equality.html Join us on IRC: irc.freenode.net #pythonchallenge다음과 같이 주석으로 암호문이 있다. 암호문을 훑어보니 전부 알파벳으로.. 더보기
http://www.pythonchallenge.com/pc/def/ocr.html 아래쪽의 글을 해석해보면 다음과 같다. 문자를 인식합니다. 어쩌면 그들은 책에하지만 어쩌면 그들은 페이지 소스에 있습니다. 페이지소스를 보라는것 같다.소스를 보면 recognize the characters. maybe they are in the book, but MAYBE theyare in the page source. General tips:Use the hints. They are helpful, most of the times.Investigate the data given to you.Avoid looking for spoilers. Forums: Python Challenge Forums,read before you post. IRC: irc.freenode.net #pythonchalle.. 더보기
http://www.pythonchallenge.com/pc/def/map.html 아래에 암호문과 위 그림을 보니 rot13 즉, 시져암호화 인거 같다.우리는 지금 파이썬을 이용한 워게임을 하고있으니 무식하게 아스키값으로 변환한뒤 더하고 다시변환하는 이러한식의 코딩은 문제를 정확히 풀었다고 할수없다. 그러므로 파이썬의 모듈중에 하나인, translate를 사용해보겠다. import string,urllib oldstring="" for i in range(ord('z')-ord('a')+1): oldstring += chr(ord('a')+i) print "k->m offset:%d" %(ord('m')-ord('k')) print "o->q offset:%d" %(ord('m')-ord('k')) print "e->g offset:%d" %(ord('m')-ord('k')) news.. 더보기
http://www.pythonchallenge.com/pc/def/0.html 2^38을 묻는 문제인듯 하다. 간단히 해결가능하다 힌트를 보아하니 2^38의 값을 URL에다 적으면 될듯 하다. >>> 2**38274877906944L http://www.pythonchallenge.com/pc/def/274877906944.html이렇게 적으면 자동으로 다음문제로 redirect된다. 더보기