• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python opt_factory.opt_factory函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中w3af.core.data.options.opt_factory.opt_factory函数的典型用法代码示例。如果您正苦于以下问题:Python opt_factory函数的具体用法?Python opt_factory怎么用?Python opt_factory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了opt_factory函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: get_options

    def get_options(self):
        """
        :return: A list of option objects for this plugin.
        """
        ol = OptionList()

        d = 'Wordlist to use in directory bruteforcing process.'
        o = opt_factory('dir_wordlist', self._dir_list, d, INPUT_FILE)
        ol.add(o)

        d = 'Wordlist to use in file bruteforcing process.'
        o = opt_factory('file_wordlist', self._file_list, d, INPUT_FILE)
        ol.add(o)

        d = 'If set to True, this plugin will bruteforce directories.'
        o = opt_factory('bf_directories', self._bf_directories, d, BOOL)
        ol.add(o)

        d = 'If set to True, this plugin will bruteforce files.'
        o = opt_factory('bf_files', self._bf_files, d, BOOL)
        ol.add(o)

        d = 'If set to True, this plugin will bruteforce all directories, not'\
            ' only the root directory.'
        h = 'WARNING: Enabling this will make the plugin send tens of thousands'\
            ' of requests.'
        o = opt_factory('be_recursive', self._be_recursive, d, BOOL, help=h)
        ol.add(o)

        return ol
开发者ID:RON313,项目名称:w3af,代码行数:30,代码来源:dir_file_bruter.py


示例2: get_options

    def get_options(self):
        """
        :return: A list of option objects for this plugin.
        """
        ol = OptionList()

        d = 'IP address that the webserver will use to receive requests'
        h = 'w3af runs a webserver to serve the files to the target web'\
            ' application when doing remote file inclusions. This setting'\
            ' configures where the webserver is going to listen for requests.'
        o = opt_factory('listen_address', self._listen_address, d, STRING, help=h)
        ol.add(o)

        d = 'TCP port that the webserver will use to receive requests'
        o = opt_factory('listen_port', self._listen_port, d, PORT)
        ol.add(o)

        d = 'Use w3af site to test for remote file inclusion'
        h = 'The plugin can use the w3af site to test for remote file'\
            ' inclusions, which is convenient when you are performing a test'\
            ' behind a NAT firewall.'
        o = opt_factory('use_w3af_site', self._use_w3af_site, d, BOOL, help=h)
        ol.add(o)

        return ol
开发者ID:foobarmonk,项目名称:w3af,代码行数:25,代码来源:rfi.py


示例3: get_options

    def get_options(self):
        """
        :return: A list of option objects for this plugin.
        """
        ol = OptionList()

        d = 'When comparing, also compare the content of files.'
        o = opt_factory('content', self._content, d, BOOL)
        ol.add(o)

        d = 'The local directory used in the comparison.'
        o = opt_factory('local_dir', self._local_dir, d, STRING)
        ol.add(o)

        d = 'The remote directory used in the comparison.'
        o = opt_factory(
            'remote_url_path', self._remote_url_path, d, URL_OPTION_TYPE)
        ol.add(o)

        d = 'When comparing content of two files, ignore files with these'\
            'extensions.'
        o = opt_factory('banned_ext', self._ban_url, d, LIST)
        ol.add(o)

        return ol
开发者ID:ElAleyo,项目名称:w3af,代码行数:25,代码来源:web_diff.py


示例4: get_options

 def get_options(self):
     """
     :return: A list of option objects for this plugin.
     """
     ol = OptionList()
     
     d = 'Stream edition expressions'
     h = ('Stream edition expressions are strings that tell the sed plugin'
          ' which transformations to apply to the HTTP requests and'
          ' responses. The sed plugin uses regular expressions, some'
          ' examples:\n'
          '\n'
          '    - qh/User/NotLuser/\n'
          '      This will make sed search in the the re[q]uest [h]eader'
          ' for the string User and replace it with NotLuser.\n'
          '\n'
          '    - sb/[fF]orm/form\n'
          '      This will make sed search in the re[s]ponse [b]ody for'\
          ' the strings form or Form and replace it with form.\n'
          '\n'
          'Multiple expressions can be specified separated by commas.')
     o = opt_factory('expressions', self._expressions, d, 'list', help=h)
     ol.add(o)
     
     d = 'Fix the content length header after mangling'
     o = opt_factory('fix_content_len', self._user_option_fix_content_len,
                     d, 'boolean')
     ol.add(o)
     
     return ol
开发者ID:0x554simon,项目名称:w3af,代码行数:30,代码来源:sed.py


