From b4b8ac084947b917030ec8974030f2efc10e1ce9 Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Thu, 16 Apr 2015 21:26:37 +0200 Subject: [PATCH] moar fail_with's --- modules/auxiliary/gather/solarwinds_orion_sqli.rb | 5 ++--- .../gather/wp_ultimate_csv_importer_user_extract.rb | 2 +- modules/exploits/osx/local/persistence.rb | 4 ++-- modules/post/osx/gather/hashdump.rb | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/auxiliary/gather/solarwinds_orion_sqli.rb b/modules/auxiliary/gather/solarwinds_orion_sqli.rb index 567a8a2faf..50ea93d350 100644 --- a/modules/auxiliary/gather/solarwinds_orion_sqli.rb +++ b/modules/auxiliary/gather/solarwinds_orion_sqli.rb @@ -64,11 +64,11 @@ class Metasploit3 < Msf::Auxiliary }) if res.nil? - fail_with("Server didn't respond in an expected way") + fail_with(Failure::UnexpectedReply, "Server didn't respond in an expected way") end if res.code == 200 - fail_with("Authentication failed with username #{username}") + fail_with(Failure::NoAccess, "Authentication failed with username #{username}") end return cookie + ';' + res.get_cookies @@ -97,4 +97,3 @@ class Metasploit3 < Msf::Auxiliary print_good("The injection worked, log in with #{username} and a blank password") end end - diff --git a/modules/auxiliary/gather/wp_ultimate_csv_importer_user_extract.rb b/modules/auxiliary/gather/wp_ultimate_csv_importer_user_extract.rb index 88c41fee0c..b2ecbc810f 100644 --- a/modules/auxiliary/gather/wp_ultimate_csv_importer_user_extract.rb +++ b/modules/auxiliary/gather/wp_ultimate_csv_importer_user_extract.rb @@ -100,7 +100,7 @@ class Metasploit3 < Msf::Auxiliary print_status("#{peer} - Parsing response...") unless parse_csv(res.body, ',') unless parse_csv(res.body, ';') - fail_with("#{peer} - Failed to parse response, the CSV was invalid") + fail_with(Failure::UnexpectedReply, "#{peer} - Failed to parse response, the CSV was invalid") end end diff --git a/modules/exploits/osx/local/persistence.rb b/modules/exploits/osx/local/persistence.rb index 1e7abb4d4d..260632a90d 100644 --- a/modules/exploits/osx/local/persistence.rb +++ b/modules/exploits/osx/local/persistence.rb @@ -89,7 +89,7 @@ class Metasploit3 < Msf::Exploit::Local if write_file(plist_path, item) print_good("LaunchAgent added: #{plist_path}") else - fail_with("Error writing LaunchAgent item to #{plist_path}") + fail_with(Failure::UnexpectedReply, "Error writing LaunchAgent item to #{plist_path}") end if run_now? @@ -154,7 +154,7 @@ class Metasploit3 < Msf::Exploit::Local print_good("Backdoor stored to #{backdoor_path}") cmd_exec("chmod +x #{backdoor_path.shellescape}") else - fail_with("Error dropping backdoor to #{backdoor_path}") + fail_with(Failure::UnexpectedReply, "Error dropping backdoor to #{backdoor_path}") end end end diff --git a/modules/post/osx/gather/hashdump.rb b/modules/post/osx/gather/hashdump.rb index 10918a0540..4125e961ac 100644 --- a/modules/post/osx/gather/hashdump.rb +++ b/modules/post/osx/gather/hashdump.rb @@ -40,7 +40,7 @@ class Metasploit3 < Msf::Post # Run Method for when run command is issued def run - fail_with("Insufficient Privileges: must be running as root to dump the hashes") unless root? + fail_with(Failure::BadConfig, "Insufficient Privileges: must be running as root to dump the hashes") unless root? # iterate over all users users.each do |user|