1.1.6. application
¶
This module provides the top level GTK application object representing the client application.
1.1.6.1. Data¶
1.1.6.2. Classes¶
-
class
ServerUser
(id, name)[source]¶ Bases:
tuple
A named tuple representing the user that is authenticated on the remote server.
-
class
KingPhisherClientApplication
(config_file=None, use_plugins=True, use_style=True)[source]¶ Bases:
Gtk.Application
This is the top level King Phisher client object. It contains the custom GObject signals, keeps all the GUI references, and manages the RPC client object. This is also the parent window for most GTK objects.
GObject Signals: Signal Flags -
__init__
(config_file=None, use_plugins=True, use_style=True)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
add_reference
(ref_object)[source]¶ Add ref_object to the
references
so the object won’t be garbage collected. The object must either be aGladeGObject
orGtk.Widget
instance so a cleanup function can be attached to adestroy
signal to remove the reference automatically.Parameters: ref_object ( GladeGObject
,Gtk.Widget
) – The object to store a reference to.
-
do_campaign_delete
(campaign_id)[source]¶ Delete the campaign on the server. A confirmation dialog will be displayed before the operation is performed. If the campaign is deleted and a new campaign is not selected with
show_campaign_selection()
, the client will quit.
-
do_config_load
(load_defaults)[source]¶ Load the client configuration from disk and set the
config
attribute.Check the proxy environment variable and set them appropriately.
Parameters: load_defaults (bool) – Load missing options from the template configuration file.
-
do_server_disconnected
()[source]¶ Clean up the connections to the server and disconnect. This logs out of the RPC, closes the server event socket, and stops the SSH forwarder.
-
do_sftp_client_start
()[source]¶ Start the client’s preferred sftp client application in a new process.
-
get_graphql_campaign
(campaign_id=None)[source]¶ Retrieve the GraphQL representation of the specified campaign. If campaign_id is not specified, then the data for the current campaign is retrieved.
Parameters: campaign_id (str) – The ID for the campaign whose information should be retrieved. Returns: The campaign’s GraphQL representation. Return type: dict
-
main_window
= None[source]¶ The primary top-level
MainAppWindow
instance.
-
merge_config
(config_file, strict=True)[source]¶ Merge the configuration information from the specified configuration file. Only keys which exist in the currently loaded configuration are copied over while non-existent keys are skipped. The contents of the new configuration overwrites the existing.
Parameters:
-
plugin_manager
= None[source]¶ The
ClientPluginManager
instance to manage the installed client plugins.
-
quit
(optional=False)[source]¶ Quit the client and perform any necessary clean up operations. If optional is False then the exit-confirm signal will not be sent and there will not be any opportunities for the client to cancel the operation.
Parameters: optional (bool) – Whether the quit is request is optional or not.
-
references
= None[source]¶ A list to store references to arbitrary objects in for avoiding garbage collection.
-
rpc
= None[source]¶ The
KingPhisherRPCClient
instance for the application.
-
server_connect
(username, password, otp=None, window=None)[source]¶ Initialize the connection to the King Phisher server.
Parameters: - username (str) – The username to authenticate with.
- password (str) – The password to authenticate with.
- otp (str) – The optional one-time password to authenticate with.
- window (
Gtk.Window
) – The GTK window to use as the parent for error dialogs.
Return type:
-
server_events
= None[source]¶ The
ServerEventSubscriber
instance for the application to receive server events.
-
server_user
= None[source]¶ The
ServerUser
instance for the authenticated user.
-
show_campaign_graph
(graph_name)[source]¶ Create a new
CampaignGraph
instance and make it into a window. graph_name must be the name of a valid, exported graph provider.Parameters: graph_name (str) – The name of the graph to make a window of.
-
show_campaign_selection
()[source]¶ Display the campaign selection dialog in a new
CampaignSelectionDialog
instance.Returns: Whether or not a campaign was selected. Return type: bool
-
show_preferences
()[source]¶ Display a
dialogs.configuration.ConfigurationDialog
instance and saves the configuration to disk if cancel is not selected.
-