2014-11-03 16:20:21 -06:00
# -*- coding: binary -*-
module Msf
2015-04-03 23:28:45 -05:00
#
# Builtin framework options with shortcut methods
#
# @example
# register_options(
# [
# Opt::RHOST,
# Opt::RPORT(21),
# ]
# )
# register_advanced_options([Opt::Proxies])
#
module Opt
2021-05-24 00:29:29 +01:00
2015-04-03 23:28:45 -05:00
# @return [OptAddress]
2021-05-24 00:29:29 +01:00
def self . CHOST ( default = nil , required = false , desc = " The local client address " )
2015-04-03 23:28:45 -05:00
Msf :: OptAddress . new ( __method__ . to_s , [ required , desc , default ] )
end
2014-11-03 16:20:21 -06:00
2015-04-03 23:28:45 -05:00
# @return [OptPort]
2021-05-24 00:29:29 +01:00
def self . CPORT ( default = nil , required = false , desc = " The local client port " )
2015-04-03 23:28:45 -05:00
Msf :: OptPort . new ( __method__ . to_s , [ required , desc , default ] )
end
2018-05-24 17:50:58 -05:00
# @return [OptAddressLocal]
2021-05-24 00:29:29 +01:00
def self . LHOST ( default = nil , required = true , desc = " The listen address (an interface may be specified) " )
2017-05-02 12:37:59 -05:00
Msf :: OptAddressLocal . new ( __method__ . to_s , [ required , desc , default ] )
2015-04-03 23:28:45 -05:00
end
# @return [OptPort]
2021-05-24 00:29:29 +01:00
def self . LPORT ( default = nil , required = true , desc = " The listen port " )
2015-04-03 23:28:45 -05:00
Msf :: OptPort . new ( __method__ . to_s , [ required , desc , default ] )
end
# @return [OptString]
2021-05-24 00:29:29 +01:00
def self . Proxies ( default = nil , required = false , desc = " A proxy chain of format type:host:port[,type:host:port][...] " )
2015-04-03 23:28:45 -05:00
Msf :: OptString . new ( __method__ . to_s , [ required , desc , default ] )
end
2021-05-22 23:15:47 +01:00
# @return [OptRhosts]
2022-12-30 12:29:14 -06:00
def self . RHOSTS ( default = nil , required = true , desc = " The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html " )
2021-05-22 23:15:47 +01:00
Msf :: OptRhosts . new ( 'RHOSTS' , [ required , desc , default ] , aliases : [ 'RHOST' ] )
2018-05-24 21:25:30 -05:00
end
2022-12-30 12:29:14 -06:00
def self . RHOST ( default = nil , required = true , desc = " The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html " )
2021-05-22 23:15:47 +01:00
Msf :: OptRhosts . new ( 'RHOSTS' , [ required , desc , default ] , aliases : [ 'RHOST' ] )
2015-04-03 23:28:45 -05:00
end
# @return [OptPort]
2021-05-24 00:29:29 +01:00
def self . RPORT ( default = nil , required = true , desc = " The target port " )
2015-04-03 23:28:45 -05:00
Msf :: OptPort . new ( __method__ . to_s , [ required , desc , default ] )
end
2016-03-06 22:06:27 -06:00
# @return [OptEnum]
def self . SSLVersion
2017-09-21 08:27:58 -05:00
Msf :: OptEnum . new ( 'SSLVersion' ,
2021-05-24 00:29:29 +01:00
'Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate)' ,
enums : Rex :: Socket :: SslTcp . supported_ssl_methods
)
2016-03-06 22:06:27 -06:00
end
2017-09-21 02:38:17 -05:00
def self . stager_retry_options
[
2017-09-21 08:27:58 -05:00
OptInt . new ( 'StagerRetryCount' ,
2021-05-24 00:29:29 +01:00
'The number of times the stager should retry if the first connect fails' ,
default : 10 ,
aliases : [ 'ReverseConnectRetries' ]
) ,
2017-09-21 08:27:58 -05:00
OptInt . new ( 'StagerRetryWait' ,
2021-05-24 00:29:29 +01:00
'Number of seconds to wait for the stager between reconnect attempts' ,
default : 5
)
2017-09-21 02:38:17 -05:00
]
end
def self . http_proxy_options
[
2017-09-21 08:27:58 -05:00
OptString . new ( 'HttpProxyHost' , 'An optional proxy server IP address or hostname' ,
2021-05-24 00:29:29 +01:00
aliases : [ 'PayloadProxyHost' ]
) ,
2017-09-21 08:27:58 -05:00
OptPort . new ( 'HttpProxyPort' , 'An optional proxy server port' ,
2021-05-24 00:29:29 +01:00
aliases : [ 'PayloadProxyPort' ]
) ,
2017-09-21 08:27:58 -05:00
OptString . new ( 'HttpProxyUser' , 'An optional proxy server username' ,
2021-05-24 00:29:29 +01:00
aliases : [ 'PayloadProxyUser' ] ,
max_length : Rex :: Payloads :: Meterpreter :: Config :: PROXY_USER_SIZE - 1
) ,
2017-09-21 08:27:58 -05:00
OptString . new ( 'HttpProxyPass' , 'An optional proxy server password' ,
2021-05-24 00:29:29 +01:00
aliases : [ 'PayloadProxyPass' ] ,
max_length : Rex :: Payloads :: Meterpreter :: Config :: PROXY_PASS_SIZE - 1
) ,
2017-09-21 08:27:58 -05:00
OptEnum . new ( 'HttpProxyType' , 'The type of HTTP proxy' ,
2021-05-24 00:29:29 +01:00
enums : [ 'HTTP' , 'SOCKS' ] ,
aliases : [ 'PayloadProxyType' ]
)
2017-09-21 02:38:17 -05:00
]
end
def self . http_header_options
[
2017-09-21 08:27:58 -05:00
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' )
2017-09-21 02:38:17 -05:00
]
end
2015-04-03 23:28:45 -05:00
CHOST = CHOST ( )
CPORT = CPORT ( )
LHOST = LHOST ( )
LPORT = LPORT ( )
Proxies = Proxies ( )
RHOST = RHOST ( )
2018-05-24 21:25:30 -05:00
RHOSTS = RHOSTS ( )
2015-04-03 23:28:45 -05:00
RPORT = RPORT ( )
2016-03-06 22:06:27 -06:00
SSLVersion = SSLVersion ( )
2015-04-03 23:28:45 -05:00
end
2014-11-03 16:20:21 -06:00
end