示例5: test_invalid_data

    def test_invalid_data(self):
        input_file = os.path.join(ROOT_PATH, "core", "data", "foobar", "does-not-exist.txt")
        output_file = input_file

        data = {
            BOOL: ["rucula"],
            INT: ["0x32"],
            POSITIVE_INT: ["-1"],
            FLOAT: ["1x2"],
            URL: ["http://", "/", ""],
            URL_LIST: ["http://moth/1 , http://moth:333333"],
            IPPORT: ["127.0.0.1"],
            IP: ["127.0.0.", "127.0.0", "3847398740"],
            REGEX: [".*("],
            INPUT_FILE: [input_file],
            OUTPUT_FILE: [output_file],
            PORT: ["65536"],
        }

        for _type in data:
            for fake_value in data[_type]:
                err = "%s for an option of type %s should raise an exception."
                try:
                    opt_factory("name", fake_value, "desc", _type)
                except BaseFrameworkException:
                    self.assertTrue(True)
                else:
                    self.assertTrue(False, err % (fake_value, _type))
开发者ID:cathartic,项目名称:w3af,代码行数:28,代码来源:test_opt_factory.py


示例6: get_options

    def get_options(self):
        """
        :return: A list of option objects for this plugin.
        """
        ol = OptionList()

        targets = ','.join(str(tar) for tar in cf.cf.get('targets'))
        d = 'A comma separated list of URLs'
        o = opt_factory('target', targets, d, 'url_list')
        ol.add(o)

        d = 'Target operating system (' + '/'.join(
            self._operating_systems) + ')'
        h = 'This setting is here to enhance w3af performance.'

        # This list "hack" has to be done because the default value is the one
        # in the first position on the list
        tmp_list = self._operating_systems[:]
        tmp_list.remove(cf.cf.get('target_os'))
        tmp_list.insert(0, cf.cf.get('target_os'))
        o = opt_factory('target_os', tmp_list, d, 'combo', help=h)
        ol.add(o)

        d = 'Target programming framework (' + '/'.join(
            self._programming_frameworks) + ')'
        h = 'This setting is here to enhance w3af performance.'
        # This list "hack" has to be done because the default value is the one
        # in the first position on the list
        tmp_list = self._programming_frameworks[:]
        tmp_list.remove(cf.cf.get('target_framework'))
        tmp_list.insert(0, cf.cf.get('target_framework'))
        o = opt_factory('target_framework', tmp_list, d, 'combo', help=h)
        ol.add(o)

        return ol
开发者ID:BioSoundSystems,项目名称:w3af,代码行数:35,代码来源:target.py


示例7: get_options

 def get_options(self):
     """
     :return: A list of option objects for this plugin.
     """
     ol = OptionList()
     
     d = 'IP address that the webserver will use to receive requests'
     h = 'w3af runs a webserver to serve the files to the target web app'\
         ' when doing remote file inclusions. This setting configures on'\
         ' what IP address the webserver is going to listen.'
     o = opt_factory('listen_address', self._listen_address, d, 'ip', help=h)
     ol.add(o)
     
     d = 'Port that the webserver will use to receive requests'
     h = 'w3af runs a webserver to serve the files to the target web app'\
         ' when doing remote file inclusions. This setting configures on'\
         ' what IP address the webserver is going to listen.'
     o = opt_factory('listen_port', self._listen_port, d, 'port', help=h)
     ol.add(o)
     
     d = 'Instead of including a file in a local webserver; include the '\
         ' result of exploiting a XSS bug within the same target site.'
     o = opt_factory('use_xss_bug', self._use_XSS_vuln, d, 'boolean')
     ol.add(o)
     
     return ol
开发者ID:ElAleyo,项目名称:w3af,代码行数:26,代码来源:rfi.py


示例8: test_invalid_data

    def test_invalid_data(self):
        input_file = os.path.join(ROOT_PATH, 'core', 'data', 'foobar',
                                  'does-not-exist.txt')
        output_file = input_file

        data = {BOOL: ['rucula'],
                INT: ['0x32'],
                POSITIVE_INT: ['-1'],
                FLOAT: ['1x2'],
                URL: ['http://', '/', ''],
                URL_LIST: ['http://moth/1 , http://moth:333333'],
                IPPORT: ['127.0.0.1'],
                IP: ['127.0.0.', '127.0.0', '3847398740'],
                REGEX: ['.*('],
                INPUT_FILE: [input_file, '/', 'base64://'],
                OUTPUT_FILE: [output_file, '/'],
                PORT: ['65536']
                }

        for _type in data:
            for fake_value in data[_type]:
                err = '%s for an option of type %s should raise an exception.'
                try:
                    opt_factory('name', fake_value, 'desc', _type)
                except BaseFrameworkException:
                    self.assertTrue(True)
                else:
                    self.assertTrue(False, err % (fake_value, _type))
开发者ID:0x554simon,项目名称:w3af,代码行数:28,代码来源:test_opt_factory.py


