'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'

def flush(self):

    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}
    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)
