This commit adds a new option to all reverse handlers: ReverseListenerBindAddress. This setting determines exactly what address is bound on the local system

git-svn-id: file:///home/svn/framework3/trunk@10472 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2010-09-25 03:25:09 +00:00
parent 3ee6117219
commit 3b31f56894
1 changed files with 11 additions and 3 deletions

View File

@ -49,7 +49,8 @@ module ReverseTcp
# XXX: Not supported by all modules
register_advanced_options(
[
OptInt.new('ReverseConnectRetries', [ true, 'The number of connection attempts to try before exiting the process', 5 ])
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'])
], Msf::Handler::ReverseTcp)
@ -72,7 +73,14 @@ module ReverseTcp
# First attempt to bind LHOST. If that fails, the user probably has
# something else listening on that interface. Try again with ANY_ADDR.
any = (addr.length == 4) ? "0.0.0.0" : "::0"
[ Rex::Socket.addr_ntoa(addr), any ].each { |ip|
addrs = [ Rex::Socket.addr_ntoa(addr), any ]
if not datastore['ReverseListenerBindAddress'].to_s.empty?
addrs = [ datastore['ReverseListenerBindAddress'] ]
end
addrs.each { |ip|
begin
self.listener_sock = Rex::Socket::TcpServer.create(