105 lines
3.9 KiB
Python
105 lines
3.9 KiB
Python
import sys
|
|
import tkinter as tk
|
|
from tkinter import messagebox
|
|
from license_manager import LicenseManager
|
|
|
|
class KeygenApp:
|
|
def __init__(self, root):
|
|
self.root = root
|
|
self.root.title("ProBackup Key Generator (XP)")
|
|
self.root.geometry("450x250")
|
|
self.root.resizable(False, False)
|
|
|
|
# Center window
|
|
self.center_window()
|
|
|
|
# Styles
|
|
bg_color = "#f0f0f0"
|
|
self.root.configure(bg=bg_color)
|
|
|
|
# Title
|
|
tk.Label(root, text="ProBackup Activation Generator", font=("Arial", 14, "bold"), bg=bg_color).pack(pady=10)
|
|
|
|
# HWID Input
|
|
input_frame = tk.Frame(root, bg=bg_color)
|
|
input_frame.pack(pady=5, padx=20, fill="x")
|
|
|
|
tk.Label(input_frame, text="Machine ID (Paste here):", bg=bg_color).pack(anchor="w")
|
|
self.hwid_entry = tk.Entry(input_frame, font=("Consolas", 10))
|
|
self.hwid_entry.pack(fill="x", pady=2)
|
|
# Add right click menu for paste (optional but helpful on older systems)
|
|
self.create_context_menu(self.hwid_entry)
|
|
|
|
# Generate Button
|
|
self.btn_generate = tk.Button(root, text="GENERATE KEY", command=self.generate_key,
|
|
bg="#4CAF50", fg="white", font=("Arial", 10, "bold"), height=1)
|
|
self.btn_generate.pack(pady=10)
|
|
|
|
# Output
|
|
output_frame = tk.Frame(root, bg=bg_color)
|
|
output_frame.pack(pady=5, padx=20, fill="x")
|
|
|
|
tk.Label(output_frame, text="Activation Key:", bg=bg_color).pack(anchor="w")
|
|
self.key_entry = tk.Entry(output_frame, font=("Consolas", 10), state="readonly", fg="blue")
|
|
self.key_entry.pack(fill="x", pady=2)
|
|
self.create_context_menu(self.key_entry)
|
|
|
|
# Instructions
|
|
tk.Label(root, text="Copy the Activation Key and send it to the user.",
|
|
bg=bg_color, fg="#666666", font=("Arial", 8)).pack(side="bottom", pady=10)
|
|
|
|
def center_window(self):
|
|
self.root.update_idletasks()
|
|
width = self.root.winfo_width()
|
|
height = self.root.winfo_height()
|
|
x = (self.root.winfo_screenwidth() // 2) - (width // 2)
|
|
y = (self.root.winfo_screenheight() // 2) - (height // 2)
|
|
self.root.geometry('{}x{}+{}+{}'.format(width, height, x, y))
|
|
|
|
def create_context_menu(self, widget):
|
|
menu = tk.Menu(self.root, tearoff=0)
|
|
menu.add_command(label="Cut", command=lambda: widget.event_generate("<<Cut>>"))
|
|
menu.add_command(label="Copy", command=lambda: widget.event_generate("<<Copy>>"))
|
|
menu.add_command(label="Paste", command=lambda: widget.event_generate("<<Paste>>"))
|
|
|
|
def show_menu(event):
|
|
menu.post(event.x_root, event.y_root)
|
|
|
|
widget.bind("<Button-3>", show_menu)
|
|
|
|
def generate_key(self):
|
|
hwid = self.hwid_entry.get().strip()
|
|
if not hwid:
|
|
messagebox.showerror("Error", "Please enter a Machine ID first.")
|
|
return
|
|
|
|
try:
|
|
full_sig = LicenseManager.generate_signature(hwid)
|
|
activation_key = full_sig[:32]
|
|
|
|
self.key_entry.config(state="normal")
|
|
self.key_entry.delete(0, tk.END)
|
|
self.key_entry.insert(0, activation_key)
|
|
self.key_entry.config(state="readonly")
|
|
|
|
# Auto copy to clipboard
|
|
self.root.clipboard_clear()
|
|
self.root.clipboard_append(activation_key)
|
|
messagebox.showinfo("Success", "Key generated and copied to clipboard!")
|
|
|
|
except Exception as e:
|
|
messagebox.showerror("Error", "Generasi gagal: {}".format(e))
|
|
|
|
def main():
|
|
root = tk.Tk()
|
|
# Try setting icon if available
|
|
try:
|
|
root.iconbitmap("icon.ico")
|
|
except: pass
|
|
|
|
app = KeygenApp(root)
|
|
root.mainloop()
|
|
|
|
if __name__ == "__main__":
|
|
main()
|