Skip to content

Commit 29649ff

Browse files
committed
Fix proxy config not making it through
1 parent 79753f7 commit 29649ff

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

lib/msf/core/transport_config.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ def transport_config_reverse_http(opts={})
5959
:uri => uri,
6060
:comm_timeout => datastore['SessionCommunicationTimeout'].to_i,
6161
:retry_total => datastore['SessionRetryTotal'].to_i,
62-
:retry_wait => datastore['SessionRetryWait'].to_i
62+
:retry_wait => datastore['SessionRetryWait'].to_i,
63+
:proxy_host => datastore['PayloadProxyHost'],
64+
:proxy_port => datastore['PayloadProxyPort'],
65+
:proxy_type => datastore['PayloadProxyType'],
66+
:proxy_user => datastore['PayloadProxyUser'],
67+
:proxy_pass => datastore['PayloadProxyPass']
6368
}
6469
end
6570

lib/rex/payloads/meterpreter/config.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,13 @@ def transport_block(opts)
8888
]
8989

9090
if url.start_with?('http')
91-
proxy_host = to_str(opts[:proxy_host] || '', PROXY_HOST_SIZE)
91+
proxy_host = ''
92+
if opts[:proxy_host] && opts[:proxy_port]
93+
prefix = 'http://'
94+
prefix = 'socks=' if opts[:proxy_type].downcase == 'socks'
95+
proxy_host = "#{prefix}#{opts[:proxy_host]}:#{opts[:proxy_port]}"
96+
end
97+
proxy_host = to_str(proxy_host || '', PROXY_HOST_SIZE)
9298
proxy_user = to_str(opts[:proxy_user] || '', PROXY_USER_SIZE)
9399
proxy_pass = to_str(opts[:proxy_pass] || '', PROXY_PASS_SIZE)
94100
ua = to_str(opts[:ua] || '', UA_SIZE)
@@ -120,7 +126,6 @@ def extension_block(ext_name, file_extension)
120126
end
121127

122128
def config_block
123-
124129
# start with the session information
125130
config = session_block(@opts)
126131

0 commit comments

Comments
 (0)