1.1.9. graphs

This module provides the functionality to support the client application’s graphing capabilities.

1.1.9.1. Data

has_matplotlib = False[source]

Whether the matplotlib module is available.

has_matplotlib_basemap = False[source]

Whether the mpl_toolkits.basemap module is available.

1.1.9.2. Functions

export_graph_provider(cls)[source]

Decorator to mark classes as valid graph providers. This decorator also sets the name attribute.

Parameters:cls (class) – The class to mark as a graph provider.
Returns:The cls parameter is returned.
get_graph(graph_name)[source]

Return the graph providing class for graph_name. The class providing the specified graph must have been previously exported using export_graph_provider().

Parameters:graph_name (str) – The name of the graph provider.
Returns:The graph provider class.
Return type:CampaignGraph
get_graphs()[source]

Get a list of all registered graph providers.

Returns:All registered graph providers.
Return type:list

1.1.9.3. Classes

class GraphBase(application, size_request=None, style_context=None)[source]

Bases: object

A basic graph provider for using matplotlib to create graph representations of campaign data. This class is meant to be subclassed by real providers.

__init__(application, size_request=None, style_context=None)[source]
Parameters:size_request (tuple) – The size to set for the canvas.
config = None[source]

A reference to the King Phisher client configuration.

get_color(color_name, default)[source]

Get a color by its style name such as ‘fg’ for foreground. If the specified color does not exist, default will be returned. The underlying logic for this function is provided by gtk_style_context_get_color().

Parameters:
  • color_name (str) – The style name of the color.
  • default – The default color to return if the specified one was not found.
Returns:

The desired color if it was found.

Return type:

tuple

graph_title = 'Unknown'[source]

The title that will be given to the graph.

make_window()[source]

Create a window from the figure manager.

Returns:The graph in a new, dedicated window.
Return type:Gtk.Window
minimum_size = None[source]

An absolute minimum size for the canvas.

name = 'Unknown'[source]

The name of the graph provider.

name_human = 'Unknown'[source]

The human readable name of the graph provider used for UI identification.

resize(width=0, height=0)[source]

Attempt to resize the canvas. Regardless of the parameters the canvas will never be resized to be smaller than minimum_size.

Parameters:
  • width (int) – The desired width of the canvas.
  • height (int) – The desired height of the canvas.
class CampaignGraph(application, size_request=None, style_context=None)[source]

Bases: king_phisher.client.graphs.GraphBase

Graph format used for the graphs generated in the dashboard and in the create graphs tab.

load_graph()[source]

Load the graph information via refresh().

refresh(info_cache=None, stop_event=None)[source]

Refresh the graph data by retrieving the information from the remote server.

Parameters:
  • info_cache (dict) – An optional cache of data tables.
  • stop_event (threading.Event) – An optional object indicating that the operation should stop.
Returns:

A dictionary of cached tables from the server.

Return type:

dict

class CampaignGraphMessageResults(*args, **kwargs)[source]

Bases: king_phisher.client.graphs.CampaignPieGraph

Display the percentage of messages which resulted in a visit.

graph_title = 'Campaign Message Results'[source]
name = 'MessageResults'[source]
name_human = 'Pie - Message Results'[source]
class CampaignGraphOverview(*args, **kwargs)[source]

Bases: king_phisher.client.graphs.CampaignBarGraph

Display a graph which represents an overview of the campaign.

graph_title = 'Campaign Overview'[source]
name = 'Overview'[source]
name_human = 'Bar - Campaign Overview'[source]
class CampaignGraphPasswordComplexityPie(*args, **kwargs)[source]

Bases: king_phisher.client.graphs.CampaignPieGraph

Display a graph which displays the number of passwords which meet standard complexity requirements.

graph_title = 'Campaign Password Complexity'[source]
name = 'PasswordComplexityPie'[source]
name_human = 'Pie - Password Complexity'[source]
class CampaignGraphVisitorInfo(*args, **kwargs)[source]

Bases: king_phisher.client.graphs.CampaignBarGraph

Display a graph which shows the different operating systems seen from visitors.

graph_title = 'Campaign Visitor OS Information'[source]
name = 'VisitorInfo'[source]
name_human = 'Bar - Visitor OS Information'[source]
class CampaignGraphVisitorInfoPie(*args, **kwargs)[source]

Bases: king_phisher.client.graphs.CampaignPieGraph

Display a graph which compares the different operating systems seen from visitors.

graph_title = 'Campaign Visitor OS Information'[source]
name = 'VisitorInfoPie'[source]
name_human = 'Pie - Visitor OS Information'[source]
class CampaignGraphVisitsMap(application, size_request=None, style_context=None)[source]

Bases: king_phisher.client.graphs.CampaignGraph

A base class to display a map which shows the locations of visit origins.

color_with_creds[source]
color_without_creds[source]
draw_states = False[source]
graph_title = 'Campaign Visit Locations'[source]
is_available = False[source]
CampaignGraphVisitsMapUSA[source]
CampaignGraphVisitsMapWorld[source]
class CampaignGraphVisitsTimeline(*args, **kwargs)[source]

Bases: king_phisher.client.graphs.CampaignLineGraph

Display a graph which represents the visits of a campaign over time.

graph_title = 'Campaign Visits Timeline'[source]
name = 'VisitsTimeline'[source]
name_human = 'Line - Visits Timeline'[source]
class CampaignGraphComparison(*args, **kwargs)[source]

Bases: king_phisher.client.graphs.GraphBase

Display selected campaigns data by order of campaign start date.

__init__(*args, **kwargs)[source]
Parameters:size_request (tuple) – The size to set for the canvas.
load_graph(campaigns)[source]

Load the information to compare the specified and paint it to the canvas. Campaigns are graphed on the X-axis in the order that they are provided. No sorting of campaigns is done by this method.

Parameters:campaigns (tuple) – A tuple containing campaign IDs to compare.