From d5f0e4cfb490d99a1441b9b4766bc235858392f6 Mon Sep 17 00:00:00 2001 From: Dusk-92 Date: Thu, 27 Aug 2026 15:41:14 +0200 Subject: [PATCH] safety: lock Apply and validate Vanilla client --- setup_tool.py | 258 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 194 insertions(+), 64 deletions(-) diff --git a/setup_tool.py b/setup_tool.py index 70dc41a..28b7cc1 100644 --- a/setup_tool.py +++ b/setup_tool.py @@ -6,6 +6,7 @@ import subprocess import math import re import stat +import struct import tkinter as tk import webbrowser from tkinter import ttk, filedialog, messagebox @@ -213,6 +214,7 @@ class WowSetupTool: self._loaded_settings_dir = None self._loading_settings = False + self._install_in_progress = False self.on_ratio_change() self.build_ui() @@ -621,7 +623,13 @@ class WowSetupTool: self.build_visual_audio_tab(tab_visual_audio) self.build_credits_tab(tab_credits) - ttk.Button(self.root, text="Apply Setup & Tweaks", command=self.run_installation, style="Accent.TButton").pack(pady=10, fill='x', padx=20) + self.apply_button = ttk.Button( + self.root, + text="Apply Setup & Tweaks", + command=self.run_installation, + style="Accent.TButton", + ) + self.apply_button.pack(pady=10, fill='x', padx=20) def build_main_tab(self, parent): ttk.Label(parent, text="Vanilla 1.12 Installation Directory:").pack(anchor='w', pady=(10, 0), padx=10) @@ -1067,21 +1075,111 @@ class WowSetupTool: text_area.config(state='disabled') + def _inspect_wow_executable(self, wow_exe): + """Validate the PE architecture without relying on a version-specific hash.""" + try: + file_size = os.path.getsize(wow_exe) + if file_size < 1024 * 1024: + return False, "WoW.exe is unexpectedly small." + + with open(wow_exe, "rb") as handle: + dos_header = handle.read(64) + if len(dos_header) < 64 or dos_header[:2] != b"MZ": + return False, "WoW.exe is not a valid Windows executable." + + pe_offset = struct.unpack_from(" file_size - 26: + return False, "WoW.exe has an invalid PE header." + + handle.seek(pe_offset) + if handle.read(4) != b"PE\0\0": + return False, "WoW.exe has an invalid PE signature." + + coff = handle.read(20) + if len(coff) != 20: + return False, "WoW.exe has a truncated PE header." + + machine = struct.unpack_from("