CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/msf/core/opt.rb
Views: 11780
1
# -*- coding: binary -*-
2
module Msf
3
#
4
# Builtin framework options with shortcut methods
5
#
6
# @example
7
# register_options(
8
# [
9
# Opt::RHOST,
10
# Opt::RPORT(21),
11
# ]
12
# )
13
# register_advanced_options([Opt::Proxies])
14
#
15
module Opt
16
17
# @return [OptAddress]
18
def self.CHOST(default=nil, required=false, desc="The local client address")
19
Msf::OptAddress.new(__method__.to_s, [ required, desc, default ])
20
end
21
22
# @return [OptPort]
23
def self.CPORT(default=nil, required=false, desc="The local client port")
24
Msf::OptPort.new(__method__.to_s, [ required, desc, default ])
25
end
26
27
# @return [OptAddressLocal]
28
def self.LHOST(default=nil, required=true, desc="The listen address (an interface may be specified)")
29
Msf::OptAddressLocal.new(__method__.to_s, [ required, desc, default ])
30
end
31
32
# @return [OptPort]
33
def self.LPORT(default=nil, required=true, desc="The listen port")
34
Msf::OptPort.new(__method__.to_s, [ required, desc, default ])
35
end
36
37
# @return [OptString]
38
def self.Proxies(default=nil, required=false, desc="A proxy chain of format type:host:port[,type:host:port][...]")
39
Msf::OptString.new(__method__.to_s, [ required, desc, default ])
40
end
41
42
# @return [OptRhosts]
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")
44
Msf::OptRhosts.new('RHOSTS', [ required, desc, default ], aliases: [ 'RHOST' ])
45
end
46
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")
48
Msf::OptRhosts.new('RHOSTS', [ required, desc, default ], aliases: [ 'RHOST' ])
49
end
50
51
# @return [OptPort]
52
def self.RPORT(default=nil, required=true, desc="The target port")
53
Msf::OptPort.new(__method__.to_s, [ required, desc, default ])
54
end
55
56
# @return [OptEnum]
57
def self.SSLVersion
58
Msf::OptEnum.new('SSLVersion',
59
'Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate)',
60
enums: Rex::Socket::SslTcp.supported_ssl_methods
61
)
62
end
63
64
def self.stager_retry_options
65
[
66
OptInt.new('StagerRetryCount',
67
'The number of times the stager should retry if the first connect fails',
68
default: 10,
69
aliases: ['ReverseConnectRetries']
70
),
71
OptInt.new('StagerRetryWait',
72
'Number of seconds to wait for the stager between reconnect attempts',
73
default: 5
74
)
75
]
76
end
77
78
def self.http_proxy_options
79
[
80
OptString.new('HttpProxyHost', 'An optional proxy server IP address or hostname',
81
aliases: ['PayloadProxyHost']
82
),
83
OptPort.new('HttpProxyPort', 'An optional proxy server port',
84
aliases: ['PayloadProxyPort']
85
),
86
OptString.new('HttpProxyUser', 'An optional proxy server username',
87
aliases: ['PayloadProxyUser'],
88
max_length: Rex::Payloads::Meterpreter::Config::PROXY_USER_SIZE - 1
89
),
90
OptString.new('HttpProxyPass', 'An optional proxy server password',
91
aliases: ['PayloadProxyPass'],
92
max_length: Rex::Payloads::Meterpreter::Config::PROXY_PASS_SIZE - 1
93
),
94
OptEnum.new('HttpProxyType', 'The type of HTTP proxy',
95
enums: ['HTTP', 'SOCKS'],
96
aliases: ['PayloadProxyType']
97
)
98
]
99
end
100
101
def self.http_header_options
102
[
103
OptString.new('HttpHostHeader', 'An optional value to use for the Host HTTP header'),
104
OptString.new('HttpCookie', 'An optional value to use for the Cookie HTTP header'),
105
OptString.new('HttpReferer', 'An optional value to use for the Referer HTTP header')
106
]
107
end
108
109
CHOST = CHOST()
110
CPORT = CPORT()
111
LHOST = LHOST()
112
LPORT = LPORT()
113
Proxies = Proxies()
114
RHOST = RHOST()
115
RHOSTS = RHOSTS()
116
RPORT = RPORT()
117
SSLVersion = SSLVersion()
118
end
119
end
120
121