本文整理汇总了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)
示例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)
示例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)
示例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)