Example #1
0
 def _cmd_add(self, params):
     if len(params) == 0:
         om.out.console('Parameter "type" is missing, see the help:')
         self._cmd_help(['add'])
         return
     
     if len(params) > 1:
         om.out.console('Only one parameter is accepted, see the help:')
         self._cmd_help(['add'])
         return
     
     template_name = params[0]
     if template_name not in get_template_names():
         om.out.console('Type %s is unknown' % template_name)
         return
     
     # Now we use the fact that templates are configurable just like
     # plugins, misc-settings, etc.
     template_inst = get_template_by_name(template_name)
     template_menu = StoreOnBackConfigMenu(template_name, self._console,
                                           self._w3af, self, template_inst)
     
     # Note: The data is stored in the KB when the user does a "back"
     #       see the StoreOnBackConfigMenu implementation
     return template_menu
Example #2
0
    def _cmd_add(self, params):
        if len(params) == 0:
            om.out.console('Parameter "type" is missing, see the help:')
            self._cmd_help(['add'])
            return

        if len(params) > 1:
            om.out.console('Only one parameter is accepted, see the help:')
            self._cmd_help(['add'])
            return

        template_name = params[0]
        if template_name not in get_template_names():
            om.out.console('Type %s is unknown' % template_name)
            return

        # Now we use the fact that templates are configurable just like
        # plugins, misc-settings, etc.
        template_inst = get_template_by_name(template_name)
        template_menu = StoreOnBackConfigMenu(template_name, self._console,
                                              self._w3af, self, template_inst)

        # Note: The data is stored in the KB when the user does a "back"
        #       see the StoreOnBackConfigMenu implementation
        return template_menu
Example #3
0
    def _para_add(self, params, part):
        if len(params):
            return []

        return suggest(get_template_names(), part)
Example #4
0
 def __init__(self, w3af):
     super(VulnAddDialog, self).__init__("Add new vulnerability", None,
                                         gtk.MESSAGE_QUESTION,
                                         (gtk.STOCK_CANCEL,
                                          gtk.RESPONSE_CANCEL,
                                          gtk.STOCK_ADD,
                                          gtk.RESPONSE_OK))
     self.set_icon_from_file(W3AF_ICON)
     
     self.w3af = w3af
     
     # Main hbox
     hbox = gtk.HBox()
     hbox.show()
     image = gtk.Image()
     image.set_from_stock(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_DIALOG)
     image.set_padding(20, 20)
     image.show()
     
     hbox.pack_start(image)
     
     # Vbox with all the information for the right section of the dialog
     vbox = gtk.VBox()
     
     # Add a label
     align = gtk.Alignment()
     align.set_padding(10, 0, 0, 10)
     label = gtk.Label('Choose the vulnerability template to use:')
     align.add(label)
     vbox.pack_start(align)
     
     template_long_names = get_template_long_names()
     template_names = get_template_names()
     self.vuln_template = None
     
     # A list store with the following columns:
     #    * Long template name (show)
     #    * Template name (code internals)
     liststore = gtk.ListStore(str, str)
     self.combobox = gtk.ComboBox(liststore)
     cell = gtk.CellRendererText()
     self.combobox.pack_start(cell, True)
     self.combobox.add_attribute(cell, 'text', 0)
     self.combobox.connect("changed", self._changed_combo)
     
     for i, long_name in enumerate(template_long_names):
         liststore.append((long_name, template_names[i]))
     
     vbox.pack_start(self.combobox, False, False)
     vbox.pack_start(gtk.Label())
     
     # the Cancel button
     but = self.action_area.get_children()[1]
     but.connect("clicked", lambda x: self.destroy())
     self.connect("delete-event", lambda x, y: self.destroy())
     
     # the Ok button
     self.ok_but = self.action_area.get_children()[0]
     self.ok_but.connect("clicked", self._ok)
     self.ok_but.set_sensitive(False)
     
     hbox.pack_start(vbox)
     
     self.vbox.pack_start(hbox)
     self.show_all()
Example #5
0
 def test_get_template_names(self):
     self.assertIn('dav', get_template_names())
Example #6
0
 def test_get_template_names(self):
     self.assertIn('dav', get_template_names())
Example #7
0
    def _para_add(self, params, part):
        if len(params):
            return []

        return suggest(get_template_names(), part)
Example #8
0
    def __init__(self, w3af):
        super(VulnAddDialog,
              self).__init__("Add new vulnerability", None,
                             gtk.MESSAGE_QUESTION,
                             (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                              gtk.STOCK_ADD, gtk.RESPONSE_OK))
        self.set_icon_from_file(W3AF_ICON)

        self.w3af = w3af

        # Main hbox
        hbox = gtk.HBox()
        hbox.show()
        image = gtk.Image()
        image.set_from_stock(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_DIALOG)
        image.set_padding(20, 20)
        image.show()

        hbox.pack_start(image)

        # Vbox with all the information for the right section of the dialog
        vbox = gtk.VBox()

        # Add a label
        align = gtk.Alignment()
        align.set_padding(10, 0, 0, 10)
        label = gtk.Label('Choose the vulnerability template to use:')
        align.add(label)
        vbox.pack_start(align)

        template_long_names = get_template_long_names()
        template_names = get_template_names()
        self.vuln_template = None

        # A list store with the following columns:
        #    * Long template name (show)
        #    * Template name (code internals)
        liststore = gtk.ListStore(str, str)
        self.combobox = gtk.ComboBox(liststore)
        cell = gtk.CellRendererText()
        self.combobox.pack_start(cell, True)
        self.combobox.add_attribute(cell, 'text', 0)
        self.combobox.connect("changed", self._changed_combo)

        for i, long_name in enumerate(template_long_names):
            liststore.append((long_name, template_names[i]))

        vbox.pack_start(self.combobox, False, False)
        vbox.pack_start(gtk.Label())

        # the Cancel button
        but = self.action_area.get_children()[1]
        but.connect("clicked", lambda x: self.destroy())
        self.connect("delete-event", lambda x, y: self.destroy())

        # the Ok button
        self.ok_but = self.action_area.get_children()[0]
        self.ok_but.connect("clicked", self._ok)
        self.ok_but.set_sensitive(False)

        hbox.pack_start(vbox)

        self.vbox.pack_start(hbox)
        self.show_all()