Coder Social home page Coder Social logo

friedkeenan / tfm-secrets-leaker Goto Github PK

View Code? Open in Web Editor NEW
12.0 2.0 1.0 85 KB

A utility for obtaining the hardcoded secrets within the Transformice client.

License: GNU General Public License v2.0

Python 6.61% ActionScript 93.39%
flash transformice atelier801

tfm-secrets-leaker's Introduction

TFM Secrets Leaker

A utility for obtaining the hardcoded secrets within the Transformice client.

Building

To build, you should use the asconfig.json file to compile the TFMSecretsLeaker.swf file. This can be done with vscode-as3mxml or asconfigc.

You will also need to place the SWC files for the following libraries under a lib folder at the same level as the asconfig.json file:

If you wish to save yourself the hassle, then there is also a pre-built SWF in the releases of this repo.

Usage

When running the built SWF file, it will trace out the obtained secrets. These can be viewed in something like ffdec, though a helpful leak-secrets.py script is also provided to get the output using the standalone debug projector, used like so:

./leak-secrets.py <path/to/TFMSecretsLeaker.swf>

When running the SWF, a window will pop up for a short moment, seem to begin to load the game, and then exit. This is normal.

Unfortunately this is not currently compatible with Ruffle as it does not currently implement fscommand("quit").

The Secrets

Transformice's networking protocol utilizes several hardcoded, frequently-changing secrets that are contained within the client. Every five minutes or so, a different main SWF is served for the game, changing most of these hardcoded secrets. Therefore it is required to have a dynamic utility to get these secrets automatically, as they change far too often to just manually obtain.

These secrets include:

  • The server address.
    • This is the address of the server that the client connects to. This changes and has changed, but infrequently enough that I think it could feasibly be hardcoded and manually rediscovered when it does change.
  • The server ports.
    • The ports of the server that the client can connect to. These to my knowledge have never changed, but theoretically they could, and we are able to report them, and so we do. The client will randomly shuffle these ports and then try to connect to them in sequence, moving on to the next one if the connection is unsuccessful.
  • The game version.
    • This is what the game displays in the bottom right corner of the login screen, showing text like 1.740. The game version that this reports is the 740 component of that, and is sent in the handshake packet that the client sends to the server. This does not change as often as the other secrets do.
  • The connection token.
    • This is a random set of characters which is similarly sent in the handshake packet. I believe it used by the server to identify what the expected values of the other secrets should be.
  • The auth key.
    • After the client sends the handshake packet to the server, the server then responds with a packet containing an "auth token". This is an integer that is used again when the client sends the login packet. The client XOR's the auth token with the hardcoded "auth key", resulting in a ciphered token, which is then sent to the server in the login packet.
  • The packet key sources.
    • Certain packets within Transformice's network protocol are encrypted, for example the login packet. The particular cipher varies per packet, but the keys used are derived from an array of integers called the "packet key sources". These integers are combined with a key name, e.g. "identification", to obtain the actual key used to encrypt a packet.
  • The client verification template.
    • Shortly after the handshake sequence has been completed by the client and server, the server will send a packet to the client to make sure that the client is official and otherwise proper (i.e. not a bot). This packet contains a "verification token" (an integer) which the client will then use in its response. The client will respond with a ciphered packet using the XXTEA algorithm with the verification token converted to a string as the name for the key. The (plaintext) packet data will begin with the verification token, and then some semi-random, hardcoded fields, with the verification token thrown in again in the midst of it. This does not seem to change as often as the other secrets do, but it does change.

      What this reports is a hex string representing a string of bytes of the plaintext body of this packet (in Python, something you could use bytes.fromhex on). In place of where the verification token should go, aabbccdd is used, and should be replaced with the actual packed verification token.

Other Games

Other Atelier 801 games have very similar structures to Transformice, and so this utility is able to also support the following games:

  • Transformice
  • Dead Maze
  • Bouboum
  • Nekodancer
  • Fortoresse

Transformice and Dead Maze are the only games that have client verification templates. And so for the others, no client verification template will be traced out.

To obtain the secrets to a particular game, its name should be supplied to the game loader parameter. For instance, here is how you would do so using the leak-secrets.py script:

./leak-secrets.py path/to/TFMSecretsLeaker.swf?game=transformice

./leak-secrets.py path/to/TFMSecretsLeaker.swf?game=deadmaze

./leak-secrets.py path/to/TFMSecretsLeaker.swf?game=bouboum

./leak-secrets.py path/to/TFMSecretsLeaker.swf?game=nekodancer

./leak-secrets.py path/to/TFMSecretsLeaker.swf?game=fortoresse

If no game parameter is supplied, then the utility will default to leaking Transformice's secrets.

tfm-secrets-leaker's People

Contributors

friedkeenan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

dichill

tfm-secrets-leaker's Issues

Setting up Private Server

Hello! Im using this server files from: https://github.com/3e08488f9bcc2dd50192b3db89f6612c/SWF-Database-and-Tools/blob/main/Sources/1.680.rar by Paranormal Activity. I tried using this tool to replace the values in the infoSWF.json and I also used TFM-Proxy-Loader to direct it to my localhost. However upon opening TFM, it says that "incorrect version, try to reload the game."

After further investigation, maybe it has something to do with the function "SendCorrectVersion()" being outdated as the server files are 3 years ago.

Here is the code for the function as it might help.

def sendCorrectVersion(self, community="en"):
        self.sendPacket(
            Identifiers.send.Correct_Version,
            ByteArray()
            .writeInt(len(self.server.players))
            .writeUTF(community)
            .writeUTF("")
            .writeInt(self.server.authKey)
            .writeBoolean(False)
            .toByteArray(),
        )
        self.sendPacket(
            Identifiers.send.Banner_Login,
            ByteArray()
            .writeBoolean(True)
            .writeByte(self.server.adventureID)
            .writeShort(256)
            .toByteArray(),
        )
        self.sendPacket(
            Identifiers.send.Image_Login,
            ByteArray().writeUTF(self.server.adventureIMG).toByteArray(),
        )

I don't really know anything about packets, networking and all of that, but I've tried researching and its still quite confusing for me.
Any help is appreciated, thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.