コード例 #1
0
    def export_message_data(self):
        """
		Gather and prepare the components of the mailer tab to be exported into
		a message archive file suitable for restoring at a later point in time.
		"""
        config_tab = self.tabs.get('config')
        if not config_tab:
            self.logger.warning(
                'attempted to export message data while the config tab was unavailable'
            )
            return
        config_prefix = config_tab.config_prefix
        config_tab.objects_save_to_config()
        dialog = gui_utilities.UtilityFileChooser(
            'Export Message Configuration', self.parent)
        response = dialog.run_quick_save('message.kpm')
        dialog.destroy()
        if not response:
            return
        message_config = {}
        config_keys = filter(lambda k: k.startswith(config_prefix),
                             self.config.keys())
        for config_key in config_keys:
            message_config[config_key[7:]] = self.config[config_key]
        export.message_data_to_kpm(message_config, response['target_path'])
コード例 #2
0
	def do_message_data_export(self, path):
		config_tab = self.tabs.get('config')
		config_prefix = config_tab.config_prefix
		config_tab.objects_save_to_config()
		message_config = {}
		config_keys = (key for key in self.config.keys() if key.startswith(config_prefix))
		for config_key in config_keys:
			message_config[config_key[7:]] = self.config[config_key]
		export.message_data_to_kpm(message_config, path)
		return True
コード例 #3
0
ファイル: mail.py プロジェクト: collin123/king-phisher
    def export_message_data(self):
        """
		Gather and prepare the components of the mailer tab to be exported into
		a message archive file suitable for restoring at a later point in time.
		"""
        config_tab = self.tabs.get("config")
        if not config_tab:
            self.logger.warning("attempted to export message data while the config tab was unavailable")
            return
        config_prefix = config_tab.config_prefix
        config_tab.objects_save_to_config()
        dialog = extras.FileChooserDialog("Export Message Configuration", self.parent)
        response = dialog.run_quick_save("message.kpm")
        dialog.destroy()
        if not response:
            return
        message_config = {}
        config_keys = (key for key in self.config.keys() if key.startswith(config_prefix))
        for config_key in config_keys:
            message_config[config_key[7:]] = self.config[config_key]
        export.message_data_to_kpm(message_config, response["target_path"])