Skip to content

Commit 1281058

Browse files
committed
Remove arg for bind port/addr functions
Done to avoid masking of datastore instance variable.
1 parent 58cd2c7 commit 1281058

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

lib/msf/core/handler/reverse_http.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ def ssl?
8383
# addresses.
8484
#
8585
def full_uri
86-
addrs = bind_address(datastore)
87-
local_port = bind_port(datastore)
86+
addrs = bind_address
87+
local_port = bind_port
8888
scheme = (ssl?) ? "https" : "http"
8989
"#{scheme}://#{addrs[0]}:#{local_port}/"
9090
end
@@ -174,8 +174,8 @@ def setup_handler
174174
comm = nil
175175
end
176176

177-
local_port = bind_port(datastore)
178-
addrs = bind_address(datastore)
177+
local_port = bind_port
178+
addrs = bind_address
179179

180180
# Start the HTTPS server service on this host/port
181181
self.service = Rex::ServiceManager.start(Rex::Proto::Http::Server,
@@ -399,12 +399,12 @@ def on_request(cli, req, obj)
399399

400400
protected
401401

402-
def bind_port(datastore)
402+
def bind_port
403403
port = datastore['ReverseListenerBindPort'].to_i
404404
port > 0 ? port : datastore['LPORT'].to_i
405405
end
406406

407-
def bind_address(datastore)
407+
def bind_address
408408
# Switch to IPv6 ANY address if the LHOST is also IPv6
409409
addr = Rex::Socket.resolv_nbo(datastore['LHOST'])
410410
# First attempt to bind LHOST. If that fails, the user probably has

lib/msf/core/handler/reverse_tcp.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ def setup_handler
8181
comm = nil
8282
end
8383

84-
local_port = bind_port(datastore)
85-
addrs = bind_address(datastore)
84+
local_port = bind_port
85+
addrs = bind_address
8686

8787
addrs.each { |ip|
8888
begin
@@ -130,7 +130,7 @@ def cleanup_handler
130130
# Starts monitoring for an inbound connection.
131131
#
132132
def start_handler
133-
local_port = bind_port(datastore)
133+
local_port = bind_port
134134
self.listener_thread = framework.threads.spawn("ReverseTcpHandlerListener-#{local_port}", false) {
135135
client = nil
136136

@@ -232,12 +232,12 @@ def stop_handler
232232

233233
protected
234234

235-
def bind_port(datastore)
235+
def bind_port
236236
port = datastore['ReverseListenerBindPort'].to_i
237237
port > 0 ? port : datastore['LPORT'].to_i
238238
end
239239

240-
def bind_address(datastore)
240+
def bind_address
241241
# Switch to IPv6 ANY address if the LHOST is also IPv6
242242
addr = Rex::Socket.resolv_nbo(datastore['LHOST'])
243243
# First attempt to bind LHOST. If that fails, the user probably has

lib/msf/core/handler/reverse_tcp_ssl.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def setup_handler
6969
comm = nil
7070
end
7171

72-
local_port = bind_port(datastore)
73-
addrs = bind_address(datastore)
72+
local_port = bind_port
73+
addrs = bind_address
7474

7575
addrs.each { |ip|
7676
begin
@@ -111,12 +111,12 @@ def setup_handler
111111

112112
protected
113113

114-
def bind_port(datastore)
114+
def bind_port
115115
port = datastore['ReverseListenerBindPort'].to_i
116116
port > 0 ? port : datastore['LPORT'].to_i
117117
end
118118

119-
def bind_address(datastore)
119+
def bind_address
120120
# Switch to IPv6 ANY address if the LHOST is also IPv6
121121
addr = Rex::Socket.resolv_nbo(datastore['LHOST'])
122122
# First attempt to bind LHOST. If that fails, the user probably has

0 commit comments

Comments
 (0)