Esempio n. 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
Esempio n. 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
Esempio n. 3
0
 def _get_active_template_in_combo(self):
     """
     Based on the user selection in the combo, return a template instance or
     None if there was any type of error.
     """
     model = self.combobox.get_model()
     active = self.combobox.get_active()
     if active < 0:
         return None
     
     try:
         template = get_template_by_name(model[active][1])
     except:
         return None
     
     return template
Esempio n. 4
0
    def _get_active_template_in_combo(self):
        """
        Based on the user selection in the combo, return a template instance or
        None if there was any type of error.
        """
        model = self.combobox.get_model()
        active = self.combobox.get_active()
        if active < 0:
            return None

        try:
            template = get_template_by_name(model[active][1])
        except:
            return None

        return template
Esempio n. 5
0
 def test_get_template_by_name(self):
     template = get_template_by_name('dav')
     self.assertEqual(template.get_short_name(), 'dav')
Esempio n. 6
0
 def test_get_template_by_name(self):
     template = get_template_by_name('dav')
     self.assertEqual(template.get_short_name(), 'dav')