f = Fernet(key) enc = f.encrypt(tfa.encode()) enc = enc.decode() f = open("user_details.txt","w") f.write(email+"\n") f.write(enc+"\n") f.write(str(age)+"\n") f.write(str(rng)+ "\n") f.write(str(target)+"\n") f.close() input("Your PC will restart now. Please save any unsaved work and then press any key. To stop receiving notifications, please run the STOPNOTIF.bat file.") os.system("shutdown -r -t 0") else: workdir = sys.argv[1] f = open(workdir+"\\user_details.txt") readdata= f.readlines() email = readdata[0][:-1] twofaauth = readdata[1][:-1] twofaauth = twofaauth.encode() key = gma() key = key*(32//len(key)) + key[:32%len(key)] key = base64.urlsafe_b64encode(key.encode()) f = Fernet(key) twofaauth = f.decrypt(twofaauth).decode() age = int(readdata[2][:-1]) rng = int(readdata[3][:-1]) target = int(readdata[4][:-1])
break else: continue print("Decoding data...\n[IT]Decodifico i dati") print(key) f = Fernet(key) with open(ifile, "rb") as fi: for line in fi: with open(ofile, "a") as fo: line2 = f.decrypt(line) msg = line2.decode() fo.write(msg) print("Removing encrypted file.\n[IT]Rimuovo il file criptato") os.remove(ifile) f = open("./token.txt", "r+") print("Updating token.txt...") d = f.readlines() f.seek(0) for i in d: x = i.split() y = base64.b64decode(x[2].encode()) z = y.decode() if z != file: f.write(i) f.truncate() f.close() del x, y, z except: print("Errore apertura file") exit(1)