Class: CMSScanner::Finders::Finder

Inherits:
Object
  • Object
show all
Defined in:
lib/cms_scanner/finders/finder.rb,
lib/cms_scanner/finders/finder/enumerator.rb,
lib/cms_scanner/finders/finder/fingerprinter.rb,
lib/cms_scanner/finders/finder/smart_url_checker.rb,
lib/cms_scanner/finders/finder/smart_url_checker/findings.rb,
lib/cms_scanner/finders/finder/breadth_first_dictionary_attack.rb

Overview

Finder

Defined Under Namespace

Modules: BreadthFirstDictionaryAttack, Enumerator, Fingerprinter, SmartURLChecker

Constant Summary collapse

DIRECT_ACCESS =

Constants for common found_by

'Direct Access (Aggressive Detection)'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ Finder

Returns a new instance of Finder.



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

def initialize(target)
  @target = target
end

Instance Attribute Details

#progress_bar ⇒ Object

Returns the value of attribute progress_bar.



15
16
17
# File 'lib/cms_scanner/finders/finder.rb', line 15

def progress_bar
  @progress_bar
end

#target ⇒ Object

Returns the value of attribute target.



15
16
17
# File 'lib/cms_scanner/finders/finder.rb', line 15

def target
  @target
end

Instance Method Details

#aggressive(_opts = {}) ⇒ Object

Parameters:

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


30
# File 'lib/cms_scanner/finders/finder.rb', line 30

def aggressive(_opts = {}); end

#browser ⇒ Browser

Returns:



44
45
46
# File 'lib/cms_scanner/finders/finder.rb', line 44

def browser
  @browser ||= NS::Browser.instance
end

#create_progress_bar(opts = {}) ⇒ ProgressBar::Base

Parameters:

Options Hash (opts):

  • :show_progression (Boolean)

Returns:

  • (ProgressBar::Base)


36
37
38
39
40
41
# File 'lib/cms_scanner/finders/finder.rb', line 36

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

#found_by(klass = self) ⇒ String

Parameters:

  • klass (String, Symbol) (defaults to: self)

Returns:

  • (String)


55
56
57
58
59
60
61
62
63
64
# File 'lib/cms_scanner/finders/finder.rb', line 55

def found_by(klass = self)
  caller_locations.each do |call|
    label = call.label

    next unless %w[aggressive passive].include? label

    return "#{klass.titleize} (#{label.capitalize} Detection)"
  end
  nil
end

#hydra ⇒ Typhoeus::Hydra

Returns:



49
50
51
# File 'lib/cms_scanner/finders/finder.rb', line 49

def hydra
  @hydra ||= browser.hydra
end

#passive(_opts = {}) ⇒ Object

Parameters:

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


27
# File 'lib/cms_scanner/finders/finder.rb', line 27

def passive(_opts = {}); end

#titleize ⇒ String

Returns The titleized name of the finder.

Returns:

  • (String) —

    The titleized name of the finder



22
23
24
# File 'lib/cms_scanner/finders/finder.rb', line 22

def titleize
  self.class.to_s.demodulize.underscore.titleize
end