1.1.3.2. mail

This module provides the contents of the tab used to create and send messages as part of a campaign.

1.1.3.2.1. Functions

test_webserver_url(target_url, secret_id)[source]

Test the target URL to ensure that it is valid and the server is responding.

Parameters
  • target_url (str) – The URL to make a test request to.

  • secret_id (str) – The King Phisher Server secret id to include in the test request.

1.1.3.2.2. Classes

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

Bases: GladeGObject

This is the tab which allows the user to configure and set parameters for sending messages as part of a campaign.

config_prefix = 'mailer.'[source]

A prefix to be used for keys when looking up value in the config.

dependencies = <GladeDependencies name='MailSenderConfigurationTab' >[source]

A GladeDependencies instance which defines information for loading the widget from the GTK builder data.

label[source]

The Gtk.Label representing this tabs name.

objects_load_from_config()[source]

Iterate through gobjects and set the GObject’s value from the corresponding value in the config.

top_gobject = 'box'[source]

The name of the attribute to set a reference of the top level GObject to.

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

Bases: GladeGObject

This is the tab which adds basic text edition for changing an email template.

dependencies = <GladeDependencies name='MailSenderEditTab' >[source]

A GladeDependencies instance which defines information for loading the widget from the GTK builder data.

label[source]

The Gtk.Label representing this tabs name.

load_html_file()[source]

Load the contents of the configured HTML file into the editor.

save_html_file(force_prompt=False)[source]

Save the contents from the editor into an HTML file if one is configured otherwise prompt to user to select a file to save as. The user may abort the operation by declining to select a file to save as if they are prompted to do so.

Parameters

force_prompt – Force prompting the user to select the file to save as.

Return type

bool

Returns

Whether the contents were saved or not.

show_tab()[source]

Load the message HTML file from disk and configure the tab for editing.

textbuffer[source]

The Gtk.TextBuffer used by the :py:attr:textview` attribute.

textview[source]

The Gtk.TextView object of the editor.

top_gobject = 'box'[source]

The name of the attribute to set a reference of the top level GObject to.

class MailSenderPreviewTab(application)[source]

Bases: object

This tab uses the WebKit engine to render the HTML of an email so it can be previewed before it is sent.

__init__(application)[source]
Parameters

application (KingPhisherClientApplication) – The application instance.

label[source]

The Gtk.Label representing this tabs name.

load_html_file()[source]

Load the configured HTML file into the WebKit engine so the contents can be previewed.

show_tab()[source]

Configure the webview to preview the the message HTML file.

webview[source]

The WebKitHTMLView object used to render the message HTML.

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

Bases: GladeGObject

This allows the MailSenderThread object to be managed by the user through the GUI. These two classes are very interdependent

dependencies = <GladeDependencies name='MailSenderSendTab' >[source]

A GladeDependencies instance which defines information for loading the widget from the GTK builder data.

label[source]

The Gtk.Label representing this tabs name.

notify_sent(emails_done, emails_total)[source]

A call back use by MailSenderThread to notify when an email has been successfully sent to the SMTP server.

Parameters
  • emails_done (int) – The number of email messages that have been sent.

  • emails_total (int) – The total number of email messages that need to be sent.

notify_status(message)[source]

A call back use by MailSenderThread to update general status information.

Parameters

message (str) – The status message.

notify_stopped()[source]

A callback used by MailSenderThread to notify when the thread has stopped.

precheck_routines = ('settings', 'attachment', 'required-files', 'campaign', 'url', 'source', 'spf')[source]

The built-in precheck routines that are executed before sending messages.

progressbar[source]

The Gtk.ProgressBar instance which is used to display progress of sending messages.

sender_start_failure(message=None, text=None, retry=False)[source]

Handle a failure in starting the message sender thread and perform any necessary clean up.

Parameters
  • message (text) – A message to shown in an error popup dialog.

  • message – A message to be inserted into the text buffer.

  • retry (bool) – The operation will be attempted again.

sender_thread[source]

The MailSenderThread instance that is being used to send messages.

text_insert(message)[source]

Insert text into the textbuffer.

Parameters

message (str) – The text to insert.

textbuffer[source]

The Gtk.TextBuffer instance associated with textview.

textview[source]

The Gtk.TextView object that renders text status messages.

top_gobject = 'box'[source]

The name of the attribute to set a reference of the top level GObject to.

class MailSenderTab(parent, application)[source]

Bases: Object

The King Phisher client top-level ‘Send Messages’ tab. This object manages the sub-tabs which display useful information for configuring, previewing and sending messages as part of a campaign.

GObject Signals

Mail Tab Signals

__init__(parent, application)[source]
Parameters
  • parent (Gtk.Window) – The parent window for this object.

  • application (Gtk.Application) – The main client application instance.

export_message_data(path=None)[source]

Gather and prepare the components of the mailer tab to be exported into a King Phisher message (KPM) archive file suitable for restoring at a later point in time. If path is not specified, the user will be prompted to select one and failure to do so will prevent the message data from being exported. This function wraps the emission of the message-data-export signal.

Parameters

path (str) – An optional path of where to save the archive file to.

Returns

Whether or not the message archive file was written to disk.

Return type

bool

import_message_data()[source]

Process a previously exported message archive file and restore the message data, settings, and applicable files from it. This function wraps the emission of the message-data-import signal.

Returns

Whether or not the message archive file was loaded from disk.

Return type

bool

label[source]

The Gtk.Label representing this tabs name.

notebook[source]

The Gtk.Notebook for holding sub-tabs.

tabs[source]

A dict object holding the sub tabs managed by this object.