Class: WPScan::Controller::Base

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

Overview

Base Controller

Constant Summary

Constants included from OptParseValidator

OptParseValidator::VERSION

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.option_parser=(parser) ⇒ Object

Parameters:



35
36
37
# File 'lib/wpscan/controller.rb', line 35

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

.resetObject

Reset all the class attributes. Currently only used in specs.



23
24
25
26
27
# File 'lib/wpscan/controller.rb', line 23

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

Instance Method Details

#==(other) ⇒ Object



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

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

#after_scanObject



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

def after_scan; end

#before_scanObject



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

def before_scan; end

#cli_optionsArray<OptParseValidator::OptBase>

Returns:



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

def cli_options; end

#datastoreHash

Returns:

  • (Hash)


45
46
47
# File 'lib/wpscan/controller.rb', line 45

def datastore
  @@datastore ||= {}
end

#formatterFormatter::Base

Returns:



50
51
52
# File 'lib/wpscan/controller.rb', line 50

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

#option_parserOptParseValidator::OptParser



40
41
42
# File 'lib/wpscan/controller.rb', line 40

def option_parser
  @@option_parser
end

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

Returns:

  • (Void)

See Also:

  • Formatter#output


57
58
59
# File 'lib/wpscan/controller.rb', line 57

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

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

Returns:

  • (String)

See Also:

  • Formatter#render


64
65
66
# File 'lib/wpscan/controller.rb', line 64

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

#runObject



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

def run; end

#targetTarget

Returns:



30
31
32
# File 'lib/wpscan/controller.rb', line 30

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

#tmp_directoryPathname

Returns:

  • (Pathname)


74
75
76
77
78
# File 'lib/wpscan/controller.rb', line 74

def tmp_directory
  return Pathname.new(ENV['TMPDIR']).join(WPScan.app_name) if ENV['TMPDIR']

  WPScan.user_cache_dir
end

#user_interaction?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/wpscan/controller.rb', line 69

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