'There was a problem with threads and self.kb_append_uniq which in some
cases was hiding a high risk vulnerability. The issue was like this:
* _analyze_result was called with response that contained PHP error
* LOW risk vulnerability was kb_append_uniq\'ed
* _analyze_result was called with response that contained execution
result after successful RFI, vulnerability was detected and
kb_append_uniq was called; but the vulnerability wasn\'t added to
the KB since the LOW risk vulnerability was already there for the
same (URL, param) tuple.
So now we store stuff in self._vulns analyze them after all vulns are
found and store the ones with highest risk.'

def _report_vulns(self):

    sorted_vulns = {}
    for v in self._vulns:
        data_tuple = (v.get_url(), v.get_token_name())
        if (data_tuple in sorted_vulns):
            sorted_vulns[data_tuple].append(v)
        else:
            sorted_vulns[data_tuple] = [v]
    rank = {severity.INFORMATION: 0, severity.LOW: 1, severity.MEDIUM: 2, severity.HIGH: 3}
    for (_, vulns_for_url_var) in sorted_vulns.iteritems():
        highest_severity = (-1)
        highest_severity_vuln = None
        for vuln in vulns_for_url_var:
            this_vuln_severity = rank.get(vuln.get_severity())
            if (this_vuln_severity > highest_severity):
                highest_severity_vuln = vuln
                highest_severity = this_vuln_severity
            self._vulns.remove(vuln)
        self.kb_append_uniq(self, 'rfi', highest_severity_vuln)
