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, InterestingFindings

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.option_parser=(parser) ⇒ Object

Parameters:

  • parser (OptParsevalidator::OptParser)


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

def self.option_parser=(parser)
  @@option_parser = parser
end

.resetObject

Reset all the class attibutes Currently only used in specs



24
25
26
27
28
# File 'lib/cms_scanner/controller.rb', line 24

def self.reset
  @@target    = nil
  @@datastore = nil
  @@formatter = nil
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/cms_scanner/controller.rb', line 18

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

#after_scanObject



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

def after_scan; end

#before_scanObject



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

def before_scan; end

#cli_optionsArray<OptParseValidator::OptBase>

Returns:

  • (Array<OptParseValidator::OptBase>)


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

def cli_options; end

#datastoreHash

Returns:

  • (Hash)


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

def datastore
  @@datastore ||= {}
end

#formatterFormatter::Base

Returns:



51
52
53
# File 'lib/cms_scanner/controller.rb', line 51

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

#option_parserOptParsevalidator::OptParser

Returns:

  • (OptParsevalidator::OptParser)


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

def option_parser
  @@option_parser
end

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

Returns:

  • (Void)

See Also:

  • Formatter#output


58
59
60
# File 'lib/cms_scanner/controller.rb', line 58

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

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

Returns:

  • (String)

See Also:

  • Formatter#render


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

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

#runObject



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

def run; end

#targetTarget

Returns:



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

def target
  @@target ||= NS::Target.new(NS::ParsedCli.url, NS::ParsedCli.options)
end

#tmp_directoryString

Returns:

  • (String)


75
76
77
# File 'lib/cms_scanner/controller.rb', line 75

def tmp_directory
  File.join('/tmp', NS.app_name)
end

#user_interaction?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/cms_scanner/controller.rb', line 70

def user_interaction?
  formatter.user_interaction? && !NS::ParsedCli.output
end