def decrypt_file(input_file, output_file): from cryptograph import key_reader as kr from cryptography.fernet import Fernet keys = kr.read_keys() key = keys[0] with open(input_file, 'rb') as f: data = f.read() f1 = Fernet(key) decrypted = f1.decrypt(data) with open(output_file, 'wb') as f: f.write(decrypted)
def encrypt_file(x, y): from cryptograph import key_reader as kr from cryptography.fernet import Fernet keys = kr.read_keys() key = keys[0] input_file = x output_file = y with open(input_file, 'rb') as f: data = f.read() f2 = Fernet(key) encrypted = f2.encrypt(data) with open(output_file, 'wb') as f: f.write(encrypted)
var2 = [] var4 = [] # for data in f1: # var0.append(data) home = os.path.expanduser('~') appdata = os.getenv('LOCALAPPDATA') print(appdata) print(home) for dir1 in f1: if 'APPDATA' in dir1: # var3 = var1.strip() # print(var3) # print(re.findall('APPDATA', var1)) # var5 = # print(var5) # vs = var4.append( os.path.join(appdata, dir1.strip("~\\/' \n").strip('\\APPDATA\\'))) else: # var3 = # print(var3) # vs = var2.append(os.path.join(home, dir1.strip("~\\/' \n"))) print(var2) print(var4) from cryptograph.key_reader import read_keys read_keys()
from cryptography.fernet import Fernet from cryptograph import key_reader as kr x = 0 y = 0 keys = kr.read_keys() key = keys[0] input_file = x output_file = y with open(input_file, 'rb') as f: data = f.read() f2 = Fernet(key) encrypted = f2.encrypt(data) with open(output_file, 'wb') as f: f.write(encrypted)