This level takes a look at converting strings to little endian integers. (link)
Source Code:
For net0, they want you to connect to the background process running on port 2999, read the integer contained in the string it sends, and send it back as a little-endian 32-bit integer.
I wrote a quick python script to do this:
#!/usr/bin/env python
#
import socket
import struct
HOST = "127.0.0.1"
PORT = 2999
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
msg = s.recv(1024)
print msg
value = int(msg.split("'")[1])
print "parsed value:", value
to_send = struct.pack("I", value) + "\n"
s.sendall(to_send)
print "sending:", to_send
print "response:", s.recv(1024)
Running it gives the following output:
user@protostar:/opt/protostar/bin$ python /tmp/net0.py
Please send '884996042' as a little endian 32bit int
parsed value: 884996042
sending: ???4
response: Thank you sir/madam
No comments:
Post a Comment