lib/wmap/site_tracker.rb
# Perform local host table reverse lookup for the IP sites, in hope that the hostname could now be resolved since the site was discovered
Perform local host table reverse lookup for the IP sites, in hope that the hostname could now be resolved since the site was discovered
Perform local host table reverse lookup for the IP sites in hope that the hostname could now be resolved since the site was discovered
def resolve_ip_sites
		puts "Resolve sites that contain an IP address. Update the site cache table once a hostname is found in the local host table." if @verbose
		updates=Array.new
		sites=get_ip_sites
		host_tracker=Wmap::HostTracker.instance
		host_tracker.data_dir=@data_dir
		host_tracker.hosts_file = host_tracker.data_dir + "/" + "hosts"
		host_tracker.load_known_hosts_from_file
		sites.map do |site|
			puts "Work on resolve the IP site: #{site}" if @verbose
			ip=url_2_host(site)
			hostname=host_tracker.local_ip_2_host(ip)
			if hostname.nil?
				puts "Can't resolve #{ip} from the local host store. Skip #{site}" if @verbose
			else
				puts "Host-name found for IP #{ip}: #{hostname}" if @verbose
				updates.push(site)
				refresh(site)
			end
		end
		updates.sort!
		puts "The following sites are now refreshed: #{updates}" if @verbose
		host_tracker=nil
		return updates
	rescue Exception => ee
		puts "Exception on method #{__method__}: #{ee}" if @verbose
	end
def resolve_ip_sites puts "Resolve sites that contain an IP address. Update the site cache table once a hostname is found in the local host table." if @verbose updates = Array . new sites = get_ip_sites host_tracker = Wmap :: HostTracker . instance host_tracker . data_dir = @data_dir host_tracker . hosts_file = host_tracker . data_dir + "/" + "hosts" host_tracker . load_known_hosts_from_file sites . map do | site | puts "Work on resolve the IP site: #{site}" if @verbose ip = url_2_host ( site ) hostname = host_tracker . local_ip_2_host ( ip ) if hostname . nil? puts "Can't resolve #{ip} from the local host store. Skip #{site}" if @verbose else puts "Host-name found for IP #{ip}: #{hostname}" if @verbose updates . push ( site ) refresh ( site ) end end updates . sort! puts "The following sites are now refreshed: #{updates}" if @verbose host_tracker = nil return updates rescue Exception => ee puts "Exception on method #{__method__}: #{ee}" if @verbose end
Perform local host table reverse lookup for the IP sites, in hope that the hostname could now be resolved since the site was discovered
Perform local host table reverse lookup for the IP sites in hope that the hostname could now be resolved since the site was discovered