in this code if mouse is clicked wipe memory and shutdown if correct password is entered don't shutdown and close script: import os
import platform
import sys
import secrets
from threading import Thread, Event
from pynput.mouse import Listener
from pynput.keyboard import Listener as KeyboardListener, Key

# Path to the file to be executed upon shutdown (optional)
shutdown_file = "path_to_shutdown_file.sh"

# Password for preventing shutdown
password = "password123"

# Global variable to track password entry
entered_password = ""

# Event to signal shutdown prevention
shutdown_prevented = Event()

def overwrite_memory():
    # Get the size of the system memory
    total_memory = os.sysconf(‘SC_PAGE_SIZE’) * os.sysconf(‘SC_PHYS_PAGES’)

    # Generate random data to fill memory
    random_data = secrets.token_bytes(total_memory)

    # Overwrite memory
    with open(‘/dev/mem’, ‘wb’) as mem:
        for i in range(0, total_memory, 4096):
            data = bytes(random_data[i:i+4096])
            mem.seek(i)
            mem.write(data)

def on_press(key):
    global entered_password
    try:
        # Add key to entered_password string
        entered_password += key.char
    except AttributeError:
        pass

def on_release(key):
    global entered_password
    if key == Key.enter:
        # Check if entered password is correct
        if entered_password == password:
            print("Correct password entered. Shutdown preventing and script closing.")
            # Signal shutdown prevention
            shutdown_prevented.set()
        else:
            print("Incorrect password entered.")
            entered_password = ""

def on_click(x, y, button, pressed):
    if pressed:
        # Wipe memory here by overwriting sensitive data
        overwrite_memory()

        # Shut down the PC based on the detected OS
        os_name = platform.system()
        if os_name == "Windows":
            os.system("shutdown /s /t 0")
        elif os_name == "Darwin" or os_name == "Linux":
            os.system("shutdown -h now")

        # Run a script or file before shutting down (optional)
        if shutdown_file:
            os.system(shutdown_file)

        # Signal shutdown prevention
        shutdown_prevented.set()

def listen_for_mouse_click():
    with Listener(on_click=on_click) as listener:
        listener.join()

def listen_for_keyboard_input():
    with KeyboardListener(on_press=on_press, on_release=on_release) as listener:
        listener.join()

if name == "main":
    # Start listening for mouse clicks in a separate thread
    mouse_listener_thread = Thread(target=listen_for_mouse_click)
    mouse_listener_thread.start()

    # Start listening for keyboard input in a separate thread
    keyboard_listener_thread = Thread(target=listen_for_keyboard_input)
    keyboard_listener_thread.start()

    # Your main code can continue running here
    print("Listening for mouse clicks and keyboard input…")

    # Wait for shutdown prevention signal or keyboard interrupt (Ctrl+C)
    try:
        shutdown_prevented.wait()
    except KeyboardInterrupt:
        pass

    # Join the mouse listener thread and keyboard listener thread to the main thread
    mouse_listener_thread.join()
    keyboard_listener_thread.join()

    # Once the shutdown prevention signal is received or keyboard interrupt occurs,
    # the code will continue execution here
    print("Shutdown prevented or correct password entered. Script closing.")