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)
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 ...
Last edited by DxPlayer on Mon Mar 27, 17 4:46 am, edited 1 time in total.
User avatar
DxPlayer
Regular
 
Posts: 488
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.
Attachments
script.py.txt
Rename to .py to execute it into Python 3
(2.13 KiB) Downloaded 861 times
User avatar
DxPlayer
Regular
 
Posts: 488
Joined: Sun Jan 25, 09 6:31 pm
Location: Brazil

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

Postby -HDD21- » Thu Nov 02, 17 10:34 pm

The nostalgia <3 The old gamespy protocol still lives on. I will admit though, I was surprised how long GS kept up their MS, good service in my opinion.
User avatar
-HDD21-
Wannabe
 
Posts: 87
Joined: Sat Jan 03, 09 1:38 am

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

Postby Kaiden » Sat Nov 04, 17 1:33 am

Considering it killed dozens of games multiplayers that were still active I think it's appalling what they did, DX was one of many that died following their decision, that I imagine didn't really save that much money.
------
Kaiden
Alpha
 
Posts: 7003
Joined: Wed Jan 18, 06 11:21 pm
Location: England

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

Postby -HDD21- » Tue Nov 07, 17 7:34 pm

by gamespy, i meant the original company, not who bought them out (Glu, who did the actual shutdowns are the ones I am not a fan of). The server usage would have been practically nothing for some of the older games too.

Was a shame, though, and even some more modern games were affected. I did email them many a time to try and get them to point master0.gamespy.com to 333 networks when we were testing their MS code back in 2014, fell on deaf ears, as we had seen this as a potential.
User avatar
-HDD21-
Wannabe
 
Posts: 87
Joined: Sat Jan 03, 09 1:38 am

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

Postby Mikelnut » Tue Jan 30, 18 8:17 am

I also want to know that server status can now be played on the creeper.
Mikelnut
Newbie
 
Posts: 2
Joined: Tue Jan 30, 18 5:27 am


Return to Deus Ex

Who is online

Users browsing this forum: No registered users and 1 guest