From a054259ee5d103963960b12ec7abe3bb3cdf4b2a Mon Sep 17 00:00:00 2001 From: Luke Imhoff Date: Wed, 8 Oct 2014 15:26:28 -0500 Subject: [PATCH] Extract Msf::DBManager::Sink MSP-11124 Extract attributes and methods associated with the deprecated sink. --- lib/msf/core/db_manager.rb | 24 +++++------------------- lib/msf/core/db_manager/sink.rb | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 lib/msf/core/db_manager/sink.rb diff --git a/lib/msf/core/db_manager.rb b/lib/msf/core/db_manager.rb index 2301f339a9..e138de9779 100644 --- a/lib/msf/core/db_manager.rb +++ b/lib/msf/core/db_manager.rb @@ -75,11 +75,15 @@ module Msf class DBManager extend Metasploit::Framework::Require + autoload :Sink, 'msf/core/db_manager/sink' + include Msf::DBManager::ImportMsfXml optionally_include_metasploit_credential_creation - # Provides :framework and other accessors include Msf::DBManager::Migration + include Msf::DBManager::Sink + + # Provides :framework and other accessors include Msf::Framework::Offspring # @@ -121,9 +125,6 @@ class DBManager # Stores the error message for why the db was not loaded attr_accessor :error - # Stores a TaskManager for serializing database events - attr_accessor :sink - # Flag to indicate that modules are cached attr_accessor :modules_cached @@ -245,21 +246,6 @@ class DBManager end end - # - # Create a new database sink and initialize it - # - def initialize_sink - self.sink = TaskManager.new(framework) - self.sink.start - end - - # - # Add a new task to the sink - # - def queue(proc) - self.sink.queue_proc(proc) - end - # # Connects this instance to a database # diff --git a/lib/msf/core/db_manager/sink.rb b/lib/msf/core/db_manager/sink.rb new file mode 100644 index 0000000000..de14452484 --- /dev/null +++ b/lib/msf/core/db_manager/sink.rb @@ -0,0 +1,27 @@ +module Msf::DBManager::Sink + # + # Attributes + # + + # Stores a TaskManager for serializing database events + attr_accessor :sink + + # + # Instance Methods + # + + # + # Create a new database sink and initialize it + # + def initialize_sink + self.sink = Msf::TaskManager.new(framework) + self.sink.start + end + + # + # Add a new task to the sink + # + def queue(proc) + self.sink.queue_proc(proc) + end +end \ No newline at end of file