Excerpt hereβ¦
This post is part of a series:
- Linux training with overthewire Part 1: Bandit 1-10
- Linux training with overthewire Part 2: Bandit 11-20
- Linux training with overthewire Part 3: Bandit 21-30
- Linux training with overthewire Part 4: Natas 1-10
- Linux training with overthewire Part 5: Natas 11-20
- Linux training with overthewire Part 6: Leviathan
- Linux training with overthewire Part 7: Krypton
- Linux training part X: Vortex
Level 0 - Raw socket receive/send
import socket
import struct
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('vortex.labs.overthewire.org', 5842))
res = 0 # final result to send
for i in range(0, 4): # we expect 4 numbers
data = s.recv(4) # each number is an unsigned int, which takes 4 bytes
print('raw', data)
iData = struct.unpack('I', data)[0] # convert from byte to int (I)
res += iData # add to final result
s.sendall(struct.pack("I", res)) # send result as bytes, converted from an int (I)
print(s.recv(1024))
('raw', '\x076\xc6*')
('raw', '(BJ%')
('raw', '\xe2\x83\xbbt')
('raw', '\x0b\x1a9\r')
Username: vortex1 Password: Gq#qu3bF3