A Python 3 script for querying Deus Ex master server info

Discussion about the original game by Ion Storm. Also known as Deus Ex: The Conspiracy.

Moderator: Forum Guards

A Python 3 script for querying Deus Ex master server info

Postby DxPlayer » Mon Mar 27, 17 4:40 am

Made this just for the sake of curiosity and nostalgia:

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)

def queryNormalDeusExServer(ip, port):
        sockUDP.sendto(bytes(particularQuery,"utf-8"), (ip, port))
        data = sockUDP.recvfrom(2048) # buffer size is 2048 bytes
        print("Received message ::: ", data[0])
        print("This server did not respond our query ::: ", ip, ":", port)

# 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), "...")

    # Send TCP auth
    print("Sending authentication ::: ", masterServerAuth)

    # Receive TCP ACK
    data = sockTCP.recv(1024)
    print("Received ack ::: ", data)

    # Send TCP query
    print("Sending query to master server ::: ", masterServerQuery)

    # 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:
    print("Closing Communication Socket used for normal game servers ...")

    print("Closing Communication Socket for Master Server ...")

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\\\\ip\\\\ip\\\\ip\\\\ip\\\\ip\\\\ip\\\\ip\\\\ip\\
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\
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\\
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
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
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
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\\
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
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
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
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
This server did not respond our query ::: : 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
Closing Communication Socket used for normal game servers ...
Closing Communication Socket for Master Server ...
Last edited by DxPlayer on Mon Mar 27, 17 4:46 am, edited 1 time in total.
User avatar
Posts: 487
Joined: Sun Jan 25, 09 6:31 pm
Location: Brazil

Re: A Python 3 script for querying Deus Ex master server inf

Postby DxPlayer » Mon Mar 27, 17 4:43 am

:!: Script attached in this message.
Rename to .py to execute it into Python 3
(2.13 KiB) Downloaded 17 times
User avatar
Posts: 487
Joined: Sun Jan 25, 09 6:31 pm
Location: Brazil

Return to Deus Ex

Who is online

Users browsing this forum: No registered users and 2 guests