Skip to content

Commit 1fd7f7c

Browse files
committed
prefix MeterpreterUserAgent and PayloadProxy* with Http for consistency,
this also adds aliases where needed
1 parent a5af21f commit 1fd7f7c

File tree

12 files changed

+124
-104
lines changed

12 files changed

+124
-104
lines changed

lib/msf/core/handler/reverse_http.rb

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,38 @@ def initialize(info = {})
5252

5353
register_advanced_options(
5454
[
55-
56-
OptString.new('MeterpreterUserAgent', [false, 'The user-agent that the payload should use for communication', Rex::UserAgent.shortest]),
57-
OptString.new('MeterpreterServerName', [false, 'The server header that the handler will send in response to requests', 'Apache']),
58-
OptAddress.new('ReverseListenerBindAddress', [false, 'The specific IP address to bind to on the local system']),
59-
OptBool.new('OverrideRequestHost', [false, 'Forces a specific host and port instead of using what the client requests, defaults to LHOST:LPORT', false]),
60-
OptString.new('OverrideLHOST', [false, 'When OverrideRequestHost is set, use this value as the host name for secondary requests']),
61-
OptPort.new('OverrideLPORT', [false, 'When OverrideRequestHost is set, use this value as the port number for secondary requests']),
62-
OptString.new('OverrideScheme', [false, 'When OverrideRequestHost is set, use this value as the scheme for secondary requests, e.g http or https']),
63-
OptString.new('HttpUnknownRequestResponse', [false, 'The returned HTML response body when the handler receives a request that is not from a payload', '<html><body><h1>It works!</h1></body></html>']),
64-
OptBool.new('IgnoreUnknownPayloads', [false, 'Whether to drop connections from payloads using unknown UUIDs', false])
55+
OptAddress.new('ReverseListenerBindAddress',
56+
'The specific IP address to bind to on the local system'
57+
),
58+
OptBool.new('OverrideRequestHost',
59+
'Forces a specific host and port instead of using what the client requests, defaults to LHOST:LPORT',
60+
),
61+
OptString.new('OverrideLHOST',
62+
'When OverrideRequestHost is set, use this value as the host name for secondary requests'
63+
),
64+
OptPort.new('OverrideLPORT',
65+
'When OverrideRequestHost is set, use this value as the port number for secondary requests'
66+
),
67+
OptString.new('OverrideScheme',
68+
'When OverrideRequestHost is set, use this value as the scheme for secondary requests, e.g http or https'
69+
),
70+
OptString.new('HttpUserAgent',
71+
'The user-agent that the payload should use for communication',
72+
default: Rex::UserAgent.shortest,
73+
aliases: ['MeterpreterUserAgent']
74+
),
75+
OptString.new('HttpServerName',
76+
'The server header that the handler will send in response to requests',
77+
default: 'Apache',
78+
aliases: ['MeterpreterServerName']
79+
),
80+
OptString.new('HttpUnknownRequestResponse',
81+
'The returned HTML response body when the handler receives a request that is not from a payload',
82+
default: '<html><body><h1>It works!</h1></body></html>'
83+
),
84+
OptBool.new('IgnoreUnknownPayloads',
85+
'Whether to drop connections from payloads using unknown UUIDs'
86+
)
6587
], Msf::Handler::ReverseHttp)
6688
end
6789

@@ -204,7 +226,7 @@ def setup_handler
204226

205227
raise ex if (ex)
206228

207-
self.service.server_name = datastore['MeterpreterServerName']
229+
self.service.server_name = datastore['HttpServerName']
208230

