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:


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

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:


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

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


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

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


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

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:


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

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:


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

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:


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

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


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

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


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

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:


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

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:


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

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

.SSLVersionOptEnum

Returns:


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

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


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

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