This Python script enables you to encrypt directories and upload them to a MEGA.nz cloud storage account. It utilizes a KeePass database to securely store and retrieve the encryption and MEGA account credentials, ensuring enhanced security for your sensitive data.
- Encrypt directories and upload them to MEGA.nz cloud storage.
- Option to decrypt the files back from the cloud.
- Directory paths and KeePass database paths can be entered manually if not set in .env file.
- Allows user to upload to a specific folder in MEGA.nz cloud storage.
Ensure you have the following Python libraries installed:
- pykeepass
- Crypto
- python-dotenv
- mega.py
You can install them using:
pip install -r requirements.txt
or:
pip install pykeepass pycryptodome python-dotenv mega.py
- Set your environment variables in a .env file in the same directory as the script. Example:
FOLDERS_TO_ENCRYPT=/path/to/folder1,/path/to/folder2
KEEPASS_DATABASE_PATH=/path/to/keepass.kdbx
MEGA_ENTRY_TITLE=MEGA
ZIP_ENCRYPTION_ENTRY_TITLE=ZIP
MEGA_DIRECTORY=path/to/folder
- Run the script:
python encrypted_cloud_storage.py
- Follow the on-screen prompts to encrypt and upload, or decrypt your directories.
- Enter 1 to choose the Encrypt and Upload option.
- Enter your KeePass password when prompted.
- Enter the MEGA directory to upload to or press Enter to upload to the main directory.
- The script will inform you about the encryption and upload status.
- Enter 2 to choose the Decrypt option.
- Enter your KeePass password when prompted.
- Enter the path of the file to decrypt and the output path and filename.
- The script will inform you about the decryption status.
- Enter 3 to exit the script.
- If you are using paths in the script, make sure to use double backslashes (\) or single forward slashes (/) to avoid errors, e.g., F:\temp\test_encrypt or F:/temp/test_encrypt.
- Ensure your .env file is correctly configured with the appropriate paths and titles.
- Ensure your Python environment has the necessary libraries installed.
- Check your internet connection as the script requires access to MEGA.nz for uploading and downloading files.
If you encounter any issues or have suggestions for improvement, feel free to open an issue or make a pull request :))))