Created
October 10, 2016 15:36
-
-
Save hellman/0995837f5a05fd2586cad5fe18959c6f to your computer and use it in GitHub Desktop.
HITCON QUALS 2016 - Sharingan (Misc 100)
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/env python | |
#-*- coding:utf-8 -*- | |
from sock import Sock | |
f = Sock("52.197.160.186 31337") | |
def read_map(): | |
res = [] | |
print " ", "".join("%2d" % i for i in xrange(19)) | |
i = 0 | |
while len(res) != 19: | |
try: | |
line = f.read_line().decode("utf-8") | |
print "%2d" % i, line.strip() | |
if "Isanagi" in line: | |
continue | |
res.append(line) | |
i += 1 | |
except: | |
print "Flag?", res, `f.buf`, `line` | |
quit() | |
return res | |
moves = [ | |
"2 0", | |
"2 1", | |
"2 2", | |
"1 2", | |
"0 2", | |
"18 18", | |
"17 18", | |
"18 17", | |
"1 1" | |
] | |
for move in moves: | |
m = read_map() | |
f.send_line(move) | |
m = read_map() | |
print f.read_all() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment