Skip to content

Commit a2fd377

Browse files
author
jvazquez-r7
committed
module cleanup
1 parent 38a9761 commit a2fd377

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

modules/auxiliary/scanner/ntp/ntp_readvar.rb

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ def initialize(info = {})
1717
super(update_info(info,
1818
'Name' => 'NTP Clock Variables Disclosure',
1919
'Description' => %q{
20-
This module reads the system internal NTP variables. These variables contain potentially sensitive
21-
information, such as the NTP software version, operating system version, peers, and more..
20+
This module reads the system internal NTP variables. These variables contain
21+
potentially sensitive information, such as the NTP software version, operating
22+
system version, peers, and more.
2223
},
23-
'Author' => 'Ewerson Guimaraes(Crash) <crash[at]dclabs.com.br>',
24+
'Author' => [ 'Ewerson Guimaraes(Crash) <crash[at]dclabs.com.br>' ],
2425
'License' => MSF_LICENSE,
25-
'Version' => '',
2626
'References' =>
2727
[
28-
['URL','http://www.rapid7.com/vulndb/lookup/ntp-clock-variables-disclosure' ],
29-
]
28+
[ 'URL','http://www.rapid7.com/vulndb/lookup/ntp-clock-variables-disclosure' ],
29+
]
3030
)
3131
)
3232
register_options(
@@ -45,17 +45,21 @@ def run_host(ip)
4545
print_status("Sending command")
4646
udp_sock.put(readvar)
4747
reply = udp_sock.recvfrom(65535, 0.1)
48-
p_reply =( reply[0].split(","))
48+
if not reply or reply[0].empty?
49+
print_error("#{rhost}:#{rport} - Couldn't read NTP variables")
50+
return
51+
end
52+
p_reply = reply[0].split(",")
4953
arr_count = 0
50-
while ( arr_count < p_reply.size)
51-
if arr_count == 0
52-
print_good (p_reply[arr_count].slice(12,p_reply[arr_count].size)) #12 is the adjustment of packet garbage
53-
arr_count = arr_count + 1
54-
else
55-
print_good (p_reply[arr_count].strip)
56-
arr_count = arr_count + 1
57-
end
58-
end
54+
while ( arr_count < p_reply.size)
55+
if arr_count == 0
56+
print_good("#{rhost}:#{rport} - #{p_reply[arr_count].slice(12,p_reply[arr_count].size)}") #12 is the adjustment of packet garbage
57+
arr_count = arr_count + 1
58+
else
59+
print_good("#{rhost}:#{rport} - #{p_reply[arr_count].strip}")
60+
arr_count = arr_count + 1
61+
end
62+
end
5963
disconnect_udp
6064

6165
end

0 commit comments

Comments
 (0)