module CMSScanner::Finders::Finder::SmartURLChecker

Smart URL Checker Typically used when some URLs are potentially in the homepage. If they are found in it, they will be checked in the passive (like a browser/client would do when loading the page). Otherwise they will be checked in the aggressive

Public Instance Methods

aggressive(opts = {}) click to toggle source

@param [ Hash ] opts

@return [ Array<Finding> ]

# File lib/cms_scanner/finders/finder/smart_url_checker.rb, line 43
def aggressive(opts = {})
  # To avoid scanning the same twice
  urls = aggressive_urls(opts)
  urls -= passive_urls(opts) if opts[:mode] == :mixed

  process_urls(urls, opts)
end
aggressive_urls(_opts = {}) click to toggle source

@param [ Hash ] opts

@return [ Array<String> ]

# File lib/cms_scanner/finders/finder/smart_url_checker.rb, line 54
def aggressive_urls(_opts = {})
  raise NotImplementedError
end
passive(opts = {}) click to toggle source

@param [ Hash ] opts

@return [ Array<Finding> ]

# File lib/cms_scanner/finders/finder/smart_url_checker.rb, line 24
def passive(opts = {})
  process_urls(passive_urls(opts), opts)
end
passive_urls(_opts = {}) click to toggle source

@param [ Hash ] opts

@return [ Array<String> ]

# File lib/cms_scanner/finders/finder/smart_url_checker.rb, line 31
def passive_urls(_opts = {})
  target.in_scope_uris(target.homepage_res, passive_urls_xpath).map(&:to_s)
end
passive_urls_xpath() click to toggle source

@return [ String ]

# File lib/cms_scanner/finders/finder/smart_url_checker.rb, line 36
def passive_urls_xpath
  raise NotImplementedError
end
process_urls(_urls, _opts = {}) click to toggle source

@param [ Array<String> ] urls @param [ Hash ] opts

@return []

# File lib/cms_scanner/finders/finder/smart_url_checker.rb, line 17
def process_urls(_urls, _opts = {})
  raise NotImplementedError
end