lib/wmap/cidr_tracker.rb
# Determine if a cidr is within the range of our known network CIDR blocks
Determine if a cidr is within the range of our known network CIDR blocks
Determine if a cidr is within the range of our known network CIDR blocks
def cidr_trusted? (cidr)
		puts "Determine if the CIDR within our ranges: #{cidr}" if @verbose
		trusted=false
		cidr=cidr.strip unless cidr.nil?
		cidr=cidr+"/32" if is_ip?(cidr)
		raise "Invalid CIDR format: #{cidr}" unless is_cidr?(cidr)
		return false if @known_cidr_blks==nil
		return true if @known_cidr_blks.key?(cidr)
		@known_cidr_blks_asce_index.each do |line|
			cidr4 = NetAddr::CIDR.create(line)
			return true if cidr4.contains?(cidr)
		end
	rescue => ee
		puts "Exception on method #{__method__}: #{ee}" if @verbose
		return false
	end
def cidr_trusted? ( cidr ) puts "Determine if the CIDR within our ranges: #{cidr}" if @verbose trusted = false cidr = cidr . strip unless cidr . nil? cidr = cidr + "/32" if is_ip? ( cidr ) raise "Invalid CIDR format: #{cidr}" unless is_cidr? ( cidr ) return false if @known_cidr_blks == nil return true if @known_cidr_blks . key? ( cidr ) @known_cidr_blks_asce_index . each do | line | cidr4 = NetAddr :: CIDR . create ( line ) return true if cidr4 . contains? ( cidr ) end rescue => ee puts "Exception on method #{__method__}: #{ee}" if @verbose return false end
Determine if a cidr is within the range of our known network CIDR blocks
Determine if a cidr is within the range of our known network CIDR blocks
cidr
<not_specific>