当前位置: 首页>>代码示例>>Python>>正文


Python FuzzableRequest.get_url方法代码示例

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


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

示例1: test_add_QsRequest

# 需要导入模块: from w3af.core.data.request.fuzzable_request import FuzzableRequest [as 别名]
# 或者: from w3af.core.data.request.fuzzable_request.FuzzableRequest import get_url [as 别名]
    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,代码行数:30,代码来源:test_disk_set.py

示例2: test_audit_plugin_timeout_threads

# 需要导入模块: from w3af.core.data.request.fuzzable_request import FuzzableRequest [as 别名]
# 或者: from w3af.core.data.request.fuzzable_request.FuzzableRequest import get_url [as 别名]
    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,代码行数:34,代码来源:test_audit_plugin.py

示例3: test_audit_plugin_timeout

# 需要导入模块: from w3af.core.data.request.fuzzable_request import FuzzableRequest [as 别名]
# 或者: from w3af.core.data.request.fuzzable_request.FuzzableRequest import get_url [as 别名]
    def test_audit_plugin_timeout(self):
        plugin_inst = self.w3af.plugins.get_plugin_inst('audit', 'sqli')

        url = URL(get_moth_http('/'))
        freq = FuzzableRequest(url)

        def delay(x, y):
            """
            According to the stopit docs it can't kill a thread running an
            atomic python function such as time.sleep() , so I have to create
            a function like this. I don't mind, since it's realistic with what
            we do in w3af anyways.
            """
            total_delay = 3.0

            for _ in xrange(100):
                time.sleep(total_delay/100)

        plugin_inst.audit = delay

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

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

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

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

            timeout_mock.return_value = mock_plugin_timeout
            plugin_inst.audit_with_copy(freq, None)

            self.assertIn(call.debug(error), om_mock.mock_calls)

        # Just to make sure we didn't affect the class attribute with our test
        self.assertEqual(plugin_inst.PLUGIN_TIMEOUT, 5 * 60)
开发者ID:BioSoundSystems,项目名称:w3af,代码行数:42,代码来源:test_audit_plugin.py

示例4: test_set_url

# 需要导入模块: from w3af.core.data.request.fuzzable_request import FuzzableRequest [as 别名]
# 或者: from w3af.core.data.request.fuzzable_request.FuzzableRequest import get_url [as 别名]
 def test_set_url(self):
     self.assertRaises(TypeError, FuzzableRequest, 'http://www.google.com/')
     
     url = URL('http://www.google.com/')
     r = FuzzableRequest(url)
     self.assertEqual(r.get_url(), url)
开发者ID:andresriancho,项目名称:w3af-kali,代码行数:8,代码来源:test_fuzzable_request.py


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