A Python 3 script for querying Deus Ex master server info
Posted: Mon Mar 27, 17 4:40 am
Made this just for the sake of curiosity and nostalgia:
This is a Python script that functions like the multiplayer game servers list inside Deus Ex. Queries the master server and lists each known game server and their status.
I used the original client, captured the packages it sent/received to/from the master server and normal game servers (using Wireshark, a network package sniffer) and studied them a little. DeusEx uses TCP for master server communications and UDP for querying each game server individually.
After the master server tells it where are the game servers (master server sends a single string, each game server address:port separated by "\\"), the game client sends a simple query to each server and expects the answer in the format of another simple char array, each information also separated by "\\".
Save this script and run into Python.
Output sample:
- Code: Select all
import socket
import sys
# UDP Socket used for communications with each particular Deus Ex game servers
particularQuery = "\\info\\"
sockUDP = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sockUDP.settimeout(1.0)
def queryNormalDeusExServer(ip, port):
try:
sockUDP.sendto(bytes(particularQuery,"utf-8"), (ip, port))
data = sockUDP.recvfrom(2048) # buffer size is 2048 bytes
print("Received message ::: ", data[0])
except:
print("This server did not respond our query ::: ", ip, ":", port)
return
# TCP/IP socket for communications with the Master Server
sockTCP = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
masterServerAddress = ('master.deusexnetwork.com', 28900)
masterServerAuth = '\\gamename\\deusex\\location\\0\\validate\\FZcjB4YA\\final\\'
masterServerQuery = '\\list\\\\gamename\\deusex\\final\\'
# Communications begin here ---->
print("Connecting to ", str(masterServerAddress), "...")
sockTCP.connect(masterServerAddress)
try:
# Send TCP auth
print("Sending authentication ::: ", masterServerAuth)
sockTCP.sendall(bytes(masterServerAuth,"utf-8"))
# Receive TCP ACK
data = sockTCP.recv(1024)
print("Received ack ::: ", data)
# Send TCP query
print("Sending query to master server ::: ", masterServerQuery)
sockTCP.sendall(bytes(masterServerQuery,"utf-8"))
# Receive servers Ips and ports by TCP from master server
data = sockTCP.recv(4096)
print("Received answer ::: ", data)
# Master server sends stuff in a big string, each server info separated by \\
arr = str(data).split('\\\\')
# For each received server info, UDP queries for infos
print('Now querying each Deus Ex server .... ')
for i in arr:
pos = str(i)
# Received from master server a bunch of IP:Port
svr = pos.split(':')
if len(svr) == 2:
queryNormalDeusExServer(svr[0],int(svr[1]))
print("Closing Communication Socket used for normal game servers ...")
sockUDP.close()
finally:
print("Closing Communication Socket for Master Server ...")
sockTCP.close()
This is a Python script that functions like the multiplayer game servers list inside Deus Ex. Queries the master server and lists each known game server and their status.
I used the original client, captured the packages it sent/received to/from the master server and normal game servers (using Wireshark, a network package sniffer) and studied them a little. DeusEx uses TCP for master server communications and UDP for querying each game server individually.
After the master server tells it where are the game servers (master server sends a single string, each game server address:port separated by "\\"), the game client sends a simple query to each server and expects the answer in the format of another simple char array, each information also separated by "\\".
Save this script and run into Python.
Output sample:
- Code: Select all
PS C:\Users\eugen> python c:/Users/eugen/Desktop/script.py
>>
Connecting to ('master.deusexnetwork.com', 28900) ...
Sending authentication ::: \gamename\deusex\location\0\validate\FZcjB4YA\final\
Received ack ::: b'\\basic\\\\secure\\TGIPCU\\'
Sending query to master server ::: \list\\gamename\deusex\final\
Received answer ::: b'\\basic\\\\ip\\46.163.66.75:7791\\ip\\46.163.66.75:7771\\ip\\5.200.18.137:7791\\ip\\72.5.102.81:7781\\ip\\72.5.102.81:7791\\ip\\72.5.102.81:7761\\ip\\72.5.102.81:7771\\ip\\142.68.206.166:4441\\ip\\142.68.206.166:44
44\\ip\\108.209.152.252:7791\\ip\\85.181.6.162:17578\\ip\\85.181.5.173:17578\\final\\'
Now querying each Deus Ex server ....
Received message ::: b'\\hostname\\~[FGS]Wunderland~ ALTFIRE 2014\\hostport\\7790\\maptitle\\Military Complex Isle v0.95\\mapname\\DXMP_MCI(v0-95)\\gametype\\ANNATeam\\numplayers\\0\\maxplayers\\20\\gamemode\\openplaying\\gamever\\1100\
\minnetver\\1100\\password\\False\\queryid\\1.1\\final\\'
Received message ::: b'\\hostname\\~[FGS]Wunderland~ Classic ZERO Aug 2016!\\hostport\\7770\\maptitle\\Untitled\\mapname\\DXMP_Smuggler\\gametype\\MTLTeam\\numplayers\\0\\maxplayers\\10\\gamemode\\openplaying\\gamever\\1100\\minnetver\\
1100\\password\\False\\queryid\\1.1\\final\\'
Received message ::: b"\\hostname\\[i3D.NET] ~The Fun Zone~\\hostport\\7790\\maptitle\\Untitled\\mapname\\Die's_MeleeArena\\gametype\\ANNADeathMatch\\numplayers\\0\\maxplayers\\8\\gamemode\\openplaying\\gamever\\1100\\minnetver\\1100\\p
assword\\False\\queryid\\4.1\\final\\"
Received message ::: b"\\hostname\\ ~Sev's US 0a Server~\\hostport\\7780\\maptitle\\Untitled\\mapname\\DXMS_Blockade\\gametype\\ANNADeathMatch\\numplayers\\0\\maxplayers\\16\\gamemode\\openplaying\\gamever\\1100\\minnetver\\1100\\passwo
rd\\False\\queryid\\1.1\\final\\"
Received message ::: b"\\hostname\\ ~Sev's US ATDM Server~\\hostport\\7790\\maptitle\\Untitled\\mapname\\DXMP_Smuggles\\gametype\\ANNAAdvTeam\\numplayers\\0\\maxplayers\\16\\gamemode\\openplaying\\gamever\\1100\\minnetver\\1100\\passwor
d\\False\\queryid\\1.1\\final\\"
Received message ::: b"\\hostname\\ ~Sev's Classic RPG Server~\\hostport\\7760\\maptitle\\Untitled\\mapname\\DXMP_rpg_v2t4\\gametype\\ANNADeathMatch\\numplayers\\0\\maxplayers\\16\\gamemode\\openplaying\\gamever\\1100\\minnetver\\1100\\
password\\False\\queryid\\15.1\\final\\"
Received message ::: b"\\hostname\\ ~Sev's Tact Server~\\hostport\\7770\\maptitle\\Untitled\\mapname\\Tact_CourseRebuilt\\gametype\\ANNADeathMatch\\numplayers\\0\\maxplayers\\16\\gamemode\\openplaying\\gamever\\1100\\minnetver\\1100\\p
assword\\False\\queryid\\1.1\\final\\"
Received message ::: b'\\hostname\\- zXc - Clan Server -\\hostport\\4440\\maptitle\\Untitled\\mapname\\DXMP_Silo\\gametype\\advteamdmgame\\numplayers\\0\\maxplayers\\32\\gamemode\\openplaying\\gamever\\1100\\minnetver\\1100\\password\\F
alse\\final\\\\queryid\\2.1'
Received message ::: b'\\hostname\\ - zXc - Party Server -\\hostport\\4443\\maptitle\\Untitled\\mapname\\DXMP_G_E-corp\\gametype\\ANNABasicTeam\\numplayers\\0\\maxplayers\\16\\gamemode\\openplaying\\gamever\\1100\\minnetver\\1100\\passw
ord\\False\\final\\\\queryid\\8.1'
Received message ::: b'\\hostname\\Sharpshooter Mod Server with Pure UT99 Maps\\hostport\\7790\\maptitle\\HiSpeed \\mapname\\UT_HiSpeed\\gametype\\Sharpshooter\\numplayers\\0\\maxplayers\\12\\gamemode\\openplaying\\gamever\\1100\\minnet
ver\\1100\\password\\False\\final\\\\queryid\\62.1'
This server did not respond our query ::: 85.181.6.162 : 17578
Received message ::: b'\\hostname\\Sunny Side\\hostport\\17577\\maptitle\\Untitled\\mapname\\DXMP_Abandoned\\gametype\\MTLTeam\\numplayers\\0\\maxplayers\\7\\gamemode\\openplaying\\gamever\\1100\\minnetver\\1100\\password\\False\\queryi
d\\26.1\\final\\'
Closing Communication Socket used for normal game servers ...
Closing Communication Socket for Master Server ...