Skip to content

Instantly share code, notes, and snippets.

@jdalley
Last active May 27, 2024 05:11
Show Gist options
  • Save jdalley/9d4ce3b4cd34ee5f4b90d8e1345061df to your computer and use it in GitHub Desktop.
Save jdalley/9d4ce3b4cd34ee5f4b90d8e1345061df to your computer and use it in GitHub Desktop.
TEC Client Explorations

TEC Client Explorations

Establishing A Connection

When making a telnet/socket connection to game.eternalcitygame.com:6730, the type of protocol engaged by the game server depends on what you send after it prompts you with Login:.

Telnet Data Format

Handshake: /\/Connect: n/a!!n/a
Login: You'll be prompted to enter your username and password (not hashed). The server's telnet implementation does not support TLS.
Example output: The following is output from Blightmud, note the missing first character on words with i= RGB colours. This is because there are escape characters encoded here, and the parser for Blightmud (and other clients like VIP mud), escape the next character after them removing it from output.

/\/TextAt:downbar:20:25:Loading toolbar graphics; please wait...
/\/ImageAt:sidebar:0:0:http://game.eternalcitygame.com/parch2.jpg
/\/ImageAt:sidebar:0:300:http://game.eternalcitygame.com/parch2.jpg
/\/ImageAt:downbar:0:0:http://game.eternalcitygame.com/IntroScreen.jpg
/\/ImageAt:downbar:246:500:http://game.eternalcitygame.com/macrobar.jpg
/\/ImageAt:downbar:246:500:http://game.eternalcitygame.com/alloff.jpg

i=255,155,09 new messages in *news (Player News and Announcements)
i=255,155,0 new message in *Thriceblinded (0)
i=255,155,0 new message in *Thriceblinded (0)
You have an unclaimed Free Veteran Character Package!
> who

