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

Python fuzzable_request.FuzzableRequest类代码示例

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

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



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

示例1: test_export_with_dc

 def test_export_with_dc(self):
     fr = FuzzableRequest(URL("http://www.w3af.com/"))
     d = DataContainer()
     d['a'] = ['1',]
     fr.set_dc(d)
     self.assertEqual(fr.export(),
                      'GET,http://www.w3af.com/?a=1,')
开发者ID:Adastra-thw,项目名称:Tortazo,代码行数:7,代码来源:test_fuzzable_request.py


示例2: __init__

    def __init__(self, uri, method="POST", headers=Headers(), cookie=None, dc=None):

        if dc is not None and not isinstance(dc, Form):
            msg = "The dc parameter for forms needs to be a Form instance," "got %s instead." % type(dc)
            TypeError(msg)

        FuzzableRequest.__init__(self, uri, method, headers, cookie, dc)
开发者ID:johnjohnsp1,项目名称:w3af,代码行数:7,代码来源:HTTPPostDataRequest.py


示例3: test_audit_plugin_timeout_threads

    def test_audit_plugin_timeout_threads(self):
        """
        I want to make sure that when stopit kills the real audit function,
        the threads which are called from it won't do anything strange.

        The plan is to scan something large with httpretty, with delays in the
        HTTP responses to simulate a slow network and a low PLUGIN_TIMEOUT to
        make the test quicker.
        """
        plugin_inst = self.w3afcore.plugins.get_plugin_inst('audit', 'sqli')

        url = URL(self.target_url)
        freq = FuzzableRequest(url)

        orig_response = plugin_inst.get_original_response(freq)

        mod = 'w3af.core.controllers.plugins.audit_plugin.%s'

        with patch(mod % 'om.out') as om_mock,\
             patch(mod % 'AuditPlugin.PLUGIN_TIMEOUT', new_callable=PropertyMock) as timeout_mock:

            timeout_mock.return_value = 2
            plugin_inst.audit_with_copy(freq, orig_response)

            msg = '[timeout] The "%s" plugin took more than %s seconds to'\
                  ' complete the analysis of "%s", killing it!'

            error = msg % (plugin_inst.get_name(),
                           plugin_inst.PLUGIN_TIMEOUT,
                           freq.get_url())

            self.assertIn(call.debug(error), om_mock.mock_calls)
开发者ID:BioSoundSystems,项目名称:w3af,代码行数:32,代码来源:test_audit_plugin.py


示例4: test_add_QsRequest

    def test_add_QsRequest(self):
        ds = DiskSet()

        uri = URL('http://w3af.org/?id=2')
        hdr = Headers([('Referer', 'http://w3af.org/')])

        qsr1 = FuzzableRequest(uri, method='GET', headers=hdr)

        uri = URL('http://w3af.org/?id=3')
        qsr2 = FuzzableRequest(uri, method='GET', headers=hdr)

        uri = URL('http://w3af.org/?id=7')
        qsr3 = FuzzableRequest(uri, method='FOO', headers=hdr)

        ds.add(qsr1)
        ds.add(qsr2)
        ds.add(qsr2)
        ds.add(qsr1)

        self.assertEqual(ds[0], qsr1)
        self.assertEqual(ds[1], qsr2)
        self.assertFalse(qsr3 in ds)
        self.assertTrue(qsr2 in ds)
        self.assertEqual(len(ds), 2)

        # This forces an internal change in the URL object
        qsr2.get_url().url_string
        self.assertIn(qsr2, ds)
开发者ID:cathartic,项目名称:w3af,代码行数:28,代码来源:test_disk_set.py


示例5: test_variants_true_similar_params

 def test_variants_true_similar_params(self):
     # change the url by adding a querystring. shouldn't affect anything.
     url = self.url.url_join('?a=z')
     fr = FuzzableRequest(url, method='GET', dc={'a': ['1'], 'b': ['bb']})
     fr_other = FuzzableRequest(
         self.url, method='GET', dc={'a': ['2'], 'b': ['cc']})
     self.assertTrue(fr.is_variant_of(fr_other))
开发者ID:Adastra-thw,项目名称:Tortazo,代码行数:7,代码来源:test_fuzzable_request.py


示例6: test_mutant_creation

    def test_mutant_creation(self):
        qs = QueryString(self.SIMPLE_KV)
        freq = FuzzableRequest(self.url)
        freq.set_querystring(qs)

        created_mutants = FakeMutant.create_mutants(freq, self.payloads, [],
                                                    False, self.fuzzer_config)

        expected_dcs = ['a=abc&b=2', 'a=1&b=abc',
                        'a=def&b=2', 'a=1&b=def']

        created_dcs = [str(i.get_dc()) for i in created_mutants]

        self.assertEquals(expected_dcs, created_dcs)

        token_0 = created_mutants[0].get_token()
        self.assertIsInstance(token_0, DataToken)
        self.assertEqual(token_0.get_name(), 'a')
        self.assertEqual(token_0.get_original_value(), '1')
        self.assertEqual(token_0.get_value(), 'abc')

        token_2 = created_mutants[1].get_token()
        self.assertIsInstance(token_0, DataToken)
        self.assertEqual(token_2.get_name(), 'b')
        self.assertEqual(token_2.get_original_value(), '2')
        self.assertEqual(token_2.get_value(), 'abc')

        self.assertTrue(all(isinstance(m, Mutant) for m in created_mutants))
        self.assertTrue(all(m.get_mutant_class() == 'FakeMutant' for m in created_mutants))
