Mercurial > farol > farolluz
view tests/testParseCVE.py @ 46:1b7f3f4f1238
Add the possibility to batch-import trees
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Tue, 30 Dec 2014 12:28:06 +0100 |
parents | b87f2a6e613a |
children | 6c320c3f3176 |
line wrap: on
line source
import utils from farolluz.parsers.cve import parse FULL_CVE = """\ <entry xmlns:scap-core="http://scap.nist.gov/schema/scap-core/0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:patch="http://scap.nist.gov/schema/patch/0.1" xmlns:vuln="http://scap.nist.gov/schema/vulnerability/0.4" xmlns:cvss="http://scap.nist.gov/schema/cvss-v2/0.2" xmlns:cpe-lang="http://cpe.mitre.org/language/2.0" xmlns="http://scap.nist.gov/schema/feed/vulnerability/2.0" id="CVE-2014-7088"> <vuln:vulnerable-configuration id="http://nvd.nist.gov/"> <cpe-lang:logical-test operator="OR" negate="false"> <cpe-lang:fact-ref name="cpe:/a:jdm_lifestyle_project:jdm_lifestyle:6.4::~~~android~~"/> </cpe-lang:logical-test> </vuln:vulnerable-configuration> <vuln:vulnerable-software-list> <vuln:product> cpe:/a:jdm_lifestyle_project:jdm_lifestyle:6.4::~~~android~~ </vuln:product> </vuln:vulnerable-software-list> <vuln:cve-id>CVE-2014-7088</vuln:cve-id> <vuln:published-datetime>2014-10-18T21:55:17.027-04:00</vuln:published-datetime> <vuln:last-modified-datetime>2014-11-14T09:07:51.650-05:00</vuln:last-modified-datetime> <vuln:cvss> <cvss:base_metrics> <cvss:score>5.4</cvss:score> <cvss:access-vector>ADJACENT_NETWORK</cvss:access-vector> <cvss:access-complexity>MEDIUM</cvss:access-complexity> <cvss:authentication>NONE</cvss:authentication> <cvss:confidentiality-impact>PARTIAL</cvss:confidentiality-impact> <cvss:integrity-impact>PARTIAL</cvss:integrity-impact> <cvss:availability-impact>PARTIAL</cvss:availability-impact> <cvss:source>http://nvd.nist.gov</cvss:source> <cvss:generated-on-datetime>2014-11-14T09:07:51.290-05:00</cvss:generated-on-datetime> </cvss:base_metrics> </vuln:cvss> <vuln:cwe id="CWE-310"/> <vuln:references reference_type="UNKNOWN" xml:lang="en"> <vuln:source>CERT-VN</vuln:source> <vuln:reference href="http://www.kb.cert.org/vuls/id/582497" xml:lang="en">VU#582497</vuln:reference> </vuln:references> <vuln:references reference_type="UNKNOWN" xml:lang="en"> <vuln:source>MISC</vuln:source> <vuln:reference href="https://docs.google.com/spreadsheets/d/1t5GXwjw82SyunALVJb2w0zi3FoLRIkfGPc7AMjRF0r4/edit?usp=sharing" xml:lang="en"> https://docs.google.com/spreadsheets/d/1t5GXwjw82SyunALVJb2w0zi3FoLRIkfGPc7AMjRF0r4/edit?usp=sharing </vuln:reference> </vuln:references> <vuln:summary> The JDM Lifestyle (aka com.hondatech) application 6.4 for Android does not verify X.509 certificates from SSL servers, which allows man-in-the-middle attackers to spoof servers and obtain sensitive information via a crafted certificate. </vuln:summary> </entry>""" CVE_NO_CVSS = """\ <entry xmlns:scap-core="http://scap.nist.gov/schema/scap-core/0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:patch="http://scap.nist.gov/schema/patch/0.1" xmlns:vuln="http://scap.nist.gov/schema/vulnerability/0.4" xmlns:cvss="http://scap.nist.gov/schema/cvss-v2/0.2" xmlns:cpe-lang="http://cpe.mitre.org/language/2.0" xmlns="http://scap.nist.gov/schema/feed/vulnerability/2.0" id="CVE-2014-9388"> <vuln:cve-id>CVE-2014-9388</vuln:cve-id> <vuln:published-datetime>2014-12-17T14:59:08.587-05:00</vuln:published-datetime> <vuln:last-modified-datetime>2014-12-17T14:59:09.620-05:00</vuln:last-modified-datetime> <vuln:references reference_type="UNKNOWN" xml:lang="en"> <vuln:source>CONFIRM</vuln:source> <vuln:reference href="https://www.mantisbt.org/bugs/view.php?id=17878" xml:lang="en">https://www.mantisbt.org/bugs/view.php?id=17878</vuln:reference> </vuln:references> <vuln:references reference_type="UNKNOWN" xml:lang="en"> <vuln:source>CONFIRM</vuln:source> <vuln:reference href="https://www.mantisbt.org/bugs/changelog_page.php?version_id=191" xml:lang="en"> https://www.mantisbt.org/bugs/changelog_page.php?version_id=191 </vuln:reference> </vuln:references> <vuln:references reference_type="UNKNOWN" xml:lang="en"> <vuln:source>MLIST</vuln:source> <vuln:reference href="http://seclists.org/oss-sec/2014/q4/955" xml:lang="en">[oss-security] 20141207 MantisBT 1.2.18 Released</vuln:reference> </vuln:references> <vuln:summary> bug_report.php in MantisBT before 1.2.18 allows remote attackers to assign arbitrary issues via the handler_id parameter. </vuln:summary> </entry>""" class testCVEParsing(utils.TestCase): def test_Full(self): self.doc = parse(FULL_CVE) self._validate() def test_no_CVSS(self): self.doc = parse(CVE_NO_CVSS) self._validate()