Author: Raphael Dray
pyRansom is not a ransomware but a tool designed to encrypt/decrypt using either symmetrically either asymmetrically a given file and checking its integrity using either HMAC-SHA-256 either RSA-PSS signature.
It can be used, for now, to encrypt/decrypt symmetrically using AES -256-CBC with a given password that will be used to generate round keys.
Also, it can be used to encrypt/decrypt asymmetrically using RSA-OAEP 2048 to encrypt only the CipherKey (used by the AES to encrypt data) in case of single user sending and to encrypt the CipherKey plus the Initialization Vector (used by the AES to encrypt data) in case of multi-protect sending.
You'll need Python 3.8+ to run this script.
- Clone this repository:
git clone [email protected]:MrrRaph/pyRansom.git
- Install the requirements:
pip install -r requirements.txt
usage: pyRansom.py [-h] --input <Input Filename> --output <Output Filename> (--encrypt | --decrypt) {sym,asym} ...
Encrypt/Decrypt given file
positional arguments:
{sym,asym} Encryption Mode
sym Symmetric Mode
asym Asymmetric Mode
optional arguments:
-h, --help show this help message and exit
I/O:
--input <Input Filename>, -i <Input Filename>
Input file to Encrypt/Decrypt
--output <Output Filename>, -o <Output Filename>
Output file to save the encrypted/decrypted
Cipher Mode:
--encrypt, -e Encrypt mode
--decrypt, -d Decrypt mode
usage: pyRansom.py sym [-h] --password <Password>
optional arguments:
-h, --help show this help message and exit
Symmetric Encryption:
--password <Password>, -p <Password>
Password to be used to encrypt/decrypt the file
Example: Start by encrypting your Input File using your password (e.g. myP@$$W0rd)
python pyRansom.py -e --input venv\Scripts\activate.fish --output output\activate.fish.enc sym -p myP@$$W0rd
Then you can decrypt your Output File as follows:
python pyRansom.py -d --input output\activate.fish.enc --output output\activate.fish.dec sym -p myP@$$W0rd
usage: pyRansom.py asym [-h] --private-key <Private Key Filename> --public-key <Public Key Filename> [<User Public Key> [<User Public Key> ...]]
optional arguments:
-h, --help show this help message and exit
Asymmetric Encryption:
--private-key <Private Key Filename>, -priv <Private Key Filename>
Receiver/Sender Private Key
--public-key <Public Key Filename>, -pub <Public Key Filename>
Receiver/Sender Public Key
<User Public Key> User Public Key (Multi-Protected File)
For encryption, you have to use the sender private key and the receiver public key.
python pyRansom.py -e --input venv\Scripts\activate.fish --output output\activate.fish.enc asym -priv senderPriv.pem -pub receiverPub.pem
For decryption, you have to use the receiver private key and the sender public key.
python pyRansom.py -d --input output\activate.fish.enc --output output\activate.fish.dec asym -priv receiverPriv.pem -pub senderPub.pem
For encryption, you have to use the sender private key and the sender public key. Then you can specify all the receivers public keys, only those could decrypt the file.
python pyRansom.py -e --input venv\Scripts\activate.fish --output output\activate.fish.enc asym -priv senderPriv.pem -pub senderPub.pem users\Thierry\thierry-pub.pem users\Lorens\lorens-pub.pem
Or by using the wrapper:
python multi_protect.py -e venv\Scripts\activate.fish output\activate.fish.enc senderPriv.pem senderPub.pem users\Thierry\thierry-pub.pem users\Lorens\lorens-pub.pem
For decryption, for example, Thierry as the receiver, will use its own private key, the sender public key and specify its public key.
python pyRansom.py -d --input output\activate.fish.enc --output output\activate.fish.dec asym -priv users\Thierry\thierry-priv.pem -pub senderPub.pem users\Thierry\thierry-pub.pem
Or by using the wrapper:
python multi_protect.py -d output\activate.fish.enc output\activate.fish.dec users\Thierry\thierry-priv.pem senderPub.pem users\Thierry\thierry-pub.pem