@@ -31,15 +31,14 @@ def initialize
31
31
'License' => MSF_LICENSE ,
32
32
'References' =>
33
33
[
34
- [ 'CVE' , 'CVE- 1999-0103' ] ,
34
+ [ 'CVE' , '1999-0103' ] ,
35
35
[ 'URL' , 'https://www.cert.be/pro/docs/chargensnmp-ddos-attacks-rise' ] ,
36
36
[ 'URL' , 'http://tools.ietf.org/html/rfc864' ] ,
37
37
] ,
38
38
'DisclosureDate' => 'Feb 08 1996' )
39
39
40
40
register_options ( [
41
- Opt ::RPORT ( 19 ) ,
42
- OptInt . new ( 'TIMEOUT' , [ true , 'Timeout for the Chargen probe' , 5 ] ) ,
41
+ Opt ::RPORT ( 19 )
43
42
] )
44
43
45
44
deregister_options ( 'RHOST' )
@@ -49,24 +48,21 @@ def run_host(rhost)
49
48
begin
50
49
connect_udp
51
50
pkt = Rex ::Text . rand_text_alpha_lower ( 1 )
52
- req = udp_sock . write ( pkt )
51
+ udp_sock . write ( pkt )
52
+ r = udp_sock . recvfrom ( 65535 , 0.1 )
53
53
54
- while ( ( res = udp_sock . recvfrom ( 65535 , 0.1 ) ) && ( res [ 1 ] ) )
55
-
56
- vprint_status ( "#{ rhost } :#{ rport } - Response: #{ res [ 0 ] . to_s } " )
57
-
58
- res = res [ 0 ] . to_s . strip
54
+ if r and r [ 1 ]
55
+ vprint_status ( "#{ rhost } :#{ rport } - Response: #{ r [ 0 ] . to_s } " )
56
+ res = r [ 0 ] . to_s . strip
59
57
if ( res . match ( /ABCDEFGHIJKLMNOPQRSTUVWXYZ/i ) || res . match ( /0123456789/ ) )
60
58
print_good ( "#{ rhost } :#{ rport } answers with #{ res . length } bytes (headers + UDP payload)" )
61
59
report_service ( :host => rhost , :port => rport , :name => "chargen" , :info => res . length )
62
60
end
63
61
end
64
-
65
- disconnect_udp
66
- rescue ::Interrupt
67
- raise $!
68
62
rescue ::Rex ::HostUnreachable , ::Rex ::ConnectionTimeout , ::Rex ::ConnectionRefused
69
63
nil
64
+ ensure
65
+ disconnect_udp if self . udp_sock
70
66
end
71
67
end
72
68
end
0 commit comments