class CMSScanner::Finders::Finder
Constants
- DIRECT_ACCESS
-
Constants for common
found_by
Attributes
Public Class Methods
Source
# File lib/cms_scanner/finders/finder.rb, line 17 def initialize(target) @target = target end
Public Instance Methods
Source
# File lib/cms_scanner/finders/finder.rb, line 34 def aggressive(_opts = {}); end
@param [ Hash ] _opts
Source
# File lib/cms_scanner/finders/finder.rb, line 48 def browser @browser ||= NS::Browser.instance end
@return [ Browser
]
Source
# File lib/cms_scanner/finders/finder.rb, line 40 def create_progress_bar(opts = {}) bar_opts = { format: '%t %a <%B> (%c / %C) %P%% %e' } bar_opts[:output] = ProgressBarNullOutput unless opts[:show_progression] @progress_bar = ::ProgressBar.create(bar_opts.merge(opts)) end
@param [ Hash ] opts See github.com/jfelchner/ruby-progressbar/wiki/Options @option opts [ Boolean ] :show_progression
@return [ ProgressBar::Base ]
Source
# File lib/cms_scanner/finders/finder.rb, line 59 def found_by(klass = self.class) labels = %w[aggressive passive] caller_locations.each do |call| label = call.label # Since ruby 3.4, the label contains the full name, including module and class # rather than just the method like in ruby < 3.4 label = label[/#(.*)/i, 1] if label.include?('#') next unless labels.include? label title = klass.to_s.demodulize.gsub(/(\d+)[a-z]+/i, '_\0').titleize(keep_id_suffix: true) return "#{title} (#{label.capitalize} Detection)" end nil end
@param [String, Class ] klass @return [ String ]
Source
# File lib/cms_scanner/finders/finder.rb, line 53 def hydra @hydra ||= browser.hydra end
@return [ Typhoeus::Hydra
]
Source
# File lib/cms_scanner/finders/finder.rb, line 31 def passive(_opts = {}); end
@param [ Hash ] _opts
Source
# File lib/cms_scanner/finders/finder.rb, line 22 def titleize # Put a _ char before any digits except those at the end, which will be replaced by a space # Otherwise, class such as Error404Page are returned as Error404 Page instead of Error 404 page # The keep_id_suffix is to concevert classes such as CssId to Css Id instead of Css @titleize ||= self.class.to_s.demodulize.gsub(/(\d+)[a-z]+/i, '_\0').titleize(keep_id_suffix: true) end
@return [ String ] The titleized name of the finder