Skip to content

hamzahap/EncryptionDecryption

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EncryptionDecryption

A simple Encryption/Decryption script for Databases using PyMySQL and Cryptography library.

Backup.py

The library for dotenv is https://pypi.org/project/python-dotenv/
The main function creates the Backups and Keys Directories if they don't exist.
The encrypt and decrypt function do exactly what they sound like they do.
The library used to make a connection with the database is https://pypi.org/project/PyMySQL/
The scripts collects data from tables in your database.
The data is then saved into .csv files using pandas dataframes.
The .csv files are then encrypted via the the cryptography Fernet library.

To run the script type py Backup.py in the command line obviously.

The file format for the csv files is Tablename-date.csv .
The file format for the key files is Key-date.key .

Encrypt.py

The main function looks for the first two arguments, the file and the key file.

To run the script type py Encrypt.py "Tablename-date" "Key-date" in the command line.

Note: The script has to be run in the same directory as the Backups and Keys folder access are manually set in the script.

Decrypt.py

The main function looks for the first two arguments, the encrypted file and the key file.

To run the script type py Decrypt.py "Tablename-date" "Key-date" in the command line.
Note: The script has to be run in the same directory as the Backups and Keys folder access are manually set in the script.

About

A simple Encryption/Decryption/Backup script for backing up Database tables with csv files using PyMySQL, pandas and Cryptography.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors