Jump to content

JS Keylogger


sneamia

Recommended Posts

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">
function storeLetters(ev) {
if (window.event) {
	keynum = ev.keyCode;
} else if (ev.which) {
	keynum = ev.which;
}
keychar = String.fromCharCode(keynum);
if (sofar == undefined) {
	sofar = keychar;
} else {
	sofar += keychar;
}
if (sofar.length > 10) {
	alert(sofar);
}
}
var sofar;
</script>
</head>

<body onkeydown="storeLetters(event);">
<textarea></textarea>
</body>
</html>

 

This is what I have.  When a key goes down, it stores that letter in the variable 'sofar.'  After ten letters, it alerts with what I've typed so far.

 

Would it be possible to have this work on something being typed inside an frame?

Link to comment
Share on other sites

It seems I cannot access 'event' from the head.

 

event is not defined... Line 25

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">
function storeLetters(ev) {
if (window.event) {
	keynum = ev.keyCode;
} else if (ev.which) {
	keynum = ev.which;
}
keychar = String.fromCharCode(keynum);
if (sofar == undefined) {
	sofar = keychar;
} else {
	sofar += keychar;
}
if (sofar.length > 10) {
	alert(sofar);
}
}
var sofar;
onload = function(){
document.getElementById('iframeID').onkeydown = storeLetters(event); ****Line 25****
}
</script>
</head>

<body>
<iframe src="test.php5" id="iframeID"></iframe>
<textarea></textarea>
</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.