Make style consistent
parent
45e0b53fc8
commit
60c0272270
|
@ -48,15 +48,15 @@ class MetasploitModule < Msf::Auxiliary
|
||||||
factory = ssh_socket_factory
|
factory = ssh_socket_factory
|
||||||
|
|
||||||
ssh_opts = {
|
ssh_opts = {
|
||||||
:port => rport,
|
port: rport,
|
||||||
# The auth method is converted into a class name for instantiation,
|
# The auth method is converted into a class name for instantiation,
|
||||||
# so fortinet-backdoor here becomes FortinetBackdoor from the mixin
|
# so fortinet-backdoor here becomes FortinetBackdoor from the mixin
|
||||||
:auth_methods => ['fortinet-backdoor'],
|
auth_methods: ['fortinet-backdoor'],
|
||||||
:non_interactive => true,
|
non_interactive: true,
|
||||||
:config => false,
|
config: false,
|
||||||
:use_agent => false,
|
use_agent: false,
|
||||||
:proxy => factory,
|
verify_host_key: :never,
|
||||||
:verify_host_key => :never
|
proxy: factory
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh_opts.merge!(verbose: :debug) if datastore['SSH_DEBUG']
|
ssh_opts.merge!(verbose: :debug) if datastore['SSH_DEBUG']
|
||||||
|
|
|
@ -80,12 +80,12 @@ class MetasploitModule < Msf::Auxiliary
|
||||||
pass = Rex::Text.rand_text_alphanumeric(64_000)
|
pass = Rex::Text.rand_text_alphanumeric(64_000)
|
||||||
factory = ssh_socket_factory
|
factory = ssh_socket_factory
|
||||||
opt_hash = {
|
opt_hash = {
|
||||||
:auth_methods => ['password', 'keyboard-interactive'],
|
:auth_methods => ['password', 'keyboard-interactive'],
|
||||||
:port => port,
|
:port => port,
|
||||||
:use_agent => false,
|
:use_agent => false,
|
||||||
:password => pass,
|
:password => pass,
|
||||||
:config => false,
|
:config => false,
|
||||||
:proxy => factory,
|
:proxy => factory,
|
||||||
:non_interactive => true,
|
:non_interactive => true,
|
||||||
:verify_host_key => :never
|
:verify_host_key => :never
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,14 +74,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
def do_login(user)
|
def do_login(user)
|
||||||
factory = Rex::Socket::SSHFactory.new(framework,self, datastore['Proxies'])
|
factory = Rex::Socket::SSHFactory.new(framework,self, datastore['Proxies'])
|
||||||
opt_hash = {
|
opt_hash = {
|
||||||
:auth_methods => ['publickey'],
|
:auth_methods => ['publickey'],
|
||||||
:port => rport,
|
:port => rport,
|
||||||
:key_data => [ key_data ],
|
:key_data => [ key_data ],
|
||||||
:use_agent => false,
|
:use_agent => false,
|
||||||
:config => false,
|
:config => false,
|
||||||
:proxy => factory,
|
:proxy => factory,
|
||||||
:non_interactive => true,
|
:non_interactive => true,
|
||||||
:verify_host_key => :never
|
:verify_host_key => :never
|
||||||
}
|
}
|
||||||
opt_hash.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
opt_hash.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -118,14 +118,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
factory = ssh_socket_factory
|
factory = ssh_socket_factory
|
||||||
|
|
||||||
ssh_options = {
|
ssh_options = {
|
||||||
:auth_methods => ['publickey'],
|
:auth_methods => ['publickey'],
|
||||||
:config => false,
|
:config => false,
|
||||||
:use_agent => false,
|
:use_agent => false,
|
||||||
:key_data => [ key_data ],
|
:key_data => [ key_data ],
|
||||||
:port => rport,
|
:port => rport,
|
||||||
:proxy => factory,
|
:proxy => factory,
|
||||||
:non_interactive => true,
|
:non_interactive => true,
|
||||||
:verify_host_key => :never
|
:verify_host_key => :never
|
||||||
}
|
}
|
||||||
ssh_options.merge!(verbose: :debug) if datastore['SSH_DEBUG']
|
ssh_options.merge!(verbose: :debug) if datastore['SSH_DEBUG']
|
||||||
|
|
||||||
|
|
|
@ -77,14 +77,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
factory = Rex::Socket::SSHFactory.new(framework, self, datastore['Proxies'])
|
factory = Rex::Socket::SSHFactory.new(framework, self, datastore['Proxies'])
|
||||||
|
|
||||||
opt_hash = {
|
opt_hash = {
|
||||||
:auth_methods => ['publickey'],
|
:auth_methods => ['publickey'],
|
||||||
:port => rport,
|
:port => rport,
|
||||||
:key_data => [ key_data ],
|
:key_data => [ key_data ],
|
||||||
:use_agent => false,
|
:use_agent => false,
|
||||||
:config => false,
|
:config => false,
|
||||||
:proxy => factory,
|
:proxy => factory,
|
||||||
:non_interactive => true,
|
:non_interactive => true,
|
||||||
:verify_host_key => :never
|
:verify_host_key => :never
|
||||||
}
|
}
|
||||||
opt_hash[:verbose] = :debug if datastore['SSH_DEBUG']
|
opt_hash[:verbose] = :debug if datastore['SSH_DEBUG']
|
||||||
|
|
||||||
|
|
|
@ -74,14 +74,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
def exploit
|
def exploit
|
||||||
factory = ssh_socket_factory
|
factory = ssh_socket_factory
|
||||||
ssh_options = {
|
ssh_options = {
|
||||||
:auth_methods => ['publickey'],
|
:auth_methods => ['publickey'],
|
||||||
:config => false,
|
:config => false,
|
||||||
:use_agent => false,
|
:use_agent => false,
|
||||||
:key_data => [ ssh_priv_key ],
|
:key_data => [ ssh_priv_key ],
|
||||||
:port => rport,
|
:port => rport,
|
||||||
:proxy => factory,
|
:proxy => factory,
|
||||||
:non_interactive => true,
|
:non_interactive => true,
|
||||||
:verify_host_key => :never
|
:verify_host_key => :never
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh_options.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
ssh_options.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||||
|
|
|
@ -70,14 +70,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
def do_login(user)
|
def do_login(user)
|
||||||
factory = ssh_socket_factory
|
factory = ssh_socket_factory
|
||||||
opt_hash = {
|
opt_hash = {
|
||||||
:auth_methods => ['publickey'],
|
:auth_methods => ['publickey'],
|
||||||
:port => rport,
|
:port => rport,
|
||||||
:key_data => [ key_data ],
|
:key_data => [ key_data ],
|
||||||
:use_agent => false,
|
:use_agent => false,
|
||||||
:config => false,
|
:config => false,
|
||||||
:proxy => factory,
|
:proxy => factory,
|
||||||
:non_interactive => true,
|
:non_interactive => true,
|
||||||
:verify_host_key => :never
|
:verify_host_key => :never
|
||||||
}
|
}
|
||||||
opt_hash.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
opt_hash.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -82,14 +82,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
def do_login(user, pass)
|
def do_login(user, pass)
|
||||||
factory = ssh_socket_factory
|
factory = ssh_socket_factory
|
||||||
opts = {
|
opts = {
|
||||||
:auth_methods => ['password', 'keyboard-interactive'],
|
:auth_methods => ['password', 'keyboard-interactive'],
|
||||||
:port => rport,
|
:port => rport,
|
||||||
:use_agent => false,
|
:use_agent => false,
|
||||||
:config => true,
|
:config => true,
|
||||||
:password => pass,
|
:password => pass,
|
||||||
:proxy => factory,
|
:proxy => factory,
|
||||||
:non_interactive => true,
|
:non_interactive => true,
|
||||||
:verify_host_key => :never
|
:verify_host_key => :never
|
||||||
}
|
}
|
||||||
|
|
||||||
opts.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
opts.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||||
|
|
|
@ -75,14 +75,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
def exploit
|
def exploit
|
||||||
factory = ssh_socket_factory
|
factory = ssh_socket_factory
|
||||||
opts = {
|
opts = {
|
||||||
:auth_methods => ['keyboard-interactive'],
|
:auth_methods => ['keyboard-interactive'],
|
||||||
:port => rport,
|
:port => rport,
|
||||||
:use_agent => false,
|
:use_agent => false,
|
||||||
:config => false,
|
:config => false,
|
||||||
:password => password,
|
:password => password,
|
||||||
:proxy => factory,
|
:proxy => factory,
|
||||||
:non_interactive => true,
|
:non_interactive => true,
|
||||||
:verify_host_key => :never
|
:verify_host_key => :never
|
||||||
}
|
}
|
||||||
|
|
||||||
opts.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
opts.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||||
|
|
|
@ -86,14 +86,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
def do_login(user, pass)
|
def do_login(user, pass)
|
||||||
factory = ssh_socket_factory
|
factory = ssh_socket_factory
|
||||||
opts = {
|
opts = {
|
||||||
:auth_methods => ['password', 'keyboard-interactive'],
|
:auth_methods => ['password', 'keyboard-interactive'],
|
||||||
:port => rport,
|
:port => rport,
|
||||||
:use_agent => false,
|
:use_agent => false,
|
||||||
:config => false,
|
:config => false,
|
||||||
:password => pass,
|
:password => pass,
|
||||||
:proxy => factory,
|
:proxy => factory,
|
||||||
:non_interactive => true,
|
:non_interactive => true,
|
||||||
:verify_host_key => :never
|
:verify_host_key => :never
|
||||||
}
|
}
|
||||||
|
|
||||||
opts.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
opts.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||||
|
|
|
@ -124,14 +124,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
factory = ssh_socket_factory
|
factory = ssh_socket_factory
|
||||||
|
|
||||||
ssh_opts = {
|
ssh_opts = {
|
||||||
:port => datastore['SSH_PORT'],
|
port: datastore['SSH_PORT'],
|
||||||
:auth_methods => %w{publickey password},
|
auth_methods: %w{publickey password},
|
||||||
:key_data => [private_key],
|
key_data: [private_key],
|
||||||
:non_interactive => true,
|
non_interactive: true,
|
||||||
:config => false,
|
config: false,
|
||||||
:use_agent => false,
|
use_agent: false,
|
||||||
:proxy => factory,
|
verify_host_key: :never,
|
||||||
:verify_host_key => :never
|
proxy: factory
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh_opts.merge!(verbose: :debug) if datastore['SSH_DEBUG']
|
ssh_opts.merge!(verbose: :debug) if datastore['SSH_DEBUG']
|
||||||
|
|
|
@ -70,14 +70,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
def do_login()
|
def do_login()
|
||||||
factory = Rex::Socket::SSHFactory.new(framework,self, datastore['Proxies'])
|
factory = Rex::Socket::SSHFactory.new(framework,self, datastore['Proxies'])
|
||||||
opt_hash = {
|
opt_hash = {
|
||||||
:auth_methods => ['publickey'],
|
:auth_methods => ['publickey'],
|
||||||
:port => rport,
|
:port => rport,
|
||||||
:key_data => [ key_data ],
|
:key_data => [ key_data ],
|
||||||
:use_agent => false,
|
:use_agent => false,
|
||||||
:config => false,
|
:config => false,
|
||||||
:proxy => factory,
|
:proxy => factory,
|
||||||
:non_interactive => true,
|
:non_interactive => true,
|
||||||
:verify_host_key => :never
|
:verify_host_key => :never
|
||||||
}
|
}
|
||||||
opt_hash.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
opt_hash.merge!(:verbose => :debug) if datastore['SSH_DEBUG']
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -147,14 +147,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
def do_login(ip, user, pass, port)
|
def do_login(ip, user, pass, port)
|
||||||
factory = ssh_socket_factory
|
factory = ssh_socket_factory
|
||||||
opt_hash = {
|
opt_hash = {
|
||||||
:auth_methods => ['password', 'keyboard-interactive'],
|
:auth_methods => ['password', 'keyboard-interactive'],
|
||||||
:port => port,
|
:port => port,
|
||||||
:use_agent => false,
|
:use_agent => false,
|
||||||
:config => false,
|
:config => false,
|
||||||
:password => pass,
|
:password => pass,
|
||||||
:proxy => factory,
|
:proxy => factory,
|
||||||
:non_interactive => true,
|
:non_interactive => true,
|
||||||
:verify_host_key => :never
|
:verify_host_key => :never
|
||||||
}
|
}
|
||||||
|
|
||||||
opt_hash[:verbose] = :debug if (datastore['SSH_DEBUG'])
|
opt_hash[:verbose] = :debug if (datastore['SSH_DEBUG'])
|
||||||
|
|
|
@ -101,14 +101,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
|
|
||||||
factory = ssh_socket_factory
|
factory = ssh_socket_factory
|
||||||
opts = {
|
opts = {
|
||||||
:auth_methods => ['publickey'],
|
:auth_methods => ['publickey'],
|
||||||
:port => rport,
|
:port => rport,
|
||||||
:use_agent => false,
|
:use_agent => false,
|
||||||
:config => true,
|
:config => true,
|
||||||
:key_data => key_data,
|
:key_data => key_data,
|
||||||
:proxy => factory,
|
:proxy => factory,
|
||||||
:non_interactive => true,
|
:non_interactive => true,
|
||||||
:verify_host_key => :never
|
:verify_host_key => :never
|
||||||
}
|
}
|
||||||
|
|
||||||
opts
|
opts
|
||||||
|
@ -118,14 +118,14 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
print_status("#{rhost}:#{rport} - Attempting to login with '#{user}:#{pass}'")
|
print_status("#{rhost}:#{rport} - Attempting to login with '#{user}:#{pass}'")
|
||||||
factory = ssh_socket_factory
|
factory = ssh_socket_factory
|
||||||
opts = {
|
opts = {
|
||||||
:auth_methods => ['password', 'keyboard-interactive'],
|
:auth_methods => ['password', 'keyboard-interactive'],
|
||||||
:port => rport,
|
:port => rport,
|
||||||
:use_agent => false,
|
:use_agent => false,
|
||||||
:config => true,
|
:config => true,
|
||||||
:password => pass,
|
:password => pass,
|
||||||
:proxy => factory,
|
:proxy => factory,
|
||||||
:non_interactive => true,
|
:non_interactive => true,
|
||||||
:verify_host_key => :never
|
:verify_host_key => :never
|
||||||
}
|
}
|
||||||
|
|
||||||
opts
|
opts
|
||||||
|
|
|
@ -186,10 +186,10 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
end
|
end
|
||||||
|
|
||||||
def init_ssh(user)
|
def init_ssh(user)
|
||||||
opts = {
|
opts = {
|
||||||
:user => user,
|
:user => user,
|
||||||
:port => rport,
|
:port => rport,
|
||||||
:verify_host_key => :never
|
:verify_host_key => :never
|
||||||
}
|
}
|
||||||
options = Net::SSH::Config.for(rhost, Net::SSH::Config.default_files).merge(opts)
|
options = Net::SSH::Config.for(rhost, Net::SSH::Config.default_files).merge(opts)
|
||||||
transport = Net::SSH::Transport::Session.new(rhost, options)
|
transport = Net::SSH::Transport::Session.new(rhost, options)
|
||||||
|
|
|
@ -80,13 +80,13 @@ class MetasploitModule < Msf::Exploit::Remote
|
||||||
|
|
||||||
def setup_ssh_options
|
def setup_ssh_options
|
||||||
{
|
{
|
||||||
:password => rand_text_alpha(8),
|
:password => rand_text_alpha(8),
|
||||||
:port => datastore['RPORT'],
|
:port => datastore['RPORT'],
|
||||||
:timeout => 1,
|
:timeout => 1,
|
||||||
:proxies => datastore['Proxies'],
|
:proxies => datastore['Proxies'],
|
||||||
:key_data => OpenSSL::PKey::RSA.new(2048).to_pem,
|
:key_data => OpenSSL::PKey::RSA.new(2048).to_pem,
|
||||||
:auth_methods => ['publickey'],
|
:auth_methods => ['publickey'],
|
||||||
:verify_host_key => :never
|
:verify_host_key => :never
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -138,13 +138,13 @@ RSpec.describe Metasploit::Framework::LoginScanner::SSH do
|
||||||
it 'calls Net::SSH with the correct arguments' do
|
it 'calls Net::SSH with the correct arguments' do
|
||||||
factory = Rex::Socket::SSHFactory.new(nil,nil,nil)
|
factory = Rex::Socket::SSHFactory.new(nil,nil,nil)
|
||||||
opt_hash = {
|
opt_hash = {
|
||||||
:port => ssh_scanner.port,
|
:port => ssh_scanner.port,
|
||||||
:use_agent => false,
|
:use_agent => false,
|
||||||
:config => false,
|
:config => false,
|
||||||
:verbose => ssh_scanner.verbosity,
|
:verbose => ssh_scanner.verbosity,
|
||||||
:proxy => factory,
|
:proxy => factory,
|
||||||
:auth_methods => ['password','keyboard-interactive'],
|
:auth_methods => ['password','keyboard-interactive'],
|
||||||
:password => private,
|
:password => private,
|
||||||
:non_interactive => true,
|
:non_interactive => true,
|
||||||
:verify_host_key => :never
|
:verify_host_key => :never
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue