Merge pull request #586 from mephos/proxy-reverse-tcp

allow reverse tcp with proxies
This commit is contained in:
HD Moore 2012-07-09 14:11:54 -07:00
commit 52752d7685
2 changed files with 10 additions and 5 deletions

View File

@ -54,6 +54,7 @@ module ReverseTcp
OptInt.new('ReverseConnectRetries', [ true, 'The number of connection attempts to try before exiting the process', 5 ]),
OptAddress.new('ReverseListenerBindAddress', [ false, 'The specific IP address to bind to on the local system']),
OptString.new('ReverseListenerComm', [ false, 'The specific communication channel to use for this listener']),
OptBool.new('ReverseAllowProxy', [ true, 'Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST', false]),
], Msf::Handler::ReverseTcp)
@ -66,8 +67,8 @@ module ReverseTcp
# if it fails to start the listener.
#
def setup_handler
if datastore['Proxies']
raise RuntimeError, 'TCP connect-back payloads cannot be used with Proxies'
if datastore['Proxies'] and not datastore['ReverseAllowProxy']
raise RuntimeError, 'TCP connect-back payloads cannot be used with Proxies. Can be overriden by setting ReverseAllowProxy to true'
end
ex = false

View File

@ -45,6 +45,11 @@ module ReverseTcpDouble
Opt::LPORT(4444)
], Msf::Handler::ReverseTcpDouble)
register_advanced_options(
[
OptBool.new('ReverseAllowProxy', [ true, 'Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST', false]),
], Msf::Handler::ReverseTcpDouble)
self.conn_threads = []
end
@ -54,10 +59,9 @@ module ReverseTcpDouble
# if it fails to start the listener.
#
def setup_handler
if datastore['Proxies']
raise 'tcp connectback can not be used with proxies'
if datastore['Proxies'] and not datastore['ReverseAllowProxy']
raise RuntimeError, 'TCP connect-back payloads cannot be used with Proxies. Can be overriden by setting ReverseAllowProxy to true'
end
self.listener_sock = Rex::Socket::TcpServer.create(
# 'LocalHost' => datastore['LHOST'],
'LocalPort' => datastore['LPORT'].to_i,