Example #1
0
    def test_verify_url(self):
        ctarget = w3af_core_target()

        self.assertRaises(w3afException, ctarget._verify_url, URL_KLASS("ftp://www.google.com/"))

        self.assertTrue(ctarget._verify_url(URL_KLASS("http://www.google.com/")))
        self.assertTrue(ctarget._verify_url(URL_KLASS("http://www.google.com:39/")))
Example #2
0
    def test_verify_url(self):
        ctarget = w3af_core_target()

        self.assertRaises(w3afException, ctarget._verify_url,
                          URL_KLASS('ftp://www.google.com/'))

        self.assertTrue(
            ctarget._verify_url(URL_KLASS('http://www.google.com/')))
        self.assertTrue(
            ctarget._verify_url(URL_KLASS('http://www.google.com:39/')))
Example #3
0
    def test_basic(self):
        opt_lst = w3af_core_target().get_options()

        for opt in opt_lst:
            self.assertIn(opt.get_type(), OPTION_TYPES)
            self.assertTrue(opt.get_name())
            self.assertEqual(opt, opt)

            # Just verify that this doesn't crash and that the types
            # are correct
            self.assertIsInstance(opt.get_name(), basestring)
            self.assertIsInstance(opt.get_desc(), basestring)
            self.assertIsInstance(opt.get_type(), basestring)
            self.assertIsInstance(opt.get_help(), basestring)
            self.assertIsInstance(opt.get_value_str(), basestring)
Example #4
0
    def test_basic(self):
        opt_lst = w3af_core_target().get_options()

        for opt in opt_lst:
            self.assertIn(opt.get_type(), OPTION_TYPES)
            self.assertTrue(opt.get_name())
            self.assertEqual(opt, opt)

            # Just verify that this doesn't crash and that the types
            # are correct
            self.assertIsInstance(opt.get_name(), basestring)
            self.assertIsInstance(opt.get_desc(), basestring)
            self.assertIsInstance(opt.get_type(), basestring)
            self.assertIsInstance(opt.get_help(), basestring)
            self.assertIsInstance(opt.get_value_str(), basestring)
Example #5
0
    def get_target(self):
        '''
        :return: The profile target with the options (target_os, target_framework, etc.)
        '''
        # Get the plugin defaults with their types
        target_instance = w3af_core_target()
        options = target_instance.get_options()

        for section in self._config.sections():
            # Section is something like audit.xss or crawl.web_spider
            # or [profile] or [target]
            if section == 'target':
                for option in self._config.options(section):
                    options[option].set_value(self._config.get(
                        section, option))

        return options
Example #6
0
    def get_target(self):
        '''
        :return: The profile target with the options (target_os, target_framework, etc.)
        '''
        # Get the plugin defaults with their types
        target_instance = w3af_core_target()
        options = target_instance.get_options()

        for section in self._config.sections():
            # Section is something like audit.xss or crawl.web_spider
            # or [profile] or [target]
            if section == 'target':
                for option in self._config.options(section):
                    options[option].set_value(
                        self._config.get(section, option))

        return options
Example #7
0
    def test_verify_file_target(self):
        ctarget = w3af_core_target()

        target_file = "/tmp/moth.target"
        target = "file://%s" % target_file

        target_file_handler = file(target_file, "w")
        target_file_handler.write("http://moth/1\n")
        target_file_handler.write("http://moth/2\n")
        target_file_handler.close()

        options = ctarget.get_options()
        options["target"].set_value(target)
        ctarget.set_options(options)

        moth1 = URL_KLASS("http://moth/1")
        moth2 = URL_KLASS("http://moth/2")

        self.assertIn(moth1, cf.cf.get("targets"))
        self.assertIn(moth2, cf.cf.get("targets"))
Example #8
0
    def test_verify_file_target(self):
        ctarget = w3af_core_target()

        target_file = '/tmp/moth.target'
        target = 'file://%s' % target_file

        target_file_handler = file(target_file, 'w')
        target_file_handler.write('http://moth/1\n')
        target_file_handler.write('http://moth/2\n')
        target_file_handler.close()

        options = ctarget.get_options()
        options['target'].set_value(target)
        ctarget.set_options(options)

        moth1 = URL_KLASS('http://moth/1')
        moth2 = URL_KLASS('http://moth/2')

        self.assertIn(moth1, cf.cf.get('targets'))
        self.assertIn(moth2, cf.cf.get('targets'))