http://www.overthewire.org/wargames/vortex/level0.shtml
Level Goal:
Your goal is to connect to port 5842 on vortex.labs.pulltheplug.org and read in 4 unsigned integers. Add these integers together and send back the results to get a username and password for level 1.
Note:
that vortex is on an x86 machine (meaning, a little endian architecture)
소켓 프로그래밍을 통하여 4개의 unsigned int형 숫자를 읽어 모두 더해서 다시 재전송 해주면
다음 레벨 ID와 Password를 보내준다.
#!/usr/bin/python
import socket, struct
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("vortex.labs.pulltheplug.org", 5842))
sum = 0
for x in range(4):
data = struct.unpack('<I', s.recv(4))
sum = sum + data[0]
s.send(struct.pack('<I', sum))
print s.recv(1024)
s.close()
Python으로는 struct 모듈에 대한 이해가 필요하다.
Username: vortex1 Password: Gq#qu3bF3