Exemple #1
0
    def setUp(self):
        self.db = DatabaseLayer(_db="cvedb_test")
        self.capec1 = CAPEC(id="10000",
                            name="test_capec",
                            summary="no summary",
                            prerequisites="No prerequisites",
                            solutions="There's no solution",
                            weaknesses=["10000"])
        self.cwe1 = CWE(id="10000",
                        name="test_cwe",
                        description="test cwe",
                        status="testing",
                        weakness='Testing')
        self.cpe1 = CPE(id="cpe:/a:test:test1",
                        title="Test CPE 1",
                        references=[])
        self.cpe2 = CPE(id="cpe:2.3:a:test:test2",
                        title="Test CPE 2",
                        references=[])
        self.cve1 = CVE(id="CVE-0001-0001",
                        cvss=0.1,
                        summary="Test Vulnerability",
                        vulnerable_configuration=[self.cpe1, self.cpe2],
                        published=datetime.datetime(2017, 1, 1),
                        impact=Impact("None", "None", "None"),
                        access=Access("Low", "None", "Local"),
                        cwe=self.cwe1)

        self.db.CAPEC.upsert(self.capec1)
        self.db.CWE.upsert(self.cwe1)
        self.db.CPE.upsert([self.cpe1, self.cpe2])
        self.db.CVE.upsert(self.cve1)
Exemple #2
0
 def test_create_cve(self):
     CVE(id="CVE-0001-0001",
         cvss=0.1,
         summary="Test Vulnerability",
         vulnerable_configuration=[self.cpe1, self.cpe2],
         published=datetime.datetime(2017, 1, 1),
         impact=Impact("None", "None", "None"),
         access=Access("Low", "None", "Local"),
         cwe=self.cwe1)
Exemple #3
0
 def test_fail_create_cve(self):
     try:
         CVE(id="CVE-0001-0001",
             cvss=0.1,
             summary="Test Vulnerability",
             vulnerable_configuration=[self.cpe1, "cpe:/a:test:test2"],
             published=datetime.datetime(2017, 1, 1),
             impact=Impact("None", "None", "None"),
             access=Access("Low", "None", "Local"),
             cwe=self.cwe1)
     except TypeError as e:
         assert "not all the items in the list are of type CPE" == str(e)