Warning
Please consider running these scripts only if you can clearly understand the workings of the script. It is advised to go through the code before running it. If you like to tinker with these scripts, then please consider running them in a safe environment (For example: in a virtual machine).
Important
These are Python scripts just to demonstrate the working process of a simple ransomware. Actual ransomware has a much more complex working process and is not as simple as these scripts.
Note
The tool can only encrypt and decrypt files (and not folders) within the same directory of the Python scripts. This project was developed out of curiosity with the help of some references. Please do not misuse the script and use it only for educational/demonstration purposes.
These Python scripts encrypt and decrypt the files within the same directory using Fernet Encryption.
The folder consists of 2 scripts:
encrypt.py
: For encrypting all the files using Fernet Encryptiondecrypt.py
: For decrypting all the files.
A separate file named "key_file.key" is generated during the encryption process, and the key present within this file is used during the decryption process. Please note that the generated key is unique every time "encrypt.py" script is run, and the key within "key_file.key" is replaced every time.
A password is required during the decryption process, which is asked by the script. The current password to decrypt the files is ransome
(Check line 37 of decrypt.py
file for a better understanding).
- Download the zip file, and extract it. The scripts should be in the
Ransomware-Script-main
folder. - (optional) Add additional files which you would like to encrypt into the
Ransomware-Script-main
folder. - Try to open
Test_PDF_File.py
andtest_file.txt
to see if data is present. - Encrypt all the files within the folder (except
encrypt.py
,decrypt.py
andkey_file.key
(which will be generated during the encryption process)). Use the following command in the present-working-directory:-
python encrypt.py
- Try to open the encrypted files
Test_PDF_File.py
andtest_file.txt
and view their content. - Decrypt the files using using the command:-
python decrypt.py
PLEASE NOTE: The script will ask for a password before decrypting the file. The password is: ransome
. (Check the below given example)
- Try to view the files again. This time, they should be decrypted back.
Here, we can see all the files from the zip file.
And here, we can see the files with their content without encryption.
Now, we encrypt the files.
Here, we can see, that the data is encrypted, hence the following output.
Now, we decrypt the files.
And here, we have recovered the files back after the decryption process.