From ae95f9a954ab3f504e42e1ac615161864cb6dcff Mon Sep 17 00:00:00 2001 From: Wade Date: Thu, 17 Nov 2011 21:09:00 +1000 Subject: [PATCH] fixed bug with hostname not existing in the dns/hosts file --- extensions/console/banners.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/extensions/console/banners.rb b/extensions/console/banners.rb index 3d36bf963..f330fe521 100644 --- a/extensions/console/banners.rb +++ b/extensions/console/banners.rb @@ -61,10 +61,9 @@ module Banners beef_host = configuration.get("beef.http.public") || 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.getaddrinfo(Socket.gethostname, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME).map { |x| x[3] } - interfaces = interfaces << "127.0.0.1" - interfaces.uniq! + 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?} + interfaces.delete_if {|x| x.nil?} # remove if the entry is nill else # the framework will listen on only one interface interfaces = [beef_host] end