209231
# Add the new resource
210232
service.add_resource((luri + "/").gsub("//", "/"),
@@ -245,14 +267,14 @@ def lookup_proxy_settings
245267
info = {}
246268
return @proxy_settings if @proxy_settings
247269

248-
if datastore['PayloadProxyHost'].to_s == ''
270+
if datastore['HttpProxyHost'].to_s == ''
249271
@proxy_settings = info
250272
return @proxy_settings
251273
end
252274

253-
info[:host] = datastore['PayloadProxyHost'].to_s
254-
info[:port] = (datastore['PayloadProxyPort'] || 8080).to_i
255-
info[:type] = datastore['PayloadProxyType'].to_s
275+
info[:host] = datastore['HttpProxyHost'].to_s
276+
info[:port] = (datastore['HttpProxyPort'] || 8080).to_i
277+
info[:type] = datastore['HttpProxyType'].to_s
256278

257279
uri_host = info[:host]
258280

@@ -266,11 +288,11 @@ def lookup_proxy_settings
266288
info[:info] = "socks=#{info[:info]}"
267289
else
268290
info[:info] = "http://#{info[:info]}"
269-
if datastore['PayloadProxyUser'].to_s != ''
270-
info[:username] = datastore['PayloadProxyUser'].to_s
291+
if datastore['HttpProxyUser'].to_s != ''
292+
info[:username] = datastore['HttpProxyUser'].to_s
271293
end
272-
if datastore['PayloadProxyPass'].to_s != ''
273-
info[:password] = datastore['PayloadProxyPass'].to_s
294+
if datastore['HttpProxyPass'].to_s != ''
295+
info[:password] = datastore['HttpProxyPass'].to_s
274296
end
275297
end
276298

lib/msf/core/handler/reverse_https_proxy.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ def initialize(info = {})
3838

3939
register_options(
4040
[
41-
OptAddressLocal.new('LHOST', [ true, "The local listener hostname" ,"127.0.0.1"]),
42-
OptPort.new('LPORT', [ true, "The local listener port", 8443 ]),
43-
OptString.new('PayloadProxyHost', [true, "The proxy server's IP address", "127.0.0.1"]),
44-
OptPort.new('PayloadProxyPort', [true, "The proxy port to connect to", 8080 ]),
45-
OptEnum.new('PayloadProxyType', [true, 'The proxy type, HTTP or SOCKS', 'HTTP', ['HTTP', 'SOCKS']]),
46-
OptString.new('PayloadProxyUser', [ false, "An optional username for HTTP proxy authentication"]),
47-
OptString.new('PayloadProxyPass', [ false, "An optional password for HTTP proxy authentication"])
41+
OptAddressLocal.new('LHOST', "The local listener hostname", default: "127.0.0.1"),
42+
OptPort.new('LPORT', "The local listener port", default: 8443),
43+
OptString.new('HttpProxyHost', "The proxy server's IP address", required: true, default: "127.0.0.1", aliases: ['PayloadProxyHost']),
44+
OptPort.new('HttpProxyPort', "The proxy port to connect to", required: true, default: 8080, aliases: ['PayloadProxyPort']),
45+
OptEnum.new('HttpProxyType', 'The proxy type, HTTP or SOCKS', enums: ['HTTP', 'SOCKS'], aliases: ['PayloadProxyType']),
46+
OptString.new('HttpProxyUser', "An optional username for HTTP proxy authentication", aliases: ['PayloadProxyUser']),
47+
OptString.new('HttpProxyPass', "An optional password for HTTP proxy authentication", aliases: ['PayloadProxyPass'])
4848
], Msf::Handler::ReverseHttpsProxy)
4949

5050
register_advanced_options(

lib/msf/core/payload/java/reverse_http.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def stager_config(opts={})
6767

6868
c = ''
6969
c << "Spawn=#{ds["Spawn"] || 2}\n"
70-
c << "HeaderUser-Agent=#{ds["MeterpreterUserAgent"]}\n" if ds["MeterpreterUserAgent"]
70+
c << "HeaderUser-Agent=#{ds["HttpUserAgent"]}\n" if ds["HttpUserAgent"]
7171
c << "HeaderHost=#{ds["HttpHeaderHost"]}\n" if ds["HttpHeaderHost"]
7272
c << "HeaderReferer=#{ds["HttpHeaderReferer"]}\n" if ds["HttpHeaderReferer"]
7373
c << "HeaderCookie=#{ds["HttpHeaderCookie"]}\n" if ds["HttpHeaderCookie"]

lib/msf/core/payload/multi/reverse_http.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@ module Payload::Multi::ReverseHttp
2323
def initialize(*args)
2424
super
2525
register_advanced_options([
26-
OptInt.new('StagerURILength', [false, 'The URI length for the stager (at least 5 bytes)']),
27-
OptInt.new('StagerRetryCount', [false, 'The number of times the stager should retry if the first connect fails', 10],
28-
aliases: ['ReverseConnectRetries']),
29-
OptString.new('PayloadProxyHost', [false, 'An optional proxy server IP address or hostname']),
30-
OptPort.new('PayloadProxyPort', [false, 'An optional proxy server port']),
31-
OptString.new('PayloadProxyUser', [false, 'An optional proxy server username']),
32-
OptString.new('PayloadProxyPass', [false, 'An optional proxy server password']),
33-
OptEnum.new('PayloadProxyType', [false, 'The type of HTTP proxy (HTTP or SOCKS)', 'HTTP', ['HTTP', 'SOCKS']])
26+
OptInt.new('StagerURILength', 'The URI length for the stager (at least 5 bytes)'),
27+
OptInt.new('StagerRetryCount', 'The number of times the stager should retry if the first connect fails', default: 10, aliases: ['ReverseConnectRetries']),
28+
OptString.new('HttpProxyHost', 'An optional proxy server IP address or hostname', aliases: ['PayloadProxyHost']),
29+
OptPort.new('HttpProxyPort', 'An optional proxy server port', aliases: ['PayloadProxyPort']),
30+
OptString.new('HttpProxyUser', 'An optional proxy server username', aliases: ['PayloadProxyUser']),
31+
OptString.new('HttpProxyPass', 'An optional proxy server password', aliases: ['PayloadProxyPass']),
32+
OptEnum.new('HttpProxyType', 'The type of HTTP proxy (HTTP or SOCKS)', enums: ['HTTP', 'SOCKS'], aliases: ['PayloadProxyType'])
3433
])
3534
end
3635

@@ -67,4 +66,3 @@ def wfs_delay
6766
end
6867

6968
end
70-

lib/msf/core/payload/python/meterpreter_loader.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ def stage_meterpreter(opts={})
8888
end
8989
met.sub!("SESSION_GUID = \'\'", "SESSION_GUID = \'#{session_guid}\'")
9090

91-
http_user_agent = opts[:http_user_agent] || ds['MeterpreterUserAgent']
92-
http_proxy_host = opts[:http_proxy_host] || ds['PayloadProxyHost'] || ds['PROXYHOST']
93-
http_proxy_port = opts[:http_proxy_port] || ds['PayloadProxyPort'] || ds['PROXYPORT']
91+
http_user_agent = opts[:http_user_agent] || ds['HttpUserAgent']
92+
http_proxy_host = opts[:http_proxy_host] || ds['HttpProxyHost'] || ds['PROXYHOST']
93+
http_proxy_port = opts[:http_proxy_port] || ds['HttpProxyPort'] || ds['PROXYPORT']
9494
http_header_host = opts[:header_host] || ds['HttpHeaderHost']
9595
http_header_cookie = opts[:header_cookie] || ds['HttpHeaderCookie']
9696
http_header_referer = opts[:header_referer] || ds['HttpHeaderReferer']

lib/msf/core/payload/python/reverse_http.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def initialize(info = {})
1313
super(info)
1414
register_options(
1515
[
16-
OptString.new('PayloadProxyHost', [ false, "The proxy server's IP address" ]),
17-
OptPort.new('PayloadProxyPort', [ true, "The proxy port to connect to", 8080 ]),
16+
OptString.new('HttpProxyHost', [ false, "The proxy server's IP address" ], aliases: ['PayloadProxyHost']),
17+
OptPort.new('HttpProxyPort', [ true, "The proxy port to connect to", 8080 ], aliases: ['PayloadProxyHost']),
1818
OptString.new('HttpHeaderHost', [false, 'An optional value to use for the Host HTTP header']),
1919
OptString.new('HttpHeaderCookie', [false, 'An optional value to use for the Cookie HTTP header']),
2020
OptString.new('HttpHeaderReferer', [false, 'An optional value to use for the Referer HTTP header'])
@@ -29,9 +29,9 @@ def generate(opts={})
2929
opts.merge!({
3030
host: ds['LHOST'] || '127.127.127.127',
3131
port: ds['LPORT'],
32-
proxy_host: ds['PayloadProxyHost'],
33-
proxy_port: ds['PayloadProxyPort'],
34-
user_agent: ds['MeterpreterUserAgent'],
32+
proxy_host: ds['HttpProxyHost'],
33+
proxy_port: ds['HttpProxyPort'],
34+
user_agent: ds['HttpUserAgent'],
3535
header_host: ds['HttpHeaderHost'],
3636
header_cookie: ds['HttpHeaderCookie'],
3737
header_referer: ds['HttpHeaderReferer']

lib/msf/core/payload/transport_config.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ def transport_config_reverse_http(opts={})
6060
lhost: opts[:lhost] || ds['LHOST'],
6161
lport: (opts[:lport] || ds['LPORT']).to_i,
6262
uri: uri,
63-
ua: ds['MeterpreterUserAgent'],
64-
proxy_host: ds['PayloadProxyHost'],
65-
proxy_port: ds['PayloadProxyPort'],
66-
proxy_type: ds['PayloadProxyType'],
67-
proxy_user: ds['PayloadProxyUser'],
68-
proxy_pass: ds['PayloadProxyPass'],
63+
ua: ds['HttpUserAgent'],
64+
proxy_host: ds['HttpProxyHost'],
65+
proxy_port: ds['HttpProxyPort'],
66+
proxy_type: ds['HttpProxyType'],
67+
proxy_user: ds['HttpProxyUser'],
68+
proxy_pass: ds['HttpProxyPass'],
6969
custom_headers: get_custom_headers(ds)
7070
}.merge(timeout_config(opts))
7171
end

lib/msf/core/payload/windows/reverse_http.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ def initialize(*args)
3232
OptInt.new('StagerRetryCount', [false, 'The number of times the stager should retry if the first connect fails', 10],
3333
aliases: ['ReverseConnectRetries']),
3434
OptInt.new('StagerRetryWait', [false, 'Number of seconds to wait for the stager between reconnect attempts', 5]),
35-
OptString.new('PayloadProxyHost', [false, 'An optional proxy server IP address or hostname']),
36-
OptPort.new('PayloadProxyPort', [false, 'An optional proxy server port']),
37-
OptString.new('PayloadProxyUser', [false, 'An optional proxy server username']),
38-
OptString.new('PayloadProxyPass', [false, 'An optional proxy server password']),
39-
OptEnum.new('PayloadProxyType', [false, 'The type of HTTP proxy (HTTP or SOCKS)', 'HTTP', ['HTTP', 'SOCKS']]),
40-
OptString.new('HttpHeaderHost', [false, 'An optional value to use for the Host HTTP header']),
41-
OptString.new('HttpHeaderCookie', [false, 'An optional value to use for the Cookie HTTP header']),
42-
OptString.new('HttpHeaderReferer', [false, 'An optional value to use for the Referer HTTP header'])
35+
OptString.new('HttpProxyHost', 'An optional proxy server IP address or hostname', aliases: ['PayloadProxyHost']),
36+
OptPort.new('HttpProxyPort', 'An optional proxy server port', aliases: ['PayloadProxyPort']),
37+
OptString.new('HttpProxyUser', 'An optional proxy server username', aliases: ['PayloadProxyUser']),
38+
OptString.new('HttpProxyPass', 'An optional proxy server password', aliases: ['PayloadProxyPass']),
39+
OptEnum.new('HttpProxyType', 'The type of HTTP proxy (HTTP or SOCKS)', enums: ['HTTP', 'SOCKS'], aliases: ['PayloadProxyType']),
40+
OptString.new('HttpHeaderHost', 'An optional value to use for the Host HTTP header'),
41+
OptString.new('HttpHeaderCookie', 'An optional value to use for the Cookie HTTP header'),
42+
OptString.new('HttpHeaderReferer', 'An optional value to use for the Referer HTTP header')
4343
], self.class)
4444
end
4545

@@ -60,12 +60,12 @@ def generate(opts={})
6060
if self.available_space.nil? || required_space <= self.available_space
6161
conf[:url] = luri + generate_uri(opts)
6262
conf[:exitfunk] = ds['EXITFUNC']
63-
conf[:ua] = ds['MeterpreterUserAgent']
64-
conf[:proxy_host] = ds['PayloadProxyHost']
65-
conf[:proxy_port] = ds['PayloadProxyPort']
66-
conf[:proxy_user] = ds['PayloadProxyUser']
67-
conf[:proxy_pass] = ds['PayloadProxyPass']
68-
conf[:proxy_type] = ds['PayloadProxyType']
63+
conf[:ua] = ds['HttpUserAgent']
64+
conf[:proxy_host] = ds['HttpProxyHost']
65+
conf[:proxy_port] = ds['HttpProxyPort']
66+
conf[:proxy_user] = ds['HttpProxyUser']
67+
conf[:proxy_pass] = ds['HttpProxyPass']
68+
conf[:proxy_type] = ds['HttpProxyType']
6969
conf[:custom_headers] = get_custom_headers(ds)
7070
else
7171
# Otherwise default to small URIs

lib/msf/core/payload/windows/reverse_winhttp.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module Payload::Windows::ReverseWinHttp
2121
def initialize(*args)
2222
super
2323
register_advanced_options([
24-
OptBool.new('PayloadProxyIE', [false, 'Enable use of IE proxy settings', true])
24+
OptBool.new('HttpProxyIE', 'Enable use of IE proxy settings', default: true, aliases: ['PayloadProxyIE'])
2525
], self.class)
2626
end
2727

@@ -41,13 +41,13 @@ def generate(opts={})
4141
conf[:uri] = luri + generate_uri
4242
conf[:exitfunk] = ds['EXITFUNC']
4343
conf[:verify_cert_hash] = opts[:verify_cert_hash]
44-
conf[:proxy_host] = ds['PayloadProxyHost']
45-
conf[:proxy_port] = ds['PayloadProxyPort']
46-
conf[:proxy_user] = ds['PayloadProxyUser']
47-
conf[:proxy_pass] = ds['PayloadProxyPass']
48-
conf[:proxy_type] = ds['PayloadProxyType']
44+
conf[:proxy_host] = ds['HttpProxyHost']
45+
conf[:proxy_port] = ds['HttpProxyPort']
46+
conf[:proxy_user] = ds['HttpProxyUser']
47+
conf[:proxy_pass] = ds['HttpProxyPass']
48+
conf[:proxy_type] = ds['HttpProxyType']
4949
conf[:retry_count] = ds['StagerRetryCount']
50-
conf[:proxy_ie] = ds['PayloadProxyIE']
50+
conf[:proxy_ie] = ds['HttpProxyIE']
5151
conf[:custom_headers] = get_custom_headers(ds)
5252
else
5353
# Otherwise default to small URIs

lib/msf/core/payload/windows/x64/reverse_http.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ def initialize(*args)
3232
OptInt.new('StagerRetryCount', [false, 'The number of times the stager should retry if the first connect fails', 10],
3333
aliases: ['ReverseConnectRetries']),
3434
OptInt.new('StagerRetryWait', [false, 'Number of seconds to wait for the stager between reconnect attempts', 5]),
35-
OptString.new('PayloadProxyHost', [false, 'An optional proxy server IP address or hostname']),
36-
OptPort.new('PayloadProxyPort', [false, 'An optional proxy server port']),
37-
OptString.new('PayloadProxyUser', [false, 'An optional proxy server username']),
38-
OptString.new('PayloadProxyPass', [false, 'An optional proxy server password']),
39-
OptEnum.new('PayloadProxyType', [false, 'The type of HTTP proxy (HTTP or SOCKS)', 'HTTP', ['HTTP', 'SOCKS']]),
40-
OptString.new('HttpHeaderHost', [false, 'An optional value to use for the Host HTTP header']),
41-
OptString.new('HttpHeaderCookie', [false, 'An optional value to use for the Cookie HTTP header']),
42-
OptString.new('HttpHeaderReferer', [false, 'An optional value to use for the Referer HTTP header'])
35+
OptString.new('HttpProxyHost', 'An optional proxy server IP address or hostname', aliases: ['PayloadProxyHost']),
36+
OptPort.new('HttpProxyPort', 'An optional proxy server port', aliases: ['PayloadProxyPort']),
37+
OptString.new('HttpProxyUser', 'An optional proxy server username', aliases: ['PayloadProxyUser']),
38+
OptString.new('HttpProxyPass', 'An optional proxy server password', aliases: ['PayloadProxyPass']),
39+
OptEnum.new('HttpProxyType', 'The type of HTTP proxy (HTTP or SOCKS)', enums: ['HTTP', 'SOCKS'], aliases: ['PayloadProxyType']),
40+
OptString.new('HttpHeaderHost', 'An optional value to use for the Host HTTP header'),
41+
OptString.new('HttpHeaderCookie', 'An optional value to use for the Cookie HTTP header'),
42+
OptString.new('HttpHeaderReferer', 'An optional value to use for the Referer HTTP header')
4343
], self.class)
4444
end
4545

@@ -65,12 +65,12 @@ def generate(opts={})
6565
if self.available_space.nil? || required_space <= self.available_space
6666
conf[:url] = luri + generate_uri(opts)
6767
conf[:exitfunk] = ds['EXITFUNC']
68-
conf[:ua] = ds['MeterpreterUserAgent']
69-
conf[:proxy_host] = ds['PayloadProxyHost']
70-
conf[:proxy_port] = ds['PayloadProxyPort']
71-
conf[:proxy_user] = ds['PayloadProxyUser']
72-
conf[:proxy_pass] = ds['PayloadProxyPass']
73-
conf[:proxy_type] = ds['PayloadProxyType']
68+
conf[:ua] = ds['HttpUserAgent']
69+
conf[:proxy_host] = ds['HttpProxyHost']
70+
conf[:proxy_port] = ds['HttpProxyPort']
71+
conf[:proxy_user] = ds['HttpProxyUser']
72+
conf[:proxy_pass] = ds['HttpProxyPass']
73+
conf[:proxy_type] = ds['HttpProxyType']
7474
conf[:custom_headers] = get_custom_headers(ds)
7575
else
7676
# Otherwise default to small URIs

0 commit comments

Comments
 (0)