my_crypto gets your passwords and connection strings or any other text that you use often in your code and store them in your local machine. By using my_crypto, you can avoid hardcoding passwords, connection strings and other important information on your source code when you are implementing or validating your code. Instead of hardcoding, you can use get_crypto() functions in your code.
You can use my_crypto in a local git repository or local folder. It will store whatever you want as a pair of key and value. my_crypto stores the data on your local machine and retreive them whenever you want. I would appreciate your comments.
git clone https://github.com/shahrjoo/my_crypto
cd my_crypto
pip install .
from my_crypto import my_crypto
myc= my_crypto()
myc.add_crypto('password#1','yourpassword')
myc.add_crypto('sqlpassword,'yourpassword')
config = {
'host': 'localhost',
'user': 'root',
'passwd': 'password',
'dbname': 'databasename'
}
myc.add_crypto('postgress_connectionstring',config)
myc.add_crypto('mysql_connection','mysql://root:password@127.0.0.1/dbName')
myc.mycrypto
myc.print_crypto()
myc.print_keys()
myc.del_crypto('pass1')
myc.add_crypto('password#1','newpassword')
myc.get_crypto('pass1')
config = {
'host': 'localhost',
'user': 'root',
'passwd': 'password',
'dbname': 'databasename'
}
#Saving config
myc.add_crypto('postgress_connectionstring',config)
# Using the saved config
import pg
conn = pg.DB(**myc.get_crypto('postgress_connectionstring'))
#is the same as using the command below:
conn = pg.DB(host="localhost", user="root", passwd="password", dbname="databasename")
myc.add_crypto('localsql_admin_password',"password")
import MySQLdb
db = MySQLdb.connect(user='root',password=myc.get_crypto('localsql_admin_password'),host='127.0.0.1',database='databasename')