Загрузка данных


import tkinter as tk
import random
import threading
import time
import subprocess
import winsound
import os

# =====================================================
# НАСТРОЙКИ
# =====================================================

UNLOCK_CODE = "perec228"
CMD_COUNT = 30

ERROR_CODES = [
    "CRITICAL_PROCESS_DIED",
    "SYSTEM_SERVICE_EXCEPTION",
    "MEMORY_MANAGEMENT",
    "IRQL_NOT_LESS_OR_EQUAL",
    "KERNEL_SECURITY_CHECK_FAILURE",
    "PAGE_FAULT_IN_NONPAGED_AREA"
]

# =====================================================
# CMD СПАМ
# =====================================================

def spawn_cmds():

    for i in range(CMD_COUNT):

        cmd = (
            f'start "" cmd /k "'
            f'title SYSTEM FAILURE && '
            f'mode con: cols=55 lines=14 && '
            f'color 0C && '
            f'echo. && '
            f'echo SYSTEM FAILURE DETECTED && '
            f'echo Loading corrupted modules... && '
            f'echo Kernel panic detected... && '
            f'echo ERROR CODE: 0x{random.randint(100000,999999)} && '
            f'echo MEMORY ACCESS VIOLATION"'
        )

        subprocess.Popen(
            cmd,
            shell=True,
            creationflags=subprocess.CREATE_NEW_CONSOLE
        )

        # звук ошибки cmd
        winsound.MessageBeep(winsound.MB_ICONHAND)

        # медленнее но всё ещё быстро
        time.sleep(0.08)

# =====================================================
# ЗВУК BSOD
# =====================================================

def play_bsod_sound():

    sound = r"C:\Windows\Media\Windows Critical Stop.wav"

    if os.path.exists(sound):

        winsound.PlaySound(
            sound,
            winsound.SND_FILENAME | winsound.SND_ASYNC
        )

# =====================================================
# CMD -> BSOD
# =====================================================

spawn_cmds()

time.sleep(1)

play_bsod_sound()

# =====================================================
# ОКНО
# =====================================================

root = tk.Tk()

# fullscreen
root.attributes("-fullscreen", True)

# поверх всех окон
root.attributes("-topmost", True)

# убрать рамки
root.overrideredirect(True)

# BSOD цвет
root.configure(bg="#0078D7")

# =====================================================
# ПЕРЕМЕННЫЕ
# =====================================================

percent = 0
stop_code = random.choice(ERROR_CODES)

# =====================================================
# FULLSCREEN TOGGLE
# =====================================================

fullscreen = True

def toggle_fullscreen(event=None):

    global fullscreen

    fullscreen = not fullscreen

    root.attributes("-fullscreen", fullscreen)

root.bind("<F11>", toggle_fullscreen)
root.bind("<Alt-Return>", toggle_fullscreen)

# =====================================================
# ТЕКСТ
# =====================================================

sad_label = tk.Label(
    root,
    text=":(",
    font=("Segoe UI", 130),
    fg="white",
    bg="#0078D7"
)

sad_label.pack(anchor="w", padx=90, pady=(70, 20))

main_text = tk.Label(
    root,
    text=(
        "Your PC ran into a problem and needs to restart.\n"
        "We're just collecting some error info, and then\n"
        "we'll restart for you."
    ),
    font=("Segoe UI", 30),
    fg="white",
    bg="#0078D7",
    justify="left"
)

main_text.pack(anchor="w", padx=90)

percent_label = tk.Label(
    root,
    text="0% complete",
    font=("Segoe UI", 24),
    fg="white",
    bg="#0078D7"
)

percent_label.pack(anchor="w", padx=90, pady=(50, 25))

info_label = tk.Label(
    root,
    text=(
        "For more information about this issue and possible fixes,\n"
        "visit https://www.windows.com/stopcode"
    ),
    font=("Segoe UI", 18),
    fg="white",
    bg="#0078D7",
    justify="left"
)

info_label.pack(anchor="w", padx=90, pady=(10, 10))

stop_label = tk.Label(
    root,
    text=f"Stop code: {stop_code}",
    font=("Segoe UI", 18),
    fg="white",
    bg="#0078D7"
)

stop_label.pack(anchor="w", padx=90)

# =====================================================
# ПОЛЕ ВВОДА
# =====================================================

entry = tk.Entry(
    root,
    font=("Consolas", 24),
    width=20,
    bd=0,
    bg="white",
    fg="black"
)

entry.pack(anchor="w", padx=90, pady=(50, 0))

entry.focus()

# =====================================================
# ПРОЦЕНТЫ
# =====================================================

def update_percent():

    global percent
    global stop_code

    while True:

        percent += random.choice([0, 1, 1, 2])

        if percent >= 100:

            percent = 0

            stop_code = random.choice(ERROR_CODES)

        percent_label.config(
            text=f"{percent}% complete"
        )

        stop_label.config(
            text=f"Stop code: {stop_code}"
        )

        time.sleep(0.15)

# =====================================================
# ПРОВЕРКА КОДА
# =====================================================

def check_code(event=None):

    code = entry.get().strip()

    if code == UNLOCK_CODE:

        root.destroy()

    else:

        entry.delete(0, tk.END)

entry.bind("<Return>", check_code)

# =====================================================
# ПОТОК
# =====================================================

threading.Thread(
    target=update_percent,
    daemon=True
).start()

# =====================================================
# СТАРТ
# =====================================================

root.mainloop()