Skip to content

Instantly share code, notes, and snippets.

@leandrozitroc
Created February 14, 2020 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leandrozitroc/67edb60d415957a427e4d5e5091bfebb to your computer and use it in GitHub Desktop.
Save leandrozitroc/67edb60d415957a427e4d5e5091bfebb to your computer and use it in GitHub Desktop.
Sistema Athena
gAAAAABeRWkvftYV6WNNB6Kp2IgggIokX7ZLUrrlb1rGestVp0CifxEptxk79O3oP7smGD6OOiLKJodFOmZN7QElBWkLPqiuvNOuzz7vLrCNEodcTMNLo3s=
F8YLWpibTePEY3wWaRtWUjlbSw9col4P2lv0WzPrTf0=
from cryptography.fernet import Fernet
from password_generator import PasswordGenerator
def write_key():
key = Fernet.generate_key()
with open("key.key", 'wb') as key_file:
key_file.write(key)
write_key()
def cript_arquivo(filename, key):
f = Fernet(key)
try:
with open(filename, 'rb') as file:
file_data = file.read()
data_encripitada = f.encrypt(file_data)
except:
print('Arquivo Inexistente')
else:
with open(filename, 'wb') as file:
file.write(data_encripitada)
def decript_arquivo(filename , key):
f= Fernet(key)
with open(filename, 'rb') as file:
file_data = file.read()
data_decripitada = f.decrypt(file_data)
with open(filename, 'wb') as file:
file.write(data_decripitada)
def gerarsenha():
pwo= PasswordGenerator()
print(f'\33[1;35m A senha segura que o sistema gerou foi:\33[m \33[1;33m{pwo.generate()} \33[m')
#! Python
import sys, pyperclip
todas = {'hotmail': "brasil61241010", 'gmail1': 'brasil61241010', 'gmail2': 'brasil61241010' }
conta = input('Insira a conta: ')
if conta in todas:
pyperclip.copy(todas[conta])
print('Senha copiada')
from senhas.valida import valida
from senhas.luli import *
print('==='* 18)
print('==='* 18)
print('\33[1;34mBem vindo ao sistema Athena\33[m'.center(20 *3))
print('==='* 18)
print('==='* 18)
while True:
print('==='* 18)
print('[1] Gerar Senha: \n'
'[2] Criptografar Arquivo: \n'
'[3] Criptografar Senha: \n'
'[4] Descriptografar Senha: \n'
'[5] Descriptografar Arquivo: \n'
'[6] Sair')
print('==='* 18)
escolha = valida('Digite uma opção: ')
if escolha == 1:
print('==='* 18)
gerarsenha()
elif escolha == 2:
cript_arquivo(input('digite o nome do arquivo que será Encriptado: '), "ccLmrWCJu7vpwaroDuSEjv6amtpLyiY9MI-PS-oWy_4=")
elif escolha == 3:
'cript_senha'
elif escolha == 4:
'decript_senha'
elif escolha == 5:
decript_arquivo(input('Digite o Arquivo que será Decriptado: '), "ccLmrWCJu7vpwaroDuSEjv6amtpLyiY9MI-PS-oWy_4=" )
elif escolha ==6:
print('==='* 18)
print('\33[4;36mObrigado por usar o sistema Athena\33[m ')
break
from cryptography.fernet import Fernet
def write_key():
key = Fernet.generate_key()
with open("key.key", 'wb') as key_file:
key_file.write(key)
write_key()
def cript_arquivo(filename, key):
f = Fernet(key)
with open (filename, 'rb') as file:
file_data = file.read()
data_encripitada = f.encrypt(file_data)
with open(filename, 'wb') as file:
file.write(data_encripitada)
caraio('key', 'hbZuAGdHuwnYKk-Y8gR2B05ADqwRdh4C3AZlYsI5DJI=')
def valida(msg):
while True:
try:
n=int(input(msg))
except (ValueError, TypeError):
print('Favor Insira um numero inteiro valido: ')
else:
if n <= 6:
return n
else:
print('Digite uma das opções acima: ')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment