Adds assets to this site excluded scan targets by IP address range.

 @param [String] from Beginning IP address of a range.
 @param [String] to Ending IP address of a range.
9644
def exclude_ip_range(from, to)
      from_ip = IPAddr.new(from)
      to_ip   = IPAddr.new(to)
      (from_ip..to_ip)
      raise 'Invalid IP range specified' if (from_ip..to_ip).to_a.size.zero?
      @excluded_scan_targets[:addresses] << IPRange.new(from, to)
    rescue ArgumentError => e
      raise "#{e.message} in given IP range"
    end
517200
def set_paths(from, to)
      @context ||= context
      from = ensure_leading_slash(from)
      data.merge!(
        "permalink" => from,
        "redirect"  => {
          "from" => from,
          "to"   => to =~ %r!^https?://! ? to : absolute_url(to),
        }
      )
    end
1305817
def next_ip(arg)
      octets = arg.split(/\./, 4).map(&:to_i)
      octets[3] += 1
      raise "out of ips!" if octets[3] > 255
      return octets.map(&:to_s).join(".")
    end
1338903
def add_pages_for_scan!
      @pages_for_scan = []
      @bad_pages = []
      @pages.each do |page|
        @bad_pages << page.page_url unless page.page_a_tags
        next unless page.page_a_tags
        page.home_a.each do |link|
          @pages_for_scan << link
        end
      end
    end
478156
def validate_ip_ranges
      raise ActionController::RoutingError.new('Not Found') unless SalesforceArSync::IPConstraint.new.matches?(request)
    end
343632
function project(value, fromIndex) {
  var index = fromIndex
  var length = value.length
  var size

  while (index < length) {
    if (!projectCharacter(value.charCodeAt(index))) {
      break
    }

    index++
  }

  size = fromIndex - index

  if (
    !size ||
    size > MAX_PROJECT_LENGTH ||
    value.slice(index - GIT_SUFFIX.length, index) === GIT_SUFFIX
  ) {
    return -1
  }

  return index
}
190407
function froms(froms) {
  var args = Array.prototype.splice.call(arguments, 0);
  if (isUndefined(froms)) {
    froms = [];
  }

  if (!isArray(froms)) {
    throw {
      name: 'Error',
      message: 'Argument is not an array',
      arguments: args
    };
  }

  var f = froms
    .filter(function (from) {
      return !isUndefined(from);
    })
    .map(function (from) {
      if (isObject(from)) {
        if (isUndefined(from.target) && isUndefined(from.default)) {
          throw {
            name: 'Error',
            message: 'from.target and from.default are both undefined',
            arguments: args
          };
        }
        if (isUndefined(from.default) && !isString(from.target)) {
          throw {
            name: 'Error',
            message: 'from.target is not a string',
            arguments: args
          };
        }
        return from;
      } else {
        return {
          target: from
        };
      };
    });

  return f;
}
936315
def normalize_ip(ip)
      case ip
      when nil then nil
      when String then IPAddr.new(ip)
      when Integer then IPAddr.new(ip, Socket::AF_INET)
      when IPAddr then ip
      else raise ArgumentError, "IP must be a String, IPAddr, or Integer, not: #{ip.inspect}"
      end
    end
1082370
def add_indirect_path(node, path, params)
      parts = url_parts(path)

      parts.each_with_index do |part, index|
        if has_binding?(part)
          # Strip off {{ and }}
          section_matcher, multipart = binding_extract(part)

          if multipart
            # Match anything for the rest of the url (multiple sections)

            # check that the splat is at the end of the url
            if index != (parts.size-1)
              raise "The splat (*) operator can only be used at the end of a url"
            end

            part = '**'
            index = (index..-1)
          else
            # Match anything in a single section, set the part to be '*'
            part = '*'
          end

          params[section_matcher] = index
        end

        node = (node[part] ||= {})
      end

      node[nil] = params
    end
