Finish browser profile rework in BES

bug/bundler_fix
HD Moore 2015-07-02 12:58:21 -05:00
parent b9a8308138
commit 0e7f610836
1 changed files with 7 additions and 16 deletions

View File

@ -111,17 +111,17 @@ module Msf
end
# Returns a note type that's unique to this browser exploit module.
# This overrides the #note_type_prefix method from Msf::Exploit::Remote::BrowserProfileManager.
# Returns a prefix that's unique to this browser exploit module.
# This overrides the #browser_profile_prefix method from Msf::Exploit::Remote::BrowserProfileManager.
# There are two way for BES to get this prefix, either:
# * It comes from a datastore option. It allows BrowserAutoPwn to share the unique prefix with
# its child exploits, so that these exploits don't have to gather browser information again.
# * If the datastore option isn't set, then we assume the user is firing the exploit as a
# standalone so we make somthing more unique, so that if there are two instances using the
# same exploit, they don't actually share info.
def note_type_prefix
self.datastore['NoteTypePrefix'] || @unique_prefix ||= lambda {
"#{self.shortname}.#{Time.now.to_i}.Client"
def browser_profile_prefix
self.datastore['BrowserProfilePrefix'] || @unique_prefix ||= lambda {
"#{self.shortname}.#{Time.now.to_i}.#{self.module_uuid}"
}.call
end
@ -129,17 +129,8 @@ module Msf
# Cleans up target information owned by the current module.
def cleanup
super
# Whoever registered NoteTypePrefix should do the cleanup for notes
return if self.datastore['NoteTypePrefix']
return unless framework.db.active
::ActiveRecord::Base.connection_pool.with_connection {
framework.db.notes.each do |note|
if note.ntype =~ /^#{self.shortname}\.\d+\.Client/
note.destroy
end
end
}
# Whoever registered BrowserProfilePrefix should do the cleanup
clear_browser_profiles unless self.datastore['BrowserProfilePrefix']
end