class CMSScanner::Target::Scope

Scope Implementation

Public Instance Methods

<<(element) click to toggle source
# File lib/cms_scanner/target/scope.rb, line 81
def <<(element)
  if PublicSuffix.valid?(element, ignore_private: true)
    domains << PublicSuffix.parse(element, ignore_private: true)
  else
    invalid_domains << element
  end
end
domains() click to toggle source

@return [ Array<PublicSuffix::Domain> ] The valid domains in scope

# File lib/cms_scanner/target/scope.rb, line 72
def domains
  @domains ||= []
end
include?(host) click to toggle source

@return [ Boolean ] Wether or not the host is in the scope

# File lib/cms_scanner/target/scope.rb, line 90
def include?(host)
  if PublicSuffix.valid?(host, ignore_private: true)
    domain = PublicSuffix.parse(host, ignore_private: true)

    domains.each { |d| return true if domain.match(d) }
  else
    invalid_domains.each { |d| return true if host == d }
  end

  false
end
invalid_domains() click to toggle source

@return [ Array<String> ] The invalid domains in scope (such as IP addresses etc)

# File lib/cms_scanner/target/scope.rb, line 77
def invalid_domains
  @invalid_domains ||= []
end