示例9: get_options

    def get_options(self):
        ol = super(LocalFileReadTemplate, self).get_options()
        
        d = 'Payload used to detect the vulnerability (i.e. ../../etc/passwd)'
        o = opt_factory('payload', self.payload, d, 'string')
        ol.add(o)

        d = 'File pattern used to detect the vulnerability (i.e. root:x:0:0:)'
        o = opt_factory('file_pattern', self.file_pattern, d, 'string')
        ol.add(o)
        
        return ol
开发者ID:3rdDegree,项目名称:w3af,代码行数:12,代码来源:local_file_read_template.py


示例10: get_options

    def get_options(self):
        ol = super(OSCommandingTemplate, self).get_options()
        
        d = 'Command separator used for injecting commands. Usually one of'\
            '&, |, &&, || or ; .'
        o = opt_factory('separator', self.separator, d, 'string')
        ol.add(o)

        d = 'Remote operating system (linux or windows).'
        o = opt_factory('operating_system', self.operating_system, d, 'string')
        ol.add(o)
        
        return ol
开发者ID:0x554simon,项目名称:w3af,代码行数:13,代码来源:os_commanding_template.py


示例11: get_options

    def get_options(self):
        opt_lst = super(FileUploadTemplate, self).get_options()
        
        d = 'Comma separated list of variable names of type "file"'
        o = opt_factory('file_vars', self.file_vars, d, 'list')
        opt_lst.add(o)

        d = 'URL for the directory where the file is stored on the remote'\
            ' server after the POST that uploads it.'
        o = opt_factory('file_dest', self.file_dest, d, 'url')
        opt_lst.add(o)

        return opt_lst
开发者ID:3rdDegree,项目名称:w3af,代码行数:13,代码来源:file_upload_template.py


示例12: get_options

    def get_options(self):
        """
        :return: A list of option objects for this plugin.
        """
        ol = OptionList()
        d1 = 'Destination http port number to analize'
        o1 = opt_factory('httpPort', self._http_port, d1, INT, help=d1)
        ol.add(o1)

        d2 = 'Destination httpS port number to analize'
        o2 = opt_factory('httpsPort', self._https_port, d2, INT, help=d2)
        ol.add(o2)

        return ol
开发者ID:everping,项目名称:w3af,代码行数:14,代码来源:http_vs_https_dist.py


示例13: get_options

    def get_options(self):
        """
        :return: A list of option objects for this plugin.
        """
        ol = OptionList()

        d = 'Enables verbose output for the console'
        o = opt_factory('verbose', self.verbose, d, BOOL)
        ol.add(o)

        d = 'Enable output coloring'
        o = opt_factory('use_colors', self.use_colors, d, BOOL)
        ol.add(o)

        return ol
开发者ID:foobarmonk,项目名称:w3af,代码行数:15,代码来源:console.py


示例14: get_options

    def get_options(self):
        """
        :return: A list of option objects for this plugin.
        """
        ol = OptionList()

        d = 'IP address that the spider_man proxy will use to receive requests'
        o = opt_factory('listen_address', self._listen_address, d, 'string')
        ol.add(o)

        d = 'Port that the spider_man HTTP proxy server will use to receive requests'
        o = opt_factory('listen_port', self._listen_port, d, 'integer')
        ol.add(o)

        return ol
开发者ID:3rdDegree,项目名称:w3af,代码行数:15,代码来源:spider_man.py


示例15: get_options

    def get_options(self):
        """
        :return: A list of option objects for this plugin.
        """
        ol = OptionList()

        d = 'Wordlist to use in the manifest file name bruteforcing process.'
        o = opt_factory('wordlist', self._wordlist, d, 'string')
        ol.add(o)

        d = 'File extensions to use when brute forcing Gears Manifest files'
        o = opt_factory('manifestExtensions', self._extensions, d, 'list')
        ol.add(o)

        return ol
开发者ID:ElAleyo,项目名称:w3af,代码行数:15,代码来源:ria_enumerator.py


示例16: get_options

    def get_options(self):
        """
        :return: A list of option objects for this plugin.
        """
        ol = OptionList()

        d = 'File name where this plugin will write to'
        o = opt_factory('output_file', self._output_file_name, d, OUTPUT_FILE)
        ol.add(o)

        d = 'True if debug information will be appended to the report.'
        o = opt_factory('verbose', self._verbose, d, 'boolean')
        ol.add(o)

        return ol
开发者ID:ElAleyo,项目名称:w3af,代码行数:15,代码来源:html_file.py


