Skip to content

Commit

Permalink
Maybe that timeout is needed.....
Browse files Browse the repository at this point in the history
  • Loading branch information
bwatters-r7 committed Jan 17, 2018
1 parent f439edf commit 4c11eae
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions modules/exploits/multi/ssh/sshexec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,14 @@ def initialize

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

def do_login(ip, user, pass, port)
Expand All @@ -148,9 +155,8 @@ def do_login(ip, user, pass, port)
proxy: factory,
non_interactive: true
}
if (datastore['SSH_DEBUG'])
opt_hash[:verbose] = :debug
end

opt_hash[:verbose] = :debug if (datastore['SSH_DEBUG'])

begin
self.ssh_socket = Net::SSH.start(ip, user, opt_hash)
Expand Down

0 comments on commit 4c11eae

Please sign in to comment.