code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def gtk_combobox_set_entry_completion(combobox): """ Add completion for a :py:class:`Gtk.ComboBox` widget which contains an entry. They combobox's ``entry-text-column`` property it used to determine which column in its model contains the strings to suggest for completion. .. versionadded:: 1.14.0 :param combobo...
Add completion for a :py:class:`Gtk.ComboBox` widget which contains an entry. They combobox's ``entry-text-column`` property it used to determine which column in its model contains the strings to suggest for completion. .. versionadded:: 1.14.0 :param combobox: The combobox to add completion for. :type: :py:cl...
gtk_combobox_set_entry_completion
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def gtk_list_store_search(list_store, value, column=0): """ Search a :py:class:`Gtk.ListStore` for a value and return a :py:class:`Gtk.TreeIter` to the first match. :param list_store: The list store to search. :type list_store: :py:class:`Gtk.ListStore` :param value: The value to search for. :param int column: ...
Search a :py:class:`Gtk.ListStore` for a value and return a :py:class:`Gtk.TreeIter` to the first match. :param list_store: The list store to search. :type list_store: :py:class:`Gtk.ListStore` :param value: The value to search for. :param int column: The column in the row to check. :return: The row on which t...
gtk_list_store_search
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def gtk_listbox_populate_labels(listbox, label_strings): """ Formats and adds labels to a listbox. Each label is styled and added as a separate entry. .. versionadded:: 1.13.0 :param listbox: Gtk Listbox to put the labels in. :type listbox: :py:class:`Gtk.listbox` :param list label_strings: List of strings to ...
Formats and adds labels to a listbox. Each label is styled and added as a separate entry. .. versionadded:: 1.13.0 :param listbox: Gtk Listbox to put the labels in. :type listbox: :py:class:`Gtk.listbox` :param list label_strings: List of strings to add to the Gtk Listbox as labels.
gtk_listbox_populate_labels
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def gtk_listbox_populate_urls(listbox, url_strings, signals=None): """ Format and adds URLs to a list box. Each URL is styled and added as a separate entry. .. versionadded:: 1.14.0 :param listbox: Gtk Listbox to put the labels in. :type listbox: :py:class:`Gtk.listbox` :param list url_strings: List of URL str...
Format and adds URLs to a list box. Each URL is styled and added as a separate entry. .. versionadded:: 1.14.0 :param listbox: Gtk Listbox to put the labels in. :type listbox: :py:class:`Gtk.listbox` :param list url_strings: List of URL strings to add to the Gtk Listbox as labels. :param dict signals: A dicti...
gtk_listbox_populate_urls
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def gtk_menu_get_item_by_label(menu, label): """ Retrieve a menu item from a menu by it's label. If more than one items share the same label, only the first is returned. :param menu: The menu to search for the item in. :type menu: :py:class:`Gtk.Menu` :param str label: The label to search for in *menu*. :return...
Retrieve a menu item from a menu by it's label. If more than one items share the same label, only the first is returned. :param menu: The menu to search for the item in. :type menu: :py:class:`Gtk.Menu` :param str label: The label to search for in *menu*. :return: The identified menu item if it could be found, ...
gtk_menu_get_item_by_label
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def gtk_menu_insert_by_path(menu, menu_path, menu_item): """ Add a new menu item into the existing menu at the path specified in *menu_path*. :param menu: The existing menu to add the new item to. :type menu: :py:class:`Gtk.Menu` :py:class:`Gtk.MenuBar` :param list menu_path: The labels of submenus to traverse t...
Add a new menu item into the existing menu at the path specified in *menu_path*. :param menu: The existing menu to add the new item to. :type menu: :py:class:`Gtk.Menu` :py:class:`Gtk.MenuBar` :param list menu_path: The labels of submenus to traverse to insert the new item. :param menu_item: The new menu item t...
gtk_menu_insert_by_path
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def gtk_menu_position(event, *args): """ Create a menu at the given location for an event. This function is meant to be used as the *func* parameter for the :py:meth:`Gtk.Menu.popup` method. The *event* object must be passed in as the first parameter, which can be accomplished using :py:func:`functools.partial`. ...
Create a menu at the given location for an event. This function is meant to be used as the *func* parameter for the :py:meth:`Gtk.Menu.popup` method. The *event* object must be passed in as the first parameter, which can be accomplished using :py:func:`functools.partial`. :param event: The event to retrieve the ...
gtk_menu_position
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def gtk_style_context_get_color(sc, color_name, default=None): """ Look up a color by it's name in the :py:class:`Gtk.StyleContext` specified in *sc*, and return it as an :py:class:`Gdk.RGBA` instance if the color is defined. If the color is not found, *default* will be returned. :param sc: The style context to u...
Look up a color by it's name in the :py:class:`Gtk.StyleContext` specified in *sc*, and return it as an :py:class:`Gdk.RGBA` instance if the color is defined. If the color is not found, *default* will be returned. :param sc: The style context to use. :type sc: :py:class:`Gtk.StyleContext` :param str color_name:...
gtk_style_context_get_color
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def gtk_treesortable_sort_func_numeric(model, iter1, iter2, column_id): """ Sort the model by comparing text numeric values with place holders such as 1,337. This is meant to be set as a sorting function using :py:meth:`Gtk.TreeSortable.set_sort_func`. The user_data parameter must be the column id which contains t...
Sort the model by comparing text numeric values with place holders such as 1,337. This is meant to be set as a sorting function using :py:meth:`Gtk.TreeSortable.set_sort_func`. The user_data parameter must be the column id which contains the numeric values to be sorted. :param model: The model that is being sort...
gtk_treesortable_sort_func_numeric
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def gtk_treeview_selection_iterate(treeview): """ Iterate over the a treeview's selected rows. :param treeview: The treeview for which to iterate over. :type treeview: :py:class:`Gtk.TreeView` :return: The rows which are selected within the treeview. :rtype: :py:class:`Gtk.TreeIter` """ selection = treeview.ge...
Iterate over the a treeview's selected rows. :param treeview: The treeview for which to iterate over. :type treeview: :py:class:`Gtk.TreeView` :return: The rows which are selected within the treeview. :rtype: :py:class:`Gtk.TreeIter`
gtk_treeview_selection_iterate
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def gtk_treeview_selection_to_clipboard(treeview, columns=0): """ Copy the currently selected values from the specified columns in the treeview to the users clipboard. If no value is selected in the treeview, then the clipboard is left unmodified. If multiple values are selected, they will all be placed in the cli...
Copy the currently selected values from the specified columns in the treeview to the users clipboard. If no value is selected in the treeview, then the clipboard is left unmodified. If multiple values are selected, they will all be placed in the clipboard on separate lines. :param treeview: The treeview instance...
gtk_treeview_selection_to_clipboard
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def gtk_treeview_get_column_titles(treeview): """ Iterate over a GTK TreeView and return a tuple containing the id and title of each of it's columns. :param treeview: The treeview instance to retrieve columns from. :type treeview: :py:class:`Gtk.TreeView` """ for column_id, column in enumerate(treeview.get_colu...
Iterate over a GTK TreeView and return a tuple containing the id and title of each of it's columns. :param treeview: The treeview instance to retrieve columns from. :type treeview: :py:class:`Gtk.TreeView`
gtk_treeview_get_column_titles
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def gtk_treeview_set_column_titles(treeview, column_titles, column_offset=0, renderers=None): """ Populate the column names of a GTK TreeView and set their sort IDs. :param treeview: The treeview to set column names for. :type treeview: :py:class:`Gtk.TreeView` :param list column_titles: The names of the columns....
Populate the column names of a GTK TreeView and set their sort IDs. :param treeview: The treeview to set column names for. :type treeview: :py:class:`Gtk.TreeView` :param list column_titles: The names of the columns. :param int column_offset: The offset to start setting column names at. :param list renderers: A...
gtk_treeview_set_column_titles
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def show_dialog(message_type, message, parent, secondary_text=None, message_buttons=Gtk.ButtonsType.OK, use_markup=False, secondary_use_markup=False): """ Display a dialog and return the response. The response is dependent on the value of *message_buttons*. :param message_type: The GTK message type to display. :t...
Display a dialog and return the response. The response is dependent on the value of *message_buttons*. :param message_type: The GTK message type to display. :type message_type: :py:class:`Gtk.MessageType` :param str message: The text to display in the dialog. :param parent: The parent window that the dialog sho...
show_dialog
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def show_dialog_exc_socket_error(error, parent, title=None): """ Display an error dialog with details regarding a :py:exc:`socket.error` exception that has been raised. :param error: The exception instance that has been raised. :type error: :py:exc:`socket.error` :param parent: The parent window that the dialog ...
Display an error dialog with details regarding a :py:exc:`socket.error` exception that has been raised. :param error: The exception instance that has been raised. :type error: :py:exc:`socket.error` :param parent: The parent window that the dialog should belong to. :type parent: :py:class:`Gtk.Window` :param t...
show_dialog_exc_socket_error
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def show_dialog_yes_no(*args, **kwargs): """ Display a dialog which asks a yes or no question with :py:func:`.show_dialog`. :return: True if the response is Yes. :rtype: bool """ kwargs['message_buttons'] = Gtk.ButtonsType.YES_NO return show_dialog(Gtk.MessageType.QUESTION, *args, **kwargs) == Gtk.ResponseType...
Display a dialog which asks a yes or no question with :py:func:`.show_dialog`. :return: True if the response is Yes. :rtype: bool
show_dialog_yes_no
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def __init__(self, method, widget=None, args=None, kwargs=None): """ :param str method: The method of the container *widget* to use to add the proxied widget. :param str widget: The widget name to add the proxied widget to. If this value is ``None``, the proxied widget is added to the top level widget. ...
:param str method: The method of the container *widget* to use to add the proxied widget. :param str widget: The widget name to add the proxied widget to. If this value is ``None``, the proxied widget is added to the top level widget. :param tuple args: Position arguments to provide when calling *method...
__init__
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def __init__(self, application): """ :param application: The parent application for this object. :type application: :py:class:`Gtk.Application` """ utilities.assert_arg_type(application, Gtk.Application, arg_pos=1) self.config = application.config """A reference to the King Phisher client configuration.""...
:param application: The parent application for this object. :type application: :py:class:`Gtk.Application`
__init__
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def get_entry_value(self, entry_name): """ Get the value of the specified entry then remove leading and trailing white space and finally determine if the string is empty, in which case return None. :param str entry_name: The name of the entry to retrieve text from. :return: Either the non-empty string or N...
Get the value of the specified entry then remove leading and trailing white space and finally determine if the string is empty, in which case return None. :param str entry_name: The name of the entry to retrieve text from. :return: Either the non-empty string or None. :rtype: None, str
get_entry_value
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def gtk_builder_get(self, gobject_id, parent_name=None): """ Find the child GObject with name *gobject_id* from the GTK builder. :param str gobject_id: The object name to look for. :param str parent_name: The name of the parent object in the builder data file. :return: The GObject as found by the GTK builder...
Find the child GObject with name *gobject_id* from the GTK builder. :param str gobject_id: The object name to look for. :param str parent_name: The name of the parent object in the builder data file. :return: The GObject as found by the GTK builder. :rtype: :py:class:`GObject.Object`
gtk_builder_get
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def objects_load_from_config(self): """ Iterate through :py:attr:`.gobjects` and set the GObject's value from the corresponding value in the :py:attr:`~.GladeGObject.config`. """ for gobject_id, gobject in self.gobjects.items(): if '_' not in gobject_id: continue gtype, config_name = gobject_id.spli...
Iterate through :py:attr:`.gobjects` and set the GObject's value from the corresponding value in the :py:attr:`~.GladeGObject.config`.
objects_load_from_config
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def __init__(self, path, on_changed): """ :param str path: The path to monitor for changes. :param on_changed: The callback function to be called when changes are detected. :type on_changed: function """ self.logger = logging.getLogger('KingPhisher.Utility.FileMonitor') self.on_changed = on_changed self...
:param str path: The path to monitor for changes. :param on_changed: The callback function to be called when changes are detected. :type on_changed: function
__init__
python
rsmusllp/king-phisher
king_phisher/client/gui_utilities.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/gui_utilities.py
BSD-3-Clause
def count_targets_file(target_file): """ Count the number of valid targets that the specified file contains. This skips lines which are missing fields or where the email address is invalid. :param str target_file: The path the the target CSV file on disk. :return: The number of valid targets. :rtype: int """ c...
Count the number of valid targets that the specified file contains. This skips lines which are missing fields or where the email address is invalid. :param str target_file: The path the the target CSV file on disk. :return: The number of valid targets. :rtype: int
count_targets_file
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def get_invite_start_from_config(config): """ Get the start time for an invite from the configuration. This takes into account whether the invite is for all day or starts at a specific time. :param dict config: The King Phisher client configuration. :return: The timestamp of when the invite is to start. :rtype: ...
Get the start time for an invite from the configuration. This takes into account whether the invite is for all day or starts at a specific time. :param dict config: The King Phisher client configuration. :return: The timestamp of when the invite is to start. :rtype: :py:class:`datetime.datetime`
get_invite_start_from_config
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def guess_smtp_server_address(host, forward_host=None): """ Guess the IP address of the SMTP server that will be connected to given the SMTP host information and an optional SSH forwarding host. If a hostname is in use it will be resolved to an IP address, either IPv4 or IPv6 and in that order. If a hostname resol...
Guess the IP address of the SMTP server that will be connected to given the SMTP host information and an optional SSH forwarding host. If a hostname is in use it will be resolved to an IP address, either IPv4 or IPv6 and in that order. If a hostname resolves to multiple IP addresses, None will be returned. This f...
guess_smtp_server_address
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def render_message_template(template, config, target=None, analyze=False): """ Take a message from a template and format it to be sent by replacing variables and processing other template directives. If the *target* parameter is not set, a placeholder will be created and the message will be formatted to be preview...
Take a message from a template and format it to be sent by replacing variables and processing other template directives. If the *target* parameter is not set, a placeholder will be created and the message will be formatted to be previewed. :param str template: The message template. :param dict config: The King ...
render_message_template
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def rfc2282_timestamp(dt=None, utc=False): """ Convert a :py:class:`datetime.datetime` instance into an :rfc:`2282` compliant timestamp suitable for use in MIME-encoded messages. :param dt: A time to use for the timestamp otherwise the current time is used. :type dt: :py:class:`datetime.datetime` :param utc: Whe...
Convert a :py:class:`datetime.datetime` instance into an :rfc:`2282` compliant timestamp suitable for use in MIME-encoded messages. :param dt: A time to use for the timestamp otherwise the current time is used. :type dt: :py:class:`datetime.datetime` :param utc: Whether to return the timestamp as a UTC offset or...
rfc2282_timestamp
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def __init__(self, mime_type, config, target): """ :param str mime_type: The type of this part such as related or alternative. :param dict config: The King Phisher client configuration. :param target: The target information for the messages intended recipient. :type target: :py:class:`.MessageTarget` """ ...
:param str mime_type: The type of this part such as related or alternative. :param dict config: The King Phisher client configuration. :param target: The target information for the messages intended recipient. :type target: :py:class:`.MessageTarget`
__init__
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def __init__(self, application, target_file, rpc, tab=None): """ :param application: The GTK application that the thread is associated with. :type application: :py:class:`.KingPhisherClientApplication` :param str target_file: The CSV formatted file to read message targets from. :param tab: The GUI tab to repo...
:param application: The GTK application that the thread is associated with. :type application: :py:class:`.KingPhisherClientApplication` :param str target_file: The CSV formatted file to read message targets from. :param tab: The GUI tab to report information to. :type tab: :py:class:`.MailSenderSendTab` :...
__init__
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def tab_notify_sent(self, emails_done, emails_total): """ Notify the tab that messages have been sent. :param int emails_done: The number of emails that have been sent. :param int emails_total: The total number of emails that are going to be sent. """ if isinstance(self.tab, gui_utilities.GladeGObject): ...
Notify the tab that messages have been sent. :param int emails_done: The number of emails that have been sent. :param int emails_total: The total number of emails that are going to be sent.
tab_notify_sent
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def tab_notify_status(self, message): """ Handle a status message regarding the message sending operation. :param str message: The notification message. """ self.logger.info(message.lower()) if isinstance(self.tab, gui_utilities.GladeGObject): GLib.idle_add(self.tab.notify_status, message + '\n')
Handle a status message regarding the message sending operation. :param str message: The notification message.
tab_notify_status
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def server_ssh_connect(self): """ Connect to the remote SMTP server over SSH and configure port forwarding with :py:class:`.SSHTCPForwarder` for tunneling SMTP traffic. :return: The connection status as one of the :py:class:`.ConnectionErrorReason` constants. """ server = smoke_zephyr.utilities.parse_serve...
Connect to the remote SMTP server over SSH and configure port forwarding with :py:class:`.SSHTCPForwarder` for tunneling SMTP traffic. :return: The connection status as one of the :py:class:`.ConnectionErrorReason` constants.
server_ssh_connect
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def server_smtp_connect(self): """ Connect and optionally authenticate to the configured SMTP server. :return: The connection status as one of the :py:class:`.ConnectionErrorReason` constants. """ if self.config.get('smtp_ssl_enable', False): SmtpClass = smtplib.SMTP_SSL else: SmtpClass = smtplib.SMT...
Connect and optionally authenticate to the configured SMTP server. :return: The connection status as one of the :py:class:`.ConnectionErrorReason` constants.
server_smtp_connect
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def server_smtp_disconnect(self): """Clean up and close the connection to the remote SMTP server.""" if self.smtp_connection: self.logger.debug('closing the connection to the SMTP server') try: self.smtp_connection.quit() except smtplib.SMTPServerDisconnected: pass self.smtp_connection = None ...
Clean up and close the connection to the remote SMTP server.
server_smtp_disconnect
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def server_smtp_reconnect(self): """ Disconnect from the remote SMTP server and then attempt to open a new connection to it. :return: The reconnection status. :rtype: bool """ if self.smtp_connection: try: self.smtp_connection.quit() except smtplib.SMTPServerDisconnected: pass self.smtp_...
Disconnect from the remote SMTP server and then attempt to open a new connection to it. :return: The reconnection status. :rtype: bool
server_smtp_reconnect
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def iterate_targets(self, counting=False): """ Iterate over each of the targets as defined within the configuration. If *counting* is ``False``, messages will not be displayed to the end user through the notification tab. :param bool counting: Whether or not to iterate strictly for counting purposes. :retu...
Iterate over each of the targets as defined within the configuration. If *counting* is ``False``, messages will not be displayed to the end user through the notification tab. :param bool counting: Whether or not to iterate strictly for counting purposes. :return: Each message target. :rtype: :py:class:`~....
iterate_targets
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def run(self): """The entry point of the thread.""" self.logger.debug("mailer routine running in tid: 0x{0:x}".format(threading.current_thread().ident)) self.running.set() self.should_stop.clear() self.paused.clear() try: self._prepare_env() emails_done = self._send_messages() except UnicodeDecodeE...
The entry point of the thread.
run
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def process_pause(self, set_pause=False): """ Pause sending emails if a pause request has been set. :param bool set_pause: Whether to request a pause before processing it. :return: Whether or not the sending operation was cancelled during the pause. :rtype: bool """ if set_pause: if isinstance(self.ta...
Pause sending emails if a pause request has been set. :param bool set_pause: Whether to request a pause before processing it. :return: Whether or not the sending operation was cancelled during the pause. :rtype: bool
process_pause
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def create_message_calendar_invite(self, target, attachments): """ Create a MIME calendar invite to be sent from a set of parameters. :param target: The information for the messages intended recipient. :type target: :py:class:`.MessageTarget` :param str uid: The message's unique identifier. :param attachme...
Create a MIME calendar invite to be sent from a set of parameters. :param target: The information for the messages intended recipient. :type target: :py:class:`.MessageTarget` :param str uid: The message's unique identifier. :param attachments: The attachments to add to the created message. :type attachme...
create_message_calendar_invite
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def create_message_email(self, target, attachments): """ Create a MIME email to be sent from a set of parameters. :param target: The information for the messages intended recipient. :type target: :py:class:`.MessageTarget` :param str uid: The message's unique identifier. :param attachments: The attachments...
Create a MIME email to be sent from a set of parameters. :param target: The information for the messages intended recipient. :type target: :py:class:`.MessageTarget` :param str uid: The message's unique identifier. :param attachments: The attachments to add to the created message. :type attachments: :py:c...
create_message_email
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def get_mime_attachments(self): """ Return a :py:class:`.MessageAttachments` object containing both the images and raw files to be included in sent messages. :return: A namedtuple of both files and images in their MIME containers. :rtype: :py:class:`.MessageAttachments` """ files = [] # allow the attac...
Return a :py:class:`.MessageAttachments` object containing both the images and raw files to be included in sent messages. :return: A namedtuple of both files and images in their MIME containers. :rtype: :py:class:`.MessageAttachments`
get_mime_attachments
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def send_message(self, target_email, msg): """ Send an email using the connected SMTP server. :param str target_email: The email address to send the message to. :param msg: The formatted message to be sent. :type msg: :py:class:`.mime.multipart.MIMEMultipart` """ source_email = self.config['mailer.source...
Send an email using the connected SMTP server. :param str target_email: The email address to send the message to. :param msg: The formatted message to be sent. :type msg: :py:class:`.mime.multipart.MIMEMultipart`
send_message
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def stop(self): """ Requests that the email sending operation stop. It can not be resumed from the same position. This function blocks until the stop request has been processed and the thread exits. """ self.should_stop.set() self.unpause() if self.is_alive(): self.join()
Requests that the email sending operation stop. It can not be resumed from the same position. This function blocks until the stop request has been processed and the thread exits.
stop
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def missing_files(self): """ Return a list of all missing or unreadable files which are referenced by the message template. :return: The list of unusable files. :rtype: list """ missing = [] attachment = self.config.get('mailer.attachment_file') if attachment and not os.access(attachment, os.R_OK): ...
Return a list of all missing or unreadable files which are referenced by the message template. :return: The list of unusable files. :rtype: list
missing_files
python
rsmusllp/king-phisher
king_phisher/client/mailer.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/mailer.py
BSD-3-Clause
def __init__(self, name, *args, **kwargs): """ :param str name: The name of this option. :param str description: The description of this option. :param default: The default value of this option. :param str display_name: The name to display in the UI to the user for this option. """ self.display_name = kwa...
:param str name: The name of this option. :param str description: The description of this option. :param default: The default value of this option. :param str display_name: The name to display in the UI to the user for this option.
__init__
python
rsmusllp/king-phisher
king_phisher/client/plugins.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/plugins.py
BSD-3-Clause
def __init__(self, name, *args, **kwargs): """ :param str name: The name of this option. :param str description: The description of this option. :param default: The default value of this option. :param str display_name: The name to display in the UI to the user for this option. :param adjustment: The adjust...
:param str name: The name of this option. :param str description: The description of this option. :param default: The default value of this option. :param str display_name: The name to display in the UI to the user for this option. :param adjustment: The adjustment details of the options value. :type adjus...
__init__
python
rsmusllp/king-phisher
king_phisher/client/plugins.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/plugins.py
BSD-3-Clause
def __init__(self, name, *args, **kwargs): """ .. versionchanged:: 1.9.0b5 Added the *multiline* parameter. :param str name: The name of this option. :param str description: The description of this option. :param default: The default value of this option. :param str display_name: The name to display in ...
.. versionchanged:: 1.9.0b5 Added the *multiline* parameter. :param str name: The name of this option. :param str description: The description of this option. :param default: The default value of this option. :param str display_name: The name to display in the UI to the user for this option. :param boo...
__init__
python
rsmusllp/king-phisher
king_phisher/client/plugins.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/plugins.py
BSD-3-Clause
def __init__(self, name, *args, **kwargs): """ :param str name: The name of this option. :param str description: The description of this option. :param default: The default value of this option. :param str display_name: The name to display in the UI to the user for this option. :param str path_type: The typ...
:param str name: The name of this option. :param str description: The description of this option. :param default: The default value of this option. :param str display_name: The name to display in the UI to the user for this option. :param str path_type: The type of the path to select, either 'directory', 'fi...
__init__
python
rsmusllp/king-phisher
king_phisher/client/plugins.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/plugins.py
BSD-3-Clause
def config(self): """ A dictionary that can be used by this plugin for persistent storage of it's configuration. """ config = self.application.config['plugins'].get(self.name) if config is None: config = {} self.application.config['plugins'][self.name] = config return config
A dictionary that can be used by this plugin for persistent storage of it's configuration.
config
python
rsmusllp/king-phisher
king_phisher/client/plugins.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/plugins.py
BSD-3-Clause
def render_template_string(self, template_string, target=None, description='string', log_to_mailer=True): """ Render the specified *template_string* in the message environment. If an error occurs during the rendering process, a message will be logged and ``None`` will be returned. If *log_to_mailer* is set to `...
Render the specified *template_string* in the message environment. If an error occurs during the rendering process, a message will be logged and ``None`` will be returned. If *log_to_mailer* is set to ``True`` then a message will also be displayed in the message send tab of the client. .. versionadded:: 1...
render_template_string
python
rsmusllp/king-phisher
king_phisher/client/plugins.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/plugins.py
BSD-3-Clause
def save_cache(self, catalog, catalog_url): """ Saves the catalog or catalogs in the manager to the cache. :param catalog: The :py:class:`~king_phisher.catalog.Catalog` to save. """ self._catalog_cache[catalog.id] = { 'created': datetime.datetime.utcnow(), 'id': catalog.id, 'url': catalog_url, 'v...
Saves the catalog or catalogs in the manager to the cache. :param catalog: The :py:class:`~king_phisher.catalog.Catalog` to save.
save_cache
python
rsmusllp/king-phisher
king_phisher/client/plugins.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/plugins.py
BSD-3-Clause
def add_catalog(self, catalog, catalog_url, cache=False): """ Adds the specified catalog to the manager and stores the associated source URL for caching. :param catalog: The catalog to add to the cache manager. :type catalog: :py:class:`~king_phisher.catalog.Catalog` :param str catalog_url: The URL from wh...
Adds the specified catalog to the manager and stores the associated source URL for caching. :param catalog: The catalog to add to the cache manager. :type catalog: :py:class:`~king_phisher.catalog.Catalog` :param str catalog_url: The URL from which the catalog was loaded. :param bool cache: Whether or not...
add_catalog
python
rsmusllp/king-phisher
king_phisher/client/plugins.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/plugins.py
BSD-3-Clause
def event_type_filter(event_types, is_method=False): """ A decorator to filter a signal handler by the specified event types. Using this will ensure that the decorated function is only called for the specified event types and not others which may have been subscribed to elsewhere in the application. :param event...
A decorator to filter a signal handler by the specified event types. Using this will ensure that the decorated function is only called for the specified event types and not others which may have been subscribed to elsewhere in the application. :param event_types: A single event type as a string or a list of even...
event_type_filter
python
rsmusllp/king-phisher
king_phisher/client/server_events.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/server_events.py
BSD-3-Clause
def __init__(self, rpc): """ :param rpc: The client's connected RPC instance. :type rpc: :py:class:`.KingPhisherRPCClient` """ super(ServerEventSubscriber, self).__init__() self._encoding = 'utf-8' self.__is_shutdown = threading.Event() self.__is_shutdown.clear() self._reconnect_event_id = None self...
:param rpc: The client's connected RPC instance. :type rpc: :py:class:`.KingPhisherRPCClient`
__init__
python
rsmusllp/king-phisher
king_phisher/client/server_events.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/server_events.py
BSD-3-Clause
def shutdown(self): """ Disconnect the event socket from the remote server. After the object is shutdown, remove events will no longer be published. :param int timeout: An optional timeout for how long to wait on the worker thread. """ self.__is_shutdown.set() self.logger.debug('shutting down the server ...
Disconnect the event socket from the remote server. After the object is shutdown, remove events will no longer be published. :param int timeout: An optional timeout for how long to wait on the worker thread.
shutdown
python
rsmusllp/king-phisher
king_phisher/client/server_events.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/server_events.py
BSD-3-Clause
def subscribe(self, event_id, event_types, attributes): """ Subscribe the client to the specified event published by the server. When the event is published the specified *attributes* of it and it's corresponding id and type information will be sent to the client. :param str event_id: The identifier of the e...
Subscribe the client to the specified event published by the server. When the event is published the specified *attributes* of it and it's corresponding id and type information will be sent to the client. :param str event_id: The identifier of the event to subscribe to. :param list event_types: A list of su...
subscribe
python
rsmusllp/king-phisher
king_phisher/client/server_events.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/server_events.py
BSD-3-Clause
def unsubscribe(self, event_id, event_types, attributes): """ Unsubscribe from an event published by the server that the client previously subscribed to. :param str event_id: The identifier of the event to subscribe to. :param list event_types: A list of sub-types for the corresponding event. :param list a...
Unsubscribe from an event published by the server that the client previously subscribed to. :param str event_id: The identifier of the event to subscribe to. :param list event_types: A list of sub-types for the corresponding event. :param list attributes: A list of attributes of the event object to be sent ...
unsubscribe
python
rsmusllp/king-phisher
king_phisher/client/server_events.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/server_events.py
BSD-3-Clause
def __init__(self, target_url, dest_dir): """ :param str target_url: The URL of the target web page to clone. :param str dest_dir: The path of a directory to write the resources to. """ if not has_webkit2: raise RuntimeError('cloning requires WebKit2GTK+') self.target_url = urllib.parse.urlparse(target_u...
:param str target_url: The URL of the target web page to clone. :param str dest_dir: The path of a directory to write the resources to.
__init__
python
rsmusllp/king-phisher
king_phisher/client/web_cloner.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/web_cloner.py
BSD-3-Clause
def _webkit_empty_resource_bug_workaround(self, url, expected_len): """ This works around an issue in WebKit2GTK+ that will hopefully be resolved eventually. Sometimes the resource data that is returned is an empty string so attempt to re-request it with Python. """ try: response = requests.get(url, time...
This works around an issue in WebKit2GTK+ that will hopefully be resolved eventually. Sometimes the resource data that is returned is an empty string so attempt to re-request it with Python.
_webkit_empty_resource_bug_workaround
python
rsmusllp/king-phisher
king_phisher/client/web_cloner.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/web_cloner.py
BSD-3-Clause
def copy_resource_data(self, resource, data): """ Copy the data from a loaded resource to a local file. :param resource: The resource whose data is being copied. :type resource: :py:class:`WebKit2.WebResource` :param data: The raw data of the represented resource. :type data: bytes, str """ resource_ur...
Copy the data from a loaded resource to a local file. :param resource: The resource whose data is being copied. :type resource: :py:class:`WebKit2.WebResource` :param data: The raw data of the represented resource. :type data: bytes, str
copy_resource_data
python
rsmusllp/king-phisher
king_phisher/client/web_cloner.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/web_cloner.py
BSD-3-Clause
def patch_html(self, data, encoding='utf-8'): """ Patch the HTML data to include the King Phisher javascript resource. The script tag is inserted just before the closing head tag. If no head tag is present, the data is left unmodified. :param str data: The HTML data to patch. :return: The patched HTML data...
Patch the HTML data to include the King Phisher javascript resource. The script tag is inserted just before the closing head tag. If no head tag is present, the data is left unmodified. :param str data: The HTML data to patch. :return: The patched HTML data. :rtype: str
patch_html
python
rsmusllp/king-phisher
king_phisher/client/web_cloner.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/web_cloner.py
BSD-3-Clause
def resource_is_on_target(self, resource): """ Test whether the resource is on the target system. This tries to match the hostname, scheme and port number of the resource's URI against the target URI. :return: Whether the resource is on the target or not. :rtype: bool """ resource_url = urllib.parse.ur...
Test whether the resource is on the target system. This tries to match the hostname, scheme and port number of the resource's URI against the target URI. :return: Whether the resource is on the target or not. :rtype: bool
resource_is_on_target
python
rsmusllp/king-phisher
king_phisher/client/web_cloner.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/web_cloner.py
BSD-3-Clause
def wait(self): """ Wait for the cloning operation to complete and return whether the operation was successful or not. :return: True if the operation was successful. :rtype: bool """ while not self.load_started: gui_utilities.gtk_sync() while self.webview.get_property('is-loading') or len(self.__web...
Wait for the cloning operation to complete and return whether the operation was successful or not. :return: True if the operation was successful. :rtype: bool
wait
python
rsmusllp/king-phisher
king_phisher/client/web_cloner.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/web_cloner.py
BSD-3-Clause
def __init__(self, application, campaign_id=None): """ :param application: The application instance which this object belongs to. :type application: :py:class:`~king_phisher.client.application.KingPhisherClientApplication` :param campaign_id: The ID of the campaign to edit. """ super(CampaignAssistant, self...
:param application: The application instance which this object belongs to. :type application: :py:class:`~king_phisher.client.application.KingPhisherClientApplication` :param campaign_id: The ID of the campaign to edit.
__init__
python
rsmusllp/king-phisher
king_phisher/client/assistants/campaign.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/assistants/campaign.py
BSD-3-Clause
def _set_comboboxes(self): """Set up all the comboboxes and load the data for their models.""" renderer = resources.renderer_text_desc rpc = self.application.rpc for tag_name, tag_table in (('campaign_type', 'campaign_types'), ('company_existing', 'companies'), ('company_industry', 'industries')): combobox =...
Set up all the comboboxes and load the data for their models.
_set_comboboxes
python
rsmusllp/king-phisher
king_phisher/client/assistants/campaign.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/assistants/campaign.py
BSD-3-Clause
def _set_defaults(self): """ Set any default values for widgets. Also load settings from the existing campaign if one was specified. """ calendar = self.gobjects['calendar_campaign_expiration'] default_day = datetime.datetime.today() + datetime.timedelta(days=31) gui_utilities.gtk_calendar_set_pydate(cale...
Set any default values for widgets. Also load settings from the existing campaign if one was specified.
_set_defaults
python
rsmusllp/king-phisher
king_phisher/client/assistants/campaign.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/assistants/campaign.py
BSD-3-Clause
def load_campaigns(self, cursor=None): """Load campaigns from the remote server and populate the :py:class:`Gtk.TreeView`.""" if cursor is None: self._tv_model.clear() self.gobjects['revealer_loading'].set_reveal_child(True) self.gobjects['progressbar_loading'].set_fraction(0.0) path = find.data_file(os....
Load campaigns from the remote server and populate the :py:class:`Gtk.TreeView`.
load_campaigns
python
rsmusllp/king-phisher
king_phisher/client/dialogs/campaign_selection.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/dialogs/campaign_selection.py
BSD-3-Clause
def format_exception_details(exc_type, exc_value, exc_traceback, error_uid=None): """ Format exception details to be show to a human. This should include enough information about the type of error that occurred and the system on which it was triggered to allow someone to attempt to debug and fix it. The first thre...
Format exception details to be show to a human. This should include enough information about the type of error that occurred and the system on which it was triggered to allow someone to attempt to debug and fix it. The first three parameters to this function directly correspond to the values returned from the :py...
format_exception_details
python
rsmusllp/king-phisher
king_phisher/client/dialogs/exception.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/dialogs/exception.py
BSD-3-Clause
def __init__(self, application, exc_info=None, error_uid=None): """ :param application: The parent application for this object. :type application: :py:class:`Gtk.Application` :param tuple exc_info: The exception information as provided by :py:func:`sys.exc_info`. :param str error_uid: An optional unique ident...
:param application: The parent application for this object. :type application: :py:class:`Gtk.Application` :param tuple exc_info: The exception information as provided by :py:func:`sys.exc_info`. :param str error_uid: An optional unique identifier for the exception that can be provided for tracking purposes. ...
__init__
python
rsmusllp/king-phisher
king_phisher/client/dialogs/exception.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/dialogs/exception.py
BSD-3-Clause
def __init__(self, application, hostname, key): """ :param application: The application to associate this popup dialog with. :type application: :py:class:`.KingPhisherClientApplication` :param str hostname: The hostname associated with the key. :param key: The host's SSH key. :type key: :py:class:`paramiko....
:param application: The application to associate this popup dialog with. :type application: :py:class:`.KingPhisherClientApplication` :param str hostname: The hostname associated with the key. :param key: The host's SSH key. :type key: :py:class:`paramiko.pkey.PKey`
__init__
python
rsmusllp/king-phisher
king_phisher/client/dialogs/ssh_host_key.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/dialogs/ssh_host_key.py
BSD-3-Clause
def __init__(self, application): """ :param application: The application which is using this policy. :type application: :py:class:`.KingPhisherClientApplication` """ self.application = application self.logger = logging.getLogger('KingPhisher.Client.' + self.__class__.__name__) super(MissingHostKeyPolicy, ...
:param application: The application which is using this policy. :type application: :py:class:`.KingPhisherClientApplication`
__init__
python
rsmusllp/king-phisher
king_phisher/client/dialogs/ssh_host_key.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/dialogs/ssh_host_key.py
BSD-3-Clause
def _sync_loader_thread(self): """ Synchronize the loader thread by ensuring that it is stopped. If it is currently running, this will use :py:attr:`~.loader_thread_stop` to request that the loader stops early. """ if not self.loader_thread_is_running: return # it's alive so tell it to stop, wait for i...
Synchronize the loader thread by ensuring that it is stopped. If it is currently running, this will use :py:attr:`~.loader_thread_stop` to request that the loader stops early.
_sync_loader_thread
python
rsmusllp/king-phisher
king_phisher/client/tabs/campaign.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/campaign.py
BSD-3-Clause
def load_campaign_information(self, force=True): """ Load the necessary campaign information from the remote server. Unless *force* is True, the :py:attr:`~.CampaignViewGenericTab.last_load_time` is compared with the :py:attr:`~.CampaignViewGenericTab.refresh_frequency` to check if the information is stale....
Load the necessary campaign information from the remote server. Unless *force* is True, the :py:attr:`~.CampaignViewGenericTab.last_load_time` is compared with the :py:attr:`~.CampaignViewGenericTab.refresh_frequency` to check if the information is stale. If the local data is not stale, this function will ...
load_campaign_information
python
rsmusllp/king-phisher
king_phisher/client/tabs/campaign.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/campaign.py
BSD-3-Clause
def loader_thread_routine(self, store): """ The loading routine to be executed within a thread. :param store: The store object to place the new data. :type store: :py:class:`Gtk.ListStore` """ gui_utilities.glib_idle_add_wait(lambda: self.gobjects['treeview_campaign'].set_property('sensitive', False)) ca...
The loading routine to be executed within a thread. :param store: The store object to place the new data. :type store: :py:class:`Gtk.ListStore`
loader_thread_routine
python
rsmusllp/king-phisher
king_phisher/client/tabs/campaign.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/campaign.py
BSD-3-Clause
def export_table_to_csv(self, filtered=False): """Export the data represented by the view to a CSV file.""" if not self._export_lock(): return dialog = extras.FileChooserDialog('Export Data', self.parent) file_name = self.config['campaign_name'] + '.csv' response = dialog.run_quick_save(file_name) dialog...
Export the data represented by the view to a CSV file.
export_table_to_csv
python
rsmusllp/king-phisher
king_phisher/client/tabs/campaign.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/campaign.py
BSD-3-Clause
def export_table_to_xlsx_worksheet(self, worksheet, title_format): """ Export the data represented by the view to an XLSX worksheet. :param worksheet: The destination sheet for the store's data. :type worksheet: :py:class:`xlsxwriter.worksheet.Worksheet` :param title_format: The formatting to use for the tit...
Export the data represented by the view to an XLSX worksheet. :param worksheet: The destination sheet for the store's data. :type worksheet: :py:class:`xlsxwriter.worksheet.Worksheet` :param title_format: The formatting to use for the title row. :type title_format: :py:class:`xlsxwriter.format.Format`
export_table_to_xlsx_worksheet
python
rsmusllp/king-phisher
king_phisher/client/tabs/campaign.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/campaign.py
BSD-3-Clause
def load_campaign_information(self, force=True): """ Load the necessary campaign information from the remote server. Unless *force* is True, the :py:attr:`~.last_load_time` is compared with the :py:attr:`~.refresh_frequency` to check if the information is stale. If the local data is not stale, this function w...
Load the necessary campaign information from the remote server. Unless *force* is True, the :py:attr:`~.last_load_time` is compared with the :py:attr:`~.refresh_frequency` to check if the information is stale. If the local data is not stale, this function will return without updating the table. :param boo...
load_campaign_information
python
rsmusllp/king-phisher
king_phisher/client/tabs/campaign.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/campaign.py
BSD-3-Clause
def loader_idle_routine(self): """The routine which refreshes the campaign data at a regular interval.""" if self.rpc and not self.loader_thread_is_running: self.logger.debug('idle loader routine called') self.load_campaign_information() return True
The routine which refreshes the campaign data at a regular interval.
loader_idle_routine
python
rsmusllp/king-phisher
king_phisher/client/tabs/campaign.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/campaign.py
BSD-3-Clause
def loader_thread_routine(self): """The loading routine to be executed within a thread.""" if not 'campaign_id' in self.config: return try: campaign = self.application.get_graphql_campaign() except (ConnectionError, advancedhttpserver.RPCConnectionError): return if campaign is None: return info_...
The loading routine to be executed within a thread.
loader_thread_routine
python
rsmusllp/king-phisher
king_phisher/client/tabs/campaign.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/campaign.py
BSD-3-Clause
def __init__(self, parent, application): """ :param parent: The parent window for this object. :type parent: :py:class:`Gtk.Window` :param application: The main client application instance. :type application: :py:class:`Gtk.Application` """ self.parent = parent self.application = application self.conf...
:param parent: The parent window for this object. :type parent: :py:class:`Gtk.Window` :param application: The main client application instance. :type application: :py:class:`Gtk.Application`
__init__
python
rsmusllp/king-phisher
king_phisher/client/tabs/campaign.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/campaign.py
BSD-3-Clause
def test_webserver_url(target_url, secret_id): """ Test the target URL to ensure that it is valid and the server is responding. :param str target_url: The URL to make a test request to. :param str secret_id: The King Phisher Server secret id to include in the test request. """ parsed_url = urllib.parse.urlparse(...
Test the target URL to ensure that it is valid and the server is responding. :param str target_url: The URL to make a test request to. :param str secret_id: The King Phisher Server secret id to include in the test request.
test_webserver_url
python
rsmusllp/king-phisher
king_phisher/client/tabs/mail.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/mail.py
BSD-3-Clause
def sender_start_failure(self, message=None, text=None, retry=False): """ Handle a failure in starting the message sender thread and perform any necessary clean up. :param message: A message to shown in an error popup dialog. :type message: str, tuple :param text message: A message to be inserted into the ...
Handle a failure in starting the message sender thread and perform any necessary clean up. :param message: A message to shown in an error popup dialog. :type message: str, tuple :param text message: A message to be inserted into the text buffer. :param bool retry: The operation will be attempted again.
sender_start_failure
python
rsmusllp/king-phisher
king_phisher/client/tabs/mail.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/mail.py
BSD-3-Clause
def notify_stopped(self): """ A callback used by :py:class:`.MailSenderThread` to notify when the thread has stopped. """ self.progressbar.set_fraction(1) self.gobjects['button_mail_sender_stop'].set_sensitive(False) self.gobjects['togglebutton_mail_sender_pause'].set_property('active', False) self.gobj...
A callback used by :py:class:`.MailSenderThread` to notify when the thread has stopped.
notify_stopped
python
rsmusllp/king-phisher
king_phisher/client/tabs/mail.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/mail.py
BSD-3-Clause
def __init__(self, application): """ :param application: The application instance. :type application: :py:class:`.KingPhisherClientApplication` """ self.label = Gtk.Label(label='Preview') """The :py:class:`Gtk.Label` representing this tabs name.""" self.application = application self.config = applicatio...
:param application: The application instance. :type application: :py:class:`.KingPhisherClientApplication`
__init__
python
rsmusllp/king-phisher
king_phisher/client/tabs/mail.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/mail.py
BSD-3-Clause
def load_html_file(self): """ Load the configured HTML file into the WebKit engine so the contents can be previewed. """ html_file = self.config.get('mailer.html_file') if not (html_file and os.path.isfile(html_file) and os.access(html_file, os.R_OK)): return try: with codecs.open(html_file, 'r', e...
Load the configured HTML file into the WebKit engine so the contents can be previewed.
load_html_file
python
rsmusllp/king-phisher
king_phisher/client/tabs/mail.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/mail.py
BSD-3-Clause
def show_tab(self): """Configure the webview to preview the the message HTML file.""" if not self.config['mailer.html_file']: if self.file_monitor: self.file_monitor.stop() self.file_monitor = None self.webview.load_html_data('') return self.load_html_file() if self.file_monitor and self.file_m...
Configure the webview to preview the the message HTML file.
show_tab
python
rsmusllp/king-phisher
king_phisher/client/tabs/mail.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/mail.py
BSD-3-Clause
def load_html_file(self): """Load the contents of the configured HTML file into the editor.""" html_file = self.config.get('mailer.html_file') if not (html_file and os.path.isfile(html_file) and os.access(html_file, os.R_OK)): self.toolbutton_save_html_file.set_sensitive(False) return self.toolbutton_save...
Load the contents of the configured HTML file into the editor.
load_html_file
python
rsmusllp/king-phisher
king_phisher/client/tabs/mail.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/mail.py
BSD-3-Clause
def save_html_file(self, force_prompt=False): """ 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. :param force_prompt: Forc...
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. :param force_prompt: Force prompting the user to select the file to save as....
save_html_file
python
rsmusllp/king-phisher
king_phisher/client/tabs/mail.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/mail.py
BSD-3-Clause
def show_tab(self): """Load the message HTML file from disk and configure the tab for editing.""" if self.file_monitor and self.file_monitor.path == self.config['mailer.html_file']: return if not self.config['mailer.html_file']: if self.file_monitor: self.file_monitor.stop() self.file_monitor = None...
Load the message HTML file from disk and configure the tab for editing.
show_tab
python
rsmusllp/king-phisher
king_phisher/client/tabs/mail.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/mail.py
BSD-3-Clause
def export_message_data(self, path=None): """ 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...
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 f...
export_message_data
python
rsmusllp/king-phisher
king_phisher/client/tabs/mail.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/mail.py
BSD-3-Clause
def import_message_data(self): """ 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. :return: Whether or not the message archive file was loaded from disk. :rtype: ...
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. :return: Whether or not the message archive file was loaded from disk. :rtype: bool
import_message_data
python
rsmusllp/king-phisher
king_phisher/client/tabs/mail.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/tabs/mail.py
BSD-3-Clause
def do_populate(self, context): """ An automated function called by GtkSource.Completion, when :py:meth:`.do_match` returns True. This function is used to provide suggested completion words (referred to as proposals) for the context based on the match. This is done by creating a list of suggestions and addi...
An automated function called by GtkSource.Completion, when :py:meth:`.do_match` returns True. This function is used to provide suggested completion words (referred to as proposals) for the context based on the match. This is done by creating a list of suggestions and adding them with :py:meth:`GtkSource.Comp...
do_populate
python
rsmusllp/king-phisher
king_phisher/client/widget/completion_providers.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/widget/completion_providers.py
BSD-3-Clause
def populate(self, context, match): """ Utilizes the match from the regular expression check to check for possible matches of :py:attr:`.jinja_vars`. :param context: The context for the completion. :type context: :py:class:`GtkSource.CompletionContext` :param match: The matching object. :types match: `re...
Utilizes the match from the regular expression check to check for possible matches of :py:attr:`.jinja_vars`. :param context: The context for the completion. :type context: :py:class:`GtkSource.CompletionContext` :param match: The matching object. :types match: `re.MatchObject` :return: List of strings ...
populate
python
rsmusllp/king-phisher
king_phisher/client/widget/completion_providers.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/widget/completion_providers.py
BSD-3-Clause
def __init__(self, title, parent, **kwargs): """ :param str title: The title for the file chooser dialog. :param parent: The parent window for the dialog. :type parent: :py:class:`Gtk.Window` """ utilities.assert_arg_type(parent, Gtk.Window, arg_pos=2) super(FileChooserDialog, self).__init__(title, parent...
:param str title: The title for the file chooser dialog. :param parent: The parent window for the dialog. :type parent: :py:class:`Gtk.Window`
__init__
python
rsmusllp/king-phisher
king_phisher/client/widget/extras.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/widget/extras.py
BSD-3-Clause
def quick_add_filter(self, name, patterns): """ Add a filter for displaying files, this is useful in conjunction with :py:meth:`.run_quick_open`. :param str name: The name of the filter. :param patterns: The pattern(s) to match. :type patterns: list, str """ if not isinstance(patterns, (list, tuple)): ...
Add a filter for displaying files, this is useful in conjunction with :py:meth:`.run_quick_open`. :param str name: The name of the filter. :param patterns: The pattern(s) to match. :type patterns: list, str
quick_add_filter
python
rsmusllp/king-phisher
king_phisher/client/widget/extras.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/widget/extras.py
BSD-3-Clause
def run_quick_open(self): """ Display a dialog asking a user which file should be opened. The value of target_path in the returned dictionary is an absolute path. :return: A dictionary with target_uri and target_path keys representing the path chosen. :rtype: dict """ self.set_action(Gtk.FileChooserActio...
Display a dialog asking a user which file should be opened. The value of target_path in the returned dictionary is an absolute path. :return: A dictionary with target_uri and target_path keys representing the path chosen. :rtype: dict
run_quick_open
python
rsmusllp/king-phisher
king_phisher/client/widget/extras.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/widget/extras.py
BSD-3-Clause
def run_quick_save(self, current_name=None): """ Display a dialog which asks the user where a file should be saved. The value of target_path in the returned dictionary is an absolute path. :param set current_name: The name of the file to save. :return: A dictionary with target_uri and target_path keys repres...
Display a dialog which asks the user where a file should be saved. The value of target_path in the returned dictionary is an absolute path. :param set current_name: The name of the file to save. :return: A dictionary with target_uri and target_path keys representing the path chosen. :rtype: dict
run_quick_save
python
rsmusllp/king-phisher
king_phisher/client/widget/extras.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/widget/extras.py
BSD-3-Clause
def run_quick_select_directory(self): """ Display a dialog which asks the user to select a directory to use. The value of target_path in the returned dictionary is an absolute path. :return: A dictionary with target_uri and target_path keys representing the path chosen. :rtype: dict """ self.set_action(G...
Display a dialog which asks the user to select a directory to use. The value of target_path in the returned dictionary is an absolute path. :return: A dictionary with target_uri and target_path keys representing the path chosen. :rtype: dict
run_quick_select_directory
python
rsmusllp/king-phisher
king_phisher/client/widget/extras.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/widget/extras.py
BSD-3-Clause
def load_html_data(self, html_data, html_file_uri=None): """ Load arbitrary HTML data into the WebKit engine to be rendered. :param str html_data: The HTML data to load into WebKit. :param str html_file_uri: The URI of the file where the HTML data came from. """ if isinstance(html_file_uri, str) and not ht...
Load arbitrary HTML data into the WebKit engine to be rendered. :param str html_data: The HTML data to load into WebKit. :param str html_file_uri: The URI of the file where the HTML data came from.
load_html_data
python
rsmusllp/king-phisher
king_phisher/client/widget/extras.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/widget/extras.py
BSD-3-Clause
def load_html_file(self, html_file): """ Load arbitrary HTML data from a file into the WebKit engine to be rendered. :param str html_file: The path to the file to load HTML data from. """ with codecs.open(html_file, 'r', encoding='utf-8') as file_h: html_data = file_h.read() self.load_html_data(html_d...
Load arbitrary HTML data from a file into the WebKit engine to be rendered. :param str html_file: The path to the file to load HTML data from.
load_html_file
python
rsmusllp/king-phisher
king_phisher/client/widget/extras.py
https://github.com/rsmusllp/king-phisher/blob/master/king_phisher/client/widget/extras.py
BSD-3-Clause