Module: CMSScanner::Finders::Finder::SmartURLChecker

Defined in:
lib/cms_scanner/finders/finder/smart_url_checker.rb,
lib/cms_scanner/finders/finder/smart_url_checker/findings.rb

Overview

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

Defined Under Namespace

Classes: Findings

Instance Method Summary collapse

Instance Method Details

#aggressive(opts = {}) ⇒ Array<Finding>

Parameters:

  • opts (Hash) (defaults to: {})

Returns:



43
44
45
46
47
48
49
# 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 = {}) ⇒ Array<String>

Parameters:

  • opts (Hash)

Returns:

  • (Array<String>)

Raises:

  • (NotImplementedError)


54
55
56
# File 'lib/cms_scanner/finders/finder/smart_url_checker.rb', line 54

def aggressive_urls(_opts = {})
  raise NotImplementedError
end

#passive(opts = {}) ⇒ Array<Finding>

Parameters:

  • opts (Hash) (defaults to: {})

Returns:



24
25
26
# 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 = {}) ⇒ Array<String>

Parameters:

  • opts (Hash)

Returns:

  • (Array<String>)


31
32
33
# 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_xpathString

Returns:

  • (String)

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/cms_scanner/finders/finder/smart_url_checker.rb', line 36

def passive_urls_xpath
  raise NotImplementedError
end

#process_urls(_urls, _opts = {}) ⇒ Object

Returns [].

Parameters:

  • urls (Array<String>)
  • opts (Hash)

Returns:

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/cms_scanner/finders/finder/smart_url_checker.rb', line 17

def process_urls(_urls, _opts = {})
  raise NotImplementedError
end