added some comments, and introduced the DatabaseEvent mixin

git-svn-id: file:///home/svn/framework3/trunk@4472 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Miller 2007-02-25 21:25:41 +00:00
parent 7440a50f04
commit c8bbefcab0
3 changed files with 49 additions and 4 deletions

View File

@ -10,7 +10,6 @@ module Msf
# targets and whatnot). # targets and whatnot).
# #
### ###
class Auxiliary < Msf::Module class Auxiliary < Msf::Module
# #

View File

@ -40,13 +40,59 @@ module ServiceState
Unknown = "unknown" Unknown = "unknown"
end end
###
#
# Events that can occur in the host/service database.
#
###
module DatabaseEvent
#
# Called when an existing host's state changes
#
def on_db_host_state(context, host, ostate)
end
#
# Called when an existing service's state changes
#
def on_db_service_state(context, host, port, ostate)
end
#
# Called when a new host is added to the database. The host parameter is
# of type Host.
#
def on_db_host(context, host)
end
#
# Called when a new service is added to the database. The service
# parameter is of type Service.
#
def on_db_service(context, service)
end
#
# Called when an applicable vulnerability is found for a service. The vuln
# parameter is of type Vuln.
#
def on_db_vuln(context, vuln)
end
#
# Called when a new reference is created.
#
def on_db_ref(context, ref)
end
end
### ###
# #
# The DB module ActiveRecord definitions for the DBManager # The DB module ActiveRecord definitions for the DBManager
# #
### ###
class DBManager class DBManager

View File

@ -69,8 +69,8 @@ class EventDispatcher
# #
# This method adds a db event subscriber. db event subscribers # This method adds a db event subscriber. db event subscribers
# receive notifications when events occur that pertain to db changes. # receive notifications when events occur that pertain to db changes.
# The subscriber provided must implement the dbEvents module methods in # The subscriber provided must implement the DatabaseEvent module methods
# some form. # in some form.
# #
def add_db_subscriber(subscriber) def add_db_subscriber(subscriber)
add_event_subscriber(db_event_subscribers, subscriber) add_event_subscriber(db_event_subscribers, subscriber)