Skip to content

Instantly share code, notes, and snippets.

@hellman
Created October 10, 2016 15:36
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
HITCON QUALS 2016 - Sharingan (Misc 100)
#!/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()
print
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