1.1.8. export

This module provides functionality for exporting information from the client application into a variety of formats.

1.1.8.1. Functions

campaign_credentials_to_msf_txt(rpc, campaign_id, target_file)[source]

Export credentials into a format that can easily be used with Metasploit’s USERPASS_FILE option.

Parameters:
  • rpc (KingPhisherRPCClient) – The connected RPC instance to load the information with.
  • campaign_id – The ID of the campaign to load the information for.
  • target_file (str) – The destination file for the credential data.
campaign_to_xml(rpc, campaign_id, xml_file, encoding='utf-8')[source]

Load all information for a particular campaign and dump it to an XML file.

Parameters:
  • rpc (KingPhisherRPCClient) – The connected RPC instance to load the information with.
  • campaign_id – The ID of the campaign to load the information for.
  • xml_file (str) – The destination file for the XML data.
  • encoding (str) – The encoding to use for strings.
campaign_visits_to_geojson(rpc, campaign_id, geojson_file)[source]

Export the geo location information for all the visits of a campaign into the GeoJSON format.

Parameters:
  • rpc (KingPhisherRPCClient) – The connected RPC instance to load the information with.
  • campaign_id – The ID of the campaign to load the information for.
  • geojson_file (str) – The destination file for the GeoJSON data.
convert_value(table_name, key, value)[source]

Perform any conversions necessary to neatly display the data in XML format.

Parameters:
  • table_name (str) – The table name that the key and value pair are from.
  • key (str) – The data key.
  • value – The data value to convert.
Returns:

The converted value.

Return type:

str

message_data_from_kpm(target_file, dest_dir, encoding='utf-8')[source]

Retrieve the stored details describing a message from a previously exported file.

Parameters:
  • target_file (str) – The file to load as a message archive.
  • dest_dir (str) – The directory to extract data and attachment files to.
  • encoding (str) – The encoding to use for strings.
Returns:

The restored details from the message config.

Return type:

dict

message_data_to_kpm(message_config, target_file, encoding='utf-8')[source]

Save details describing a message to the target file.

Parameters:
  • message_config (dict) – The message details from the client configuration.
  • target_file (str) – The file to write the data to.
  • encoding (str) – The encoding to use for strings.
liststore_export(store, columns, cb_write, cb_write_args, row_offset=0, write_columns=True)[source]

A function to facilitate writing values from a list store to an arbitrary callback for exporting to different formats. The callback will be called with the row number, the column values and the additional arguments specified in *cb_write_args.

cb_write(row, column_values, *cb_write_args).
Parameters:
  • store (Gtk.ListStore) – The store to export the information from.
  • columns (dict) – A dictionary mapping store column ids to the value names.
  • cb_write (function) – The callback function to be called for each row of data.
  • cb_write_args (tuple) – Additional arguments to pass to cb_write.
  • row_offset (int) – A modifier value to add to the row numbers passed to cb_write.
  • write_columns (bool) – Write the column names to the export.
Returns:

The number of rows that were written.

Return type:

int

liststore_to_csv(store, target_file, columns)[source]

Write the contents of a Gtk.ListStore to a csv file.

Parameters:
  • store (Gtk.ListStore) – The store to export the information from.
  • target_file (str) – The destination file for the CSV data.
  • columns (dict) – A dictionary mapping store column ids to the value names.
Returns:

The number of rows that were written.

Return type:

int

liststore_to_xlsx_worksheet(store, worksheet, columns, title_format, xlsx_options=None)[source]

Write the contents of a Gtk.ListStore to an XLSX worksheet.

Parameters:
  • store (Gtk.ListStore) – The store to export the information from.
  • worksheet (xlsxwriter.worksheet.Worksheet) – The destination sheet for the store’s data.
  • columns (dict) – A dictionary mapping store column ids to the value names.
  • xlsx_options (XLSXWorksheetOptions) – A collection of additional options for formatting the Excel Worksheet.
Returns:

The number of rows that were written.

Return type:

int