@@ -17,16 +17,16 @@ def initialize(info = {})
17
17
super ( update_info ( info ,
18
18
'Name' => 'NTP Clock Variables Disclosure' ,
19
19
'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.
22
23
} ,
23
- 'Author' => 'Ewerson Guimaraes(Crash) <crash[at]dclabs.com.br>' ,
24
+ 'Author' => [ 'Ewerson Guimaraes(Crash) <crash[at]dclabs.com.br>' ] ,
24
25
'License' => MSF_LICENSE ,
25
- 'Version' => '' ,
26
26
'References' =>
27
27
[
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
+ ]
30
30
)
31
31
)
32
32
register_options (
@@ -45,17 +45,21 @@ def run_host(ip)
45
45
print_status ( "Sending command" )
46
46
udp_sock . put ( readvar )
47
47
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 ( "," )
49
53
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
59
63
disconnect_udp
60
64
61
65
end
0 commit comments