ASADQI/index_files/main.js.download

469 lines
14 KiB
Plaintext
Raw Normal View History

2023-02-19 20:01:49 +00:00
var before = document.getElementById("before");
var liner = document.getElementById("liner");
var command = document.getElementById("typer");
var textarea = document.getElementById("texter");
var terminal = document.getElementById("terminal");
var git = 0;
var pw = false;
let pwd = false;
var gt = 0;
var wr = false;
let wrd = false;
let wrr = false;
let wrdd = false;
var commands = [];
2023-03-01 23:30:20 +00:00
2023-02-19 20:01:49 +00:00
setTimeout(function() {
loopLines(banner, "", 80);
textarea.focus();
}, 100);
window.addEventListener("keyup", enterKey);
console.log(
"%cYou hacked my password!😠",
"color: #04ff00; font-weight: bold; font-size: 24px;"
);
console.log("%cPassword: '" + password + "' - I wonder what it does?🤔", "color: grey");
console.log(
"%cYou hacked my password!😠",
"color: #04ff00; font-weight: bold; font-size: 24px;"
);
console.log("%cPassword: '" + who + "' - I wonder what it does?🤔", "color: grey");
//init
textarea.value = "";
command.innerHTML = textarea.value;
function enterKey(e) {
if (e.keyCode == 181) {
document.location.reload(true);
}
if (pw) {
let et = "*";
let w = textarea.value.length;
command.innerHTML = et.repeat(w);
if (textarea.value === password) {
pwd = true;
}
if (pwd && e.keyCode == 13) {
loopLines(secret, "color2 margin", 120);
command.innerHTML = "";
textarea.value = "";
pwd = false;
pw = false;
liner.classList.remove("password");
} else if (e.keyCode == 13) {
addLine("Wrong password", "error", 0);
command.innerHTML = "";
textarea.value = "";
pw = false;
liner.classList.remove("password");
}
}
2023-03-01 19:51:45 +00:00
if (wr) {
// Set the command text to the value of the textarea
command.innerHTML = textarea.value;
2023-02-19 20:01:49 +00:00
2023-03-01 19:51:45 +00:00
// Check if the textarea value matches any of the expected values
if (textarea.value === adil || textarea.value === Adil || textarea.value === ADIL) {
wrd = true;
} else if (textarea.value === jaber) {
wrdd = true;
2023-02-19 20:01:49 +00:00
}
2023-03-01 19:51:45 +00:00
// If the textarea value matches, execute the appropriate function
if (wrd && e.keyCode == 13) {
loopLines(whois, social, "color2 margin", 120);
loopLines(social, "color2 margin", 120);
command.innerHTML = "";
textarea.value = "";
wrd = false;
wr = false;
liner.classList.remove("who");
} else if (wrdd && e.keyCode == 13) {
loopLines(jb, "color2 margin", 120);
loopLines(socialjb, "color2 margin", 120);
command.innerHTML = "";
textarea.value = "";
wrdd = false;
wrr = false;
liner.classList.remove("who");
} else if (e.keyCode == 13) {
// If the textarea value doesn't match, display an error message
addLine("We don't know anything about this person yet", "error", 0);
command.innerHTML = "";
textarea.value = "";
wrr = false;
wr = false;
liner.classList.remove("who");
}
}
2023-02-19 20:01:49 +00:00
else {
if (e.keyCode == 13) {
commands.push(command.innerHTML);
git = commands.length;
addLine("visitor@asadqi.com:~$ " + command.innerHTML, "no-animation", 0);
commander(command.innerHTML.toLowerCase());
command.innerHTML = "";
textarea.value = "";
}
if (e.keyCode == 38 && git != 0) {
git -= 1;
textarea.value = commands[git];
command.innerHTML = textarea.value;
}
if (e.keyCode == 40 && git != commands.length) {
git += 1;
if (commands[git] === undefined) {
textarea.value = "";
} else {
textarea.value = commands[git];
}
command.innerHTML = textarea.value;
}
}
}
function commander(cmd) {
switch (cmd.toLowerCase()) {
case "help":
loopLines(help, "color2 margin", 80);
2023-03-01 18:55:59 +00:00
break;
case "menu":
loopLines(help, "color2 margin", 80);
2023-02-19 20:01:49 +00:00
break;
2023-03-14 16:46:47 +00:00
case "ls":
loopLines(help, "color2 margin", 80);
break;
2023-02-19 20:01:49 +00:00
case "root":
loopLines(root, "color2 margin", 80);
break;
case "whois":
loopLines(whois, "color2 margin", 80);
break;
case "adil":
loopLines(whois, "color2 margin", 120);
break;
case "jaber":
addLine("Jaber Sadqi...", "color2", 80);
loopLines(socialjb, "color2 margin", 120);
break;
case "whoami":
loopLines(whoami, "color2 margin", 80);
break;
case "cloud":
addLine("Opening Cloud...", "color2", 80);
newTab(cloud);
break;
case "youtube":
addLine("Opening Youtube...", "color2", 80);
setTimeout(function() {
window.open('https://www.youtube.com');
}, 1000);
2024-04-03 22:02:12 +00:00
break;
case "cv":
addLine("Opening Curriculum Vitae...", "color2", 80);
setTimeout(function() {
window.open('https://asadqi.com/Adil-CV.pdf');
}, 1000);
2023-02-19 20:01:49 +00:00
break;
case "google":
addLine("Opening Google...", "color2", 80);
setTimeout(function() {
window.open('https://www.google.com');
}, 1000);
2023-04-04 16:32:20 +00:00
break;
2024-04-04 07:39:06 +00:00
case "ip":
// Function to fetch the IP address
function getIP(callback){
// Using a free service to fetch the IP address
fetch('https://api.ipify.org?format=json')
.then(response => response.json())
.then(data => callback(data.ip))
.catch(error => callback("Unable to fetch IP address"));
}
// Displaying the IP address
getIP(function(ip){
addLine("Your current IP address is: " + ip, "color2", 80);
});
break;
2024-04-07 00:08:53 +00:00
2024-04-07 00:04:10 +00:00
case "time":
2024-04-07 00:08:53 +00:00
// Function to get current local time and date in UK format
2024-04-07 00:04:10 +00:00
function getCurrentTime() {
const now = new Date();
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric', timeZoneName: 'short' };
2024-04-07 00:08:53 +00:00
const formattedTime = now.toLocaleString('en-GB', options);
2024-04-07 00:11:02 +00:00
addLine("Your Current Local Time : " + formattedTime, "color2", 80);
2024-04-06 23:24:20 +00:00
}
2024-04-07 00:08:53 +00:00
// Displaying the current local time and date in UK format
2024-04-07 00:04:10 +00:00
getCurrentTime();
2024-04-06 23:24:20 +00:00
break;
2024-04-07 00:20:06 +00:00
2024-04-25 20:58:10 +00:00
case "destroy":
2024-04-07 00:20:06 +00:00
// Prank function to randomly change text on the page
function prankFriends() {
// Select all elements on the page
var elements = document.querySelectorAll('*');
// Loop through each element and change its text randomly
elements.forEach(function(element) {
if (element.tagName.toLowerCase() === 'script') return; // Skip script elements
if (element.tagName.toLowerCase() === 'style') return; // Skip style elements
var text = element.innerText.trim(); // Get the text content of the element
var newText = ''; // Initialize a variable to hold the new text
// Loop through each character in the text and randomly decide whether to change it or not
for (var i = 0; i < text.length; i++) {
if (Math.random() < 0.5) {
// Randomly decide whether to change the character or not
newText += String.fromCharCode(text.charCodeAt(i) + Math.floor(Math.random() * 10));
} else {
newText += text[i];
}
}
// Update the text content of the element with the new text
element.innerText = newText;
});
}
// Call the prankFriends function
prankFriends();
break;
2024-04-07 00:27:45 +00:00
case "pin":
2024-04-07 00:31:46 +00:00
// Function to generate a random PIN with a specified number of digits
function generatePIN(numDigits) {
2024-04-07 00:27:45 +00:00
var pin = "";
2024-04-07 00:31:46 +00:00
for (var i = 0; i < numDigits; i++) {
2024-04-07 00:27:45 +00:00
pin += Math.floor(Math.random() * 10); // Append a random digit (0-9) to the PIN
}
return pin;
}
2024-04-07 00:31:46 +00:00
// Prompt the user to enter the number of digits for the PIN
var numDigits = prompt("Enter the number of digits for the PIN:");
2024-04-07 00:27:45 +00:00
2024-04-07 00:31:46 +00:00
// Validate the input
if (numDigits && !isNaN(numDigits) && parseInt(numDigits) > 0) {
// Call the generatePIN function with the specified number of digits
var generatedPIN = generatePIN(parseInt(numDigits));
// Display the generated PIN
addLine("Your generated PIN is: " + generatedPIN, "color2", 80);
} else {
// Display an error message if the input is invalid
addLine("Invalid input. Please enter a valid number of digits.", "color2", 80);
}
2024-04-07 00:27:45 +00:00
break;
2024-04-20 14:59:34 +00:00
case "update":
addLine("Opening Updater...", "color2", 80);
setTimeout(function() {
var url = '/update';
var win = window.open(url, '_self');
if (win) {
win.addEventListener('load', function() {
win.document.documentElement.requestFullscreen();
});
}
}, 1000);
break;
2024-04-07 00:08:53 +00:00
case "sudo":
2023-02-19 20:01:49 +00:00
addLine("Oh no, you're not admin...", "color2", 80);
addLine("---------------------------","color2", 80);
loopLines(help, "color2 margin", 80);
break;
case "version":
2024-04-03 22:09:14 +00:00
addLine("ASCODES v3.0.2", "color2", 80);
2023-02-19 20:01:49 +00:00
setTimeout(function() {
},800);
break;
case "creator":
addLine("Adil Sadqi", "color2", 80);
setTimeout(function() {
},800);
break;
2023-03-01 19:51:45 +00:00
case "exit":
addLine("Thank you for your visit. Goodbye!", "color2", 80);
2023-02-19 20:01:49 +00:00
setTimeout(function() {
2023-03-01 19:51:45 +00:00
window.open('','_parent','');
window.setTimeout(function() {
window.location.href = 'about:blank';
window.close();
}, 500);
}, 2500);
2023-02-19 20:01:49 +00:00
break;
2023-03-01 19:51:45 +00:00
case "close":
addLine("Thank you for your visit. Goodbye!", "color2", 80);
2023-02-19 20:01:49 +00:00
setTimeout(function() {
2023-03-01 19:51:45 +00:00
window.open('','_parent','');
window.setTimeout(function() {
window.location.href = 'about:blank';
window.close();
}, 500);
}, 2500);
2023-02-19 20:01:49 +00:00
break;
2023-04-04 16:32:20 +00:00
case "update1":
2023-02-19 20:01:49 +00:00
loopLines(update, "color2 margin", 1000);
2023-03-01 23:30:20 +00:00
setTimeout(function() {
location.reload();
}, 17000);
break;
2023-02-19 20:01:49 +00:00
case "social":
loopLines(social, "color2 margin", 80);
break;
case "secret":
liner.classList.add("password");
pw = true;
break;
case "projects":
loopLines(projects, "color2 margin", 80);
break;
case "password":
addLine("<span class=\"inherit\"> Lol! You're joking, right? You\'re gonna have to try harder than that!😂</span>", "error", 100);
break;
case "weather":
loopLines(weather, "color2 margin", 10);
break;
case "sadqi":
liner.classList.add("who");
wr = true;
wrr = true;
break;
case "history":
addLine("<br>", "", 0);
loopLines(commands, "color2", 80);
addLine("<br>", "command", 80 * commands.length + 50);
break;
case "email":
addLine('Opening mailto:<a href="mailto:adil@asadqi.com.com">adil@asadqi.com</a>...', "color2", 80);
newTab(email);
break;
case "clear":
setTimeout(function() {
terminal.innerHTML = '<a id="before"></a>';
before = document.getElementById("before");
}, 1);
break;
case "banner":
loopLines(banner, "", 80);
break;
// socials
case "cloud":
addLine("Opening Cloud...", "color2", 80);
newTab(cloud);
break;
case "twitter":
addLine("Opening Twitter...", "color2", 0);
newTab(twitter);
break;
case "whatsapp":
addLine("Opening Whatsapp...", "color2", 0);
newTab(whatsapp);
break;
case "discord":
addLine("Opening Discord...", "color2", 0);
newTab(discord);
break;
case "instagram":
addLine("Opening Instagram...", "color2", 0);
newTab(instagram);
break;
case "phone":
addLine("Opening Phone Number...", "color2", 0);
newTab(phone);
break;
2023-04-01 23:21:04 +00:00
case "windows":
2023-04-04 16:32:20 +00:00
addLine("Starting Windows Sadqi...", "color2", 0);
setTimeout(() => {
newTab(website);
}, 2000);
break;
2023-04-01 23:21:04 +00:00
2023-04-04 16:32:20 +00:00
case "curl":
2023-02-19 20:01:49 +00:00
addLine("Opening Website...", "color2", 0);
newTab(curl);
break;
default:
addLine("<span class=\"inherit\">Command not found. For a list of commands, type <span class=\"command\">'help'</span>.</span>", "error", 100);
break;
}
}
function newTab(link) {
setTimeout(function() {
window.open(link, "_blank");
}, 500);
}
function addLine(text, style, time) {
var t = "";
for (let i = 0; i < text.length; i++) {
if (text.charAt(i) == " " && text.charAt(i + 1) == " ") {
t += "&nbsp;&nbsp;";
i++;
} else {
t += text.charAt(i);
}
}
setTimeout(function() {
var next = document.createElement("p");
next.innerHTML = t;
next.className = style;
before.parentNode.insertBefore(next, before);
window.scrollTo(0, document.body.offsetHeight);
}, time);
}
function loopLines(name, style, time) {
name.forEach(function(item, index) {
addLine(item, style, index * time);
});
}
2023-09-10 19:33:37 +00:00
// Function to get the current date and time
function getCurrentDateTime() {
const now = new Date();
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit', second: '2-digit' };
const formattedDateTime = now.toLocaleDateString(undefined, options);
return formattedDateTime;
}
// Function to get the user's local IP address
function getLocalIpAddress() {
return new Promise((resolve, reject) => {
const rtcPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
const connection = new rtcPeerConnection({ iceServers: [] });
connection.createDataChannel("");
connection.createOffer()
.then(offer => connection.setLocalDescription(offer))
.catch(error => reject(error));
connection.onicecandidate = (event) => {
if (event.candidate) {
const ipAddress = event.candidate.candidate.split(" ")[4];
resolve(ipAddress);
connection.onicecandidate = null;
connection.close();
}
};
});
}