Skip to content

Commit ff63e6e

Browse files
committed
Land rapid7#7018, unvendor net-ssh
2 parents 8d8e1f8 + 1ea425a commit ff63e6e

File tree

106 files changed

+193
-8276
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+193
-8276
lines changed

Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ PATH
1818
metasploit_data_models
1919
metasploit_payloads-mettle
2020
msgpack
21+
net-ssh
2122
network_interface
2223
nokogiri
2324
octokit
@@ -174,6 +175,7 @@ GEM
174175
multi_json (1.12.1)
175176
multi_test (0.1.2)
176177
multipart-post (2.0.0)
178+
net-ssh (3.2.0)
177179
network_interface (0.0.1)
178180
nokogiri (1.6.8)
179181
mini_portile2 (~> 2.1.0)

lib/metasploit/framework/login_scanner/ssh.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require 'net/ssh'
22
require 'metasploit/framework/login_scanner/base'
3+
require 'rex/socket/ssh_factory'
34

45
module Metasploit
56
module Framework
@@ -47,12 +48,14 @@ class SSH
4748
# @note The caller *must* close {#ssh_socket}
4849
def attempt_login(credential)
4950
self.ssh_socket = nil
51+
factory = Rex::Socket::SSHFactory.new(framework,framework_module, proxies)
5052
opt_hash = {
51-
:port => port,
52-
:disable_agent => true,
53-
:config => false,
54-
:verbose => verbosity,
55-
:proxies => proxies
53+
:port => port,
54+
:use_agent => false,
55+
:config => false,
56+
:verbose => verbosity,
57+
:proxy => factory,
58+
:non_interactive => true
5659
}
5760
case credential.private_type
5861
when :password, nil

lib/msf/core/exploit/mixins.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
require 'msf/core/exploit/http/client'
4343
require 'msf/core/exploit/http/server'
4444
require 'msf/core/exploit/smtp'
45+
require 'msf/core/exploit/ssh'
4546
require 'msf/core/exploit/sunrpc'
4647
require 'msf/core/exploit/mssql'
4748
require 'msf/core/exploit/mssql_commands'

lib/msf/core/exploit/ssh.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module Msf
2+
module Exploit::Remote::SSH
3+
4+
def ssh_socket_factory
5+
Rex::Socket::SSHFactory.new(framework,self, datastore['Proxies'])
6+
end
7+
end
8+
end

lib/msf/core/handler/reverse_tcp_double.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def initialize(framework, inp, out)
207207
initialize_abstraction
208208

209209
self.lsock.extend(TcpReverseDoubleChannelExt)
210-
self.lsock.peerinfo = @sock_inp.getpeername[1,2].map{|x| x.to_s}.join(":")
210+
self.lsock.peerinfo = @sock_inp.getpeername_as_array[1,2].map{|x| x.to_s}.join(":")
211211
self.lsock.localinfo = @sock_inp.getsockname[1,2].map{|x| x.to_s}.join(":")
212212

213213
monitor_shell_stdout

lib/msf/core/handler/reverse_tcp_double_ssl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def initialize(framework, inp, out)
256256
initialize_abstraction
257257

258258
self.lsock.extend(TcpReverseDoubleSSLChannelExt)
259-
self.lsock.peerinfo = @sock_inp.getpeername[1,2].map{|x| x.to_s}.join(":")
259+
self.lsock.peerinfo = @sock_inp.getpeername_as_array[1,2].map{|x| x.to_s}.join(":")
260260
self.lsock.localinfo = @sock_inp.getsockname[1,2].map{|x| x.to_s}.join(":")
261261

262262
monitor_shell_stdout

lib/net/ssh.rb

Lines changed: 0 additions & 232 deletions
This file was deleted.

0 commit comments

Comments
 (0)