1330569
final void parseRange(String range) {
		if (range == null) {
			throw new IllegalArgumentException("Invalid IP range");
		}
		
		int index = range.indexOf('/');
		String subnetStr = null;
		if (index == -1) {
			ipAddress = new IPAddress(range);
		} else {
			ipAddress = new IPAddress(range.substring(0, index));
			subnetStr = range.substring(index + 1);
		}
		
		// try to convert the remaining part of the range into a decimal
		// value.
		try {
			if (subnetStr != null) {
				extendedNetworkPrefix = Integer.parseInt(subnetStr);
				if ((extendedNetworkPrefix < 0) || (extendedNetworkPrefix > 32)) {
					throw new IllegalArgumentException("Invalid IP range [" + range + "]");
				}
				ipSubnetMask = computeMaskFromNetworkPrefix(extendedNetworkPrefix);
			}
		} catch (NumberFormatException ex) {
			
			// the remaining part is not a valid decimal value.
			// Check if it's a decimal-dotted notation.
			ipSubnetMask = new IPAddress(subnetStr);
			
			// create the corresponding subnet decimal
			extendedNetworkPrefix = computeNetworkPrefixFromMask(ipSubnetMask);
			if (extendedNetworkPrefix == -1) {
				throw new IllegalArgumentException("Invalid IP range [" + range + "]", ex);
			}
		}
	}
405495
def remove_exclusion(host_or_ip)
      asset = host_or_ip
      unless host_or_ip.respond_to?(:host) || host_or_ip.respond_to?(:from)
        # Attept to convert String to appropriate object.
        asset = HostOrIP.convert(host_or_ip)
      end
      @asset_exclusions = asset_exclusions.reject { |a| a.eql? asset }
    end
76858
public void appendHitRange(int start, int end) {
		hits.add(new Range(start, end));
		ranges = null;//キャッシュをクリア
	}
1335988
def add_range(self, start, stop, step=1, pad=0):
        
        assert start < stop, "please provide ordered node index ranges"
        assert step > 0
        assert pad >= 0
        assert stop - start < 1e9, "range too large"

        if pad > 0 and self.padding is None:
            self.padding = pad
        set.update(self, range(start, stop, step))
356300
def validate_each(record, attribute, value)
      begin
        unless value.blank?
          IPAddr.new(value)
          if options[:no_mask]
            if value =~ /\//
              record.errors[attribute] << (options[:message] || 'must not contain a mask')
            end
          elsif options[:require_mask]
            unless value =~ /\//
              record.errors[attribute] << (options[:message] || 'must contain a mask')
            end
          end
        end
      rescue IPAddr::InvalidAddressError
        record.errors[attribute] << (options[:message] || 'is not a valid IP address')
      end
    end
1116969
def allowed?(to_url, from_url)
      to_url.host.nil? || (to_url.host == from_url.host)
    end
32561
def extract_from(rails_message, format: :full, source: nil)
      from = nil

      # check to see if a source is present, and if it is use the naming convention
      if source.present?
        # we'll set from here, and then fall through
        from = extract_custom(rails_message, "#{source}_from")
      end

      # if a source was specified and value found, from should already be set
      # otherwise we need to fall back to the normal from field
      from ||= rails_message[:from].formatted.first

      # try to do a complex extract on the from, and proceed from there
      from = complex_extract(from)
      return from[:value] if from[:decoded]

      case format
      when :full
        rails_message[:from].formatted.first
      when :name
        rails_message[:from].address_list.addresses.first.name
      when :address
        rails_message[:from].address_list.addresses.first.address
      end
    end
243705
def refresh_whitelisted_ips
      config.allowed_ips.merge(["127.0.0.0/8", "::1/128"])
      config.allowed_ips&.each do |ip|
        begin
          ActiveAccess::Middleware.allow_ip!(ip)
        ensure
          next # windows ruby doesn't have ipv6 support
        end
      end
    end