Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #PY3
- import subprocess
- import hashlib
- import base64
- from urllib.request import urlopen
- import tkinter as tk
- from tkinter import messagebox
- def encode_with_hwid(string,hwid_):
- sha = (hashlib.sha512(bytes(str(string).encode('utf-8') + hwid_.encode('utf-8'))).hexdigest())
- return (base64.b64encode(sha.encode('utf-8'))).decode() # SHA 512 Encryption
- def get_hwid():
- return str(subprocess.check_output('wmic csproduct get uuid')).split('\\r\\n')[1].strip('\\r').strip() # WINDOWS SUPPORTED ONLY! so if lin systems are different
- def checkLogin(key):
- HWID = get_hwid()
- ENCODED = (encode_with_hwid(key,HWID))
- if ENCODED in db:
- messagebox.showinfo("Welcome!","You've been logged in successfully!")
- else:
- messagebox.showinfo("Incorrect information!","Either you've inputed the wrong key or it doesn't exist.", icon = 'error')
- return
- # Getting database...
- db = urlopen("https://pastebin.com/raw/j9tEQPt0").read().decode().split()
- # Setting up the GUI
- class loginPage(tk.Frame):
- def __init__(self, master = None):
- tk.Frame.__init__(self,master)
- self.page_settings()
- self.title()
- self.key_label()
- self.key_entry()
- self.login_button()
- self.master.mainloop()
- def page_settings(self):
- self.master.geometry("400x200") # W x H
- self.master.title("Login Page - Example")
- self.master.resizable(width = False, height = False)
- self.master.attributes('-topmost', True)
- self.master.configure(background = 'black')
- def title(self):
- T = tk.Label(self.master, text = "Login Page")
- T.configure(background = 'black', foreground = 'green', font = ('Arial Black',20,'bold','underline'))
- T.place(x = 200, y = 20, anchor = 'center')
- def key_label(self):
- username_field = tk.Label(self.master, text = "Key")
- username_field.configure(background = 'black', foreground = 'white', font = ('Arial Black',12,'bold'))
- username_field.place(x = 0, y = 50)
- required_mark = tk.Label(self.master, text = "*")
- required_mark.configure(background = 'black', foreground = 'red', font = ('Arial Black',12,'bold'))
- required_mark.place(x = 40, y = 50)
- def key_entry(self):
- global entry
- entry = tk.Entry(self.master)
- entry.configure(background = 'black', foreground = 'white', font = ('Arial Black',12,'bold'))
- entry.place(x = 0, y = 80)
- def login_button(self):
- LOGIN_B = tk.Button(self.master, text = "Sign in", command = lambda:checkLogin(entry.get()))
- LOGIN_B.configure(background = 'black', foreground = 'red', font = ('Arial Black',12,'bold'), borderwidth = 0)
- LOGIN_B.place(x = 200, y = 170, anchor = 'center', width = 180)
- mainPage = tk.Tk()
- loginPage(master = mainPage)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement