wargame/pythonchallenge.com

http://www.pythonchallenge.com/pc/def/linkedlist.php

Sanguine 2014. 6. 3. 08:32



문제는 아무 글없이 다음과 같이 사진이 한장 있다. 사진을 클릭해보니 아래와 같은 화면이 나왔다.


문제의 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':
            print solve
            break