Skip to content

Commit f361e4e

Browse files
author
HD Moore
committed
Prefer the new-style proxy datastore options when available
1 parent 7e89281 commit f361e4e

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

lib/msf/core/handler/reverse_http.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ def on_request(cli, req, obj)
204204
blob.sub!('HTTP_COMMUNICATION_TIMEOUT = 300', "HTTP_COMMUNICATION_TIMEOUT = #{datastore['SessionCommunicationTimeout']}")
205205
blob.sub!('HTTP_USER_AGENT = None', "HTTP_USER_AGENT = '#{var_escape.call(datastore['MeterpreterUserAgent'])}'")
206206

207-
unless datastore['PROXYHOST'].blank?
208-
proxy_url = "http://#{datastore['PROXYHOST']}:#{datastore['PROXYPORT']}"
207+
unless datastore['PROXYHOST'].blank? && datastore['StagerProxyHost'].blank?
208+
proxy_url = "http://#{datastore['StagerProxyHost']||datastore['PROXYHOST']}:#{datastore['StagerProxyPort']||datastore['PROXYPORT']}"
209209
blob.sub!('HTTP_PROXY = None', "HTTP_PROXY = '#{var_escape.call(proxy_url)}'")
210210
end
211211

@@ -268,11 +268,11 @@ def on_request(cli, req, obj)
268268
:expiration => datastore['SessionExpirationTimeout'],
269269
:comm_timeout => datastore['SessionCommunicationTimeout'],
270270
:ua => datastore['MeterpreterUserAgent'],
271-
:proxyhost => datastore['PROXYHOST'],
272-
:proxyport => datastore['PROXYPORT'],
273-
:proxy_type => datastore['PROXY_TYPE'],
274-
:proxy_username => datastore['PROXY_USERNAME'],
275-
:proxy_password => datastore['PROXY_PASSWORD']
271+
:proxyhost => datastore['StagerProxyHost'] || datastore['PROXYHOST'],
272+
:proxyport => datastore['StagerProxyPort'] || datastore['PROXYPORT'],
273+
:proxy_type => datastore['StagerProxyType'] || datastore['PROXY_TYPE'],
274+
:proxy_username => datastore['StagerProxyUser'] || datastore['PROXY_USERNAME'],
275+
:proxy_password => datastore['StagerProxyPass'] || datastore['PROXY_PASSWORD']
276276

277277
resp.body = encode_stage(blob)
278278

lib/rex/post/meterpreter/client_core.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -411,11 +411,11 @@ def generate_windows_stub(process)
411411
:expiration => self.client.expiration,
412412
:comm_timeout => self.client.comm_timeout,
413413
:ua => client.exploit_datastore['MeterpreterUserAgent'],
414-
:proxyhost => client.exploit_datastore['PROXYHOST'],
415-
:proxyport => client.exploit_datastore['PROXYPORT'],
416-
:proxy_type => client.exploit_datastore['PROXY_TYPE'],
417-
:proxy_username => client.exploit_datastore['PROXY_USERNAME'],
418-
:proxy_password => client.exploit_datastore['PROXY_PASSWORD']
414+
:proxyhost => client.exploit_datastore['StagerProxyHost'] || client.exploit_datastore['PROXYHOST'],
415+
:proxyport => client.exploit_datastore['StagerProxyPort'] || client.exploit_datastore['PROXYPORT'],
416+
:proxy_type => client.exploit_datastore['StagerProxyType'] || client.exploit_datastore['PROXY_TYPE'],
417+
:proxy_username => client.exploit_datastore['StagerProxyUser'] || client.exploit_datastore['PROXY_USERNAME'],
418+
:proxy_password => client.exploit_datastore['StagerProxyPass'] || client.exploit_datastore['PROXY_PASSWORD']
419419

420420
end
421421

0 commit comments

Comments
 (0)