Class: WPScan::ParsedCli

Inherits:
Object
  • Object
show all
Defined in:
lib/wpscan/parsed_cli.rb

Overview

Holds the parsed CLI options and exposes them via class methods (e.g. #verbose?) rather than from the raw hash. Similar to an OpenStruct but class-wise, with extra logic to push browser-relevant options into the Browser singleton.

Class Method Summary collapse

Class Method Details

.method_missing(method_name, *_args) ⇒ Object

Unknown methods return nil — expected behaviour for option lookups. rubocop:disable Style/MissingRespondToMissing



29
30
31
32
33
# File 'lib/wpscan/parsed_cli.rb', line 29

def self.method_missing(method_name, *_args, &)
  super if method_name == :new

  options[method_name.to_sym]
end

.optionsHash

Returns:

  • (Hash)


9
10
11
# File 'lib/wpscan/parsed_cli.rb', line 9

def self.options
  @options ||= {}
end

.options=(options) ⇒ Object

Sets the CLI options and propagates them to the Browser.

Parameters:

  • options (Hash)


15
16
17
18
19
20
# File 'lib/wpscan/parsed_cli.rb', line 15

def self.options=(options)
  @options = options.dup || {}

  WPScan::Browser.reset
  WPScan::Browser.instance(@options)
end

.verbose?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/wpscan/parsed_cli.rb', line 23

def self.verbose?
  options[:verbose] ? true : false
end