=[i=0,32,225sers Playingi=0,0,0

There are 23 users currently connected and roaming the gameworld.
There are 7 users who are hidden from the WHO list.

 i=0,205,32uosi=0,0,0i=0,205,32yrioni=0,0,0i=0,205,32itaniusi=0,0,0i=0,205,32athaiasini=0,0,0
 i=0,205,32taerki=0,0,0i=0,205,32risai=0,0,0i=0,205,32lathi=0,0,0i=0,205,32eredi=0,0,0
 i=0,205,32ylinai=0,0,0i=0,205,32i=0,0,0i=0,205,32rixosi=0,0,0i=0,205,32uroni=0,0,0
 i=0,205,32arici=0,0,0i=0,205,32enaei=0,0,0i=0,205,32ayzei=0,0,0i=0,205,32raylori=0,0,0

Whereas the raw output has something like the following, note the ASCII character representing the escape character:

�ci=255,155,0�30 new messages in *news (Player News and Announcements)
�ci=255,155,0�1 new message in *Thriceblinded (0)
You have an unclaimed Free Veteran Character Package!

=[�ci=0,32,225�Users Playing�ci=0,0,0�]==============================================================

There are 29 users currently connected and roaming the gameworld.
There are 9 users who are hidden from the WHO list.

 �ci=0,205,32�Torthus�ci=0,0,0�            �ci=0,205,32�Athed�ci=0,0,0�              �ci=0,205,32�Jageris�ci=0,0,0�            �ci=0,205,32�Potentinus�ci=0,0,0�      
 �ci=0,205,32�Xylea�ci=0,0,0�              �ci=0,205,32�Tenae�ci=0,0,0�              �ci=0,205,32�Nereza�ci=0,0,0�             �ci=0,205,32�Nomad�ci=0,0,0�           
 �ci=0,205,32�Kalandra�ci=0,0,0�           �ci=0,205,32�Skade�ci=0,0,0�              �ci=0,205,32�Atemidio�ci=0,0,0�           �ci=0,205,32�Athras�ci=0,0,0�          
 �ci=0,205,32�Vanya�ci=0,0,0�              �ci=0,205,32�Sylina�ci=0,0,0�             �ci=0,205,32�Okko�ci=0,0,0�               �ci=0,205,32�Orianthe�ci=0,0,0�        
 �ci=0,205,32�Vuos�ci=0,0,0�               �ci=0,205,32�Draylor�ci=0,0,0�            �ci=0,205,32�Jalaeus�ci=0,0,0�            �ci=0,205,32�Gendibold�ci=0,0,0�       

The escape character can be represented like:

  • Hexadecimal: 1B
  • Byte data as string: \x1B
  • Octal as string: \033

Orchil and Zealotry HTML Format

Handshake: SKOTOS Zealous 0.7.12.2 or SKOTOS Orchil 0.2.3
Login: This is a multi step process where we send multiple separate inputs to the server to complete a login after sending one of the two handshakes above.

The following is an illustrative example of accomplishing this multi-input login. Lines with > are input we enter for each login step. Lines without > indicate response from the server.

> SKOTOS Orchil 0.2.3

SECRET NONE
> USER thriceblinded
> SECRET NONE
> HASH <calculatedHash>

The calculatedHash value here is an md5 hash constructured as:

<username><hashKey>NONE
  • username -> TEC username
  • hashKey -> value set for pass in the cookie when logging in at login.eternalcitygame.com/login.php
  • NONE -> required marker at the end

Example output:

</font><font color="#ff9b00">30 new messages in *news (Player News and Announcements)</font>
</font><font color="#ff9b00">1 new message in *Thriceblinded (0)</font>
SKOOT 6 -10,-10,20,#ff0000,215.0,10,-10,20,#ffffff,200.0,-30,-10,20,#ffffff,190.353,-10,10,20,#ffffff,120.0,-10,-30,20,#ffffff,140.0,30,-10,20,#ffffff,120.0,30,10,20,#ffffff,120.0,30,-30,20,#ffffff,120.0,10,-30,20,#ffffff,120.0,-50,-10,20,#ffffff,175.0,-50,10,20,#ffffff,35.0,-50,-30,20,#ffffff,21.764,-30,-30,20,#ffffff,135.0,-30,10,20,#ffffff,135.0,10,-50,20,#ffffff,120.0,20,10,10,#ffffff,20.0,20,30,10,#ffffff,20.0,-70,-10,20,#ffffff,135.0,-50,-70,40,#ffffff,15.3528
SKOOT 10 10,0,hor,1,-11,0,hor,1,0,10,ver,1,0,-11,ver,1,30,0,hor,1,30,10,nw,1,30,-10,ne,1,20,-11,ver,1,-31,0,hor,1,-30,10,ne,1,-30,-10,nw,1,-20,-11,ver,1,-20,10,ver,1,0,30,ver,0,10,-30,ne,1,50,10,nw,0,29,15,hor,1,30,30,ne,1,-51,0,hor,1,-51,20,hor,0,-40,-31,ver,1,-20,30,ver,0
You have an unclaimed Free Veteran Character Package!

</pre><pre><font size=+1><b>Users Playing</b></font></font>
<hr>

There are 22 users currently connected and roaming the gameworld.
There are 9 users who are hidden from the WHO list.

 </font><font color="#00cd20">Sylina</font>             </font><font color="#00cd20">Potentinus</font>         </font><font color="#00cd20">Xylea</font>              </font><font color="#00cd20">Lelex</font>           </font>
 </font><font color="#00cd20">Tenae</font>              </font><font color="#00cd20">Irisa</font>              </font><font color="#00cd20">Torthus</font>            </font><font color="#00cd20">Draylor</font>         </font>
 </font><font color="#00cd20">Kalei</font>              </font><font color="#00cd20">Ulath</font>              </font><font color="#00cd20">Dyrion</font>             </font><font color="#00cd20">Orianthe</font>        </font>
 </font><font color="#00cd20">Athed</font>           </font>

<hr>
</pre>

Retrieving & Calculating Authentication Hash

The following is an example shell script for retrieving the calculated hash for logging in, as mentioned above.

Note: This was written for Ubuntu WSL (Windows Subsystem for Linux), so it calls out to clip.exe to save the output to the clipboard.

#!/bin/bash

# Check for --help
if [[ $1 == "--help" ]]; then
  echo "Usage: ./tecauth.sh [username] [password]"
  echo "Logs into the Eternal City game and copies the response cookie value to the clipboard."
  echo "Options:"
  echo "  --help    Display this help message and exit."
  exit 0
fi

# Fetch the cookie from the login page.
tempFile=$(mktemp)
data=$(curl --ssl-no-revoke \
	 -X POST "https://login.eternalcitygame.com/login.php" \
	 -b "biscuit=test" \
	 -c $tempFile \
	 -d "submit=true" \
	 -d "uname=$1" \
	 -d "pwd=$2" )

# Get the server's pass hash value from the 7th "column" of the cookie.
cookie=$(cat $tempFile)
passhash=$(echo "${cookie}" | awk '/pass/ {print $7}')
echo -e "Passhash: ${passhash}"

# This is the md5 hash of username, passhash, and the secret "NONE".
md5hash=$(echo -n "${1}${passhash}NONE" | md5sum | awk '{print $1}')
echo -e "Hash: ${md5hash}"

# Copy to the clipboard
# Note: clip.exe used here as this is a WSL Ubuntu script
echo $md5hash | clip.exe

PowerShell version: https://github.com/jdalley/tecext/blob/main/tecauth.ps1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment