diff --git a/lib/rex/socket.rb b/lib/rex/socket.rb index 0a759e3bbf..231ee49e78 100644 --- a/lib/rex/socket.rb +++ b/lib/rex/socket.rb @@ -135,11 +135,12 @@ module Socket # Wrapper for Resolv.getaddress that takes special care to see if the # supplied address is already a dotted quad, for instance. This is # necessary to prevent calls to gethostbyaddr (which occurs on windows). - # These calls can be quite slow. + # These calls can be quite slow. This also fixes an issue with the + # Resolv.getaddress() call being non-functional on Ruby 1.9.1 (Win32). # def self.getaddress(addr) begin - dotted_ip?(addr) ? addr : Resolv.getaddress(addr) + dotted_ip?(addr) ? addr : self.addr_ntoa( ::Socket.gethostbyname(addr)[3] ) rescue ::ArgumentError # Win32 bug nil end