Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os, sys, base64
- print("1 > Crypter")
- print("2 > Decrypter")
- choix = input("> ")
- if int(choix) == 1:
- os.system("cls")
- print("*** Crypteur ***")
- file = input("File > ")
- try:
- FileName = open(file, 'r')
- print("[+]File correct")
- except:
- print("[-]Wrong file selected")
- os.system("color c")
- input()
- sys.exit()
- print("[*]Cryptage ...")
- text = FileName.read()
- TextEncode = base64.b64encode(text.encode())
- TextEncode = TextEncode.decode()
- FileCrypted = open(file, 'w')
- FileCrypted.write(TextEncode)
- print("[+]File crypted")
- os.system("color a")
- nameBackup = "backup." + file
- backup = open(nameBackup, 'w')
- backup.write(text)
- input()
- elif int(choix) == 2:
- os.system("cls")
- print("*** Decrypteur ***")
- file = input("File > ")
- try:
- FileName = open(file, 'r')
- print("[+]File correct")
- except:
- print("[-]Wrong file selected")
- os.system("color c")
- input()
- sys.exit()
- print("[*]Decryptage ...")
- text = FileName.read()
- TextDecode = base64.b64decode(text.encode())
- TextDecode = TextDecode.decode()
- FileDeCrypted = open(file, 'w')
- FileDeCrypted.write(TextDecode)
- print("[+]File decrypted")
- os.system("color a")
- nameBackup = "backup." + file
- backup = open(nameBackup, 'w')
- backup.write(text)
- input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement