Monday, December 29, 2014

Protostar - Net #1


This level tests the ability to convert binary integers into ascii representation. (link)

Source Code:


Net1 seems to be the inverse operation as net0 -- take a 32-bit little-endian integer and send it back using ascii representation.

Here's a quick python script that will do it for you:

#!/usr/bin/env python

import socket
import struct

HOST = ""
PORT = 2998

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

s.connect((HOST, PORT))

msg = struct.unpack("I", s.recv(1024))[0]
print msg

to_send = str(msg) + "\n"
print to_send

print "sending:", to_send

print "response:", s.recv(1024)

Running it gives the following output:

user@protostar:/opt/protostar/bin$ python /tmp/

sending: 1763649439

response: you correctly sent the data

No comments:

Post a Comment