Module: CMSScanner::Finders::Finder::Enumerator
- Defined in:
- lib/cms_scanner/finders/finder/enumerator.rb
Overview
Module to provide an easy way to enumerate items such as plugins, themes etc
Instance Method Summary collapse
- #enumerate(target_urls, opts = {}) {|Typhoeus::Response, String| ... } ⇒ Object
- #request_params ⇒ Hash
Instance Method Details
#enumerate(target_urls, opts = {}) {|Typhoeus::Response, String| ... } ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cms_scanner/finders/finder/enumerator.rb', line 12 def enumerate(target_urls, opts = {}) = (total: target_urls.size) if opts[:show_progression] target_urls.each do |url, id| request = browser.forge_request(url, request_params) request.on_complete do |res| .progress += 1 if opts[:show_progression] next if target.homepage_or_404?(res) next if opts[:exclude_content] && res.body.match(opts[:exclude_content]) yield res, id end hydra.queue(request) end hydra.run end |
#request_params ⇒ Hash
34 35 36 37 38 39 |
# File 'lib/cms_scanner/finders/finder/enumerator.rb', line 34 def request_params # disabling the cache, as it causes a 'stack level too deep' exception # with a large number of requests :/ # See https://github.com/typhoeus/typhoeus/issues/408 { cache_ttl: 0 } end |