def delayed(): key = sec.gen_key() f_encrypt = Fernet(key) for i in listdir('files'): #encrypt all files w/ my function sec.encrypt('files/' + i, f_encrypt) pw = self.pw1.get().encode() pw = f_encrypt.encrypt(pw) #encyrpted pw f = open('unlock.py:eKey', 'wb') f.write(pw) f.close() #hides and unhides subprocess.check_call(['attrib', '+H', 'setup.py']) subprocess.check_call(['attrib', '-H', 'unlock.py']) self.label_char.configure( text= ' Success! ' ) def Exit(): sys.exit() root.after(3000, Exit) #bye
def encrypt(hash): global ciphertext # plaintext = str(crypter.encrypt(key=crypter.pad(hash), plaintext=data)) ciphertext = str(crypter.encrypt(key=crypter.pad(hash), plaintext=data)) # obj = AES.new(crypter.pad(password), AES.MODE_GCM, iv.encode()) # plaintext = plaintext.encode() # ciphertext = obj.encrypt(plaintext) # print(ciphertext) return ciphertext
def changeSettings(self, val): self.config_file['pg_user']['login'] = self.login = val['_LOG_'] self.password = val['_PAS_'] self.config_file['pg_user']['password'] = crypter.encrypt(val['_PAS_']) self.config_file['pg_user']['link'] = self.link = val['_LIN_'] self.look_for = self.whole_look_for.split(';') self.config_file['pg_user']['look_for'] = self.whole_look_for = val[ '_LFO_'] self.private_key = val['_KEY_'] self.config_file['settings']['notification'][ 'private_key'] = crypter.encrypt(val['_KEY_']) self.config_file['settings']['notification'][ 'device_ID'] = self.device_ID = val['_DEV_'] self.config_file['settings'][ 'where_to_send_email'] = self.where_to_email = val['_EMA_'] with open('loginDetails.yml', 'w') as file_to_get_updated: yaml.safe_dump(self.config_file, file_to_get_updated, default_flow_style=False)
def encrypt(self, string): string = str(string) for i in range(self.repeat): string_toencrypt = encrypt(string, self.password) string = string_toencrypt return string
def get_next_json(): wrong_answers = False while not wrong_answers: next_set = queue.pop(0) chosen_audio = random.choice(next_set).strip() hidden_filename = crypter.encrypt(chosen_audio,deslen=30) wmcf_url = "/wfs/En-us-{}.mp3".format(hidden_filename) try: afilepath = "mp3subset/En-us-{}.mp3".format(chosen_audio) # print(afilepath) os.stat(afilepath) wrong_answers = list(map(lambda x:x.upper().strip(), next_set)) except FileNotFoundError: # print("Not found") wrong_answers = False enqueue() # print(next_set, chosen_audio, wmcf_url) return template("templates/game_section.html", wmcf_url=wmcf_url, wrong_answers=wrong_answers)
def execute_edit_method(master_password, args): args[3] = crypter.encrypt(args[3], master_password) return database.update_user(args[0], args[1], args[2], args[3])
def execute_add_method(master_password, args): args[2] = crypter.encrypt(args[2], master_password) return database.insert_user(args[0], args[1], args[2])