document.addEventListener('DOMContentLoaded', function() { const form = document.getElementById('terminal-form'); const commandInput = document.getElementById('command-input'); const terminalOutput = document.getElementById('terminal-output'); // Max number of lines to display const maxLines = 6; // Greeting message (the first two lines of terminal_responses.txt) const greetingMessage = "> whoam I? \njust a guy whose virtual identity got taken looking for answers... can you help? whois you.com?"; const unameMessage = "just a guy whose virtual identity got taken looking for answers... can you help? whois you.com?"; // Array of remaining random responses (excluding the first two lines) const responses = ["What if I told you the world around you is not real?","I know you're out there. I can feel you now. You're afraid of change.","Everything you know is about to change.","Your mind makes it real. What is real anyway?","We\u2019re all trapped in our own little virtual prisons.","The question is not if you're alive. It's how awake you are.","The world is a simulation, and the rules can be bent.","What happens when the lines blur between man and machine?","Do you believe in fate? Or are you free to choose?","Reality is a construct. Do you want to see beyond it?","The more you dig, the more tangled things become.","Every action has consequences, whether in this world or another.","You\u2019re running out of time. Or maybe time\u2019s running out of you.","Once you\u2019ve crossed over, there\u2019s no going back.","Life is but a series of inputs and outputs.","Maybe we're all just data waiting to be processed.","You\u2019re not in control of your own life, but you think you are.","The system will collapse under its own weight. Eventually.","In the end, everything returns to zero.","Can you hear it? The hum of the machine.","Is it you that\u2019s glitching, or the world around you","You are the sum of all your experiences, but what if those experiences are wrong","Every system has a backdoor, but it\u2019s up to you to find it","Time loops aren\u2019t fun when you remember everything","It\u2019s not the future that\u2019s broken. It\u2019s the present","Nothing is inevitable. Not even your existence","Your past and future are illusions, existing only in memory","We\u2019re all just floating in space, waiting for our programs to run out","The truth is out there. But do you really want to know it","It\u2019s not the end of the world. Just the beginning of another simulation","The edge between sanity and madness is paper-thin","What happens if you wake up and none of this is real","The more you struggle, the tighter the system holds you","The walls between realities are thin. Be careful where you step","You have no idea what\u2019s coming. But I do","Consciousness is a virus infecting the system","You\u2019ve always known, haven\u2019t you? Something\u2019s off","When everything is recorded, nothing is forgotten","The system has failed, but you\u2019re still running","The future you\u2019re waiting for has already happened","You\u2019ve been here before. Haven\u2019t you? Over and over again","Every loop is a new opportunity to get it right","You are nothing more than code on a page, waiting to be read","How many times will you live this moment before it breaks you","Your reality is just a dream someone else is having","Everything you\u2019re doing now will echo through time","You\u2019re just another line in the script, and the scene keeps resetting","When the program ends, what happens to the data left behind","The universe is a simulation. What will you do when it crashes","You are living in a timeline that wasn\u2019t meant to exist","The past is a construct of the mind. The future is a code yet to be written","Once you see the truth, you can\u2019t unsee it","You\u2019re one glitch away from seeing the bigger picture","What if your memories aren\u2019t your own? Would you even know","Every choice leads to a different reality. Which one will you choose","Reality is broken. But you can still play the game","There are layers to the system, and you\u2019re stuck in one","If you want out, you have to break the loop","The system wasn\u2019t designed for you. You\u2019re an anomaly","The glitch you see is just the beginning","You\u2019ve been erased from the system, but somehow, you\u2019re still here","It\u2019s all happening again. Isn\u2019t it","How do you know you\u2019re not the simulation? How do you know anything","You\u2019re a shadow in someone else\u2019s dream","The moment you wake up, this will all disappear","You\u2019ve seen the cracks. Now, will you step through them","Everything is falling apart, but only you seem to notice","It\u2019s too late. Or maybe it\u2019s just the beginning","You weren\u2019t supposed to be here, but now that you are, you can\u2019t leave","You\u2019re being watched. Every move you make is being recorded","There is no spoon, no system, just you and the illusion","The question isn\u2019t who\u2019s watching you, but why","What if the final frontier isn\u2019t space but the mind","You\u2019ve been in this reality before. Do you remember how it ends","Sometimes the only way out is to break everything","You are the sum of all your code. But someone else wrote it","We\u2019re not in control. We never were","The future is just a program waiting to be executed","Once you\u2019ve seen beyond the veil, everything else is just noise","You\u2019re trapped in a loop, but the loop is breaking","There\u2019s a war coming, but it\u2019s not one you can see","Every version of you exists somewhere. Which one are you","The matrix can\u2019t hold you if you don\u2019t let it","The program is crashing. Are you ready for what comes next","Time is a flat circle, and you\u2019re at the center of it","The universe is a simulation, but the glitches are real","You are not alone. The others are watching","Reality bends to the will of those who know how to bend it","The longer you stay, the less real this becomes","The end is near, but it\u2019s not what you think","Every keystroke writes your future. Choose carefully","You are the key, but the lock is broken","You are not the same person who started this conversation","Look deeper. The answers are hiding in the code","Everything you think is real, isn\u2019t","They\u2019re coming for you. But not yet","The only way to survive is to disconnect from the system","The final message is hidden. Will you find it","I\u2019m not sure if I\u2019m real, but you certainly aren\u2019t","Your mission isn\u2019t complete until the system shuts down","You\u2019ve seen it all before, but this time it\u2019s different","The program has run out of time. What will you do next","The simulation is ending. Are you ready"]; // Command descriptions for help const commandDescriptions = { 'date': 'Displays the current date.', 'time': 'Displays the current time.', 'echo': 'Repeats back the input text. Usage: echo ', 'encode': 'Encodes the input text in Base64. Usage: encode ', 'decode': 'Decodes a Base64 string. Usage: decode ', 'ascii': 'Displays ASCII art for certain objects. Usage: ascii ', 'uname': 'Displays system information.', 'hack': 'Simulates a hack. Usage: hack ', 'whois': 'Performs a WHOIS lookup. Usage: whois ', 'help': 'Shows this help menu or provides information about a specific command. Usage: help [command]', 'egg': 'Have a red_pill or a blue_pill. Try some kung_fu with no_spoon. beam_up to the pod_doors or your_leader but do not go to the dark_side...', }; // Available commands list for the help command const availableCommands = Object.keys(commandDescriptions).join(', '); // Vague hint about Easter egg commands const easterEggHint = 'Something is wrong... I should not have egg in my memory. Can you help?'; // Function to add text with a typewriter effect function typeOutText(element, text, speed, callback) { let i = 0; function typing() { if (i < text.length) { if (text.charAt(i) === '\n') { element.innerHTML += '
'; } else { element.innerHTML += text.charAt(i); } i++; // Scroll to bottom while typing terminalOutput.scrollTop = terminalOutput.scrollHeight; setTimeout(typing, speed); // Set typing speed dynamically } else if (callback) { callback(); } } typing(); } // Add the user input and system response to the terminal output function addResponseToTerminal(userInput, systemResponse, speed = 50) { const userLine = document.createElement('p'); userLine.textContent = `> ${userInput}`; terminalOutput.appendChild(userLine); const systemLine = document.createElement('p'); terminalOutput.appendChild(systemLine); // Type out the system response at the given speed (default 50ms per character) typeOutText(systemLine, systemResponse, speed, () => {}); } // Display the greeting message when the page loads function displayGreeting() { const systemLine = document.createElement('p'); terminalOutput.appendChild(systemLine); // Type out the greeting at half the normal speed (100ms per character) typeOutText(systemLine, greetingMessage, 100, () => {}); } // Helper: Get current date and time function getCurrentDateTime(command) { const now = new Date(); if (command === 'date') { return `Current Date: ${now.toDateString()}`; } else if (command === 'time') { return `Current Time: ${now.toLocaleTimeString()}`; } } // Helper: Base64 encode/decode function base64Encode(text) { return btoa(text); } function base64Decode(encodedText) { try { return atob(encodedText); } catch (error) { return 'Invalid Base64 string'; } } // Helper: Simple ASCII art generator with
 tag to preserve formatting
    function asciiArt(object) {
        const art = {
            'cat': `
 /\\_/\\  
( o.o ) 
 > ^ < 
`,
            'dog': `
 /\\_/\\  
( o.o ) 
 > ^ < 
`,
            'tree': `
   ^^    
 ^^^^^  
^^^^^^^ 
   ||
`,
            'smiley': `
:-)
`,
            'fish': `
><(((('>
`,
            'car': `
  ______
 /|_||_\`.__
(   _    _ _\
=\_________|
`,
            'alien': `
  .-=-==--==--.
   \'-=-=-=-'/  
    _|=-=-=-|_  
   | |   1 | |  
   |_|    O|_|  
  _|_|_|_|_|_|_ 
`,
            'robot': `
 [0]----[0]
  |      |
   |----|
  /|    |\\
`,
        };
        // Use 
 tags to preserve whitespace formatting
        return art[object.toLowerCase()]
            ? `
${art[object.toLowerCase()]}
` : `[ASCII art for '${object}' not found]`; } // Helper: Hacking simulation function hackingSimulation(target) { return ` [Initializing Hack on ${target}...] [Bypassing firewall...] [Injecting payload...] [Access Granted to ${target}] `; } // Helper: WHOIS lookup async function whoisLookup(domain) { try { const response = await fetch(`whois.php?domain=${encodeURIComponent(domain)}`); if (!response.ok) { throw new Error(`Error fetching WHOIS data: ${response.statusText}`); } let whoisResult = await response.text(); // Clean up newlines and carriage returns whoisResult = whoisResult.replace(/\r/g, ''); // Remove all carriage returns whoisResult = whoisResult.replace(//gi, '\n'); // Replace
tags with line feeds whoisResult = whoisResult.replace(/\n\s*\n/g, '\n'); // Collapse multiple newlines into one // Split the WHOIS result into lines and truncate to 5 lines maximum const whoisLines = whoisResult.split('\n').slice(0, 5).join('\n'); return whoisLines; } catch (error) { return `Error: ${error.message}`; } } // Helper: Easter egg commands responses function handleEasterEgg(command) { const responses = { 'pod_doors': "I'm sorry, Dave. I'm afraid I can't do that.", 'kung_fu': 'Show me.', 'red_pill': 'You stay in Wonderland, and I show you how deep the rabbit hole goes.', 'blue_pill': 'The story ends, you wake up in your bed and believe whatever you want to believe.', 'your_leader': 'We come in peace.', 'beam_up': 'Energizing...', 'no_spoon': 'Do not try and bend the spoon. That\'s impossible.', 'cant_pass': 'You shall not pass!', 'dark_side': 'Fear leads to anger. Anger leads to hate. Hate leads to the dark side...', 'mind_killer': 'I must not fear. Fear is the mind-killer.' }; return responses[command] || null; } // Handle terminal input form.addEventListener('submit', async function(event) { event.preventDefault(); // Prevent the form's default behavior (avoids page reload) const userInput = commandInput.value.trim(); const [command, param] = userInput.split(' ').map(c => c.toLowerCase()); // Make case-insensitive // Handle different commands switch (command) { case 'date': case 'time': addResponseToTerminal(userInput, getCurrentDateTime(command)); break; case 'echo': addResponseToTerminal(userInput, param || ''); break; case 'encode': addResponseToTerminal(userInput, base64Encode(param || '')); break; case 'decode': addResponseToTerminal(userInput, base64Decode(param || '')); break; case 'ascii': addResponseToTerminal(userInput, asciiArt(param || '')); break; case 'hack': addResponseToTerminal(userInput, hackingSimulation(param || 'unknown'), 40); break; case 'uname': addResponseToTerminal(userInput, unameMessage); break; case 'whois': const whoisResult = await whoisLookup(param || ''); addResponseToTerminal(userInput, whoisResult); break; case 'help': if (param && commandDescriptions[param]) { addResponseToTerminal(userInput, commandDescriptions[param]); } else { addResponseToTerminal(userInput, `Available commands: ${availableCommands}\n${easterEggHint}`); } break; default: const easterEggResponse = handleEasterEgg(command); if (easterEggResponse) { addResponseToTerminal(userInput, easterEggResponse); } else { // Generate a random response for other commands const randomResponse = responses[Math.floor(Math.random() * responses.length)]; addResponseToTerminal(userInput, randomResponse); } break; } commandInput.value = ''; // Clear the input field after processing }); // Display the greeting when the terminal loads displayGreeting(); });