Skip to content

Instantly share code, notes, and snippets.

@halit
Created December 7, 2014 20:08
Show Gist options
  • Save halit/b0466f33ffb921fc1e43 to your computer and use it in GitHub Desktop.
Save halit/b0466f33ffb921fc1e43 to your computer and use it in GitHub Desktop.
# SECCON 2014 : Choose the number
#!/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