From 66cb048ed70bd5a270c1c40bd83e03e16c6537a7 Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Mon, 4 Jun 2018 07:57:21 +0000 Subject: [PATCH] Fix startup banners for public host/port --- core/main/console/banners.rb | 46 ++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/core/main/console/banners.rb b/core/main/console/banners.rb index ea49481ad..041d25eae 100644 --- a/core/main/console/banners.rb +++ b/core/main/console/banners.rb @@ -32,7 +32,7 @@ module Banners version = config.get('beef.version') print_info "Browser Exploitation Framework (BeEF) #{version}" data = "Twit: @beefproject\n" - data += "Site: http://beefproject.com\n" + data += "Site: https://beefproject.com\n" data += "Blog: http://blog.beefproject.com\n" data += "Wiki: https://github.com/beefproject/beef/wiki\n" print_more data @@ -48,9 +48,8 @@ module Banners def print_network_interfaces_count # get the configuration information configuration = BeEF::Core::Configuration.instance - version = BeEF::Core::Configuration.instance.get('beef.version') - beef_host = configuration.get("beef.http.public") || configuration.get("beef.http.host") - + beef_host = configuration.get('beef.http.host') + # create an array of the interfaces the framework is listening on if beef_host == '0.0.0.0' # the framework will listen on all interfaces interfaces = Socket.ip_address_list.map {|x| x.ip_address if x.ipv4?} @@ -58,13 +57,13 @@ module Banners else # the framework will listen on only one interface interfaces = [beef_host] end - + self.interfaces = interfaces - + # output the banner to the console print_info "#{interfaces.count} network interfaces were detected." end - + # # Prints the route to the network interfaces beef has been deployed on. # Looks like that: @@ -78,20 +77,31 @@ module Banners # def print_network_interfaces_routes configuration = BeEF::Core::Configuration.instance - prototxt = configuration.get("beef.http.https.enable") == true ? "https" : "http" - - self.interfaces.map do |host| # display the important URLs on each interface from the interfaces array - print_success "running on network interface: #{host}" - port = configuration.get("beef.http.public_port") || configuration.get("beef.http.port") - data = "Hook URL: #{prototxt}://#{host}:#{port}#{configuration.get("beef.http.hook_file")}\n" - if configuration.get("beef.extension.admin_ui.enable") - data += "UI URL: #{prototxt}://#{host}:#{port}#{configuration.get("beef.http.web_ui_basepath")}/panel\n" - end - + proto = configuration.get("beef.http.https.enable") == true ? 'https' : 'http' + hook_file = configuration.get("beef.http.hook_file") + admin_ui = configuration.get("beef.extension.admin_ui.enable") ? true : false + web_ui_basepath = configuration.get("beef.http.web_ui_basepath") + + # display the hook URL and Admin UI URL on each interface from the interfaces array + self.interfaces.map do |host| + print_info "running on network interface: #{host}" + port = configuration.get("beef.http.port") + data = "Hook URL: #{proto}://#{host}:#{port}#{hook_file}\n" + data += "UI URL: #{proto}://#{host}:#{port}#{web_ui_basepath}/panel\n" if admin_ui + print_more data + end + + # display the public hook URL and Admin UI URL + if configuration.get("beef.http.public") + host = configuration.get('beef.http.public') + port = configuration.get("beef.http.public_port") || configuration.get('beef.http.port') + print_info 'Public:' + data = "Hook URL: #{proto}://#{host}:#{port}#{hook_file}\n" + data += "UI URL: #{proto}://#{host}:#{port}#{web_ui_basepath}/panel\n" if admin_ui print_more data end end - + # # Print loaded extensions #