2019-06-02 17:11:37 -05:00
|
|
|
# -*- coding: binary -*-
|
|
|
|
|
|
2019-06-02 19:59:06 -05:00
|
|
|
# Require most things so that modules using this will "just work"
|
|
|
|
|
require 'net/ssh'
|
|
|
|
|
require 'net/ssh/command_stream'
|
|
|
|
|
require 'rex/socket/ssh_factory'
|
2020-12-06 01:35:10 -06:00
|
|
|
|
|
|
|
|
# Patch in our custom auth methods:
|
|
|
|
|
# fortinet-backdoor
|
|
|
|
|
# libssh-auth-bypass
|
|
|
|
|
# malformed-packet
|
2020-12-09 16:54:10 -06:00
|
|
|
require 'msf/core/exploit/remote/ssh/auth_methods'
|
2018-09-05 23:10:28 -05:00
|
|
|
|
2019-06-02 19:59:06 -05:00
|
|
|
module Msf::Exploit::Remote::SSH
|
2019-06-02 17:11:37 -05:00
|
|
|
# Register SSH datastore options:
|
2019-06-02 18:26:25 -05:00
|
|
|
# SSH_IDENT (TODO: Refactor to SSHIdent)
|
2019-06-02 17:11:37 -05:00
|
|
|
# SSH_TIMEOUT (TODO: Refactor to SSHTimeout)
|
|
|
|
|
# SSH_DEBUG (TODO: Refactor to SSHDebug)
|
|
|
|
|
include Msf::Exploit::Remote::SSH::Options
|
2018-09-05 23:10:28 -05:00
|
|
|
|
2019-06-02 17:11:37 -05:00
|
|
|
def ssh_socket_factory
|
2022-03-25 16:32:58 +01:00
|
|
|
unless defined? datastore
|
2022-03-24 22:57:27 +01:00
|
|
|
return Rex::Socket::SSHFactory.new(framework, self, proxies)
|
|
|
|
|
end
|
|
|
|
|
|
2019-06-02 17:11:37 -05:00
|
|
|
Rex::Socket::SSHFactory.new(framework, self, datastore['Proxies'])
|
|
|
|
|
end
|
|
|
|
|
|
2020-11-30 16:17:17 -06:00
|
|
|
def ssh_client_defaults
|
|
|
|
|
{
|
|
|
|
|
non_interactive: true,
|
|
|
|
|
config: false,
|
|
|
|
|
use_agent: false,
|
|
|
|
|
verify_host_key: :never,
|
2022-04-13 18:53:50 +02:00
|
|
|
proxy: ssh_socket_factory,
|
|
|
|
|
append_all_supported_algorithms: true
|
2020-11-30 16:17:17 -06:00
|
|
|
}
|
|
|
|
|
end
|
2016-07-19 16:37:19 -05:00
|
|
|
end
|