From b133428bc1c6470e06f993a5459ca1842a4e18c8 Mon Sep 17 00:00:00 2001 From: HD Moore Date: Sun, 15 Jul 2012 21:56:00 -0500 Subject: [PATCH] Better error handling in two web app modules --- modules/exploits/multi/http/horde_href_backdoor.rb | 4 ++-- modules/exploits/unix/http/lifesize_room.rb | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/exploits/multi/http/horde_href_backdoor.rb b/modules/exploits/multi/http/horde_href_backdoor.rb index 1ec179a995..c306f767bc 100644 --- a/modules/exploits/multi/http/horde_href_backdoor.rb +++ b/modules/exploits/multi/http/horde_href_backdoor.rb @@ -85,8 +85,8 @@ class Metasploit3 < Msf::Exploit::Remote } }) #default timeout, we don't care about the response - if (res) - print_status("The server returned: #{res.code} #{res.message}") + if not res + fail_with(Exploit::Failure::NotFound, 'The server did not respond to our request') end resp = res.body.split(key) diff --git a/modules/exploits/unix/http/lifesize_room.rb b/modules/exploits/unix/http/lifesize_room.rb index c7cca73397..711f214f9b 100644 --- a/modules/exploits/unix/http/lifesize_room.rb +++ b/modules/exploits/unix/http/lifesize_room.rb @@ -63,9 +63,8 @@ class Metasploit3 < Msf::Exploit::Remote 'method' => 'GET', }, 10) - if not res.headers['set-cookie'] - print_error('Could Not Obtain A Session ID') - return + if not (res and res.headers['set-cookie']) + fail_with(Exploit::Failure::NotFound, 'Could not obtain a Session ID') end sessionid = 'PHPSESSID=' << res.headers['set-cookie'].split('PHPSESSID=')[1].split('; ')[0] @@ -93,7 +92,7 @@ class Metasploit3 < Msf::Exploit::Remote }, 10) if not res - print_error('Could Not Validate The Session ID') + fail_with(Exploit::Failure::NotFound, 'Could not validate the Session ID') return end