diff --git a/modules/post/multi/manage/sudo.rb b/modules/post/multi/manage/sudo.rb index e2e1273030..8b7b2f672f 100644 --- a/modules/post/multi/manage/sudo.rb +++ b/modules/post/multi/manage/sudo.rb @@ -30,7 +30,9 @@ class Metasploit3 < Msf::Post versions from 2008 and later which support -A. }, 'License' => MSF_LICENSE, - 'Author' => [ 'todb '], + 'Author' => [ 'todb ', + 'Ryan Baxendale ' #added password option + ], 'Platform' => [ 'linux','unix','osx','solaris','aix' ], 'References' => [ @@ -39,6 +41,11 @@ class Metasploit3 < Msf::Post ], 'SessionTypes' => [ 'shell' ] # Need to test 'meterpreter' )) + + register_options( + [ + OptString.new('PASSWORD', [false, 'The password to use when running sudo.']) + ], self.class) end # Run Method for when run command is issued @@ -57,7 +64,12 @@ class Metasploit3 < Msf::Post end def get_root - password = session.exploit_datastore['PASSWORD'] + if datastore['PASSWORD'] + password = datastore['PASSWORD'] + else + password = session.exploit_datastore['PASSWORD'] + end + if password.to_s.empty? print_status "No password available, trying a passwordless sudo." else