示例17: test_root_path_variable_init

    def test_root_path_variable_init(self):
        opt = opt_factory('name', self.SHORT_INPUT_FILE, 'desc', INPUT_FILE,
                          'help', 'tab1')

        self.assertEqual(opt.get_value_for_profile(), self.SHORT_INPUT_FILE)
        self.assertEqual(opt.get_value_str(), self.INPUT_FILE)
        self.assertEqual(opt._value, self.INPUT_FILE)
开发者ID:0x554simon,项目名称:w3af,代码行数:7,代码来源:test_opt_factory.py


示例18: test_factory_already_converted_type

    def test_factory_already_converted_type(self):
        data = {BOOL: (True, True),
                INT: (1, 1),
                FLOAT: (1.0, 1.0),
                STRING: ('hello world', 'hello world'),
                URL: (URL_KLASS('http://moth/'), URL_KLASS('http://moth/')),
                URL_LIST: ([URL_KLASS('http://moth/1'),
                            URL_KLASS('http://moth/2')],
                           [URL_KLASS('http://moth/1'),
                            URL_KLASS('http://moth/2')]),
                LIST: (['a', 'b', 'c'], ['a', 'b', 'c']),
                PORT: (12345, 12345)
                }

        for _type, (user_value, parsed_value) in data.iteritems():
            opt = opt_factory('name', user_value, 'desc', _type)

            self.assertEqual(opt.get_name(), 'name')
            self.assertEqual(opt.get_desc(), 'desc')
            self.assertEqual(opt.get_type(), _type)
            self.assertEqual(opt.get_default_value(), parsed_value)
            self.assertEqual(opt.get_value(), parsed_value)

            self.assertIsInstance(opt.get_name(), basestring)
            self.assertIsInstance(opt.get_desc(), basestring)
            self.assertIsInstance(opt.get_type(), basestring)
            self.assertIsInstance(opt.get_help(), basestring)
开发者ID:0x554simon,项目名称:w3af,代码行数:27,代码来源:test_opt_factory.py


示例19: test_factory_already_converted_type

    def test_factory_already_converted_type(self):
        data = {
            BOOL: (True, True),
            INT: (1, 1),
            FLOAT: (1.0, 1.0),
            STRING: ("hello world", "hello world"),
            URL: (URL_KLASS("http://moth/"), URL_KLASS("http://moth/")),
            URL_LIST: (
                [URL_KLASS("http://moth/1"), URL_KLASS("http://moth/2")],
                [URL_KLASS("http://moth/1"), URL_KLASS("http://moth/2")],
            ),
            LIST: (["a", "b", "c"], ["a", "b", "c"]),
            PORT: (12345, 12345),
        }

        for _type, (user_value, parsed_value) in data.iteritems():
            opt = opt_factory("name", user_value, "desc", _type)

            self.assertEqual(opt.get_name(), "name")
            self.assertEqual(opt.get_desc(), "desc")
            self.assertEqual(opt.get_type(), _type)
            self.assertEqual(opt.get_default_value(), parsed_value)
            self.assertEqual(opt.get_value(), parsed_value)

            self.assertIsInstance(opt.get_name(), basestring)
            self.assertIsInstance(opt.get_desc(), basestring)
            self.assertIsInstance(opt.get_type(), basestring)
            self.assertIsInstance(opt.get_help(), basestring)
开发者ID:cathartic,项目名称:w3af,代码行数:28,代码来源:test_opt_factory.py


示例20: test_no_duplicate_vuln_reports

    def test_no_duplicate_vuln_reports(self):
        # The xml_file plugin had a bug where vulnerabilities were written to
        # disk multiple times, this test makes sure I fixed that vulnerability

        # First we create one vulnerability in the KB
        self.kb.cleanup()
        desc = 'Just a test for the XML file output plugin.'
        v = Vuln('SQL injection', desc, severity.HIGH, 1, 'sqli')
        self.kb.append('sqli', 'sqli', v)

        self.assertEqual(len(self.kb.get_all_vulns()), 1)

        # Setup the plugin
        plugin_instance = xml_file()

        # Set the output file for the unittest
        ol = OptionList()
        d = 'Output file name where to write the XML data'
        o = opt_factory('output_file', self.FILENAME, d, OUTPUT_FILE)
        ol.add(o)

        # Then we flush() twice to disk, this reproduced the issue
        plugin_instance.set_options(ol)
        plugin_instance.flush()
        plugin_instance.flush()
        plugin_instance.flush()

        # Now we parse the vulnerabilities from disk and confirm only one
        # is there
        file_vulns = self._from_xml_get_vulns(self.FILENAME)
        self.assertEqual(len(file_vulns), 1, file_vulns)
开发者ID:everping,项目名称:w3af,代码行数:31,代码来源:test_xml_file.py



注:本文中的w3af.core.data.options.opt_factory.opt_factory函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sgml.SGMLParser类代码示例发布时间:2022-05-26
下一篇:
Python encoding.smart_unicode函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap