1.1.9. graphs
This module provides the functionality to support the client application’s graphing capabilities.
1.1.9.1. Data
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
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.
- 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()
.
- make_window()[source]
Create a window from the figure manager.
- Returns
The graph in a new, dedicated window.
- Return type
Gtk.Window
- 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
.
- 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.
- 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
- class CampaignGraphMessageResults(*args, **kwargs)[source]
Bases:
king_phisher.client.graphs.CampaignPieGraph
Display the percentage of messages which resulted in a visit.
- class CampaignGraphOverview(*args, **kwargs)[source]
Bases:
king_phisher.client.graphs.CampaignBarGraph
Display a graph which represents an overview of the campaign.
- 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.
- class CampaignGraphVisitorInfo(*args, **kwargs)[source]
Bases:
king_phisher.client.graphs.CampaignBarGraph
Display a graph which shows the different operating systems seen from visitors.
- class CampaignGraphVisitorInfoPie(*args, **kwargs)[source]
Bases:
king_phisher.client.graphs.CampaignPieGraph
Display a graph which compares the different operating systems seen from visitors.
- 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.
- class CampaignGraphVisitsTimeline(*args, **kwargs)[source]
Bases:
king_phisher.client.graphs.CampaignLineGraph
Display a graph which represents the visits of a campaign over time.
- 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.