Class: CMSScanner::Controller::Base

Inherits:
Object
  • Object
show all
Includes:
OptParseValidator
Defined in:
lib/cms_scanner/controller.rb

Overview

Base Controller

Direct Known Subclasses

Core, InterestingFiles

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parsed_options=(options) ⇒ Object

Set the parsed options and initialize the browser with them

Parameters:

  • options (Hash)


29
30
31
32
33
# File 'lib/cms_scanner/controller.rb', line 29

def self.parsed_options=(options)
  @@parsed_options = options

  NS::Browser.instance(options)
end

Instance Method Details

#==(other) ⇒ Object



16
17
18
# File 'lib/cms_scanner/controller.rb', line 16

def ==(other)
  self.class == other.class
end

#after_scanObject



14
# File 'lib/cms_scanner/controller.rb', line 14

def after_scan; end

#before_scanObject



10
# File 'lib/cms_scanner/controller.rb', line 10

def before_scan; end

#cli_optionsArray<OptParseValidator::OptBase>

Returns:

  • (Array<OptParseValidator::OptBase>)


8
# File 'lib/cms_scanner/controller.rb', line 8

def cli_options; end

#datastoreHash

Returns:

  • (Hash)


41
42
43
# File 'lib/cms_scanner/controller.rb', line 41

def datastore
  @@datastore ||= {}
end

#formatterFormatter::Base

Returns:



46
47
48
# File 'lib/cms_scanner/controller.rb', line 46

def formatter
  @@formatter ||= NS::Formatter.load(parsed_options[:format], datastore[:views])
end

#output(tpl, vars = {}) ⇒ Void

Returns:

  • (Void)

See Also:

  • Formatter#output


53
54
55
# File 'lib/cms_scanner/controller.rb', line 53

def output(tpl, vars = {})
  formatter.output(*tpl_params(tpl, vars))
end

#parsed_optionsHash

Returns:

  • (Hash)


36
37
38
# File 'lib/cms_scanner/controller.rb', line 36

def parsed_options
  @@parsed_options ||= {}
end

#render(tpl, vars = {}) ⇒ String

Returns:

  • (String)

See Also:

  • Formatter#render


60
61
62
# File 'lib/cms_scanner/controller.rb', line 60

def render(tpl, vars = {})
  formatter.render(*tpl_params(tpl, vars))
end

#runObject



12
# File 'lib/cms_scanner/controller.rb', line 12

def run; end

#targetTarget

Returns:



21
22
23
# File 'lib/cms_scanner/controller.rb', line 21

def target
  @@target ||= NS::Target.new(parsed_options[:url], parsed_options)
end

#user_interaction?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/cms_scanner/controller.rb', line 65

def user_interaction?
  formatter.user_interaction? && !parsed_options[:output]
end