SourceRestorer is a tool designed to recover lost code from .pye
files
encrypted using SOURCEdefender. It provides
a means to decrypt and analyze otherwise unreadable Python source code, which
can be particularly useful in several scenarios such as:
- Malware analysis: Analyzing potentially harmful code without having access to its original sources
- Forensic investigation of unknown code: Gaining insights into third-party scripts with no available documentation
- Code recovery: Restoring your own code when you've accidentally lost the original source files
It has been tested with version 11.0 of the library.
SOURCEdefender uses TgCrypto
and msgpack
under the hood. We simply need to
wrap the tgcrypto.ctr256_decrypt
function so that it prints the decrypted
code.
Finally, we make it return an empty value instead. This last step is performed to ensure no harmful code is ever executed.
Firstly, you should install the original SOURCEdefender library:
pip install -r requirements.txt
To use the program place the encrypted file in the same directory as the script, then simply call it by passing the file name as the only parameter:
python sourcerestorer.py input.pye
The code will be printed out on screen.
This software is released in the public domain under The Unlicense. It comes without warrant of any kind and no support will be provided.