1.2.8. plugins

1.2.8.1. Classes

class ServerPlugin(root_config)[source]

Bases: king_phisher.plugins.PluginBase

The base object to be inherited by plugins that are loaded into the King Phisher server. This provides a convenient interface for interacting with the runtime.

config[source]

A dictionary that can be used by this plugin to access it’s configuration. Any changes to this configuration will be lost with the server restarts.

register_http(path, method)[source]

Register a new HTTP request handler at path that is handled by method. Two parameters are passed to the method. The first parameter is a KingPhisherRequestHandler instance and the second is a dictionary of the HTTP query parameters. The specified path is added within the plugins private HTTP handler namespace at _/plugins/$PLUGIN_NAME/$PATH

Warning

This resource can be reached by any user whether or not they are authenticated and or associated with a campaign.

New in version 1.7.0.

Parameters:
  • path (str) – The path to register the method at.
  • method – The handler for the HTTP method.
register_rpc(path, method, database_access=False)[source]

Register a new RPC function at path that is handled by method. This RPC function can only be called by authenticated users. A single parameter of the KingPhisherRequestHandler instance is passed to method when the RPC function is invoked. The specified path is added within the plugins private RPC handler namespace at plugins/$PLUGIN_NAME/$PATH.

New in version 1.7.0.

Changed in version 1.12.0: Added the database_access parameter.

Parameters:
  • path (str) – The path to register the method at.
  • method – The handler for the RPC method.
root_config = None[source]

A reference to the main server instance config.

server = None[source]

A reference to the KingPhisherServer instance. Only available if the instance has been created.

storage = None[source]

An instance of KeyValueStorage for this plugin to use for persistent data storage. This attribute is None until the db_initialized signal is emitted.

class ServerPluginManager(config)[source]

Bases: king_phisher.plugins.PluginManagerBase

The manager for plugins loaded into the King Phisher server application.