Skip to content

Commit 8f63075

Browse files
committed
Land rapid7#3837, @jabra-'s update to chargen scanner to support spoofing
2 parents 650b652 + bb018de commit 8f63075

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

modules/auxiliary/scanner/chargen/chargen_probe.rb

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
class Metasploit3 < Msf::Auxiliary
1010

1111
include Msf::Auxiliary::Scanner
12+
include Msf::Exploit::Capture
1213
include Msf::Auxiliary::Report
1314
include Msf::Exploit::Remote::Udp
15+
include Msf::Auxiliary::DRDoS
16+
include Msf::Auxiliary::UDPScanner
1417

1518
def initialize
1619
super(
@@ -45,24 +48,28 @@ def initialize
4548
end
4649

4750
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)
5359

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
6067
end
68+
rescue ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionRefused
69+
nil
70+
ensure
71+
disconnect_udp if self.udp_sock
6172
end
62-
rescue ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionRefused
63-
nil
64-
ensure
65-
disconnect_udp if self.udp_sock
6673
end
6774
end
6875
end

0 commit comments

Comments
 (0)