示例#1
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 = CoreTarget()
        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
示例#2
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 = CoreTarget()
        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
示例#3
0
    def test_verify_file_target(self):
        ctarget = CoreTarget()

        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'))
示例#4
0
    def test_verify_file_target(self):
        ctarget = CoreTarget()

        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'))