Skip to content

Instantly share code, notes, and snippets.

@luc-lynx
Created December 17, 2017 15:00
Show Gist options
  • Save luc-lynx/62b3102326bf361d6c53b86414c8e814 to your computer and use it in GitHub Desktop.
Save luc-lynx/62b3102326bf361d6c53b86414c8e814 to your computer and use it in GitHub Desktop.
Protostar net1
import socket
import struct
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
HOST = "127.0.0.1"
PORT = 2998
s.connect((HOST, PORT))
n = s.recv(4)
print n
print repr(n)
print n.encode('hex')
N = struct.unpack("I", n)[0]
print N
s.send(str(N))
print s.recv(1024)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment