lib/cms_scanner.rb in cms_scanner-0.0.18 vs lib/cms_scanner.rb in cms_scanner-0.0.19

- old
+ new

@@ -11,10 +11,11 @@ require 'uri' require 'fileutils' require 'pathname' # Monkey Patches require 'cms_scanner/typhoeus/response' +require 'cms_scanner/typhoeus/hydra' require 'cms_scanner/public_suffix/domain' # Custom Libs require 'cms_scanner/helper' require 'cms_scanner/errors/auth_errors' require 'cms_scanner/cache/typhoeus' @@ -36,10 +37,23 @@ remove_const(:NS) const_set(:NS, base) super(base) end + # Number of requests performed to display at the end of the scan + Typhoeus.on_complete do |response| + self.total_requests += 1 unless response.cached? + end + + def self.total_requests + @@total_requests ||= 0 + end + + def self.total_requests=(value) + @@total_requests = value + end + # Scan class Scan def initialize controllers << NS::Controller::Core.new @@ -57,12 +71,10 @@ formatter.output('@scan_aborted', reason: e.message, trace: e.backtrace, verbose: controllers.first.parsed_options[:verbose]) ensure - # Ensures a clean abort of Hydra Browser.instance.hydra.abort - Browser.instance.hydra.run formatter.beautify end # Used for convenience