demos/filter_known_services.rb
# Go through the new scan list and look up for known service from last quarter
Go through the new scan list and look up for known service from last quarter
Go through the new scan list and look up for known service from last quarter
def diff
	host_tracker=Wmap::HostTracker.instance
	f_new = File.open(ARGV[1],'r')
	f_new.each do |line|
		site=line.chomp.strip
		site1=host_tracker.url_2_site(site)
		abort "Error on processing site: #{site}" if site1.nil?
		host=host_tracker.url_2_host(site1)
		abort "Error on processing host: #{host}" if host.nil?
		ip=host_tracker.local_host_2_ip(host)
		ip=host_tracker.host_2_ip(host) if ip.nil?
		abort "Error resolve host: #{host}" if ip.nil?
		port=host_tracker.url_2_port(site1)
		abort "Error retrieve service port on site: #{site}" if port.nil?
		key=ip+":"
		key+=port.to_s
		if @services.key?(key)
			puts "No"
		else
			puts "Yes"
		end
	end
	f_new.close
	host_tracker=nil 
end
def diff host_tracker = Wmap :: HostTracker . instance f_new = File . open ( ARGV [ 1 ] , 'r' ) f_new . each do | line | site = line . chomp . strip site1 = host_tracker . url_2_site ( site ) abort "Error on processing site: #{site}" if site1 . nil? host = host_tracker . url_2_host ( site1 ) abort "Error on processing host: #{host}" if host . nil? ip = host_tracker . local_host_2_ip ( host ) ip = host_tracker . host_2_ip ( host ) if ip . nil? abort "Error resolve host: #{host}" if ip . nil? port = host_tracker . url_2_port ( site1 ) abort "Error retrieve service port on site: #{site}" if port . nil? key = ip + ":" key += port . to_s if @services . key? ( key ) puts "No" else puts "Yes" end end f_new . close host_tracker = nil end
Go through the new scan list and look up for known service from last quarter
Go through the new scan list and look up for known service from last quarter