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()
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



101
102
103
104
105
106
107
# File 'lib/msf/core/opt.rb', line 101

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
95
96
97
98
99
# 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:



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), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html") ⇒ Object



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

def self.RHOST(default=nil, required=true, desc="The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html")
  Msf::OptRhosts.new('RHOSTS', [ required, desc, default ], aliases: [ 'RHOST' ])
end

.RHOSTS(default = nil, required = true, desc = "The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html") ⇒ OptRhosts

Returns:



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

def self.RHOSTS(default= nil, required=true, desc="The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html")
  Msf::OptRhosts.new('RHOSTS', [ required, desc, default ], aliases: [ 'RHOST' ])
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
62
# 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



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

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