开发者ID:0x554simon,项目名称:w3af,代码行数:29,代码来源:test_mutant.py


示例7: test_mutant_creation_repeated_params

    def test_mutant_creation_repeated_params(self):
        qs = QueryString([('a', ['1', '2']), ('b', ['3'])])
        freq = FuzzableRequest(self.url)
        freq.set_querystring(qs)

        created_mutants = FakeMutant.create_mutants(freq, self.payloads, [],
                                                    False, self.fuzzer_config)

        expected_dcs = ['a=abc&a=2&b=3',
                        'a=1&a=abc&b=3',
                        'a=1&a=2&b=abc',
                        'a=def&a=2&b=3',
                        'a=1&a=def&b=3',
                        'a=1&a=2&b=def']

        created_dcs = [str(i.get_dc()) for i in created_mutants]

        self.assertEquals(expected_dcs, created_dcs)

        token_0 = created_mutants[0].get_token()
        self.assertIsInstance(token_0, DataToken)
        self.assertEqual(token_0.get_name(), 'a')
        self.assertEqual(token_0.get_original_value(), '1')
        self.assertEqual(token_0.get_value(), 'abc')

        token_1 = created_mutants[1].get_token()
        self.assertIsInstance(token_1, DataToken)
        self.assertEqual(token_1.get_name(), 'a')
        self.assertEqual(token_1.get_original_value(), '2')
        self.assertEqual(token_1.get_value(), 'abc')
开发者ID:0x554simon,项目名称:w3af,代码行数:30,代码来源:test_mutant.py


示例8: test_find_csrf_token_false

 def test_find_csrf_token_false(self):
     url = URL('http://moth/w3af/audit/csrf/')
     query_string = parse_qs('secret=not a token')
     freq = FuzzableRequest(url, method='GET')
     freq.set_querystring(query_string)
     
     token = self.csrf_plugin._find_csrf_token(freq)
     self.assertNotIn('secret', token)
开发者ID:ElAleyo,项目名称:w3af,代码行数:8,代码来源:test_csrf.py


示例9: test_find_csrf_token_true_simple

 def test_find_csrf_token_true_simple(self):
     url = URL('http://moth/w3af/audit/csrf/')
     query_string = parse_qs('secret=f842eb01b87a8ee18868d3bf80a558f3')
     freq = FuzzableRequest(url, method='GET')
     freq.set_querystring(query_string)
     
     token = self.csrf_plugin._find_csrf_token(freq)
     self.assertIn('secret', token)
开发者ID:ElAleyo,项目名称:w3af,代码行数:8,代码来源:test_csrf.py


示例10: test_export_import_with_post_data

    def test_export_import_with_post_data(self):
        dc = KeyValueContainer(init_val=[('a', ['1'])])
        fr = FuzzableRequest(URL("http://www.w3af.com/"), post_data=dc)

        self.assertEqual(fr.to_csv(), '"GET","http://www.w3af.com/","a=1"')

        raise SkipTest('Failing because we do NOT export headers')
        imported_fr = fr.from_csv(fr.to_csv())
        self.assertEqual(imported_fr, fr)
开发者ID:andresriancho,项目名称:w3af-kali,代码行数:9,代码来源:test_fuzzable_request.py


示例11: test_sent_post_data

    def test_sent_post_data(self):
        form_params = FormParameters()
        form_params.add_field_by_attr_items([("name", "username"), ("value", """d'z"0""")])
        form_params.add_field_by_attr_items([("name", "address"), ("value", "")])

        form = dc_from_form_params(form_params)

        f = FuzzableRequest(URL('http://example.com/'), post_data=form)
        self.assertTrue(f.sent('d%5C%27z%5C%220'))
开发者ID:andresriancho,项目名称:w3af-kali,代码行数:9,代码来源:test_fuzzable_request.py


示例12: test_mutant_creation_ignore_params

    def test_mutant_creation_ignore_params(self):
        qs = QueryString(self.SIMPLE_KV)
        freq = FuzzableRequest(self.url)
        freq.set_querystring(qs)

        created_mutants = FakeMutant.create_mutants(freq, self.payloads, ['a'],
                                                    False, self.fuzzer_config)

        expected_dcs = ['a=abc&b=2', 'a=def&b=2']
        created_dcs = [str(i.get_dc()) for i in created_mutants]

        self.assertEqual(expected_dcs, created_dcs)
开发者ID:0x554simon,项目名称:w3af,代码行数:12,代码来源:test_mutant.py


