1.1.6. application

This module provides the top level GTK application object representing the client application.

1.1.6.1. Data

GTK3_DEFAULT_THEME = 'Adwaita'[source]

The default GTK3 Theme for style information.

USER_DATA_PATH = 'king-phisher'[source]

The default folder name for user specific data storage.

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.

id[source]

The user’s unique identifier.

name[source]

The user’s name.

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 a GladeGObject or Gtk.Widget instance so a cleanup function can be attached to a destroy signal to remove the reference automatically.

Parameters:ref_object (GladeGObject, Gtk.Widget) – The object to store a reference to.
config = None[source]

The primary King Phisher client configuration.

config_file = None[source]

The file containing the King Phisher client configuration.

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
load_server_config()[source]

Load the necessary values from the server’s configuration.

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:
  • strict (bool) – Do not try remove trailing commas from the JSON data.
  • config_file (str) – The path to the configuration file to merge.
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:

tuple

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.

stop_remote_service()[source]

Stop the remote King Phisher server. This will request that the server stop processing new requests and exit. This will display a confirmation dialog before performing the operation. If the remote service is stopped, the client will quit.

user_data_path = None[source]

The path to a directory where user data files can be stored. This path must be writable by the current user.

The default value is platform dependant:

Linux:~/.config/king-phisher
Windows:%LOCALAPPDATA%\king-phisher