Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python
from cryptography.fernet import Fernet
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-f", "--fernet", required=True,help="Fernet Key")
parser.add_argument("-v", "--val", required=True,help="Value to decode")
args = parser.parse_args()
KEY = args.fernet
VAL = bytes(args.val, 'utf-8')
def decrypt_message(encrypted_message,KEY):
"""
Decrypts an encrypted message
"""
f = Fernet(KEY)
decrypted_message = f.decrypt(encrypted_message)
print(decrypted_message.decode())
if __name__ == "__main__":
decrypt_message(VAL,KEY)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment