Module: Msf::Opt

Defined in:
lib/msf/core/opt.rb

Overview

Builtin framework options with shortcut methods

Examples:

register_options(
  [
    Opt::RHOST,
    Opt::RPORT(21),
  ]
)
register_advanced_options([Opt::Proxies])

Constant Summary collapse

CHOST =
CHOST()
CPORT =
CPORT()
LHOST =
LHOST()
LPORT =
LPORT()
Proxies =
Proxies()
RHOST =
RHOST()
RHOSTS =
RHOSTS()
RHOST_HTTP_URL =
RHOST_HTTP_URL()
RPORT =
RPORT()
SSLVersion =
SSLVersion()

Class Method Summary collapse

Class Method Details

.CHOST(default = nil, required = false, desc = 'The local client address') ⇒ OptAddress

Returns:


17
18
19
# File 'lib/msf/core/opt.rb', line 17

def self.CHOST(default = nil, required = false, desc = 'The local client address')
  Msf::OptAddress.new(__method__.to_s, [ required, desc, default ])
end

.CPORT(default = nil, required = false, desc = 'The local client port') ⇒ OptPort

Returns:


22
23
24
# File 'lib/msf/core/opt.rb', line 22

def self.CPORT(default = nil, required = false, desc = 'The local client port')
  Msf::OptPort.new(__method__.to_s, [ required, desc, default ])
end

.http_header_optionsObject


96
97
98
99
100
101
102
# File 'lib/msf/core/opt.rb', line 96

def self.http_header_options
  [
    OptString.new('HttpHostHeader', 'An optional value to use for the Host HTTP header'),
    OptString.new('HttpCookie', 'An optional value to use for the Cookie HTTP header'),
    OptString.new('HttpReferer', 'An optional value to use for the Referer HTTP header')
  ]
end

.http_proxy_optionsObject


78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/msf/core/opt.rb', line 78

def self.http_proxy_options
  [
    OptString.new('HttpProxyHost', 'An optional proxy server IP address or hostname',
                  aliases: ['PayloadProxyHost']),
    OptPort.new('HttpProxyPort', 'An optional proxy server port',
                aliases: ['PayloadProxyPort']),
    OptString.new('HttpProxyUser', 'An optional proxy server username',
                  aliases: ['PayloadProxyUser'],
                  max_length: Rex::Payloads::Meterpreter::Config::PROXY_USER_SIZE - 1),
    OptString.new('HttpProxyPass', 'An optional proxy server password',
                  aliases: ['PayloadProxyPass'],
                  max_length: Rex::Payloads::Meterpreter::Config::PROXY_PASS_SIZE - 1),
    OptEnum.new('HttpProxyType', 'The type of HTTP proxy',
                enums: ['HTTP', 'SOCKS'],
                aliases: ['PayloadProxyType'])
  ]
end

.LHOST(default = nil, required = true, desc = 'The listen address (an interface may be specified)') ⇒ OptAddressLocal

Returns:


27
28
29
# File 'lib/msf/core/opt.rb', line 27

def self.LHOST(default = nil, required = true, desc = 'The listen address (an interface may be specified)')
  Msf::OptAddressLocal.new(__method__.to_s, [ required, desc, default ])
end

.LPORT(default = nil, required = true, desc = 'The listen port') ⇒ OptPort

Returns:


32
33
34
# File 'lib/msf/core/opt.rb', line 32

def self.LPORT(default = nil, required = true, desc = 'The listen port')
  Msf::OptPort.new(__method__.to_s, [ required, desc, default ])
end

.Proxies(default = nil, required = false, desc = 'A proxy chain of format type:host:port[,type:host:port][...]') ⇒ OptString

Returns:


37
38
39
# File 'lib/msf/core/opt.rb', line 37

def self.Proxies(default = nil, required = false, desc = 'A proxy chain of format type:host:port[,type:host:port][...]')
  Msf::OptString.new(__method__.to_s, [ required, desc, default ])
end

.RHOST(default = nil, required = true, desc = "The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'") ⇒ Object


46
47
48
# File 'lib/msf/core/opt.rb', line 46

def self.RHOST(default = nil, required = true, desc = "The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'")
  Msf::OptAddressRange.new('RHOSTS', [ required, desc, default ], aliases: [ 'RHOST' ])
end

.RHOST_HTTP_URL(default = nil, required = false, desc = 'The target URL, only applicable if there is a single URL') ⇒ Object


62
63
64
# File 'lib/msf/core/opt.rb', line 62

def self.RHOST_HTTP_URL(default = nil, required = false, desc = 'The target URL, only applicable if there is a single URL')
  Msf::OptHTTPRhostURL.new(__method__.to_s, [required, desc, default ])
end

.RHOSTS(default = nil, required = true, desc = "The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'") ⇒ OptAddressRange

Returns:


42
43
44
# File 'lib/msf/core/opt.rb', line 42

def self.RHOSTS(default = nil, required = true, desc = "The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'")
  Msf::OptAddressRange.new('RHOSTS', [ required, desc, default ])
end

.RPORT(default = nil, required = true, desc = 'The target port') ⇒ OptPort

Returns:


51
52
53
# File 'lib/msf/core/opt.rb', line 51

def self.RPORT(default = nil, required = true, desc = 'The target port')
  Msf::OptPort.new(__method__.to_s, [ required, desc, default ])
end

.SSLVersionOptEnum

Returns:


56
57
58
59
60
# File 'lib/msf/core/opt.rb', line 56

def self.SSLVersion
  Msf::OptEnum.new('SSLVersion',
                   'Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate)',
                   enums: Rex::Socket::SslTcp.supported_ssl_methods)
end

.stager_retry_optionsObject


66
67
68
69
70
71
72
73
74
75
76
# File 'lib/msf/core/opt.rb', line 66

def self.stager_retry_options
  [
    OptInt.new('StagerRetryCount',
               'The number of times the stager should retry if the first connect fails',
               default: 10,
               aliases: ['ReverseConnectRetries']),
    OptInt.new('StagerRetryWait',
               'Number of seconds to wait for the stager between reconnect attempts',
               default: 5)
  ]
end