Do you know http://overthewire.org/ ? It has a very cool wargames section. I found it a few weeks ago. I’m currently doing the “Vortex” level [stuck at level8 :-)].
The Level0 is very easy, you must read 4 integers from a remote port and send back the sum of them, to get a shell account for Level1.
I choose python to solve this problem. I think python fits good to hacking challenges because of low-level libs like structs or ctype.
#!/usr/bin/env python from socket import * from struct import * s = socket(AF_INET, SOCK_STREAM) s.connect(("vortex.labs.overthewire.org" , 5842)) sum = 0; #print ' '.join(["%02X"%ord(x) for x in s.recv(32)]) for i in range(4): data = s.recv(4) sum += unpack("<I", data) s.send(pack("<I",(sum & 0xFFFFFFFF))) print s.recv(1024) s.close ()
The result is:
Username: vortex1 Password: *********