Skip to content

Commit 4c11eae

Browse files
committed
Maybe that timeout is needed.....
1 parent f439edf commit 4c11eae

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

modules/exploits/multi/ssh/sshexec.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,14 @@ def initialize
134134

135135
def execute_command(cmd, opts = {})
136136
vprint_status("Executing #{cmd}")
137-
self.ssh_socket.exec!("#{cmd}\n")
137+
begin
138+
Timeout.timeout(5) do
139+
self.ssh_socket.exec!("#{cmd}\n")
140+
end
141+
rescue Timeout::Error
142+
print_error("SSH Timeout Exception will say the Exploit Failed; do not believe it.")
143+
print_good("You will likely still get a shell; run sessions -l to be sure.")
144+
end
138145
end
139146

140147
def do_login(ip, user, pass, port)
@@ -148,9 +155,8 @@ def do_login(ip, user, pass, port)
148155
proxy: factory,
149156
non_interactive: true
150157
}
151-
if (datastore['SSH_DEBUG'])
152-
opt_hash[:verbose] = :debug
153-
end
158+
159+
opt_hash[:verbose] = :debug if (datastore['SSH_DEBUG'])
154160

155161
begin
156162
self.ssh_socket = Net::SSH.start(ip, user, opt_hash)

0 commit comments

Comments
 (0)