加了个UI
import tkinter as tk
from tkinter import messagebox
from hashlib import md5
from Crypto.Hash import keccak
import pyperclip
def md5_hash(msg):
return md5(msg.encode()).hexdigest()
def keccak384_hash(msg):
keccak_hash = keccak.new(digest_bits=384)
keccak_hash.update(msg.encode())
return keccak_hash.hexdigest()
def generate_hashes():
code = entry_code.get()
if not code:
messagebox.showwarning("输入错误", "请输入机器码")
return
try:
old_advanced = md5_hash("61305" + code + "8552")[8:24]
old_pro = md5_hash("2356" + code + "13593")[8:24]
new_advanced = keccak384_hash(code + "hSf(78cvVlS5E")[12:28]
new_pro = keccak384_hash(code + "FF3Go(*Xvbb5s2")[12:28]
label_old_advanced.config(text=old_advanced)
label_old_pro.config(text=old_pro)
label_new_advanced.config(text=new_advanced)
label_new_pro.config(text=new_pro)
except Exception as e:
messagebox.showerror("错误", str(e))
def copy_to_clipboard(hash_value):
pyperclip.copy(hash_value)
# 创建主窗口
root = tk.Tk()
root.title("Finalshell激活码生成器")
# 创建并放置标签和输入框
tk.Label(root, text="输入机器码:").grid(row=0, column=0, padx=10, pady=10)
entry_code = tk.Entry(root)
entry_code.grid(row=0, column=1, padx=10, pady=10)
# 创建并放置按钮
generate_button = tk.Button(root, text="开始生成", command=generate_hashes)
generate_button.grid(row=1, columnspan=3, pady=10)
# 创建并放置哈希结果标签和复制按钮
tk.Label(root, text="旧版高级版:").grid(row=2, column=0, padx=10, pady=5)
label_old_advanced = tk.Label(root, text="")
label_old_advanced.grid(row=2, column=1, padx=10, pady=5)
button_old_advanced = tk.Button(root, text="复制", command=lambda: copy_to_clipboard(label_old_advanced.cget("text")))
button_old_advanced.grid(row=2, column=2, padx=10, pady=5)
tk.Label(root, text="旧版专业版:").grid(row=3, column=0, padx=10, pady=5)
label_old_pro = tk.Label(root, text="")
label_old_pro.grid(row=3, column=1, padx=10, pady=5)
button_old_pro = tk.Button(root, text="复制", command=lambda: copy_to_clipboard(label_old_pro.cget("text")))
button_old_pro.grid(row=3, column=2, padx=10, pady=5)
tk.Label(root, text="新版高级版:").grid(row=4, column=0, padx=10, pady=5)
label_new_advanced = tk.Label(root, text="")
label_new_advanced.grid(row=4, column=1, padx=10, pady=5)
button_new_advanced = tk.Button(root, text="复制", command=lambda: copy_to_clipboard(label_new_advanced.cget("text")))
button_new_advanced.grid(row=4, column=2, padx=10, pady=5)
tk.Label(root, text="新版专业版:").grid(row=5, column=0, padx=10, pady=5)
label_new_pro = tk.Label(root, text="")
label_new_pro.grid(row=5, column=1, padx=10, pady=5)
button_new_pro = tk.Button(root, text="复制", command=lambda: copy_to_clipboard(label_new_pro.cget("text")))
button_new_pro.grid(row=5, column=2, padx=10, pady=5)
# 添加说明信息
tk.Label(root, text="版本号 < 3.9.6(旧版)|版本号 >= 3.9.6(新版)").grid(row=6, columnspan=3, padx=10, pady=10)
# 开始主循环
root.mainloop()