'Identify server software using favicon.
:param fuzzable_request: A fuzzable_request instance that contains
(among other things) the URL to test.'

@runonce(exc_class=RunOnce)
def discover(self, fuzzable_request):

    domain_path = fuzzable_request.get_url().get_domain_path()
    favicon_url = domain_path.url_join('favicon.ico')
    response = self._uri_opener.GET(favicon_url, cache=True)
    remote_fav_md5 = hashlib.md5(response.get_body()).hexdigest()
    if (not is_404(response)):
        for (md5part, favicon_desc) in self._read_favicon_db():
            if (md5part == remote_fav_md5):
                desc = ('Favicon.ico    file    was    identified    as    "%s".' % favicon_desc)
                i = Info('Favicon    identification', desc, response.id, self.get_name())
                i.set_url(favicon_url)
                kb.kb.append(self, 'info', i)
                om.out.information(i.get_desc())
                break
        else:
            desc = 'Favicon    identification    failed.    If    the    remote    site    is    using    framework    that    is    being    exposed    by    its    favicon,    please    send    an    email    to    w3af-develop@lists.sourceforge.net    including    this    md5    hash    "%s"    and    the    name    of    the    server    or    Web    application    it    represents.    New    fingerprints    make    this    plugin    more    powerful    and        accurate.'
            desc = (desc % remote_fav_md5)
            i = Info('Favicon    identification    failed', desc, response.id, self.get_name())
            i.set_url(favicon_url)
            kb.kb.append(self, 'info', i)
            om.out.information(i.get_desc())
