Esempio n. 1
0
    def new_profile(self, widget=None):
        """Creates a new profile."""
        # ask for new profile info
        dlg = entries.EntryDialog(_("New profile"), gtk.STOCK_NEW,
                                  [_("Name:"), _("Description:")])
        dlg.run()
        dlgResponse = dlg.inputtexts
        dlg.destroy()
        if dlgResponse is None:
            return

        # use the empty profile
        try:
            self.w3af.profiles.use_profile(None)
        except BaseFrameworkException as w3:
            dlg = gtk.MessageDialog(None, gtk.DIALOG_MODAL,
                                    gtk.MESSAGE_WARNING, gtk.BUTTONS_OK,
                                    str(w3))
            dlg.run()
            dlg.destroy()
            return
        self.w3af.mainwin.pcbody.reload(None)

        # save it
        filename, description = dlgResponse
        filename = cgi.escape(filename)
        try:
            profile_obj = helpers.coreWrap(
                self.w3af.profiles.save_current_to_new_profile, filename,
                description)
        except BaseFrameworkException:
            #FIXME: This message should be more descriptive
            self.w3af.mainwin.sb(_("Problem hit!"))
            return
        self.w3af.mainwin.sb(_("New profile created"))
        self.load_profiles(selected=profile_obj.get_name())

        # get the activated plugins
        self.origActPlugins = self.w3af.mainwin.pcbody.get_activated_plugins()

        # update the mainwin buttons
        path = self.get_cursor()[0]
        newstatus = self._get_actionsSensitivity(path)
        self.w3af.mainwin.activate_profile_actions(newstatus)
Esempio n. 2
0
    def new_profile(self, widget=None):
        """Creates a new profile."""
        # ask for new profile info
        dlg = entries.EntryDialog(_("New profile"), gtk.STOCK_NEW,
                                  [_("Name:"), _("Description:")])
        dlg.run()
        dlgResponse = dlg.inputtexts
        dlg.destroy()
        if dlgResponse is None:
            return

        # use the empty profile
        try:
            self.w3af.profiles.use_profile(None)
        except BaseFrameworkException, w3:
            dlg = gtk.MessageDialog(None, gtk.DIALOG_MODAL,
                                    gtk.MESSAGE_WARNING, gtk.BUTTONS_OK,
                                    str(w3))
            dlg.run()
            dlg.destroy()
            return
Esempio n. 3
0
    def save_as_profile(self, widget=None):
        """Copies the selected profile."""
        if not self.w3af.mainwin.save_state_to_core(relaxedTarget=True):
            return

        dlg = entries.EntryDialog(_(
            "Save as..."), gtk.STOCK_SAVE_AS, [_("Name:"), _("Description:")])
        dlg.run()
        dlgResponse = dlg.inputtexts
        dlg.destroy()
        if dlgResponse is not None:
            filename, description = dlgResponse
            filename = cgi.escape(filename)
            try:
                profile_obj = helpers.coreWrap(self.w3af.profiles.save_current_to_new_profile,
                                               filename, description)
            except BaseFrameworkException:
                self.w3af.mainwin.sb(
                    _("There was a problem saving the profile!"))
                return
            self.w3af.mainwin.sb(_("New profile created"))
            self.load_profiles(selected=profile_obj.get_name())