Skip to content

Commit 813a10f

Browse files
committed
Land rapid7#7950, s/udp_sock/udp_socket/ in UDPScanner
2 parents a69e199 + c1d08b9 commit 813a10f

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

lib/msf/core/auxiliary/udp_scanner.rb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,28 @@ def run_batch_size
4343
datastore['BATCHSIZE'].to_i
4444
end
4545

46-
def udp_sock(ip, port)
47-
@udp_socks_mutex.synchronize do
46+
def udp_socket(ip, port)
47+
@udp_sockets_mutex.synchronize do
4848
key = "#{ip}:#{port}"
49-
unless @udp_socks.key?(key)
50-
@udp_socks[key] =
49+
unless @udp_sockets.key?(key)
50+
@udp_sockets[key] =
5151
Rex::Socket::Udp.create({
5252
'LocalHost' => datastore['CHOST'] || nil,
5353
'LocalPort' => datastore['CPORT'] || 0,
5454
'PeerHost' => ip,
5555
'PeerPort' => port,
5656
'Context' => { 'Msf' => framework, 'MsfExploit' => self }
5757
})
58-
add_socket(@udp_socks[key])
58+
add_socket(@udp_sockets[key])
5959
end
60-
return @udp_socks[key]
60+
return @udp_sockets[key]
6161
end
6262
end
6363

64-
def cleanup_udp_socks
65-
@udp_socks_mutex.synchronize do
66-
@udp_socks.each do |key, sock|
67-
@udp_socks.delete(key)
64+
def cleanup_udp_sockets
65+
@udp_sockets_mutex.synchronize do
66+
@udp_sockets.each do |key, sock|
67+
@udp_sockets.delete(key)
6868
remove_socket(sock)
6969
sock.close
7070
end
@@ -73,8 +73,8 @@ def cleanup_udp_socks
7373

7474
# Start scanning a batch of IP addresses
7575
def run_batch(batch)
76-
@udp_socks = {}
77-
@udp_socks_mutex = Mutex.new
76+
@udp_sockets = {}
77+
@udp_sockets_mutex = Mutex.new
7878

7979
@udp_send_count = 0
8080
@interval_mutex = Mutex.new
@@ -122,7 +122,7 @@ def scanner_send(data, ip, port)
122122
resend_count = 0
123123
sock = nil
124124
begin
125-
sock = udp_sock(ip, port)
125+
sock = udp_socket(ip, port)
126126
sock.send(data, 0)
127127

128128
rescue ::Errno::ENOBUFS
@@ -160,7 +160,7 @@ def scanner_recv(timeout = 0.1)
160160
queue = []
161161
start = Time.now
162162
while Time.now - start < timeout do
163-
readable, _, _ = ::IO.select(@udp_socks.values, nil, nil, timeout)
163+
readable, _, _ = ::IO.select(@udp_sockets.values, nil, nil, timeout)
164164
if readable
165165
for sock in readable
166166
res = sock.recvfrom(65535, timeout)
@@ -186,7 +186,7 @@ def scanner_recv(timeout = 0.1)
186186
end
187187
end
188188

189-
cleanup_udp_socks
189+
cleanup_udp_sockets
190190

191191
queue.each do |q|
192192
scanner_process(*q)

0 commit comments

Comments
 (0)