1
+ #####
2
+
3
+
4
+ # This file is part of the Metasploit Framework and may be subject to
5
+ # redistribution and commercial restrictions. Please see the Metasploit
6
+ # web site for more information on licensing and terms of use.
7
+ # http://metasploit.com/
8
+ ##
9
+
10
+ require 'msf/core'
11
+
12
+ class Metasploit3 < Msf ::Auxiliary
13
+
14
+
15
+ include Msf ::Exploit ::Remote ::Udp
16
+ include Msf ::Auxiliary ::Report
17
+ include Msf ::Auxiliary ::Scanner
18
+
19
+
20
+ def initialize ( info = { } )
21
+ super ( update_info ( info ,
22
+ 'Name' => 'NTP Clock Variables Disclosure' ,
23
+ 'Description' => %q{
24
+ This module reads the system internal NTP variables. These variables contain potentially sensitive
25
+ information, such as the NTP software version, operating system version, peers, and more..
26
+ } ,
27
+ 'Author' => 'Ewerson Guimaraes(Crash) <crash[at]dclabs.com.br>' ,
28
+ 'License' => MSF_LICENSE ,
29
+ 'Version' => '' ,
30
+ 'References' =>
31
+ [
32
+ [ 'URL' , 'http://www.rapid7.com/vulndb/lookup/ntp-clock-variables-disclosure' ] ,
33
+ ]
34
+ )
35
+ )
36
+ register_options (
37
+ [
38
+ Opt ::RPORT ( 123 )
39
+ ] , self . class )
40
+ end
41
+
42
+ def run_host ( ip )
43
+
44
+ connect_udp
45
+
46
+ readvar = "\x16 \x02 \x00 \x01 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 " #readvar command
47
+ print_status ( "Connecting target #{ rhost } :#{ rport } ..." )
48
+
49
+ print_status ( "Sending command" )
50
+ udp_sock . put ( readvar )
51
+ reply = udp_sock . recvfrom ( 65535 , 0.1 )
52
+ p_reply = ( reply [ 0 ] . split ( "," ) )
53
+ arr_count = 0
54
+ while ( arr_count < p_reply . size )
55
+ if arr_count == 0
56
+ print_good ( 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 ( p_reply [ arr_count ] . strip )
60
+ arr_count = arr_count + 1
61
+ end
62
+ end
63
+ disconnect_udp
64
+
65
+ end
66
+
67
+ end
0 commit comments