From 0e7f61083673bf7f20be9be77d5e31a79db6f8ab Mon Sep 17 00:00:00 2001 From: HD Moore Date: Thu, 2 Jul 2015 12:58:21 -0500 Subject: [PATCH] Finish browser profile rework in BES --- .../exploit/remote/browser_exploit_server.rb | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/lib/msf/core/exploit/remote/browser_exploit_server.rb b/lib/msf/core/exploit/remote/browser_exploit_server.rb index bcd08b9426..a1e36041f6 100644 --- a/lib/msf/core/exploit/remote/browser_exploit_server.rb +++ b/lib/msf/core/exploit/remote/browser_exploit_server.rb @@ -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