privacy11_installer_script/install.py

218 lines
6.5 KiB
Python
Raw Permalink Normal View History

2025-08-12 19:35:12 +00:00
import tkinter as tk
from tkinter import messagebox
import ctypes
import subprocess
import sys
import os
import platform
def is_admin():
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
if not is_admin():
ctypes.windll.shell32.ShellExecuteW(
None, "runas", sys.executable, " ".join(sys.argv), None, 1)
sys.exit()
class Privacy11Installer:
def __init__(self, root):
self.root = root
self.root.title("Privacy11 Installer")
self.root.geometry("600x400")
self.root.configure(bg="#121212")
self.big_font = ("Segoe UI", 20, "bold")
self.normal_font = ("Segoe UI", 12)
self.frame = tk.Frame(self.root, bg="#121212")
self.frame.pack(expand=True, fill='both')
self.os_version_string, self.win_version = self.get_os_version_string()
if not self.is_supported_os():
messagebox.showerror(
"Unsupported OS",
f"Detected: {self.os_version_string}\n\nPrivacy11 only works on Windows 10 and 11."
)
sys.exit()
self.os_edition = self.detect_edition()
self.show_welcome_page()
def clear_frame(self):
for widget in self.frame.winfo_children():
widget.destroy()
def get_os_version_string(self):
release = platform.release()
win_ver = sys.getwindowsversion()
return f"Windows {release} (build {win_ver.build})", release
def is_supported_os(self):
return self.win_version in ['10', '11']
def show_welcome_page(self):
self.clear_frame()
welcome = tk.Label(
self.frame,
text="Welcome to the Privacy11 installer",
font=self.big_font,
fg="white",
bg="#121212"
)
welcome.pack(pady=20)
desc = tk.Label(
self.frame,
text="Privacy11 is a Windows modification tool that gives a sense of privacy in Windows.",
font=self.normal_font,
fg="white",
bg="#121212",
wraplength=500,
justify="center"
)
desc.pack(pady=20)
version_label = tk.Label(
self.frame,
text=f"Detected OS: {self.os_version_string}",
font=self.normal_font,
fg="green",
bg="#121212"
)
version_label.pack(pady=5)
edition_label = tk.Label(
self.frame,
text=f"Detected Edition: {self.os_edition}",
font=self.normal_font,
fg="green",
bg="#121212"
)
edition_label.pack(pady=5)
next_btn = tk.Button(
self.frame,
text="Next",
command=self.show_actions_page,
bg="#1E88E5",
fg="white",
activebackground="#1565C0",
padx=20,
pady=10
)
next_btn.pack(pady=40)
def show_actions_page(self):
self.clear_frame()
title = tk.Label(
self.frame,
text="The installer will:",
font=self.big_font,
fg="white",
bg="#121212"
)
title.pack(pady=20)
actions = [
"• Disable Windows Updates and debloat the OS",
"• Disable Services related to Telemetry",
"• Apply a custom hosts file, blocking all Microsoft's spyware attempts."
]
for action in actions:
lbl = tk.Label(
self.frame,
text=action,
font=self.normal_font,
fg="white",
bg="#121212",
anchor="w",
justify="left"
)
lbl.pack(anchor="w", padx=50)
next_btn = tk.Button(
self.frame,
text="Next",
command=self.confirm_install,
bg="#1E88E5",
fg="white",
activebackground="#1565C0",
padx=20,
pady=10
)
next_btn.pack(pady=40)
def confirm_install(self):
answer = messagebox.askyesno(
"Confirm", "Do you want to install Privacy11?")
if answer:
self.create_restore_point()
self.run_proper_batch()
def create_restore_point(self):
try:
subprocess.run([
"powershell",
"-Command",
"Checkpoint-Computer -Description 'Privacy11 Restore Point' -RestorePointType 'MODIFY_SETTINGS'"
], check=True)
except subprocess.CalledProcessError:
messagebox.showwarning("Restore Point", "Failed to create restore point.")
def detect_edition(self):
try:
result = subprocess.run(
["powershell", "-Command", "(Get-WmiObject -Class Win32_OperatingSystem).OperatingSystemSKU"],
capture_output=True, text=True, check=True
)
sku = int(result.stdout.strip())
ltsc_skus = [125, 126, 188, 189]
if sku in ltsc_skus:
return "LTSC"
else:
return "Regular"
except:
return "Unknown"
def run_proper_batch(self):
if self.win_version == "10":
folder = "w10"
elif self.win_version == "11":
folder = "w11"
else:
messagebox.showerror("Error", "Unsupported Windows version detected at install stage.")
return
batch_name = "ltsc_batch.bat" if self.os_edition == "LTSC" else "regular_batch.bat"
batch_file = os.path.join("C:\\Privacy11", folder, batch_name)
if not os.path.exists(batch_file):
messagebox.showerror("Error", f"{batch_file} not found!")
return
try:
subprocess.run(["cmd", "/c", batch_file], check=True)
messagebox.showinfo("Reboot", "A reboot is required to complete installation. Click OK to reboot.")
self.root.after(100, self.reboot_system)
except subprocess.CalledProcessError:
messagebox.showerror("Error", f"An error occurred while running {batch_file}")
self.root.quit()
def reboot_system(self):
try:
subprocess.run(["shutdown", "/r", "/t", "0"], check=True)
except subprocess.CalledProcessError:
messagebox.showerror("Error", "Failed to reboot system.")
self.root.quit()
if __name__ == "__main__":
root = tk.Tk()
app = Privacy11Installer(root)
root.mainloop()