A malware is just a malicious executable.
First we shall consider running windows on a test environment / sandbox
(Note: Windows 11 inbuilt windows sandbox has limitations)
Opt for Linode instances or virtual machines
We are just deploying simple file encryptions and decryption using python hashlib,cryptography and basic base64
Then add full screen alert to juice it up!!
-
The malware.py has an encryption to a photos folder commented out. The second part is for a directory, the Current user directory.
-
The anti-malware is just a decryption of the malware.py.
DO NOT execute the malware with Fernet Key without noting the encryption key.
That is essential in decryption!!
The code will set the directory_path to the current user's folder on the C drive, and then iterate through all the files in that directory. If a file is a photo (based on the file extension), it will be encrypted and the original file will be deleted.
Please note that this code will only encrypt photo files (.jpg and .png) and will not encrypt other types of files. If you want to encrypt all types of files, you can remove the if statement that checks the file extension.
⛔️ Encryption of the C drive without path can cause irreversible damage!!
🫳 The password is first hashed through hashlib digest then base64 encoding and finally a fernet key generation from the encoded string.
You can add the alert between the encryption finish point and the final message " Encryption complete"
Use:
-
cx_Freeze - pip install cx_Freeze
-
pyinstaller - pip install pyinstaller
For cx_freeze use the variables to fit your needs
🫴🫴🫴🫴🫴🫴🫴🫴🫴🫴🫴🫴🫴🫴🫴🫴🫴🫴🫴🫴🫴🫴🫴🫴🫴