COD4 Hacking

Hacking is an overstatement. Fiddling around with COD4. Anyways, here is a code snippet to get information (send the getinfo command) from a COD4 server:

import socket
hex = '\xFF\xFF\xFF\xFF\x67\x65\x74\x73\x74\x61\x74\x75\x73'
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
host = ''
port = 29056
s.sendto(hex, (host, port))
d = s.recvfrom(1024)

To list the number of players and their names:

import re
print d[0].count('\"')/2 + " players"
list_l = re.findall('"([^"]*)"', d[0]);
for pl in list_l:
	print pl

3 thoughts on “COD4 Hacking

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s