def main(option): if option == '--aes': banner.head() password = input('[*] Pick a password: '******'[*] Enter the text to be encrypted: ') encrypted_text = func.aes(f'{text_to_aes}', password) print('\n[*]', encrypted_text) elif option == '--caesar': banner.head() text_to_binary = input('[*] Enter the text to be encrypted: ') while True: try: s = int(input("[*] Enter the shift: ") ) #how many shifts to encode in caesar break except ValueError: print('[!] Please enter a numerical value.') continue encrypt_text = func.caesar(text_to_binary, s) print('\n[*] Encrypted value:', "{}".format(encrypt_text)) elif option == '--md5': func.md5() elif option == '--rot13': func.rot13() elif option == '--base64': func.base64() elif option == '--sha256': func.sha256() elif option == '--hex': func.hex() elif option == '--help' or option == '-h': banner.usage()
def hex(): banner.head() text_to_hex = input('[*] Enter the text to be encoded: ').encode('utf-8') encrypted_text = text_to_hex.hex() print('\n[*] Encoded value:', encrypted_text)
def sha256(): banner.head() text_to_sha = input('[*] Enter the text to be hashed: ').encode() encode = hashlib.sha256(text_to_sha).hexdigest() print('\n[*] Hashed value:', encode)
def base64(): banner.head() text_to_64 = input('[*] Enter the text to be encoded: ') encode = b64.b64encode(bytes(f'{text_to_64}', "utf-8")) print('\n[*] Encoded value:', encode.decode('utf-8'))
def rot13(): banner.head() text_to_rot = input('[*] Enter the text to be encrypted: ') encrypted_text = codecs.getencoder("rot-13") result = encrypted_text(text_to_rot)[0] print('\n[*] Encrypted value:', result)
def md5(): banner.head() text_to_md5 = input('[*] Enter the text to be hashed: ') hash_object = hashlib.md5(text_to_md5.encode()) md5_hash = hash_object.hexdigest() print('\n[*] Hashed value:', md5_hash)