diff --git a/elinethingz/encfile.py b/elinethingz/encfile.py index daae312..af518b9 100644 --- a/elinethingz/encfile.py +++ b/elinethingz/encfile.py @@ -9,16 +9,24 @@ from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives import padding as sym_padding from argparse import ArgumentParser + # SYNTAX/USE GUIDE: -# python3 --{encrypt/decrypt} --input {filename} --output {filename, but optional if encrypting. defaults to current working directory/cwd.} +# python3 encfile.py --{encrypt/decrypt} --input {filename} --output {filename, but optional if encrypting. defaults to current working directory/cwd.} # example: -# python3 --encrypt --input secret.js -# python3 -e -i secret.js -print(" ____ _____ ____ ____ _____ _____ _____ _ ___ _____ ___ ____ _ _ ") -print("/ ___|| ____/ ___| _ \| ____|_ _|/ / / \ | |/ _ \| ___/ _ \| _ \| \ | |") -print("\___ \| _|| | | |_) | _| | | / / /| \| | | | | |_ | | | | |_) | \| |") -print(" ___) | |__| |___| _ <| |___ | |/ / / | |\ | |_| | _|| |_| | _ <| |\ |") -print("|____/|_____\____|_| \_\_____| |_/_/_/ |_| \_|\___/|_| \___/|_| \_\_| \_|\n") +# python3 encfile.py --encrypt --input secret.js +# python3 encfile.py -e -i secret.js +def banner(): + print(" ____ _____ ____ ____ _____ _____ _____ _ ___ _____ ___ ____ _ _ ") + print("/ ___|| ____/ ___| _ \| ____|_ _|/ / / \ | |/ _ \| ___/ _ \| _ \| \ | |") + print("\___ \| _|| | | |_) | _| | | / / /| \| | | | | |_ | | | | |_) | \| |") + print(" ___) | |__| |___| _ <| |___ | |/ / / | |\ | |_| | _|| |_| | _ <| |\ |") + print("|____/|_____\____|_| \_\_____| |_/_/_/ |_| \_|\___/|_| \___/|_| \_\_| \_|\n") + + + print("'[S] The Secrets of the Fighter.' ") + print("Do not transmit this program over unsecure channels.") + print("This program allows you to encrypt files to send them to your fellow operatives.") + print("It is classified as: SECRET//NOFORN.\n") parser = ArgumentParser() parser.add_argument("-e", "--encrypt", action="store_true", help="Encrypt a file", dest="encrypt") @@ -27,16 +35,17 @@ parser.add_argument("-i", "-input", dest="input") parser.add_argument("-o", "--output", dest="output") args = parser.parse_args() -if not args.output: - print() # retard +if not any([args.encrypt, args.decrypt]): + print("Specify a mode with -e or -d.") + exit(1) +if not args.input: + print("Specify an input file with -i.") + exit(1) + + +else: + banner() -print("'[S] The Secrets of the Fighter.' ") -print("Do not transmit this program over unsecure channels.") -print("This program allows you to encrypt files to send them to your fellow operatives.") -print("It is classified as: SECRET//NOFORN.\n") -#print("USAGE:") -#print("-e;--encrypt = Encrypt \n -d; --decrypt = Decrypt\n;--input = Input file\n-o;--output = Output file\n\n") -#print("Example command:\n mjsecrets -e Downloads/catPicture.png -o Downloads/encryptedCatpic\n mjsecrets -d -i Downloads/encryptedCatpicture.png -o Downloads/decryptedCatpic.png") def derive_key(password:bytes, salt:bytes): kdf = PBKDF2HMAC( @@ -87,13 +96,12 @@ def decrypt_file(input_file, output_file, password): if args.encrypt: args.output = getcwd() - args.output = args.output + "/encryptedfile" - args.output = args.output + ".enc" + args.output = args.output + "/encryptedfile.enc" password = bytes(input("PASSWORD:\n"), 'UTF-8') encrypt_file(args.input, args.output, password) - print("Done. File stored as", args.output) + print("Done. File stored as ", args.output) if args.decrypt: password = bytes(input("PASSWORD:\n"), 'UTF-8') decrypt_file(args.input, args.output, password) - print("Done.") \ No newline at end of file + print("Done. File stored as ", args.output) \ No newline at end of file