import tkinter as tk
import random
import time
import threading
from datetime import datetime


class CyberSystemConsole:

    def __init__(self, root):

        self.root = root

        self.root.title(
            "SYSTEM OPERATIONS // SECURE CONSOLE"
        )

        self.root.configure(
            bg="#050805"
        )

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

        self.running = True
        self.progress = 0

        self.commands = [
            "initializing system modules",
            "checking network interfaces",
            "loading infrastructure services",
            "validating system parameters",
            "scanning active processes",
            "checking server availability",
            "synchronizing configuration",
            "validating backup services",
            "analyzing system resources",
            "checking database connections",
            "updating service registry",
            "verifying security policies",
            "monitoring active sessions",
            "checking communication channels",
            "validating operational status"
        ]

        self.create_interface()

        self.start_terminal()

    # =========================================================
    # INTERFACE
    # =========================================================

    def create_interface(self):

        # HEADER

        header = tk.Frame(
            self.root,
            bg="#020402",
            height=80
        )

        header.pack(
            fill="x"
        )

        header.pack_propagate(
            False
        )

        tk.Label(
            header,
            text="◉ SYSTEM OPERATIONS CONSOLE",
            bg="#020402",
            fg="#00FF66",
            font=("Consolas", 22, "bold")
        ).pack(
            side="left",
            padx=25
        )

        self.clock = tk.Label(
            header,
            text="",
            bg="#020402",
            fg="#00CC55",
            font=("Consolas", 12)
        )

        self.clock.pack(
            side="right",
            padx=25
        )

        # MAIN AREA

        main = tk.Frame(
            self.root,
            bg="#050805"
        )

        main.pack(
            fill="both",
            expand=True
        )

        # TERMINAL

        terminal_frame = tk.Frame(
            main,
            bg="#020402"
        )

        terminal_frame.pack(
            side="left",
            fill="both",
            expand=True,
            padx=(20, 10),
            pady=15
        )

        self.terminal = tk.Text(
            terminal_frame,
            bg="#020402",
            fg="#00FF66",
            insertbackground="#00FF66",
            font=("Consolas", 12),
            borderwidth=0,
            highlightthickness=1,
            highlightbackground="#073D19",
            wrap="word"
        )

        self.terminal.pack(
            fill="both",
            expand=True
        )

        # CONTROL PANEL

        panel = tk.Frame(
            main,
            bg="#071007",
            width=300
        )

        panel.pack(
            side="right",
            fill="y",
            padx=(10, 20),
            pady=15
        )

        panel.pack_propagate(
            False
        )

        tk.Label(
            panel,
            text="SYSTEM STATUS",
            bg="#071007",
            fg="#00FF66",
            font=("Consolas", 14, "bold")
        ).pack(
            pady=(20, 15)
        )

        self.status = tk.Label(
            panel,
            text="● ONLINE",
            bg="#071007",
            fg="#00FF66",
            font=("Consolas", 18, "bold")
        )

        self.status.pack()

        # SEPARATOR

        tk.Frame(
            panel,
            bg="#0B3D1B",
            height=1
        ).pack(
            fill="x",
            padx=25,
            pady=20
        )

        # METRICS

        self.cpu_label = self.create_metric(
            panel,
            "CPU LOAD"
        )

        self.ram_label = self.create_metric(
            panel,
            "MEMORY"
        )

        self.net_label = self.create_metric(
            panel,
            "NETWORK"
        )

        self.tasks_label = self.create_metric(
            panel,
            "ACTIVE TASKS"
        )

        # PROGRESS

        tk.Label(
            panel,
            text="PROCESS EXECUTION",
            bg="#071007",
            fg="#00AA44",
            font=("Consolas", 10, "bold")
        ).pack(
            pady=(30, 5)
        )

        self.progress_label = tk.Label(
            panel,
            text="0%",
            bg="#071007",
            fg="#00FF66",
            font=("Consolas", 28, "bold")
        )

        self.progress_label.pack()

        self.progress_canvas = tk.Canvas(
            panel,
            height=15,
            bg="#020402",
            highlightthickness=0
        )

        self.progress_canvas.pack(
            fill="x",
            padx=25,
            pady=10
        )

        # FOOTER

        footer = tk.Frame(
            self.root,
            bg="#020402",
            height=35
        )

        footer.pack(
            fill="x"
        )

        footer.pack_propagate(
            False
        )

        self.footer_text = tk.Label(
            footer,
            text="SYSTEM READY // MONITORING ACTIVE",
            bg="#020402",
            fg="#008833",
            font=("Consolas", 10),
            anchor="w"
        )

        self.footer_text.pack(
            padx=20,
            fill="both"
        )

        # EXIT BUTTON

        exit_button = tk.Button(
            panel,
            text="[ EXIT CONSOLE ]",
            command=self.close,
            bg="#071007",
            fg="#008833",
            activebackground="#0B1A0E",
            activeforeground="#00FF66",Ay 
            relief="flat",
            font=("Consolas", 10)
        )

        exit_button.pack(
            side="bottom",
            pady=25
        )

    # =========================================================
    # METRIC CREATOR
    # =========================================================

    def create_metric(
        self,
        parent,
        title
    ):

        frame = tk.Frame(
            parent,
            bg="#071007"
        )

        frame.pack(
            fill="x",
            padx=25,
            pady=7
        )

        tk.Label(
            frame,
            text=title,
            bg="#071007",
            fg="#008833",
            font=("Consolas", 9)
        ).pack(
            anchor="w"
        )

        label = tk.Label(
            frame,
            text="--",
            bg="#071007",
            fg="#00FF66",
            font=("Consolas", 14, "bold")
        )

        label.pack(
            anchor="w"
        )

        return label

    # =========================================================
    # TERMINAL ENGINE
    # =========================================================

    def start_terminal(self):

        self.write_line(
            "=============================================="
        )

        self.write_line(
            " SYSTEM OPERATIONS / SECURE ENVIRONMENT"
        )

        self.write_line(
            "=============================================="
        )

        self.write_line("")

        self.write_line(
            "[BOOT] Initializing secure console..."
        )

        self.write_line(
            "[BOOT] Loading operational modules..."
        )

        self.write_line(
            "[BOOT] Establishing monitoring services..."
        )

        self.write_line(
            "[BOOT] System initialization complete."
        )

        self.write_line("")

        self.root.after(
            1000,
            self.generate_logs
        )

        self.update_metrics()

        self.update_clock()

    # =========================================================
    # LOG GENERATOR
    # =========================================================

    def generate_logs(self):

        if not self.running:
            return

        command = random.choice(
            self.commands
        )

        timestamp = datetime.now().strftime(
            "%H:%M:%S"
        )

        self.write_line(
            f"[{timestamp}] "
            f"[SYSTEM] {command}..."
        )

        time.sleep(
            random.uniform(
                0.05,
                0.2
            )
        )

        result = random.choice([
            "OK",
            "COMPLETED",
            "VALIDATED",
            "SUCCESS",
            "ACTIVE"
        ])

        self.write_line(
            f"           └── STATUS: {result}"
        )

        self.write_line("")

        if self.progress < 98:

            self.progress += random.randint(
                1,
                3
            )

        self.progress_label.config(
            text=f"{self.progress}%"
        )

        self.draw_progress()

        self.footer_text.config(
            text=f"SYSTEM ACTIVE // LAST EVENT: {command.upper()}"
        )

        self.root.after(
            random.randint(
                700,
                1800
            ),
            self.generate_logs
        )

    # =========================================================
    # METRICS
    # =========================================================

    def update_metrics(self):

        cpu = random.randint(
            18,
            73
        )

        ram = random.randint(
            32,
            81
        )

        network = random.randint(
            80,
            99
        )

        tasks = random.randint(
            4,
            12
        )

        self.cpu_label.config(
            text=f"{cpu}%"
        )

        self.ram_label.config(
            text=f"{ram}%"
        )

        self.net_label.config(
            text=f"{network} Mbps"
        )

        self.tasks_label.config(
            text=str(tasks)
        )

        self.root.after(
            1500,
            self.update_metrics
        )

    # =========================================================
    # PROGRESS BAR
    # =========================================================

    def draw_progress(self):

        self.progress_canvas.delete(
            "all"
        )

        width = self.progress_canvas.winfo_width()

        if width <= 1:
            width = 230

        filled = (
            width *
            self.progress /
            100
        )

        self.progress_canvas.create_rectangle(
            0,
            0,
            width,
            15,
            fill="#061006",
            outline=""
        )

        self.progress_canvas.create_rectangle(
            0,
            0,
            filled,
            15,
            fill="#00AA44",
            outline=""
        )

    # =========================================================
    # WRITE TERMINAL
    # =========================================================

    def write_line(
        self,
        text
    ):

        self.terminal.insert(
            "end",
            text + "\n"
        )

        self.terminal.see(
            "end"
        )

    # =========================================================
    # CLOCK
    # =========================================================

    def update_clock(self):

        if not self.running:
            return

        current = datetime.now().strftime(
            "%d/%m/%Y  %H:%M:%S"
        )

        self.clock.config(
            text=current
        )

        self.root.after(
            1000,
            self.update_clock
        )

    # =========================================================
    # CLOSE
    # =========================================================

    def close(self):

        self.running = False

        self.root.destroy()


# =============================================================
# MAIN
# =============================================================

if __name__ == "__main__":

    root = tk.Tk()

    app = CyberSystemConsole(
        root
    )

    root.mainloop()

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: