Sha256: db7fe9489170dfd1dc459e2d7987f511130e678087d0d594b8e8f2ecf02a4c40

Contents?: true

Size: 1.56 KB

Versions: 20

Compression:

Stored size: 1.56 KB

Contents

require 'cms_scanner/finders/finder/smart_url_checker/findings'

module CMSScanner
  module Finders
    class Finder
      # 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
      module SmartURLChecker
        # @param [ Array<String> ] urls
        # @param [ Hash ] opts
        #
        # @return []
        def process_urls(_urls, _opts = {})
          raise NotImplementedError
        end

        # @param [ Hash ] opts
        #
        # @return [ Array<Finding> ]
        def passive(opts = {})
          process_urls(passive_urls(opts), opts)
        end

        # @param [ Hash ] opts
        #
        # @return [ Array<String> ]
        def passive_urls(_opts = {})
          target.in_scope_urls(target.homepage_res, passive_urls_xpath)
        end

        # @return [ String ]
        def passive_urls_xpath
          raise NotImplementedError
        end

        # @param [ Hash ] opts
        #
        # @return [ Array<Finding> ]
        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

        # @param [ Hash ] opts
        #
        # @return [ Array<String> ]
        def aggressive_urls(_opts = {})
          raise NotImplementedError
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
cms_scanner-0.0.41.10 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.41.9 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.41.8 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.41.7 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.41.6 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.41.5 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.41.4 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.41.3 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.41.2 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.41.1 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.41.0 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.40.3 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.40.2 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.40.1 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.40 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.39.4 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.39.3 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.39.2 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.39.1 lib/cms_scanner/finders/finder/smart_url_checker.rb
cms_scanner-0.0.39.0 lib/cms_scanner/finders/finder/smart_url_checker.rb