def assisstant(command): if command == str("Open YT"): scraper.youtube() speak("Opening Youtube") if command == str("Open Music app"): scraper.YT_music() speak("Opening YT Music") if command == str("Open Github"): scraper.Github() speak("Opening Github") if command == str("Enter a task = str"): task_input = input(str("Enter a new task: ")) tasks.text(task_input) speak("Changes saved") if command == str("Enter a task = int"): task_input = input("Enter a new task: ") task_input_float = int(float(task_input)) tasks.text(task_input_float) speak("Changes saved") if command == str("Encrypt"): encrypter_input = input(str("Enter a string to encrypt: ")) encrypter.encrypt(bytes(encrypter_input, encoding='utf-8')) # encrypter_input = message if command == str("Decrypt"): decrypter_input = input(str("Enter to decrypt: ")) encrypter.decrypt(bytes(decrypter_input, encoding='utf-8')) if command == str("Play some music"): music_choice = input(str("Should I open YT Music or Play locally?")) if music_choice == str("Play from YT Music"): scraper.YT_music() elif music_choice == str("Play Locally"): # pick an external mp3 player you have music.play_music( "/home/atif/Documents/MyProjects/Assistant/Music/Post Malone - Better Now.mp3" )
def retrieve(svc, usr, AES_key): # Retrieve encrypted password from database data = check_record(svc, usr) if data == 1: print("Try Again!") return 1 else: key = data[0][2] # Decrypt pasword with AES algorithm pw_decrypt = encrypter.decrypt(key, AES_key) return pw_decrypt
def make_sense(data, response_type): global message_id #decryting the data came from server calculated_key = enc.key_calculator(message_id) data = enc.decrypt(calculated_key, data) #original response data from server always contain \n\n if that is not the case then man in the middle happend if (not "\n\n" in data): raise Exception #chunks is the list of all the data of person sent from server in server readable format chunks = data.split("\n\n") #it will contian list of dictionary data of each individual output = [] lis = [1, 2, 4, 8, 16, 32] #chunk contains data of one person sent from the server in server readable format for chunk in chunks: if (chunk == ""): break #it contain data for one person in dictionary format dict_out = {} rows = chunk.split("\n") row_index = 0 for elem in lis: #now check if the field required were department or blood group then we need to convert it into string because from server we are sending 0 1 2 .. for mapping of blood group and department if (response_type & elem != 0): if (elem == DEPARTMENT): dict_out[elem] = department_mapping[int(rows[row_index])] elif (elem == BLOOD_GROUP): dict_out[elem] = blood_group_mapping[int(rows[row_index])] elif (elem == NAME): dict_out[elem] = rows[row_index].title() else: dict_out[elem] = rows[row_index] row_index = row_index + 1 else: dict_out[elem] = None output.append(dict_out) return output
def join_file(rel_file_path, temp_file_paths): """Joins the files given by temp_file_paths, and writes the new file to the path given by the relative path.""" chunks = {} for temp_file in temp_file_paths: index, file_chunk = retrieve_metatags(temp_file) chunks[index] = file_chunk remove(temp_file) temp_file_path = cumulusStore.directory+rel_file_path[:-1]+".cumuluswap" temp_file = open(temp_file_path, 'w') for i in range(0, len(chunks)): temp_file.write(decrypt(chunks[i])) return get_abs_path(rel_file_path), temp_file_path
import getpass import encrypter import json from datetime import date, timedelta from fints.client import FinTS3PinTanClient print('Getting transactions...') pp = pprint.PrettyPrinter(indent=4) logging.basicConfig(level=logging.DEBUG) password = getpass.getpass("Your password: "******"banking_login", password).decode(), encrypter.decrypt("banking_pin", password).decode(), 'https://banking.haspa.de/OnlineBankingFinTS/pintan' # endpoint ) accounts = client.get_sepa_accounts() statement = client.get_statement(accounts[0], date.today() - timedelta(90), date.today()) balance = client.get_balance(accounts[0]) print('\n\nGot transactions from SEPA Account:', accounts) for transaction in statement: print('\n\n=============================') print('Transaction date:', transaction.data.get('date', 'Not given').strftime('%m/%d/%Y'))