Attached is an encrypted GameScript (ie; .gse) file in a zip package from Trainz Simulator. The original author has lost the original unencrypted file and password to decrypt the file. He is no longer in the hobby but has granted me permission to decrypt the file, if a way can be found to do it.
The latest version of Trainz (TRS19) has broken the freeware content items, including mine, that uses that script and they need to be updated and fixed. Unfortunately with no way to decrypt it we cannot do that with the many hundreds of freeware content items that need that fixing. FYI I am a retired person who produces strictly freeware 3rd party content for the Trainz simulator.
Is their any possibility that someone can assist with this decryption? I simply do not possess the skills to recover this text based script file which has been encrypted.
For information on Trainz Railroad Simulator 2019 see at:
https://store.steampowered.com/app/5535 ... ator_2019/
Thank you for your consideration of my assistance request.
Kind Regards;
Bob (aka MSGSapper in Trainz)
Help needed to Decrypt a Trainz simulation GameScript File
-
- Posts: 1
- Joined: Tue Oct 15, 2019 5:41 pm
-
- Posts: 4
- Joined: Sun May 22, 2022 7:30 pm
Re: Help needed to Decrypt a Trainz simulation GameScript File
Sorry to bump and older thread, but I've been in search of the same solution. I couldn't find one, but I learned a few things that can maybe help someone else solve this.
It appears early .gse files were encrypted from .gs files using the gse.exe located in the bin folder of TRS2004 or TRS2006. Later versions, mainly TS12, are encrypted using the TrainzUtil.exe (also located in the bin folder) which is ran from command prompt and doesn't need the full game to function. The programs are apparently written in C++ and the GameScript language of the scripts is said to be similar to that of C++, though with slight differences. I've heard others say it has similarities to Java.
I tried looking into various methods of decompiling or reverse engineering these exe programs but came up short with my limited knowledge and experience. The exe files that I mentioned do not need the game to run and I have posted them on mediafire for someone to download. The exe files are in what are mostly the contents of the Bin folders from these games contained in ZIP files, just with some unnecessary exe files excluded.
I have also included and incredibly simple script in both .gs form and .gse form (after encryption by TrainzUtil) for comparison.
The .gs and .gse files can simply be opened in notepad for viewing, but the .gse file will return encrypted gibberish. Perhaps if we can crack a simple file first, we can then figure out how to crack a more complex one.
It should also be noted that the commands for the TrainzUtil program can be found here:
https://online.ts2009.com/mediaWiki/ind ... TrainzUtil
Also in the bin folders are Universal Extractor dumps of the exe files in question. Some of these files could be opened in notepad and were partially intelligible, but again, nothing that I could do much with, given my limited knowledge.
Here are the links to the files:
https://drive.google.com/file/d/1STmW0Q ... sp=sharing
https://drive.google.com/file/d/1D2BM5g ... sp=sharing
https://drive.google.com/file/d/1QuS7bq ... sp=sharing
https://drive.google.com/file/d/1QtnPku ... sp=sharing
If anyone can solve this, it would be greatly appreciated. If not, if anyone has any pointers in decryption in general that may lead to solving this, that would also be greatly appreciated.
Edit: according to what I can google, the .gse files are a form of ciphertext. If there is a way to reverse engineer the encryption algorithm by comparing the ciphertext with the original plaintext, that woud (hopefully) be very helpful and may even be the solution. I may be wrong given my limited knowledge, however.
It appears early .gse files were encrypted from .gs files using the gse.exe located in the bin folder of TRS2004 or TRS2006. Later versions, mainly TS12, are encrypted using the TrainzUtil.exe (also located in the bin folder) which is ran from command prompt and doesn't need the full game to function. The programs are apparently written in C++ and the GameScript language of the scripts is said to be similar to that of C++, though with slight differences. I've heard others say it has similarities to Java.
I tried looking into various methods of decompiling or reverse engineering these exe programs but came up short with my limited knowledge and experience. The exe files that I mentioned do not need the game to run and I have posted them on mediafire for someone to download. The exe files are in what are mostly the contents of the Bin folders from these games contained in ZIP files, just with some unnecessary exe files excluded.
I have also included and incredibly simple script in both .gs form and .gse form (after encryption by TrainzUtil) for comparison.
The .gs and .gse files can simply be opened in notepad for viewing, but the .gse file will return encrypted gibberish. Perhaps if we can crack a simple file first, we can then figure out how to crack a more complex one.
It should also be noted that the commands for the TrainzUtil program can be found here:
https://online.ts2009.com/mediaWiki/ind ... TrainzUtil
Also in the bin folders are Universal Extractor dumps of the exe files in question. Some of these files could be opened in notepad and were partially intelligible, but again, nothing that I could do much with, given my limited knowledge.
Here are the links to the files:
https://drive.google.com/file/d/1STmW0Q ... sp=sharing
https://drive.google.com/file/d/1D2BM5g ... sp=sharing
https://drive.google.com/file/d/1QuS7bq ... sp=sharing
https://drive.google.com/file/d/1QtnPku ... sp=sharing
If anyone can solve this, it would be greatly appreciated. If not, if anyone has any pointers in decryption in general that may lead to solving this, that would also be greatly appreciated.
Edit: according to what I can google, the .gse files are a form of ciphertext. If there is a way to reverse engineer the encryption algorithm by comparing the ciphertext with the original plaintext, that woud (hopefully) be very helpful and may even be the solution. I may be wrong given my limited knowledge, however.
-
- Posts: 250
- Joined: Sat Dec 27, 2014 8:49 pm
Re: Help needed to Decrypt a Trainz simulation GameScript File
I don't personally have time to dig into this but can help share some quick info I got just looking at the files you linked.
First, the scripts are potentially compiled. The gsc.exe and gse.exe tools in the archives are used to compile and bundle the scripts.
gsc.exe appears to be used to compile them. This looks to be actually called 'Auran GameScript Compiler'.
gse.exe appears to be used to encrypt them. This makes use of the Jet library (see below) to bundle the files into an 'archive' and compress them.
KernelStandard.dll is a fake named DLL, it is actually a custom archiving library for 'Jet' archives. This looks to be built in-house for this game/studio. This library has everything you need/are looking for in it. Along with all the symbols/naming left in, so its very easy to reverse engineer in general, since all the info you need is there.
If the scripts are compiled down to byte code or similar, then you'd need to make some means of converting them back to any kind of readable format.
First, the scripts are potentially compiled. The gsc.exe and gse.exe tools in the archives are used to compile and bundle the scripts.
gsc.exe appears to be used to compile them. This looks to be actually called 'Auran GameScript Compiler'.
gse.exe appears to be used to encrypt them. This makes use of the Jet library (see below) to bundle the files into an 'archive' and compress them.
KernelStandard.dll is a fake named DLL, it is actually a custom archiving library for 'Jet' archives. This looks to be built in-house for this game/studio. This library has everything you need/are looking for in it. Along with all the symbols/naming left in, so its very easy to reverse engineer in general, since all the info you need is there.
If the scripts are compiled down to byte code or similar, then you'd need to make some means of converting them back to any kind of readable format.
-
- Posts: 4
- Joined: Sun May 22, 2022 7:30 pm
Re: Help needed to Decrypt a Trainz simulation GameScript File
atom0s wrote:I don't personally have time to dig into this but can help share some quick info I got just looking at the files you linked.
First, the scripts are potentially compiled. The gsc.exe and gse.exe tools in the archives are used to compile and bundle the scripts.
gsc.exe appears to be used to compile them. This looks to be actually called 'Auran GameScript Compiler'.
gse.exe appears to be used to encrypt them. This makes use of the Jet library (see below) to bundle the files into an 'archive' and compress them.
KernelStandard.dll is a fake named DLL, it is actually a custom archiving library for 'Jet' archives. This looks to be built in-house for this game/studio. This library has everything you need/are looking for in it. Along with all the symbols/naming left in, so its very easy to reverse engineer in general, since all the info you need is there.
If the scripts are compiled down to byte code or similar, then you'd need to make some means of converting them back to any kind of readable format.
According to a post on the Trainz forums "The .gse script files are compiled machine code." I did some further research and to the best of my knowledge, the compiler is for compiling a script library, or .gsl file which is comprised of a script and the scripts it depends on to form one library. These appear as partially compiled when opened in notepad. I have attached a .gsl if anyone is interested in looking at it.
I am still unsure if the .gse files are compiled first, then encrypted, or simply encrypted. I'm also wondering if the "encryption" is really just compiling it down to the mentioned "machine code." Perhaps someone can tell?
As for the DLL, I'm glad you found that and was able to read some of the plaintext. Unfortunately I'm probably in over my head as far as deciphering any of it with my limited programming knowledge. I'm sort of learning as I go. Would anyone else be interested in looking into that DLL to hopefully find some meaning among the plaintext?
Either that, or would someone know where I may start as far as learning the necessary skills to decipher said plaintext, perhaps without taking an entire C++ course?
Again, I greatly appreciate anyone taking the time to look into this.
-
- Posts: 4
- Joined: Sun May 22, 2022 7:30 pm
Re: Help needed to Decrypt a Trainz simulation GameScript File
Also, for anyone interested, here is the original index file included with TRS2004 on using GameScript in Trainz.
-
- Posts: 4
- Joined: Sun May 22, 2022 7:30 pm