本文整理汇总了Python中w3af.core.data.db.disk_list.DiskList.clear方法的典型用法代码示例。如果您正苦于以下问题:Python DiskList.clear方法的具体用法?Python DiskList.clear怎么用?Python DiskList.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类w3af.core.data.db.disk_list.DiskList
的用法示例。
在下文中一共展示了DiskList.clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_clear
# 需要导入模块: from w3af.core.data.db.disk_list import DiskList [as 别名]
# 或者: from w3af.core.data.db.disk_list.DiskList import clear [as 别名]
def test_clear(self):
dl = DiskList()
dl.append('a')
dl.append('b')
self.assertEqual(len(dl), 2)
dl.clear()
self.assertEqual(len(dl), 0)
示例2: html_file
# 需要导入模块: from w3af.core.data.db.disk_list import DiskList [as 别名]
# 或者: from w3af.core.data.db.disk_list.DiskList import clear [as 别名]
#.........这里部分代码省略.........
o = opt_factory('template', self._template, d, INPUT_FILE)
ol.add(o)
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
def log_enabled_plugins(self, plugins_dict, options_dict):
"""
This method is called from the output manager object. This method
should take an action for the enabled plugins and their configuration.
Usually, write the info to a file or print it somewhere.
:param plugins_dict: A dict with all the plugin types and the
enabled plugins for that type of plugin.
:param options_dict: A dict with the options for every plugin.
"""
self._enabled_plugins = {}
# TODO: Improve so it contains the plugin configuration too
for plugin_type, enabled in plugins_dict.iteritems():
self._enabled_plugins[plugin_type] = enabled
def end(self):
try:
self.flush()
finally:
self._additional_info.clear()
self._enabled_plugins = {}
def flush(self):
"""
This method is called when we want to write the data to the html,
performs these main tasks:
* Get the target URLs
* Get the enabled plugins
* Get the vulnerabilities and infos from the KB
* Get the debug data
* Send all the data to jinja2 for rendering the template
"""
target_urls = [t.url_string for t in cf.cf.get('targets')]
target_domain = cf.cf.get('target_domains')[0]
enabled_plugins = self._enabled_plugins
findings = kb.kb.get_all_findings()
debug_log = ((t, l, smart_unicode(m)) for (t, l, m) in self._additional_info)
known_urls = kb.kb.get_all_known_urls()
context = {'target_urls': target_urls,
'target_domain': target_domain,
'enabled_plugins': enabled_plugins,
'findings': findings,
'debug_log': debug_log,
'known_urls': known_urls}
# The file was verified to exist when setting the plugin configuration
template_fh = file(os.path.expanduser(self._template), 'r')
output_fh = file(os.path.expanduser(self._output_file_name), 'w')
self._render_html_file(template_fh, context, output_fh)