@@ -43,28 +43,28 @@ def run_batch_size
43
43
datastore [ 'BATCHSIZE' ] . to_i
44
44
end
45
45
46
- def udp_sock ( ip , port )
47
- @udp_socks_mutex . synchronize do
46
+ def udp_socket ( ip , port )
47
+ @udp_sockets_mutex . synchronize do
48
48
key = "#{ ip } :#{ port } "
49
- unless @udp_socks . key? ( key )
50
- @udp_socks [ key ] =
49
+ unless @udp_sockets . key? ( key )
50
+ @udp_sockets [ key ] =
51
51
Rex ::Socket ::Udp . create ( {
52
52
'LocalHost' => datastore [ 'CHOST' ] || nil ,
53
53
'LocalPort' => datastore [ 'CPORT' ] || 0 ,
54
54
'PeerHost' => ip ,
55
55
'PeerPort' => port ,
56
56
'Context' => { 'Msf' => framework , 'MsfExploit' => self }
57
57
} )
58
- add_socket ( @udp_socks [ key ] )
58
+ add_socket ( @udp_sockets [ key ] )
59
59
end
60
- return @udp_socks [ key ]
60
+ return @udp_sockets [ key ]
61
61
end
62
62
end
63
63
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 )
68
68
remove_socket ( sock )
69
69
sock . close
70
70
end
@@ -73,8 +73,8 @@ def cleanup_udp_socks
73
73
74
74
# Start scanning a batch of IP addresses
75
75
def run_batch ( batch )
76
- @udp_socks = { }
77
- @udp_socks_mutex = Mutex . new
76
+ @udp_sockets = { }
77
+ @udp_sockets_mutex = Mutex . new
78
78
79
79
@udp_send_count = 0
80
80
@interval_mutex = Mutex . new
@@ -122,7 +122,7 @@ def scanner_send(data, ip, port)
122
122
resend_count = 0
123
123
sock = nil
124
124
begin
125
- sock = udp_sock ( ip , port )
125
+ sock = udp_socket ( ip , port )
126
126
sock . send ( data , 0 )
127
127
128
128
rescue ::Errno ::ENOBUFS
@@ -160,7 +160,7 @@ def scanner_recv(timeout = 0.1)
160
160
queue = [ ]
161
161
start = Time . now
162
162
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 )
164
164
if readable
165
165
for sock in readable
166
166
res = sock . recvfrom ( 65535 , timeout )
@@ -186,7 +186,7 @@ def scanner_recv(timeout = 0.1)
186
186
end
187
187
end
188
188
189
- cleanup_udp_socks
189
+ cleanup_udp_sockets
190
190
191
191
queue . each do |q |
192
192
scanner_process ( *q )
0 commit comments