tuiHoneyPot

front and back end of my TUI honeypot
Log | Files | Refs | README

challenge3.js (1358B)


      1 "use strict"
      2 
      3 document.addEventListener("DOMContentLoaded", init);
      4 
      5 function init() {
      6     const okButton = document.querySelector("button.ok");
      7     const files = document.querySelectorAll(".file");
      8     files.forEach(file => file.addEventListener("click", displayFile));
      9 }
     10 
     11 function displayFile(e) {
     12     console.log(e.target);
     13     let fileName = e.target.textContent;
     14     const fileContent = document.querySelector(".content")
     15 
     16     switch (fileName) {
     17         case "important.txt":
     18             fileContent.innerText = "";
     19             fileContent.innerText = "a very important doc with nothing inside it :) ";
     20             break;
     21         case "user.md":
     22             fileContent.innerText = "";
     23             fileContent.innerText = "# this is you personal notes file!";
     24             break;
     25         case "lfrc":
     26             fileContent.innerText = "";
     27             fileContent.innerText = "# write any changes to the lf file manger to this file";
     28             break;
     29         case "vim":
     30             fileContent.innerText = "";
     31             fileContent.innerText = "vimrc";
     32             break;
     33         case ".bashrc":
     34             fileContent.innerText = "";
     35             fileContent.innerText = "set -o vi";
     36             break;
     37         default:
     38             fileContent.innerText = "";
     39             fileContent.innerText = "https://yewtu.be/watch?v=158bJFTETRI";
     40     }
     41 
     42 
     43 }
     44