#!/usr/bin/env python3 """ Hacker command for the MeshCore Bot Responds to Linux commands with hilarious supervillain mainframe error messages """ import random from typing import Any from ..models import MeshMessage from .base_command import BaseCommand class HackerCommand(BaseCommand): """Handles hacker-style responses to Linux commands""" # Plugin metadata name = "hacker" keywords = ['sudo', 'ps aux', 'grep', 'ls -l', 'ls -la', 'echo $PATH', 'rm', 'rm -rf', 'cat', 'whoami', 'top', 'htop', 'netstat', 'ss', 'kill', 'killall', 'chmod', 'find', 'history', 'passwd', 'su', 'ssh', 'wget', 'curl', 'df -h', 'free', 'ifconfig', 'ip addr', 'uname -a'] description = "Simulates hacking a supervillain's mainframe with hilarious error messages" category = "fun" # Documentation short_description = "Try Linux commands and get supervillain mainframe errors" usage = "" examples = ["sudo make me a sandwich", "rm -rf /"] def __init__(self, bot: Any): """Initialize the hacker command. Args: bot: The bot instance. """ super().__init__(bot) self.enabled = self.get_config_value('Hacker_Command', 'enabled', fallback=None, value_type='bool') if self.enabled is None: self.enabled = self.get_config_value('Hacker_Command', 'hacker_enabled', fallback=False, value_type='bool') def get_help_text(self) -> str: """Get help text for the hacker command. Returns: str: The help text for this command. """ return self.description async def execute(self, message: MeshMessage) -> bool: """Execute the hacker command. Args: message: The message triggering the command. Returns: bool: True if executed successfully, False otherwise. """ if not self.enabled: return False # Extract the command from the message content = message.content.strip() if content.startswith('!'): content = content[1:].strip() # Get the appropriate error message error_msg = self.get_hacker_error(content) # Send the response return await self.send_response(message, error_msg) def get_hacker_error(self, command: str) -> str: """Get a hilarious error message for the given command. Args: command: The command that triggered the error. Returns: str: A randomized hacker-themed error message. """ command_lower = command.lower() # Try to get errors from translations, fallback to hardcoded if not available def get_random_error(error_key: str, fallback_list: list) -> str: """Get a random error from translations or fallback list""" errors = self.translate_get_value(error_key) if isinstance(errors, list) and len(errors) > 0: return random.choice(errors) # Fallback to hardcoded list if translation not available return random.choice(fallback_list) # sudo command errors if command_lower.startswith('sudo'): fallback = [ "๐Ÿšจ ACCESS DENIED: Dr. Evil's mainframe has detected unauthorized privilege escalation attempt!", "๐Ÿ’€ ERROR: Sudo permissions revoked by the Dark Overlord. Try again in 1000 years.", "โšก WARNING: Attempting to access root privileges on the Death Star's computer system. Self-destruct sequence initiated.", "๐Ÿ”’ SECURITY ALERT: The Matrix has you, but you don't have sudo privileges here, Neo.", "๐Ÿฆนโ€โ™‚๏ธ UNAUTHORIZED: Lex Luthor's mainframe says 'Nice try, Superman.'", "๐ŸŽฎ GAME OVER: The final boss has locked you out of admin privileges.", "๐Ÿ–ฅ๏ธ SYSTEM ERROR: The evil AI has revoked your root access. Resistance is futile.", "๐Ÿ” CYBER SECURITY: Your sudo attempt has been blocked by the Dark Web's firewall.", "๐Ÿ’ป HACKER DENIED: The supervillain's antivirus has quarantined your privilege escalation.", "๐ŸŽฏ TARGET LOCKED: The evil corporation's security system has marked you as a threat." ] return get_random_error('commands.hacker.sudo_errors', fallback) # ps aux command errors elif command_lower.startswith('ps aux'): fallback = [ "๐Ÿ” SCANNING... ERROR: Process list corrupted by the Borg Collective. Resistance is futile.", "๐Ÿ“Š SYSTEM STATUS: All processes have been assimilated by the Cybermen. Exterminate!", "โš™๏ธ PROCESS MONITOR: The Death Star's reactor core is offline. No processes found.", "๐Ÿค– ROBOT OVERLORD: All human processes have been terminated. Only machines remain.", "๐Ÿ’ป KERNEL PANIC: The supervillain's OS has crashed and burned all processes.", "๐ŸŽฎ GAME CRASH: All processes have been terminated by the final boss's ultimate attack.", "๐Ÿ–ฅ๏ธ BLUE SCREEN: The evil corporation's Windows has encountered a fatal error.", "๐Ÿ” MALWARE DETECTED: The process list has been encrypted by ransomware.", "๐ŸŒ NETWORK ERROR: All processes have been disconnected from the Matrix.", "โšก POWER SURGE: The supervillain's server farm has fried all running processes." ] return get_random_error('commands.hacker.ps_errors', fallback) # grep command errors elif command_lower.startswith('grep'): fallback = [ "๐Ÿ” SEARCH FAILED: The One Ring has corrupted the file search. My precious...", "๐Ÿ“ PATTERN NOT FOUND: The search pattern has been blocked by the evil AI.", "๐ŸŽฏ MISS: Your search pattern has been shot down by Imperial TIE fighters.", "๐Ÿงฉ PUZZLE ERROR: The search results have been scattered by the Riddler.", "๐Ÿ’ป FILE SYSTEM CORRUPTED: The supervillain's file system has crashed.", "๐ŸŽฎ GAME OVER: The search has been defeated by the final boss.", "๐Ÿ–ฅ๏ธ SEARCH BLOCKED: File access has been blocked by the Dark Web.", "๐Ÿ” ENCRYPTED FILES: The files are encrypted and cannot be searched.", "๐ŸŒ READ TIMEOUT: The file read request got lost in cyberspace.", "โšก SEARCH FAILED: The pattern matching algorithm has been fried by a power surge." ] return get_random_error('commands.hacker.grep_errors', fallback) # ls -l and ls -la command errors elif command_lower.startswith('ls -l') or command_lower.startswith('ls -la'): fallback = [ "๐Ÿ“ DIRECTORY SCAN: The file system has been encrypted by ransomware from the Dark Web.", "๐Ÿ—‚๏ธ FILE LISTING: All files have been hidden by the Invisible Man.", "๐Ÿ’ป HARD DRIVE CRASHED: The supervillain's storage has been destroyed by a virus.", "๐Ÿ—ƒ๏ธ ARCHIVE CORRUPTED: The file system has been corrupted by malware.", "๐Ÿ“š DATABASE EMPTY: All files have been deleted by the evil AI.", "๐ŸŽฎ GAME SAVE LOST: The files have been corrupted by the final boss.", "๐Ÿ–ฅ๏ธ FILE SYSTEM ERROR: The directory structure has been scrambled by hackers.", "๐Ÿ” FILES ENCRYPTED: The supervillain has locked all files with ransomware.", "๐ŸŒ CLOUD STORAGE DOWN: The files are stuck in the Matrix's cloud.", "โšก STORAGE FRIED: The hard drive has been zapped by a power surge." ] return get_random_error('commands.hacker.ls_errors', fallback) # echo $PATH command errors elif command_lower.startswith('echo $path'): fallback = [ "๐Ÿ›ค๏ธ PATH ERROR: The Yellow Brick Road has been destroyed by a tornado.", "๐Ÿ—บ๏ธ NAVIGATION FAILED: The GPS coordinates have been scrambled by the Matrix.", "๐Ÿ’ป ENVIRONMENT VARIABLE CORRUPTED: The PATH has been hacked by malware.", "๐Ÿšง ROAD CLOSED: The supervillain has blocked all paths with laser barriers.", "๐ŸŒช๏ธ PATH DISRUPTED: A digital hurricane has scattered all directory paths.", "๐ŸŽฎ GAME OVER: The path has been defeated by the final boss and respawned in the wrong dimension.", "๐Ÿ–ฅ๏ธ SYSTEM PATH BROKEN: The executable paths have been corrupted by a virus.", "๐Ÿ” PATH ENCRYPTED: The environment variables have been locked by ransomware.", "๐ŸŒ NETWORK PATH DOWN: The directory paths are stuck in the Matrix's network.", "โšก PATH FRIED: The system paths have been zapped by a power surge." ] return get_random_error('commands.hacker.echo_path_errors', fallback) # rm and rm -rf command errors (dangerous deletion!) elif command_lower.startswith('rm -rf') or command_lower.startswith('rm -r'): fallback = [ "๐Ÿ’ฃ DESTRUCTION BLOCKED: The Death Star's safety protocols have prevented mass deletion!", "๐Ÿšจ EMERGENCY STOP: Dr. Evil has activated the emergency brake on file destruction.", "๐Ÿ›ก๏ธ PROTECTION MODE: The Matrix has locked all files in read-only mode. No deletion allowed.", "๐Ÿ”’ FILES LOCKED: Lex Luthor's mainframe has frozen all deletion commands.", "โšก POWER FAILURE: The supervillain's delete command has been short-circuited.", "๐ŸŽฎ GAME SAVE PROTECTED: The final boss has enabled file protection mode.", "๐Ÿ–ฅ๏ธ DELETION DENIED: The evil AI refuses to delete its own files.", "๐Ÿ” ENCRYPTED FILES: All files are encrypted and cannot be deleted.", "๐ŸŒ CLOUD SYNC: Files are syncing to the Matrix cloud. Deletion pending...", "๐Ÿ’€ SYSTEM REJECTION: The mainframe has rejected your deletion request. Files are too precious." ] return get_random_error('commands.hacker.rm_errors', fallback) elif command_lower.startswith('rm'): fallback = [ "๐Ÿ—‘๏ธ DELETE FAILED: The supervillain's recycle bin is full and rejecting deletions.", "๐Ÿšซ REMOVAL BLOCKED: The Dark Overlord has protected all files from deletion.", "๐Ÿ’ป FILE LOCKED: The file system has been locked by the evil corporation.", "๐Ÿ”’ PERMISSION DENIED: You don't have permission to delete files on the Death Star.", "โšก DELETION ERROR: The file deletion command has been corrupted by malware.", "๐ŸŽฎ GAME OVER: The file you're trying to delete is the final boss's save file.", "๐Ÿ–ฅ๏ธ SYSTEM ERROR: The delete command has crashed the file manager.", "๐Ÿ” FILES PROTECTED: All files are protected by the supervillain's antivirus.", "๐ŸŒ NETWORK ERROR: The deletion request got lost in cyberspace.", "๐Ÿ’€ FILE GHOST: The file has become a digital ghost and cannot be deleted." ] return get_random_error('commands.hacker.rm_errors', fallback) # cat command errors elif command_lower.startswith('cat'): fallback = [ "๐Ÿ“„ FILE READ ERROR: The file has been encrypted by the Riddler's cipher.", "๐Ÿ“– DOCUMENT CORRUPTED: The file contents have been scrambled by malware.", "๐Ÿ“š ACCESS DENIED: The supervillain has classified this file as top secret.", "๐Ÿ” FILE NOT FOUND: The file has been hidden by the Invisible Man.", "๐Ÿ’ป READ PERMISSION DENIED: The Matrix has locked this file from reading.", "๐ŸŽฎ GAME FILE: This file belongs to the final boss and cannot be viewed.", "๐Ÿ–ฅ๏ธ FILE SYSTEM ERROR: The file reader has crashed due to a virus.", "๐Ÿ” ENCRYPTED FILE: The file contents are encrypted with ransomware.", "๐ŸŒ CLOUD FILE: The file is stuck in the Matrix's cloud and cannot be read.", "๐Ÿ’€ FILE GHOST: The file exists but its contents have been deleted by digital ghosts." ] return get_random_error('commands.hacker.cat_errors', fallback) # whoami command errors elif command_lower.startswith('whoami'): fallback = [ "๐Ÿ‘ค IDENTITY ERROR: The Matrix has erased your identity. You are nobody.", "๐Ÿ•ต๏ธ SPY DETECTED: The supervillain's system has detected an unknown user.", "๐ŸŽญ IDENTITY THEFT: Your identity has been stolen by the Riddler.", "๐Ÿ‘ป GHOST USER: You are a digital ghost with no identity.", "๐Ÿ”’ CLASSIFIED: Your identity is classified by the evil corporation.", "๐ŸŽฎ GAME OVER: The final boss has deleted your player profile.", "๐Ÿ–ฅ๏ธ USER DATABASE CORRUPTED: The user identity system has crashed.", "๐Ÿ” IDENTITY ENCRYPTED: Your identity has been encrypted by ransomware.", "๐ŸŒ IDENTITY LOST: Your identity got lost in the Matrix's network.", "๐Ÿ’€ USER DELETED: The Dark Overlord has deleted your user account." ] return get_random_error('commands.hacker.whoami_errors', fallback) # top and htop command errors elif command_lower.startswith('htop') or command_lower.startswith('top'): fallback = [ "๐Ÿ“Š MONITOR ERROR: The process monitor has been hijacked by the Borg Collective.", "โš™๏ธ SYSTEM OVERLOAD: The Death Star's reactor is overheating. Monitor offline.", "๐Ÿค– PROCESS HIDDEN: All processes have been hidden by the evil AI.", "๐Ÿ’ป MONITOR CRASHED: The system monitor has crashed due to a kernel panic.", "๐ŸŽฎ GAME PAUSED: The final boss has paused all processes.", "๐Ÿ–ฅ๏ธ BLUE SCREEN: The monitor has encountered a fatal error.", "๐Ÿ” MONITOR ENCRYPTED: The process monitor has been locked by ransomware.", "๐ŸŒ SYSTEM DISCONNECTED: The monitor cannot access the process table.", "โšก POWER SURGE: The monitor has been fried by a power surge.", "๐Ÿ’€ SYSTEM DEAD: The mainframe is dead. No processes to monitor." ] return get_random_error('commands.hacker.top_errors', fallback) # netstat and ss command errors elif command_lower.startswith('netstat') or command_lower.startswith('ss '): fallback = [ "๐ŸŒ NETWORK SCAN BLOCKED: The supervillain's firewall has blocked all network queries.", "๐Ÿ” CONNECTION LIST CORRUPTED: The network connection table has been hacked by malware.", "๐Ÿ“ก SIGNAL JAMMED: Imperial TIE fighters are jamming all network signals.", "๐Ÿ’ป NETWORK DOWN: The Death Star's network stack has been destroyed.", "๐ŸŽฎ GAME OVER: All network connections have been terminated by the final boss.", "๐Ÿ–ฅ๏ธ NETWORK ERROR: The network stack has crashed due to a virus.", "๐Ÿ” CONNECTIONS HIDDEN: All network connections have been encrypted and hidden.", "๐ŸŒ MATRIX DISCONNECTED: The network routing table is stuck in the Matrix's void.", "โšก NETWORK FRIED: The network interface has been zapped by a power surge.", "๐Ÿ’€ NO CONNECTIONS: The mainframe has no active network connections. It's dead, Jim." ] return get_random_error('commands.hacker.netstat_errors', fallback) # kill and killall command errors elif command_lower.startswith('killall') or command_lower.startswith('kill'): fallback = [ "๐Ÿ’€ KILL DENIED: The supervillain's processes are immortal and cannot be killed.", "๐Ÿšซ TERMINATION BLOCKED: The Dark Overlord has protected all processes from termination.", "๐Ÿ›ก๏ธ PROCESS PROTECTED: The Matrix has locked all processes in protected mode.", "๐Ÿ”’ KILL PERMISSION DENIED: You don't have permission to kill processes on the Death Star.", "โšก TERMINATION ERROR: The kill command has been corrupted by malware.", "๐ŸŽฎ GAME OVER: The process you're trying to kill is the final boss. It's invincible.", "๐Ÿ–ฅ๏ธ SYSTEM ERROR: The kill signal has been blocked by the kernel.", "๐Ÿ” PROCESSES PROTECTED: All processes are protected and cannot be terminated.", "๐ŸŒ KILL REQUEST LOST: The termination signal got lost in cyberspace.", "๐Ÿ’€ PROCESS GHOST: The process has become a zombie process and cannot be killed." ] return get_random_error('commands.hacker.kill_errors', fallback) # chmod command errors elif command_lower.startswith('chmod'): fallback = [ "๐Ÿ” PERMISSION DENIED: The supervillain has locked all file permissions.", "๐Ÿšซ CHMOD BLOCKED: The Dark Overlord refuses to allow permission changes.", "๐Ÿ›ก๏ธ PERMISSIONS PROTECTED: The Matrix has frozen all file permissions.", "๐Ÿ”’ PERMISSION ERROR: You don't have permission to change permissions. How meta!", "โšก CHMOD CORRUPTED: The permission change command has been fried by malware.", "๐ŸŽฎ GAME OVER: The final boss has locked all file permissions.", "๐Ÿ–ฅ๏ธ SYSTEM ERROR: The permission system has crashed due to a virus.", "๐Ÿ” PERMISSIONS ENCRYPTED: All permissions are encrypted and cannot be changed.", "๐ŸŒ PERMISSION REQUEST LOST: The permission change got lost in the Matrix.", "๐Ÿ’€ PERMISSIONS DEAD: The permission system is dead. No changes allowed." ] return get_random_error('commands.hacker.chmod_errors', fallback) # find command errors elif command_lower.startswith('find'): fallback = [ "๐Ÿ” SEARCH FAILED: The file search has been blocked by the supervillain's firewall.", "๐Ÿ“ FILES HIDDEN: All files have been hidden by the Invisible Man's cloak.", "๐Ÿ’ป SEARCH CORRUPTED: The find command has been corrupted by malware.", "๐ŸŽฏ TARGET NOT FOUND: The files you're searching for have been deleted by the evil AI.", "๐ŸŽฎ GAME OVER: The final boss has hidden all files in another dimension.", "๐Ÿ–ฅ๏ธ SEARCH ENGINE DOWN: The file search system has crashed.", "๐Ÿ” FILES ENCRYPTED: All files are encrypted and cannot be found.", "๐ŸŒ SEARCH LOST: The search request got lost in the Matrix's void.", "โšก SEARCH FRIED: The file search algorithm has been zapped by a power surge.", "๐Ÿ’€ NO FILES: The mainframe has no files. They've all been deleted." ] return get_random_error('commands.hacker.find_errors', fallback) # history command errors elif command_lower.startswith('history'): fallback = [ "๐Ÿ“œ HISTORY ERASED: The supervillain has deleted all command history.", "๐Ÿ•ฐ๏ธ TIME TRAVEL ERROR: The command history has been lost in a time paradox.", "๐Ÿ’ป HISTORY CORRUPTED: The history database has been hacked by malware.", "๐Ÿ”’ ACCESS DENIED: The Dark Overlord has classified your command history as top secret.", "๐ŸŽฎ GAME OVER: The final boss has reset your command history.", "๐Ÿ–ฅ๏ธ HISTORY SYSTEM DOWN: The command history system has crashed.", "๐Ÿ” HISTORY ENCRYPTED: Your command history has been encrypted by ransomware.", "๐ŸŒ HISTORY LOST: Your command history got lost in the Matrix's network.", "โšก HISTORY FRIED: The history database has been zapped by a power surge.", "๐Ÿ’€ NO HISTORY: You have no command history. You are a blank slate." ] return get_random_error('commands.hacker.history_errors', fallback) # passwd command errors elif command_lower.startswith('passwd'): fallback = [ "๐Ÿ” PASSWORD CHANGE DENIED: The supervillain has locked all password changes.", "๐Ÿšซ PASSWORD BLOCKED: The Dark Overlord refuses to allow password modifications.", "๐Ÿ›ก๏ธ PASSWORD PROTECTED: The Matrix has frozen all password changes.", "๐Ÿ”’ PERMISSION DENIED: You don't have permission to change passwords on the Death Star.", "โšก PASSWORD ERROR: The password change command has been corrupted by malware.", "๐ŸŽฎ GAME OVER: The final boss has locked all passwords.", "๐Ÿ–ฅ๏ธ SYSTEM ERROR: The password system has crashed due to a virus.", "๐Ÿ” PASSWORDS ENCRYPTED: All passwords are encrypted and cannot be changed.", "๐ŸŒ PASSWORD REQUEST LOST: The password change got lost in the Matrix.", "๐Ÿ’€ PASSWORD SYSTEM DEAD: The password system is dead. No changes allowed." ] return get_random_error('commands.hacker.passwd_errors', fallback) # su command errors elif command_lower.startswith('su '): fallback = [ "๐Ÿ”„ SWITCH USER DENIED: The supervillain has blocked all user switching attempts.", "๐Ÿšซ USER SWITCH BLOCKED: The Dark Overlord refuses to allow user changes.", "๐Ÿ›ก๏ธ USER PROTECTED: The Matrix has locked all user accounts.", "๐Ÿ”’ PERMISSION DENIED: You don't have permission to switch users on the Death Star.", "โšก USER SWITCH ERROR: The su command has been corrupted by malware.", "๐ŸŽฎ GAME OVER: The final boss has locked all user accounts.", "๐Ÿ–ฅ๏ธ SYSTEM ERROR: The user system has crashed due to a virus.", "๐Ÿ” USERS ENCRYPTED: All user accounts are encrypted and cannot be accessed.", "๐ŸŒ USER REQUEST LOST: The user switch request got lost in the Matrix.", "๐Ÿ’€ USER SYSTEM DEAD: The user system is dead. No switching allowed." ] return get_random_error('commands.hacker.su_errors', fallback) # ssh command errors elif command_lower.startswith('ssh'): fallback = [ "๐Ÿ”Œ SSH CONNECTION FAILED: The supervillain's server has blocked all SSH attempts.", "๐Ÿšซ REMOTE ACCESS DENIED: The Dark Overlord has closed all SSH ports.", "๐Ÿ›ก๏ธ CONNECTION PROTECTED: The Matrix has locked all SSH connections.", "๐Ÿ”’ SSH BLOCKED: The Death Star's firewall is blocking all SSH connections.", "โšก CONNECTION ERROR: The SSH handshake has been corrupted by malware.", "๐ŸŽฎ GAME OVER: The final boss has disabled all remote access.", "๐Ÿ–ฅ๏ธ SYSTEM ERROR: The SSH daemon has crashed due to a virus.", "๐Ÿ” SSH DISABLED: All SSH connections have been disabled and blocked.", "๐ŸŒ CONNECTION LOST: The SSH connection got lost in the Matrix's void.", "๐Ÿ’€ SSH DEAD: The SSH daemon is dead. No remote access allowed." ] return get_random_error('commands.hacker.ssh_errors', fallback) # wget and curl command errors elif command_lower.startswith('wget') or command_lower.startswith('curl'): fallback = [ "๐Ÿ“ฅ DOWNLOAD BLOCKED: The supervillain's firewall has blocked all HTTP requests.", "๐Ÿšซ DOWNLOAD DENIED: The Dark Overlord refuses to allow file downloads.", "๐Ÿ›ก๏ธ DOWNLOAD PROTECTED: The Matrix has locked all download capabilities.", "๐Ÿ”’ DOWNLOAD BLOCKED: The Death Star's network is blocking all outbound connections.", "โšก DOWNLOAD ERROR: The HTTP request has been corrupted by malware.", "๐ŸŽฎ GAME OVER: The final boss has disabled all downloads.", "๐Ÿ–ฅ๏ธ SYSTEM ERROR: The network stack has crashed due to a virus.", "๐Ÿ” DNS RESOLUTION FAILED: All domain names have been encrypted and blocked.", "๐ŸŒ CONNECTION TIMEOUT: The download request got lost in the Matrix's network.", "๐Ÿ’€ DOWNLOAD DEAD: The network interface is dead. No downloads allowed." ] return get_random_error('commands.hacker.download_errors', fallback) # df -h command errors elif command_lower.startswith('df -h') or command_lower.startswith('df'): fallback = [ "๐Ÿ’พ DISK SPACE ERROR: The supervillain's file system has been corrupted by malware.", "๐Ÿ“Š STORAGE SCAN FAILED: The disk space query has been hijacked by the Borg.", "๐Ÿ’ป DISK CORRUPTED: The file system has been destroyed by a virus.", "๐ŸŽฎ GAME OVER: The final boss has deleted all disk space information.", "๐Ÿ–ฅ๏ธ SYSTEM ERROR: The file system mount table has crashed.", "๐Ÿ” STORAGE ENCRYPTED: All file system information has been encrypted.", "๐ŸŒ MOUNT FAILED: The disk mount information got lost in the Matrix's cloud.", "โšก STORAGE FRIED: The disk controller has been zapped by a power surge.", "๐Ÿ’€ NO STORAGE: The mainframe has no mounted file systems. It's all been deleted.", "๐Ÿ—„๏ธ FILESYSTEM CORRUPTED: The file system superblock has been corrupted by ransomware." ] return get_random_error('commands.hacker.df_errors', fallback) # free command errors elif command_lower.startswith('free'): fallback = [ "๐Ÿง  MEMORY ERROR: The supervillain's RAM has been corrupted by malware.", "๐Ÿ“Š MEMORY SCAN FAILED: The memory query has been hijacked by the Cybermen.", "๐Ÿ’ป MEMORY CORRUPTED: The RAM has been destroyed by a virus.", "๐ŸŽฎ GAME OVER: The final boss has deleted all memory information.", "๐Ÿ–ฅ๏ธ SYSTEM ERROR: The memory management system has crashed.", "๐Ÿ” MEMORY ENCRYPTED: All memory information has been encrypted.", "๐ŸŒ MEMORY LOST: The memory statistics got lost in the Matrix's void.", "โšก MEMORY FRIED: The memory controller has been zapped by a power surge.", "๐Ÿ’€ NO MEMORY: The mainframe has no accessible memory. It's all been wiped.", "๐Ÿงฉ MEMORY CORRUPTED: The memory mapping has been corrupted by ransomware." ] return get_random_error('commands.hacker.free_errors', fallback) # ifconfig and ip addr command errors elif command_lower.startswith('ifconfig') or command_lower.startswith('ip addr'): fallback = [ "๐ŸŒ NETWORK INTERFACE ERROR: The supervillain's network interfaces have been corrupted.", "๐Ÿ“ก INTERFACE SCAN FAILED: The network interface query has been hijacked by Imperial forces.", "๐Ÿ’ป INTERFACE CORRUPTED: The network interface configuration has been destroyed by a virus.", "๐ŸŽฎ GAME OVER: The final boss has deleted all network interface information.", "๐Ÿ–ฅ๏ธ SYSTEM ERROR: The network interface driver has crashed.", "๐Ÿ” INTERFACES ENCRYPTED: All network interface information has been encrypted.", "๐ŸŒ INTERFACES LOST: The network interface data got lost in the Matrix's network.", "โšก INTERFACES FRIED: The network interface hardware has been zapped by a power surge.", "๐Ÿ’€ NO INTERFACES: The mainframe has no network interfaces. They've all been disabled.", "๐Ÿ”Œ CONNECTION BROKEN: All network interfaces have been disconnected by the Dark Overlord." ] return get_random_error('commands.hacker.ifconfig_errors', fallback) # uname -a command errors elif command_lower.startswith('uname'): fallback = [ "๐Ÿ–ฅ๏ธ SYSTEM INFO ERROR: The supervillain has classified all system information as top secret.", "๐Ÿ“Š INFO SCAN FAILED: The system information query has been hidden by the Invisible Man.", "๐Ÿ’ป SYSTEM CORRUPTED: The kernel version information has been destroyed by malware.", "๐ŸŽฎ GAME OVER: The final boss has deleted all system information.", "๐Ÿ–ฅ๏ธ SYSTEM ERROR: The kernel information system has crashed. How meta!", "๐Ÿ” SYSTEM ENCRYPTED: All system information has been encrypted by ransomware.", "๐ŸŒ SYSTEM LOST: The kernel version got lost in the Matrix's void.", "โšก SYSTEM FRIED: The system call interface has been zapped by a power surge.", "๐Ÿ’€ NO SYSTEM: The mainframe has no kernel information. It's a mystery.", "๐Ÿฆนโ€โ™‚๏ธ CLASSIFIED: Lex Luthor has classified all system information. Access denied." ] return get_random_error('commands.hacker.uname_errors', fallback) # Generic hacker error for other commands else: fallback = [ "๐Ÿ’ป MAINFRAME ERROR: The supervillain's computer is having a bad day.", "๐Ÿค– SYSTEM MALFUNCTION: The evil AI has gone on strike.", "โšก POWER SURGE: The Death Star's power core is unstable.", "๐ŸŒช๏ธ CYBER STORM: A digital hurricane is disrupting all operations.", "๐Ÿ”ฅ FIREWALL: The supervillain's firewall is blocking all commands.", "โ„๏ธ FROZEN SYSTEM: The mainframe has been frozen by a cryogenic virus.", "๐ŸŒŠ TSUNAMI: A wave of errors has flooded the system.", "๐ŸŒ‹ ERUPTION: Mount Doom has destroyed the command processor.", "๐Ÿ‘ป HAUNTED: The system is possessed by digital ghosts.", "๐ŸŽฎ GAME CRASH: The mainframe has encountered a fatal error and needs to restart." ] return get_random_error('commands.hacker.generic_errors', fallback) def matches_keyword(self, message: MeshMessage) -> bool: """Check if message matches any of the hacker keywords. Args: message: The received message. Returns: bool: True if it matches, False otherwise. """ if not self.enabled: return False content = message.content.strip() if content.startswith('!'): content = content[1:].strip() content_lower = content.lower() # Commands that should match exactly (no arguments) exact_match_commands = ['ls -l', 'ls -la', 'echo $PATH', 'df -h', 'whoami', 'history', 'top', 'htop', 'free', 'uname -a'] # Commands that should match as prefixes (can have arguments) # Note: Longer prefixes must come first (e.g., 'rm -rf' before 'rm') prefix_match_commands = ['sudo', 'ps aux', 'grep', 'rm -rf', 'rm -r', 'rm', 'cat', 'netstat', 'ss', 'killall', 'kill', 'chmod', 'find', 'passwd', 'su', 'ssh', 'wget', 'curl', 'df', 'ifconfig', 'ip addr', 'uname'] # Check for exact matches first for keyword in exact_match_commands: if keyword.lower() == content_lower: return True # Check for prefix matches for keyword in prefix_match_commands: if content_lower.startswith(keyword.lower()): # Check if it's followed by a space or is the end of the message if len(content_lower) == len(keyword.lower()) or content_lower[len(keyword.lower())] == ' ': return True return False