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