lib/wmap/port_scanner.rb
# Prepare and load the target list from a target file
Prepare and load the target list from a target file
Prepare and load the target list from a target file
def load_target_file (file)
		puts "Preparing the discovery target file: #{file}" if @verbose
		begin
			targets=Array.new
			f=File.open(file,'r')
			f.each do |line|
				line=line.chomp.strip
				next if line.nil?
				next if line.empty?
				next if line =~ /^\s*#/
				line=line.split(',')[0]
				if is_cidr?(line)
					ips=cidr_2_ips(line)
					targets+=ips
				elsif is_ip?(line) or is_fqdn?(line)
					targets.push(line)
				elsif is_url?(line)
					host=url_2_host(line)
					targets.push(host)
				else
					puts "Unknown entry in the seed file: #{line}"
				end
			end
			f.close
			return targets
		rescue Exception => ee
			puts "Error on method #{__method__} on file #{file} exception: #{ee}" if @verbose
			return nil
		end
	end
def load_target_file ( file ) puts "Preparing the discovery target file: #{file}" if @verbose begin targets = Array . new f = File . open ( file , 'r' ) f . each do | line | line = line . chomp . strip next if line . nil? next if line . empty? next if line =~ / ^ \s *# / line = line . split ( ',' ) [ 0 ] if is_cidr? ( line ) ips = cidr_2_ips ( line ) targets += ips elsif is_ip? ( line ) or is_fqdn? ( line ) targets . push ( line ) elsif is_url? ( line ) host = url_2_host ( line ) targets . push ( host ) else puts "Unknown entry in the seed file: #{line}" end end f . close return targets rescue Exception => ee puts "Error on method #{__method__} on file #{file} exception: #{ee}" if @verbose return nil end end
Prepare and load the target list from a target file
Prepare and load the target list from a target file
file
<not_specific>