Skip to content

Commit c0b214c

Browse files
committed
Merge branch 'bindaddress' of git://github.com/corelanc0d3r/metasploit-framework into corelanc0d3r-bindaddress
2 parents 1cb067e + 7733843 commit c0b214c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/msf/core/handler/reverse_http.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ def initialize(info = {})
153153
OptInt.new('SessionExpirationTimeout', [ false, 'The number of seconds before this session should be forcibly shut down', (24*3600*7)]),
154154
OptInt.new('SessionCommunicationTimeout', [ false, 'The number of seconds of no activity before this session should be killed', 300]),
155155
OptString.new('MeterpreterUserAgent', [ false, 'The user-agent that the payload should use for communication', 'Mozilla/4.0 (compatible; MSIE 6.1; Windows NT)' ]),
156-
OptString.new('MeterpreterServerName', [ false, 'The server header that the handler will send in response to requests', 'Apache' ])
156+
OptString.new('MeterpreterServerName', [ false, 'The server header that the handler will send in response to requests', 'Apache' ]),
157+
OptAddress.new('ReverseListenerBindAddress', [ false, 'The specific IP address to bind to on the local system'])
157158
], Msf::Handler::ReverseHttp)
158159
end
159160

@@ -176,10 +177,17 @@ def setup_handler
176177
comm = nil
177178
end
178179

180+
# Determine where to bind the HTTP(S) server to
181+
bindaddrs = ipv6 ? '::' : '0.0.0.0'
182+
183+
if not datastore['ReverseListenerBindAddress'].to_s.empty?
184+
bindaddrs = datastore['ReverseListenerBindAddress']
185+
end
186+
179187
# Start the HTTPS server service on this host/port
180188
self.service = Rex::ServiceManager.start(Rex::Proto::Http::Server,
181189
datastore['LPORT'].to_i,
182-
ipv6 ? '::' : '0.0.0.0',
190+
bindaddrs,
183191
ssl?,
184192
{
185193
'Msf' => framework,

0 commit comments

Comments
 (0)