Hackvent_2019/Hidden 03/decode.py

25 lines
435 B
Python
Raw Normal View History

2019-12-13 21:34:19 +01:00
#!/usr/bin/python
import sys
import socket
if len(sys.argv) < 2:
print("Invalid usage: %s <outfile>" % sys.argv[0])
exit(1)
OUTFILE = sys.argv[1]
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('whale.hacking-lab.com', 17))
data = ""
while True:
buf = sock.recv(16)
if buf:
data += buf.decode("UTF-8")
else:
break
with open(OUTFILE, "a") as f:
f.write(data.strip())