lib/wmap/utils/utils.rb
# Perform reverse dns lookup for an IP. Return the found 'hostname' if found, or the original IP if not
Perform reverse dns lookup for an IP. Return the found 'hostname' if found, or the original IP if not
Perform reverse dns lookup for an IP . Return the found ' hostname ' if found or the original IP if not
def reverse_dns_lookup (ip)
		puts "Retrieve the hostname by the reverse DNS lookup on IP: #{ip}"
		hostname = ip
		begin
			hostname = Socket.gethostbyaddr(ip.split('.').collect{ |x| x.to_i}.pack("CCCC"))[0]
			return hostname.downcase
		rescue => ee
			puts "Exception on method reverse_dns_lookup: #{ee}" if @verbose
			return hostname
		end
	end
def reverse_dns_lookup ( ip ) puts "Retrieve the hostname by the reverse DNS lookup on IP: #{ip}" hostname = ip begin hostname = Socket . gethostbyaddr ( ip . split ( '.' ) . collect { | x | x . to_i } . pack ( "CCCC" ) ) [ 0 ] return hostname . downcase rescue => ee puts "Exception on method reverse_dns_lookup: #{ee}" if @verbose return hostname end end
Perform reverse dns lookup for an IP.
Perform reverse dns lookup for an IP .
ip
<not_specific>