1.2.13. signals
¶
This module contains the signals which are used by the server to dispatch events. Additional signal details regarding how these signals are used is available in the Server Signals documentation.
1.2.13.1. Functions¶
-
send_safe
(signal, logger, sender, **kwargs)[source]¶ Send a signal and catch any exception which may be raised during it’s emission. Details regarding the error that occurs (including a stack trace) are logged to the specified logger. This is suitable for allowing signals to be emitted in critical code paths without interrupting the emitter.
Parameters: - signal (str) – The name of the signal to send safely.
- logger (
logging.Logger
) – The logger to use for logging exceptions. - sender – The sender for this signal emission.
- kwargs – The key word arguments to be forward to the signal as it is sent.
1.2.13.2. Signals¶
-
campaign_alert
[source]¶ Emitted for each user who is subscribed to alerts for a particular campaign. Users subscribe to campaign alerts through the GUI by enabling the “Subscribe To Event Alerts” setting. Alerts are for either the “credentials” or “visits” table.
Note
This signal is not emitted for every entry into the respective tables but rather at progressively longer intervals to prevent the user from receiving an excessive amount of messages within a short period of time.
Parameters:
-
db_initialized
[source]¶ Emitted after a connection has been made and the database has been fully initialized. At this point, it is safe to operate on the database.
Parameters: connection_url ( sqlalchemy.engine.url.URL
) – The connection string for the database that has been initialized.
-
db_session_deleted
[source]¶ Emitted after one or more rows have been deleted on a SQLAlchemy session. At this point, references are valid but objects can not be modified. See
sqlalchemy.orm.events.SessionEvents.after_flush()
for more details.Parameters:
-
db_session_inserted
[source]¶ Emitted after one or more rows have been inserted in a SQLAlchemy session. At this point, references are valid but objects can not be modified. See
sqlalchemy.orm.events.SessionEvents.after_flush()
for more details.Parameters:
-
db_session_updated
[source]¶ Emitted after one or more rows have been updated in a SQLAlchemy session. At this point, references are valid but objects can not be modified. See
sqlalchemy.orm.events.SessionEvents.after_flush()
for more details.Parameters:
-
db_table_delete
[source]¶ Emitted before a row inheriting from
Base
is deleted from the database table. To only subscribe to delete events for a specific table, specify the table’s name as the sender parameter when callingblinker.base.Signal.connect()
. Seesqlalchemy.orm.events.MapperEvents.before_delete()
for more details.Parameters: - table (str) – The name of the table for which the target object belongs.
- mapper (
sqlalchemy.orm.mapper.Mapper
) – The Mapper object which is the target of the event. - connection (
sqlalchemy.engine.Connection
) – The SQLAlchemy connection object which is being used to emit the SQL statements for the instance. - target – The target object instance.
-
db_table_insert
[source]¶ Emitted before a row inheriting from
Base
is inserted into the database table. To only subscribe to insert events for a specific table, specify the table’s name as the sender parameter when callingblinker.base.Signal.connect()
. Seesqlalchemy.orm.events.MapperEvents.before_insert()
for more details.Parameters: - table (str) – The name of the table for which the target object belongs.
- mapper (
sqlalchemy.orm.mapper.Mapper
) – The Mapper object which is the target of the event. - connection (
sqlalchemy.engine.Connection
) – The SQLAlchemy connection object which is being used to emit the SQL statements for the instance. - target – The target object instance.
-
db_table_update
[source]¶ Emitted before a row inheriting from
Base
is updated in the database table. To only subscribe to update events for a specific table, specify the table’s name as the sender parameter when callingblinker.base.Signal.connect()
. Seesqlalchemy.orm.events.MapperEvents.before_update()
for more details.Parameters: - table (str) – The name of the table for which the target object belongs.
- mapper (
sqlalchemy.orm.mapper.Mapper
) – The Mapper object which is the target of the event. - connection (
sqlalchemy.engine.Connection
) – The SQLAlchemy connection object which is being used to emit the SQL statements for the instance. - target – The target object instance.
-
email_opened
[source]¶ Sent when a request for the embedded image is received.
Parameters: request_handler – The handler for the received request.
-
request_handle
[source]¶ Sent after a new HTTP request has been received and is about to be handled. This signal is suitable for implementing custom request handlers or aborting requests. This signal is emitted after
request_received
to allow subscribers the opportunity to handle requests themselves.Note
If a request has been handled by the signal, the signal handler must raise the
KingPhisherAbortRequestError
exception to prevent further processing.Parameters: request_handler – The handler for the received request.
-
request_received
[source]¶ Sent when a new HTTP request has been received and is about to be handled. This signal is not suitable for implementing custom request handlers or aborting requests. This signal is emitted before
request_handle
allowing subscribers to be notified before a request may be blocked.Parameters: request_handler – The handler for the received request.
-
response_sent
[source]¶ Sent after a response to an HTTP request has been sent to the client. At this point headers may be added to the response body.
Parameters:
-
rpc_method_call
[source]¶ Sent when a new RPC request has been received and it’s corresponding method is about to be called.
Parameters:
-
rpc_method_called
[source]¶ Sent after an RPC request has been received and it’s corresponding method has been called.
Parameters: - method (str) – The RPC method which has been executed.
- request_handler – The handler for the received request.
- args (tuple) – The arguments that were passed to the method.
- kwargs (dict) – The key word arguments that were passed to the method.
- retval – The value returned from the RPC method invocation.
-
rpc_user_logged_in
[source]¶ Sent when a new RPC user has successfully logged in and created a new authenticated session.
Parameters:
-
rpc_user_logged_out
[source]¶ Sent when an authenticated RPC user has successfully logged out and terminated their authenticated session.
Parameters:
-
server_initialized
[source]¶ Sent when a new instance of
KingPhisherServer
is initialized.Parameters: server – The newly initialized server instance.