Created
December 7, 2014 20:08
-
-
Save halit/b0466f33ffb921fc1e43 to your computer and use it in GitHub Desktop.
# SECCON 2014 : Choose the number
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
#!/usr/bin/python | |
import socket | |
p = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
p.connect(("number.quals.seccon.jp", 31337)) | |
while True: | |
result = p.recv(2048) | |
if "?" not in result: | |
print "[*] {0}".format(result) | |
print "[*] flag: {0}".format(p.recv(2048)) | |
break | |
result = result.splitlines() | |
question = result[1] | |
numbers = map(int, result[0].replace(' ', '').split(',')) | |
if "maximum" in question: | |
p.send("{0}\n".format(max(numbers))) | |
print "[*] maximum sended" | |
elif "minimum" in question: | |
p.send("{0}\n".format(min(numbers))) | |
print "[*] minimum sended" | |
else: | |
print "[*] error" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment