Server emulator for the Hasbro Em@il Games clients

Overview

HasbroPBEMProxy

Greg Kennedy, 2021

Server emulator for the Hasbro Em@il Games clients

About

In 1999 Hasbro launched a series of games under the "Em@il Games" banner, allowing users with limited internet connections to play a handful of turn-based games using their existing email address. A player would begin a new game from the app on their computer, make moves, and submit them to Hasbro's servers by clicking a button. Hasbro would then send an email to the opponent with a .bin snapshot of the gamestate and an "it's your turn!" message. From there the opponent would check their email, see an attached savegame, double-click to launch and make moves, and submit their updates back to the first opponent (again, through Hasbro's servers).

The servers folded in 2001. This rendered the games nearly unplayable, except for certain workarounds involving retrieving the savegame from a temp folder and passing it around manually. Most games in the series were board game conversions and not very interesting, but there was a lesser-known X-Com tactical game that still may be worth playing today.

This project is an attempt to revive the game servers to enable easier exchange of the savegames without needing to dig around in folders anywhere. This is done by using the "Proxy Server" settings in a game, like so:

Proxy config dialog box

A Proxy Server is intended to act as a middleman for HTTP connections: instead of sending your requests to a remote website directly, you instead pass them to the proxy server, which forwards the request (and response) on your behalf. This is helpful for privacy, website allow/deny listing, etc. The Hasbro games support a proxy, but do not use HTTPS (SSL) for the connection. It is thus very easy to write our own bogus proxy service that captures the request and instead serves its own response. By faking the response as though it is an actual Hasbro server, the proxy can capture and exchange gamestates, while the application thinks it's just gotten off the phone with Hasbro.

Supported Games

So far, support is available for Email X-Com (aka EX-COM aka X-Com: First Alien Encounter). I am interested in other games in the Em@il Games series, especially the NASCAR turn-based racing game, and may add support for those in the future.

Details

Submitting a turn involves sending a specially crafted HTTP request to a formatted URL at one of two hardcoded IP addresses. For X-Com, the primary IP is 128.11.41.76, and if any part of the request fails it makes another identical attempt at 128.11.41.77 instead.

The URL format is: http://128.11.41.76:80/1632633091/776.htm where the first path parameter is a time32_t Unix timestamp, and the second is milliseconds.

An example web request made by the client looks like this:

GET http://128.11.41.76:80/1632635052/35.htm HTTP/1.0
User-Agent: Hasbro/2.0 (compatible; EmailGame 57.57; Windows 95)
Host: 128.11.41.76:80
Pragma: no-cache
Cookie: H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zPMgS3Gbxu4WOWuRuOAMO1SHntgCITYRyayTUmQR8bXuEiYPkKpa36b5IR0VzOOaGMG5kZ2Y5jtvQyOOpVzagw0lz/cOC+A+YLBkHpxFEtkgFUXQH3isjtU8WG2PoGPWefEpBX7oiOHOMmVcqj79MBRKqJTPJg2NV7YMGThXqLz37vCYOJbe4AwydZyg7kY4RIqr46+Fgma91C6M5Emb3sUsa0K5kM8mHXSjivEoAXhTiv3UD2aoFVIOjNXZPPNQvYTTJptd4suwmedrtZUDOtJ32fOkjXJbqUN31sX8k78H0GZPNB1r9Dkph75VDEVKWAH239E5+2pKYBc4g1lwqcL774a9rwsi2Q/BPRZPoJmRSH8WzeSYTA9jVI3m387F7AVAa5O75gowW3ex2gIswHCn0vwiS4Wbxu/qSWtgteT6N2CNStsEKK98rCn5JrV3mDLyHrRunkzgBcppgUDVDtpXyctHz40FE/OknjZjG/rMi3QYYnkAAAACAAAACVBsYXllciAxAAAAABRwbGF5ZXIxQGV4YW1wbGUuY29tAAAAAAlQbGF5ZXIgMgAAAAAUcGxheWVyMkBleGFtcGxlLmNvbQA=
Accept-Language: en-us

The interesting portion here is the cookie HasbroCookieVR1, containing a Base64-encoded binary structure with information about the to/from email addresses, game snapshot, and other information. This is similar to a POST request with the same information in the body.

The server response is parsed for certain HTML tags - mainly, a <PRE> block with a Base64-encoded server binary response. A sample response accepted by the client looks like this:

HTTP/1.0 200 OK
Date: Sun, 26 Sep 2021 05:49:53 +0000
Content-Length: 1658

<HTML><TITLE>title</TITLE><BODY><PRE>
AAAAAAAAAAAAAAADAO7/DAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHRlbXB4ZW0AAAAEKVY+
F/+pwRlLIcHzpVtxLsSTlkR+EtLw0usmTXBgNw7lQmyTv+cmt2rb1Y1qTiHk2PPNJVkHzKiLfjZc
1tqQ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rmQ
zyYddKOK8SgBeFOK/dQPZqgVUg6M1dk881C9hNMmm13iy7CZ52u1lQM60nfZ86SNclupQ3fWxfyT
vwfQZk80HWv0OSmHvlUMRUpYAfbf0Tn7akpgFziDWXCpwvvvhr2vCyLZD8E9Fk+gmZFIfxbN5JhM
D2NUjebfzsXsBUBrk7vmCjBbd7HaAizAcKfS/CJLhZvG7+pJa2C15Po3YI1K2wQor3ysKfkmtXeY
MvIetG6eTOAFymmBQNUO2lfJIieZLQUT86SeNmMb+syLdBhieQAAAAA=
</PRE></BODY></HTML>

The client parses this and looks for certain flags indicating a successful response, then informs the user that submission was successful. Most of the data in the response structure is not known, but some flags allow sending a custom error message, indicating error status, etc.

The server's task is to pass the turn snapshot (.xem) to the next player. The original role of the Hasbro servers was to wrap this in an email message. It is up to the dev to determine what to do with it in this case. I have connected the output to a Discord webhook, which notifies the players and attaches the .xem for the opponent to pick up and play.

For details of the binary structure itself, please see the comments in the source code.

Usage

The handoff server is written as a single .php file which parses the cookie and constructs the response. Setting this up requires a PHP-enabled web server, listening on the desired port and sending requests to the script. Path parameters should be parsed into a single query parameter timestamp of form seconds.milliseconds.

For example, this httpd.conf VirtualHost directive for Apache listens to incoming requests on port 8080, and forwards them to the script residing in /usr/local/www/pbemproxy/index.php. Adjust especially the FilesMatch portion if you use mod_php instead of an FPM service, etc:

<VirtualHost *:8080>
  ServerName 128.11.41.76
  ServerAlias 128.11.41.77

  DocumentRoot "/usr/local/www/pbemproxy"
  <Directory "/usr/local/www/pbemproxy">
    DirectoryIndex index.php

    # Controls who can get stuff from this server.
    Require all granted

    # Set up the PHP handler
    ProxyErrorOverride on
    <FilesMatch \.php$>
      SetHandler "proxy:unix:/tmp/php-fpm.sock|fcgi://localhost"
    </FilesMatch>

    RewriteEngine On
    RewriteRule "^(\d+)/(\d+)\.htm$" "/index.php?timestamp=$1.$2" [L]

  </Directory>
</VirtualHost>

Alternately, if you just want to play the game without any of this, there is a Discord server available with the correct setup.

Click here to join: https://discord.com/invite/xB4XsTeFta

You might also like...
An API for implementing leaderboards into your games

simple-leaderboard-api An API for implementing leaderboards into your games How to use it You'll first want to visit http://indiealchemy.com/simple-le

It's goal is to create my own platform where I can play various board games I like.
It's goal is to create my own platform where I can play various board games I like.

Card games The goal of this project is to create a social platform where players can communicate, create lobbies and play various board games. Current

Library for generating random names (for table-top roleplaying games)

RPG-Name-Generator The RPG character name generator library is designed to create list of random names used for table-top role-playing games. This lib

PlayZ is an esport event organization and management website allowing the creation of tournaments on the most popular video games of the esport scene.

PlayZ the playz to play Table of Contents Description "What is Playz?" In one sentence PlayZ is "an esport event organization and management website a

Backend application using Laravel 9.x REST APIs for games topup from digiflazz.com and payment gateway using xendit.co

TOPUP - Laravel 9.x REST API Documentation is still on progress. For now, you can fork this postman collection Installation Clone this project git clo

Simple handler system used to power clients and servers in PHP (this project is no longer used in Guzzle 6+)

RingPHP Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function. RingPHP be used to power HTTP clie

Jane is a set of libraries to generate Models & API Clients based on JsonSchema / OpenAPI specs
Jane is a set of libraries to generate Models & API Clients based on JsonSchema / OpenAPI specs

Jane is a set of libraries to generate Models & API Clients based on JsonSchema / OpenAPI specs Documentation Documentation is available at http://jan

ControlPanel's Dashboard is a dashboard application designed to offer clients a management tool to manage their pterodactyl servers.
ControlPanel's Dashboard is a dashboard application designed to offer clients a management tool to manage their pterodactyl servers.

Features PayPal Integration Email Verification Audit Log Admin Dashboard User/Server Management Store (credit system) Vouchers and so much more! Contr

This is code to create a new user as admin use for Wordpress FrontEnd Developer to prevent any scaming from clients

theme-setup This is code to create a new user as admin use for Wordpress FrontEnd Developer to prevent any scaming from clients How to use Just copy c

ProjectSend is a free, clients-oriented, private file sharing web application.
ProjectSend is a free, clients-oriented, private file sharing web application.

ProjectSend is a free, open source software that lets you share files with your clients, focused on ease of use and privacy. It supports clients groups, system users roles, statistics, multiple languages, detailed logs... and much more!

This is a free Billing System for Resellme clients.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Project that aims to create a website for a gym, where the clients and employees can access their data, buy in the gym store and check the gym activities.

Gym_Management_Project Project that aims to create a website for a gym, where the clients and employees can access their data, buy in the gym store an

The system that will administer or manage companies and their employees and clients.

About - - Business Management System The system that will administer or manage companies and their employees and clients. Resources Use of Notificatio

This plugin integrates cache functionality into Guzzle Bundle, a bundle for building RESTful web service clients.

Guzzle Bundle Cache Plugin This plugin integrates cache functionality into Guzzle Bundle, a bundle for building RESTful web service clients. Requireme

Extended response classes for Rest API clients/SDKs
Extended response classes for Rest API clients/SDKs

Rest Response Extended response classes for Rest API clients/SDKs. About This package is intended to be component of SDKs so the responses can be easi

Allows the connection of Minecraft: JE clients to PocketMine servers. Made for PM4

JavaPlayer Allows the connection of Minecraft: JE clients to PocketMine servers. Made for PM4 MCJE VER: 1.18.2 Need implemented Chunks (convert proble

Now Introducing a new and easy way to manage your clients and MyOwnFreeHost hosting accounts.

Warning This is a beta version of Xera. Use it for testing purpose only. You are be responsible for any loss or damages that may occor from using this

ATOS is a locally hosted application that allows you to easily manage clients/projects, generate invoices against backlogs, and estimate taxes.
ATOS is a locally hosted application that allows you to easily manage clients/projects, generate invoices against backlogs, and estimate taxes.

Built by freelancer 🙋‍♂️, for freelancer 🕺 🤷 💃🏾 - ATOS is a locally hosted application that allows you to easily manage clients/projects, generate invoices against backlogs, and estimate taxes.

Declarative HTTP Clients using Guzzle HTTP Library and PHP 8 Attributes

Waffler How to install? $ composer require waffler/waffler This package requires PHP 8 or above. How to test? $ composer phpunit Quick start For our e

Releases(release)
Owner
Greg Kennedy
Greg Kennedy
Declarative HTTP Clients using Guzzle HTTP Library and PHP 8 Attributes

Waffler How to install? $ composer require waffler/waffler This package requires PHP 8 or above. How to test? $ composer phpunit Quick start For our e

Waffler 3 Aug 26, 2022
↪️ Bypass for PHP creates a custom HTTP Server to return predefined responses to client requests

Bypass for PHP provides a quick way to create a custom HTTP Server to return predefined responses to client requests.Useful for tests with Pest PHP or PHPUnit.

CiaReis 101 Dec 1, 2022
Transform your WordPress site into a modern GraphQL server: graphql-api.com.

GraphQL API for WordPress Transform your WordPress site into a modern GraphQL server: graphql-api.com. This plugin is the implementation for WordPress

GraphQL API 151 Dec 14, 2022
Pushpin is a publish-subscribe server, supporting HTTP and WebSocket connections.

Pushpin and 1 million connections Pushpin is a publish-subscribe server, supporting HTTP and WebSocket connections. This repository contains instructi

Fanout 14 Jul 15, 2022
Express.php is a new HTTP - Server especially made for RESTful APIs written in PHP.

express.php Express.php is a new HTTP - Server especially made for RESTful APIs written in PHP. Features Fast The Library is handles requests fast and

null 5 Aug 19, 2022
A WebSocket server written in PHP.

WebSocketServer A WebSocket server written in PHP. If you like this project gift us a ⭐ . Installation. $ composer require thenlabs/websocket-server 1

ThenLabs 3 Nov 28, 2022
Read-only WebDAV server written in php8.0; supports browsing archives and GETting files in encodings other than what's on disk

Best Read-only WebDAV Server: TODO Features and notes of implementation Keeping generated files in a place that nginx can find them (2 ways to do this

Joe Koop 1 Nov 17, 2021
Event-driven, streaming HTTP client and server implementation for ReactPHP

HTTP Event-driven, streaming HTTP client and server implementation for ReactPHP. This HTTP library provides re-usable implementations for an HTTP clie

ReactPHP 640 Dec 29, 2022
Creating an all in one AI with a web UI to control it. Create your own AI server and/or sell API keys to other people to use your AI.

+ Currently taking an hour or two break to spend some time with the wife. - Then going to work on auto refreshing the chat and document ingestion so y

null 10 Jun 14, 2023
Minecraft Server Emulator

EncryptedKitten's Minecraft Server Emulator What does it do? It provides an implementation of: api.mojang.com authserver.mojang.com login.minecraft.ne

null 24 Dec 10, 2022