def _add_menu_actions(self, action_group): # Edit Menu Actions action_editmenu = Gtk.Action("EditMenu", "Edit", None, None) action_group.add_action(action_editmenu) action_copy = Gtk.Action("EditCopy", "Copy", "Copy", None) action_copy.connect("activate", lambda x: self.terminal.copy_clipboard()) action_group.add_action_with_accel(action_copy, "<control><shift>C") action_paste = Gtk.Action("EditPaste", "Paste", "Paste", None) action_paste.connect("activate", lambda x: self.terminal.paste_clipboard()) action_group.add_action_with_accel(action_paste, "<control><shift>V") # Help Menu Actions action = Gtk.Action('HelpMenu', 'Help', None, None) action_group.add_action(action) action = Gtk.Action('HelpAbout', 'About', 'About', None) action.connect('activate', lambda x: dialogs.AboutDialog(self.config, self.window).interact()) action_group.add_action(action) rpc_api_docs_url = "http://king-phisher.readthedocs.org/en/{0}/rpc_api.html".format('latest' if version.version_label in ('alpha', 'beta') else 'stable') action = Gtk.Action('HelpApiDocs', 'API Documentation', 'API Documentation', None) action.connect('activate', lambda x: utilities.open_uri(rpc_api_docs_url)) action_group.add_action(action) action = Gtk.Action('HelpWiki', 'Wiki', 'Wiki', None) action.connect('activate', lambda x: utilities.open_uri('https://github.com/securestate/king-phisher/wiki')) action_group.add_action(action)
def show_about_dialog(self): license_text = None if os.path.splitext(__file__)[1] == '.py': source_file_h = open(__file__, 'r') source_code = [] source_code.append(source_file_h.readline()) while source_code[-1].startswith('#'): source_code.append(source_file_h.readline()) source_code = source_code[5:-1] source_code = map(lambda x: x.strip('# '), source_code) license_text = ''.join(source_code) about_dialog = Gtk.AboutDialog() about_dialog.set_transient_for(self) about_dialog_properties = { 'authors': ['Spencer McIntyre', 'Jeff McCutchan', 'Brandan Geise'], 'comments': 'Phishing Campaign Toolkit', 'copyright': '(c) 2013 SecureState', 'license-type': Gtk.License.BSD, 'program-name': 'King Phisher', 'version': version.version, 'website': 'https://github.com/securestate/king-phisher', 'website-label': 'GitHub Home Page', 'wrap-license': False, } if license_text: about_dialog_properties['license'] = license_text for property_name, property_value in about_dialog_properties.items(): about_dialog.set_property(property_name, property_value) about_dialog.connect('activate-link', lambda _, url: utilities.open_uri(url)) about_dialog.show_all() about_dialog.run() about_dialog.destroy()
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. :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 should belong to. :type parent: :py:class:`Gtk.Window` :param str secondary_text: Optional subtext for the dialog. :param message_buttons: The buttons to display in the dialog box. :type message_buttons: :py:class:`Gtk.ButtonsType` :param bool use_markup: Whether or not to treat the message text as markup. :param bool secondary_use_markup: Whether or not to treat the secondary text as markup. :return: The response of the dialog. :rtype: int """ dialog = Gtk.MessageDialog(parent, Gtk.DialogFlags.DESTROY_WITH_PARENT, message_type, message_buttons) dialog.set_property('text', message) dialog.set_property('use-markup', use_markup) dialog.set_property('secondary-text', secondary_text) dialog.set_property('secondary-use-markup', secondary_use_markup) if secondary_use_markup: signal_label_activate_link = lambda _, uri: utilities.open_uri(uri) for label in dialog.get_message_area().get_children(): if not isinstance(label, Gtk.Label): continue label.connect('activate-link', signal_label_activate_link) dialog.show_all() response = dialog.run() dialog.destroy() return response
def __init__(self, *args, **kwargs): super(AboutDialog, self).__init__(*args, **kwargs) logo_file_path = find.find_data_file('king-phisher-icon.svg') if logo_file_path: logo_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(logo_file_path, 128, 128) self.dialog.set_property('logo', logo_pixbuf) self.dialog.set_property('version', version.version) self.dialog.connect('activate-link', lambda _, url: utilities.open_uri(url))
def __init__(self, *args, **kwargs): super(AboutDialog, self).__init__(*args, **kwargs) logo_file_path = find.data_file('king-phisher-icon.svg') if logo_file_path: logo_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size( logo_file_path, 128, 128) self.dialog.set_property('logo', logo_pixbuf) self.dialog.set_property('version', version.version) self.dialog.connect('activate-link', lambda _, url: utilities.open_uri(url))
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 identifier for the exception that can be provided for tracking purposes. """ super(ExceptionDialog, self).__init__(application) self.error_description = self.gtk_builder_get('label_error_description') self.error_details = self.gtk_builder_get('textview_error_details') self.exc_info = exc_info or sys.exc_info() self.error_uid = error_uid linkbutton = self.gobjects['linkbutton_github_issues'] linkbutton.set_label('Project Issue Tracker') linkbutton.connect('activate-link', lambda _: utilities.open_uri(linkbutton.get_property('uri')))
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 identifier for the exception that can be provided for tracking purposes. """ super(ExceptionDialog, self).__init__(application) self.error_description = self.gtk_builder_get('label_error_description') self.error_details = self.gtk_builder_get('textview_error_details') self.error_details.modify_font(Pango.FontDescription('monospace 9')) self.exc_info = exc_info or sys.exc_info() self.error_uid = error_uid linkbutton = self.gobjects['linkbutton_github_issues'] linkbutton.set_label('Project Issue Tracker') linkbutton.connect('activate-link', lambda _: utilities.open_uri(linkbutton.get_property('uri')))
def show_about_dialog(self): """ Display the about dialog showing details about the programs version, license etc. """ license_text = None if os.path.splitext(__file__)[1] == '.py': source_file_h = open(__file__, 'r') source_code = [] source_code.append(source_file_h.readline()) while source_code[-1].startswith('#'): source_code.append(source_file_h.readline()) source_code = source_code[5:-1] source_code = map(lambda x: x.strip('# '), source_code) license_text = ''.join(source_code) logo_pixbuf = None logo_file_path = find.find_data_file('king-phisher-icon.svg') if logo_file_path: logo_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size( logo_file_path, 128, 128) about_dialog = Gtk.AboutDialog() about_dialog.set_transient_for(self) about_dialog_properties = { 'authors': ['Spencer McIntyre', 'Jeff McCutchan', 'Brandan Geise'], 'comments': 'Phishing Campaign Toolkit', 'copyright': 'Copyright (c) 2013-2015, SecureState LLC', 'license-type': Gtk.License.BSD, 'program-name': 'King Phisher', 'version': version.version, 'website': 'https://github.com/securestate/king-phisher', 'website-label': 'GitHub Home Page', 'wrap-license': False, } if license_text: about_dialog_properties['license'] = license_text if logo_pixbuf: about_dialog_properties['logo'] = logo_pixbuf for property_name, property_value in about_dialog_properties.items(): about_dialog.set_property(property_name, property_value) about_dialog.connect('activate-link', lambda _, url: utilities.open_uri(url)) about_dialog.show_all() about_dialog.run() about_dialog.destroy()
def signal_template_help(self, _): utilities.open_uri( 'https://github.com/securestate/king-phisher/wiki/Templates#web-page-templates' )
def signal_label_activate_link(self, _, uri): utilities.open_uri(uri)
def signal_webview_open_remote_uri(self, webview, uri, decision): utilities.open_uri(uri)
def do_help_wiki(self, _): utilities.open_uri('https://github.com/securestate/king-phisher/wiki')
def do_help_templates(self, _): utilities.open_uri('https://github.com/securestate/king-phisher-templates')
def signal_menuitem_help_api_docs(self, menuitem): rpc_api_docs_url = "https://king-phisher.readthedocs.io/en/{0}/server/rpc_api.html".format( 'latest' if version.version_label in ('alpha', 'beta') else 'stable') utilities.open_uri(rpc_api_docs_url)
def signal_menuitem_help_api_docs(self, menuitem): rpc_api_docs_url = "http://king-phisher.readthedocs.io/en/{0}/server_api/rpc_api.html".format('latest' if version.version_label in ('alpha', 'beta') else 'stable') utilities.open_uri(rpc_api_docs_url)
def signal_toolbutton_template_wiki(self, toolbutton): utilities.open_uri("https://github.com/securestate/king-phisher/wiki/Templates#message-templates")
def _add_menu_actions(self, action_group): # File Menu Actions action = Gtk.Action(name='FileMenu', label='File', tooltip=None, stock_id=None) action_group.add_action(action) action = Gtk.Action(name='FileOpenCampaign', label='_Open Campaign', tooltip='Open a Campaign', stock_id=Gtk.STOCK_NEW) action.connect('activate', lambda x: self.show_campaign_selection()) action_group.add_action_with_accel(action, '<control>O') action = Gtk.Action(name='FileImportMenu', label='Import', tooltip=None, stock_id=None) action_group.add_action(action) action = Gtk.Action(name='FileImportMessageConfiguration', label='Message Configuration', tooltip='Message Configuration', stock_id=None) action.connect('activate', lambda x: self.tabs['mailer'].import_message_data()) action_group.add_action(action) action = Gtk.Action(name='FileExportMenu', label='Export', tooltip=None, stock_id=None) action_group.add_action(action) action = Gtk.Action(name='FileExportCampaignXML', label='Campaign XML', tooltip='Campaign XML', stock_id=None) action.connect('activate', lambda x: self.export_campaign_xml()) action_group.add_action(action) action = Gtk.Action(name='FileExportMessageConfiguration', label='Message Configuration', tooltip='Message Configuration', stock_id=None) action.connect('activate', lambda x: self.tabs['mailer'].export_message_data()) action_group.add_action(action) action = Gtk.Action(name='FileQuit', label=None, tooltip=None, stock_id=Gtk.STOCK_QUIT) action.connect('activate', lambda x: self.emit('exit-confirm')) action_group.add_action_with_accel(action, '<control>Q') # Edit Menu Actions action = Gtk.Action(name='EditMenu', label='Edit', tooltip=None, stock_id=None) action_group.add_action(action) action = Gtk.Action(name='EditPreferences', label='Preferences', tooltip='Edit Preferences', stock_id=Gtk.STOCK_EDIT) action.connect('activate', lambda x: self.edit_preferences()) action_group.add_action(action) action = Gtk.Action(name='EditDeleteCampaign', label='Delete Campaign', tooltip='Delete Campaign', stock_id=None) action.connect('activate', lambda x: self.delete_campaign()) action_group.add_action(action) action = Gtk.Action(name='EditRenameCampaign', label='Rename Campaign', tooltip='Rename Campaign', stock_id=None) action.connect('activate', lambda x: self.rename_campaign()) action_group.add_action(action) action = Gtk.Action(name='EditStopService', label='Stop Service', tooltip='Stop The Remote King-Phisher Service', stock_id=None) action.connect('activate', lambda x: self.stop_remote_service()) action_group.add_action(action) # Tools Menu Action action = Gtk.Action(name='ToolsMenu', label='Tools', tooltip=None, stock_id=None) action_group.add_action(action) action = Gtk.Action(name='ToolsRPCTerminal', label='RPC Terminal', tooltip='RPC Terminal', stock_id=None) action.connect( 'activate', lambda x: tools.KingPhisherClientRPCTerminal( self.config, self, self.get_property('application'))) action_group.add_action_with_accel(action, '<control>F1') action = Gtk.Action(name='ToolsCloneWebPage', label='Clone Web Page', tooltip='Clone A Web Page', stock_id=None) action.connect( 'activate', lambda x: dialogs.ClonePageDialog(self.config, self).interact()) action_group.add_action(action) # Help Menu Actions action = Gtk.Action(name='HelpMenu', label='Help', tooltip=None, stock_id=None) action_group.add_action(action) action = Gtk.Action(name='HelpAbout', label='About', tooltip='About', stock_id=None) action.connect( 'activate', lambda x: dialogs.AboutDialog(self.config, self).interact()) action_group.add_action(action) action = Gtk.Action(name='HelpWiki', label='Wiki', tooltip='Wiki', stock_id=None) action.connect( 'activate', lambda x: utilities.open_uri( 'https://github.com/securestate/king-phisher/wiki')) action_group.add_action(action)
def signal_activate_help_templates(self, _): utilities.open_uri( 'https://github.com/securestate/king-phisher-templates')
def signal_menuitem_help_api_docs(self, menuitem): rpc_api_docs_url = "http://king-phisher.readthedocs.io/en/{0}/server_api/rpc_api.html".format( "latest" if version.version_label in ("alpha", "beta") else "stable" ) utilities.open_uri(rpc_api_docs_url)
def signal_activate_help_wiki(self, _): utilities.open_uri('https://github.com/securestate/king-phisher/wiki')
def _add_menu_actions(self, action_group): # File Menu Actions action = Gtk.Action(name='FileMenu', label='File', tooltip=None, stock_id=None) action_group.add_action(action) action = Gtk.Action(name='FileOpenCampaign', label='_Open Campaign', tooltip='Open a Campaign', stock_id=Gtk.STOCK_NEW) action.connect('activate', lambda x: self.show_campaign_selection()) action_group.add_action_with_accel(action, '<control>O') action = Gtk.Action(name='FileImportMenu', label='Import', tooltip=None, stock_id=None) action_group.add_action(action) action = Gtk.Action(name='FileImportMessageConfiguration', label='Message Configuration', tooltip='Message Configuration', stock_id=None) action.connect('activate', lambda x: self.tabs['mailer'].import_message_data()) action_group.add_action(action) action = Gtk.Action(name='FileExportMenu', label='Export', tooltip=None, stock_id=None) action_group.add_action(action) action = Gtk.Action(name='FileExportCampaignXML', label='Campaign XML', tooltip='Campaign XML', stock_id=None) action.connect('activate', lambda x: self.export_campaign_xml()) action_group.add_action(action) action = Gtk.Action(name='FileExportMessageConfiguration', label='Message Configuration', tooltip='Message Configuration', stock_id=None) action.connect('activate', lambda x: self.tabs['mailer'].export_message_data()) action_group.add_action(action) action = Gtk.Action(name='FileQuit', label=None, tooltip=None, stock_id=Gtk.STOCK_QUIT) action.connect('activate', lambda x: self.emit('exit-confirm')) action_group.add_action_with_accel(action, '<control>Q') # Edit Menu Actions action = Gtk.Action(name='EditMenu', label='Edit', tooltip=None, stock_id=None) action_group.add_action(action) action = Gtk.Action(name='EditPreferences', label='Preferences', tooltip='Edit Preferences', stock_id=Gtk.STOCK_EDIT) action.connect('activate', lambda x: self.edit_preferences()) action_group.add_action(action) action = Gtk.Action(name='EditDeleteCampaign', label='Delete Campaign', tooltip='Delete Campaign', stock_id=None) action.connect('activate', lambda x: self.delete_campaign()) action_group.add_action(action) action = Gtk.Action(name='EditRenameCampaign', label='Rename Campaign', tooltip='Rename Campaign', stock_id=None) action.connect('activate', lambda x: self.rename_campaign()) action_group.add_action(action) action = Gtk.Action(name='EditStopService', label='Stop Service', tooltip='Stop The Remote King-Phisher Service', stock_id=None) action.connect('activate', lambda x: self.stop_remote_service()) action_group.add_action(action) # Tools Menu Action action = Gtk.Action(name='ToolsMenu', label='Tools', tooltip=None, stock_id=None) action_group.add_action(action) action = Gtk.Action(name='ToolsRPCTerminal', label='RPC Terminal', tooltip='RPC Terminal', stock_id=None) action.connect('activate', lambda x: tools.KingPhisherClientRPCTerminal(self.config, self, self.get_property('application'))) action_group.add_action_with_accel(action, '<control>F1') action = Gtk.Action(name='ToolsCloneWebPage', label='Clone Web Page', tooltip='Clone A Web Page', stock_id=None) action.connect('activate', lambda x: dialogs.ClonePageDialog(self.config, self).interact()) action_group.add_action(action) # Help Menu Actions action = Gtk.Action(name='HelpMenu', label='Help', tooltip=None, stock_id=None) action_group.add_action(action) action = Gtk.Action(name='HelpAbout', label='About', tooltip='About', stock_id=None) action.connect('activate', lambda x: dialogs.AboutDialog(self.config, self).interact()) action_group.add_action(action) action = Gtk.Action(name='HelpWiki', label='Wiki', tooltip='Wiki', stock_id=None) action.connect('activate', lambda x: utilities.open_uri('https://github.com/securestate/king-phisher/wiki')) action_group.add_action(action)
def signal_toolbutton_template_wiki(self, toolbutton): utilities.open_uri('https://github.com/securestate/king-phisher/wiki/Templates#message-templates')
def signal_menuitem_help_wiki(self, menuitem): utilities.open_uri('https://github.com/securestate/king-phisher/wiki')
def signal_template_help(self, _): utilities.open_uri('https://github.com/securestate/king-phisher/wiki/Templates#web-page-templates')
def _add_menu_actions(self, action_group): # File Menu Actions action = Gtk.Action('FileMenu', 'File', None, None) action_group.add_action(action) action = Gtk.Action('FileOpenCampaign', '_Open Campaign', 'Open a Campaign', Gtk.STOCK_NEW) action.connect('activate', lambda x: self.show_campaign_selection()) action_group.add_action_with_accel(action, '<control>O') action = Gtk.Action('FileExportMenu', 'Export', None, None) action_group.add_action(action) action = Gtk.Action('FileExportXML', 'Export XML', 'Export XML', None) action.connect('activate', lambda x: self.export_xml()) action_group.add_action(action) action = Gtk.Action('FileQuit', None, None, Gtk.STOCK_QUIT) action.connect('activate', lambda x: self.client_quit()) action_group.add_action_with_accel(action, '<control>Q') # Edit Menu Actions action = Gtk.Action('EditMenu', 'Edit', None, None) action_group.add_action(action) action = Gtk.Action('EditPreferences', 'Preferences', 'Edit preferences', Gtk.STOCK_EDIT) action.connect('activate', lambda x: self.edit_preferences()) action_group.add_action(action) action = Gtk.Action('EditDeleteCampaign', 'Delete Campaign', 'Delete Campaign', None) action.connect('activate', lambda x: self.delete_campaign()) action_group.add_action(action) action = Gtk.Action('EditStopService', 'Stop Service', 'Stop Remote King-Phisher Service', None) action.connect('activate', lambda x: self.stop_remote_service()) action_group.add_action(action) # Tools Menu Action action = Gtk.Action('ToolsMenu', 'Tools', None, None) action_group.add_action(action) action = Gtk.Action('ToolsRPCTerminal', 'RPC Terminal', 'RPC Terminal', None) action.connect('activate', lambda x: KingPhisherClientRPCTerminal(self.config, self)) action_group.add_action(action) # Help Menu Actions action = Gtk.Action('HelpMenu', 'Help', None, None) action_group.add_action(action) if graphs.has_matplotlib: action = Gtk.Action('ToolsGraphMenu', 'Create Graph', None, None) action_group.add_action(action) for graph_name in graphs.get_graphs(): action_name = 'ToolsGraph' + graph_name action = Gtk.Action(action_name, graph_name, graph_name, None) action.connect('activate', lambda _: self.show_campaign_graph(graph_name)) action_group.add_action(action) action = Gtk.Action('HelpAbout', 'About', 'About', None) action.connect('activate', lambda x: self.show_about_dialog()) action_group.add_action(action) action = Gtk.Action('HelpWiki', 'Wiki', 'Wiki', None) action.connect('activate', lambda x: utilities.open_uri('https://github.com/securestate/king-phisher/wiki')) action_group.add_action(action)