本文整理汇总了Python中w3af.core.data.kb.knowledge_base.kb.get函数的典型用法代码示例。如果您正苦于以下问题:Python get函数的具体用法?Python get怎么用?Python get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_info_set_keep_uniq_id
def test_info_set_keep_uniq_id(self):
#
# Create a new InfoSet, load it from the KB, confirm that it has
# the same uniq_id
#
vuln = MockVuln(name='Foos')
info_set_a, created = kb.append_uniq_group('a', 'b', vuln,
group_klass=MockInfoSetNames)
self.assertTrue(created)
info_set_b = kb.get('a', 'b')[0]
self.assertEqual(info_set_a.get_uniq_id(),
info_set_b.get_uniq_id())
#
# Change the InfoSet a little bit by adding a new Info. That should
# change the uniq_id
#
vuln = MockVuln(name='Foos')
_, created = kb.append_uniq_group('a', 'b', vuln,
group_klass=MockInfoSetNames)
self.assertFalse(created)
info_set_b = kb.get('a', 'b')[0]
self.assertNotEqual(info_set_a.get_uniq_id(),
info_set_b.get_uniq_id())
示例2: test_pickleable_vuln
def test_pickleable_vuln(self):
original_vuln = MockVuln()
kb.append('a', 'b', original_vuln)
unpickled_vuln = kb.get('a', 'b')[0]
self.assertEqual(original_vuln, unpickled_vuln)
示例3: test_alert_if_target_is_301_all_internal_redir
def test_alert_if_target_is_301_all_internal_redir(self):
"""
Tests that no info is created if the site redirects internally
"""
core = w3afCore()
httpretty.register_uri(httpretty.GET,
re.compile("w3af.com/(.*)"),
body='301',
status=301,
adding_headers={'Location': 'http://w3af.com/xyz'})
target = core.target.get_options()
target['target'].set_value('http://w3af.com/')
core.target.set_options(target)
core.plugins.set_plugins(['sqli'], 'audit')
core.plugins.init_plugins()
core.verify_environment()
core.scan_start_hook()
strategy = CoreStrategy(core)
strategy.start()
infos = kb.get('core', 'core')
self.assertEqual(len(infos), 0, infos)
示例4: test_pickleable_info
def test_pickleable_info(self):
original_info = MockInfo()
kb.append('a', 'b', original_info)
unpickled_info = kb.get('a', 'b')[0]
self.assertEqual(original_info, unpickled_info)
示例5: test_return_all_for_plugin
def test_return_all_for_plugin(self):
i1 = MockInfo()
i2 = MockInfo()
i3 = MockInfo()
kb.append('a', 'b', i1)
kb.append('a', 'b', i2)
kb.append('a', 'b', i3)
self.assertEqual(kb.get('a', 'b'), [i1, i2, i3])
示例6: multi_append
def multi_append():
for i in xrange(InfoSet.MAX_INFO_INSTANCES * 2):
vuln = MockVuln()
kb.append_uniq_group('a', 'b', vuln, group_klass=MockInfoSetTrue)
info_set_list = kb.get('a', 'b')
self.assertEqual(len(info_set_list), 1)
info_set = info_set_list[0]
self.assertEqual(len(info_set.infos), InfoSet.MAX_INFO_INSTANCES)
return True
示例7: test_append
def test_append(self):
i1 = MockInfo()
i2 = MockInfo()
i3 = MockInfo()
kb.append('a', 'b', i1)
kb.append('a', 'b', i1)
kb.append('a', 'b', i1)
kb.append('a', 'b', i2)
kb.append('a', 'b', i3)
self.assertEqual(kb.get('a', 'b'), [i1, i1, i1, i2, i3])
示例8: test_append_uniq_var_bug_10Dec2012
def test_append_uniq_var_bug_10Dec2012(self):
i1 = MockInfo()
i1.set_uri(URL('http://moth/abc.html'))
i1.set_var('id')
i2 = MockInfo()
i2.set_uri(URL('http://moth/abc.html'))
i2.set_var('id')
kb.append_uniq('a', 'b', i1)
kb.append_uniq('a', 'b', i2)
self.assertEqual(kb.get('a', 'b'), [i1, ])
示例9: test_append_uniq_var_default
def test_append_uniq_var_default(self):
i1 = MockInfo()
i1.set_uri(URL('http://moth/abc.html?id=1'))
i1.set_dc(QueryString([('id', ['1'])]))
i1.set_token(('id', 0))
i2 = MockInfo()
i2.set_uri(URL('http://moth/abc.html?id=3'))
i2.set_dc(QueryString([('id', ['3'])]))
i2.set_token(('id', 0))
kb.append_uniq('a', 'b', i1)
kb.append_uniq('a', 'b', i2)
self.assertEqual(kb.get('a', 'b'), [i1, ])
示例10: test_save_append
def test_save_append(self):
"""
Although calling raw_write and then append is highly discouraged,
someone would want to use it.
"""
i0 = MockInfo()
self.assertRaises(TypeError, kb.raw_write, 'a', 'b', i0)
i1 = MockInfo()
i2 = MockInfo()
kb.append('a', 'b', i1)
kb.append('a', 'b', i2)
self.assertEqual(kb.get('a', 'b'), [i1, i2])
示例11: test_append_uniq_url_different
def test_append_uniq_url_different(self):
i1 = MockInfo()
i1.set_uri(URL('http://moth/abc.html?id=1'))
i1.set_dc(QueryString([('id', ['1'])]))
i1.set_token(('id', 0))
i2 = MockInfo()
i2.set_uri(URL('http://moth/def.html?id=3'))
i2.set_dc(QueryString([('id', ['3'])]))
i2.set_token(('id', 0))
kb.append_uniq('a', 'b', i1, filter_by='URL')
kb.append_uniq('a', 'b', i2, filter_by='URL')
self.assertEqual(kb.get('a', 'b'), [i1, i2])
示例12: test_append_uniq_url_uniq
def test_append_uniq_url_uniq(self):
i1 = MockInfo()
i1.set_uri(URL('http://moth/abc.html?id=1'))
i1.set_dc(QueryString([('id', '1')]))
i1.set_var('id')
i2 = MockInfo()
i2.set_uri(URL('http://moth/abc.html?id=3'))
i2.set_dc(QueryString([('id', '3')]))
i2.set_var('id')
kb.append_uniq('a', 'b', i1, filter_by='URL')
kb.append_uniq('a', 'b', i2, filter_by='URL')
self.assertEqual(kb.get('a', 'b'), [i1,])
示例13: test_store_in_kb
def test_store_in_kb(self):
dt = DAVTemplate()
dt.store_in_kb()
stored_data = kb.get(*dt.get_kb_location())
self.assertEqual(len(stored_data), 1)
stored_vuln = stored_data[0]
created_vuln = dt.create_vuln()
stored_vuln.set_id(created_vuln.get_id())
self.assertEqual(stored_vuln, created_vuln)
示例14: test_pickleable_shells
def test_pickleable_shells(self):
pool = Pool(1)
xurllib = ExtendedUrllib()
original_shell = Shell(MockVuln(), xurllib, pool)
kb.append('a', 'b', original_shell)
unpickled_shell = kb.get('a', 'b')[0]
self.assertEqual(original_shell, unpickled_shell)
self.assertEqual(unpickled_shell.worker_pool, None)
self.assertEqual(unpickled_shell._uri_opener, None)
pool.terminate()
pool.join()
xurllib.end()
示例15: test_append_uniq_var_not_uniq_diff_token_name
def test_append_uniq_var_not_uniq_diff_token_name(self):
i1 = MockInfo()
i1.set_uri(URL('http://moth/abc.html?id=1&foo=bar'))
i1.set_dc(QueryString([('id', ['1']),
('foo', ['bar'])]))
i1.set_token(('id', 0))
i2 = MockInfo()
i2.set_uri(URL('http://moth/abc.html?id=1&foo=bar'))
i2.set_dc(QueryString([('id', ['3']),
('foo', ['bar'])]))
i2.set_token(('foo', 0))
kb.append_uniq('a', 'b', i1)
kb.append_uniq('a', 'b', i2)
self.assertEqual(kb.get('a', 'b'), [i1, i2])