示例13: test_dump_case02

 def test_dump_case02(self):
     expected = u'\r\n'.join([u'GET http://w3af.com/a/b/c.php HTTP/1.1',
                              u'Hola: Múndo',
                              u'',
                              u''])
     headers = Headers([(u'Hola', u'Múndo')])
     
     #TODO: Note that I'm passing a dc to the FuzzableRequest and it's not
     # appearing in the dump. It might be a bug...
     fr = FuzzableRequest(self.url, method='GET', dc={u'á': ['b']},
                          headers=headers)
     self.assertEqual(fr.dump(), expected)
开发者ID:Adastra-thw,项目名称:Tortazo,代码行数:12,代码来源:test_fuzzable_request.py


示例14: test_dump_case01

    def test_dump_case01(self):
        expected = '\r\n'.join(['GET http://w3af.com/a/b/c.php HTTP/1.1',
                                'Hello: World',
                                '',
                                ''])
        headers = Headers([('Hello', 'World')])

        #TODO: Note that I'm passing a dc to the FuzzableRequest and it's not
        # appearing in the dump. It might be a bug...
        fr = FuzzableRequest(self.url, method='GET', dc={'a': ['b']},
                             headers=headers)
        self.assertEqual(fr.dump(), expected)
开发者ID:Adastra-thw,项目名称:Tortazo,代码行数:12,代码来源:test_fuzzable_request.py


示例15: test_dump_case02

    def test_dump_case02(self):
        expected = u'\r\n'.join([u'GET http://w3af.com/a/b/c.php HTTP/1.1',
                                 u'Hola: Múndo',
                                 u'',
                                 u'a=b'])

        headers = Headers([(u'Hola', u'Múndo')])
        post_data = KeyValueContainer(init_val=[('a', ['b'])])
        fr = FuzzableRequest(self.url, method='GET', post_data=post_data,
                             headers=headers)

        self.assertEqual(fr.dump(), expected.encode('utf-8'))
开发者ID:andresriancho,项目名称:w3af-kali,代码行数:12,代码来源:test_fuzzable_request.py


示例16: test_basic

    def test_basic(self):
        freq = FuzzableRequest(URL('http://www.w3af.com/'))
        fake_ref = 'http://w3af.org/'

        mutant = HeadersMutant(freq.copy())
        mutant.set_var('Referer')
        original_referer = freq.get_referer()
        mutant.set_original_value(original_referer)
        mutant.set_mod_value(fake_ref)

        self.assertEqual(mutant.get_headers()['Referer'], fake_ref)
        self.assertEqual(mutant.get_original_value(), original_referer)
开发者ID:3rdDegree,项目名称:w3af,代码行数:12,代码来源:test_headers_mutants.py


示例17: test_mutant_creation_empty_dc

    def test_mutant_creation_empty_dc(self):
        qs = QueryString()
        freq = FuzzableRequest(self.url)
        freq.set_querystring(qs)

        created_mutants = FakeMutant.create_mutants(freq, self.payloads, [],
                                                    False, self.fuzzer_config)

        expected_dc_lst = []
        created_dc_lst = [i.get_dc() for i in created_mutants]

        self.assertEqual(created_dc_lst, expected_dc_lst)
开发者ID:0x554simon,项目名称:w3af,代码行数:12,代码来源:test_mutant.py


示例18: test_mutant_copy

    def test_mutant_copy(self):
        qs = QueryString(self.SIMPLE_KV)
        freq = FuzzableRequest(self.url)
        freq.set_querystring(qs)

        mutant = FakeMutant(freq)
        mutant.set_token(('a', 0))

        mutant_copy = mutant.copy()

        self.assertEqual(mutant, mutant_copy)
        self.assertEqual(mutant.get_token(), mutant_copy.get_token())
        self.assertIsNot(None, mutant_copy.get_token())
开发者ID:0x554simon,项目名称:w3af,代码行数:13,代码来源:test_mutant.py


示例19: test_basic

    def test_basic(self):
        referer_1 = 'http://w3af.org/'
        referer_2 = 'http://spam.w3af.org/'

        freq = FuzzableRequest(URL('http://www.w3af.com/'),
                               headers=Headers([('Referer', referer_1)]))
        self.assertEqual(freq.get_referer(), referer_1)

        m = HeadersMutant(freq)
        m.get_dc().set_token(('Referer',))
        m.set_token_value(referer_2)

        self.assertEqual(m.get_token_value(), referer_2)
开发者ID:Daisymei,项目名称:w3af,代码行数:13,代码来源:test_headers_mutants.py


示例20: test_mutant_creation_append

    def test_mutant_creation_append(self):
        qs = QueryString(self.SIMPLE_KV)
        freq = FuzzableRequest(self.url)
        freq.set_querystring(qs)

        created_mutants = FakeMutant.create_mutants(freq, self.payloads, [],
                                                    True, self.fuzzer_config)

        expected_dcs = ['a=1abc&b=2', 'a=1&b=2abc',
                        'a=1def&b=2', 'a=1&b=2def',]

        created_dcs = [str(i.get_dc()) for i in created_mutants]

        self.assertEquals(expected_dcs, created_dcs)
开发者ID:0x554simon,项目名称:w3af,代码行数:14,代码来源:test_mutant.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python HTTPResponse.HTTPResponse类代码示例发布时间:2022-05-26
下一篇:
Python form_params.FormParameters类代码示例发布时间: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