Esempio n. 1
0
    def __init__(self, id, title=None, references=None):
        if not references: references = []
        tk.assertType(str, id=id)
        tk.assertType((str, None), title=title)
        tk.assertType((list, tuple, None), references=references)
        if references:
            tk.assertTypeForAllIn(str, references)

        self.id = tk.toStringFormattedCPE(id)
        self.id_2_2 = tk.toOldCPE(id)
        self.title = title if title else tk.cpeTitle(self.id)
        self.references = references and list(references) or []
Esempio n. 2
0
    def __init__(self, id, name, summary, prerequisites, solutions,
                 weaknesses):
        tk.assertType(str,
                      id=id,
                      name=name,
                      summary=summary,
                      prerequisites=prerequisites,
                      solutions=solutions)
        tk.assertType((list, tuple), weaknesses=weaknesses)
        tk.assertTypeForAllIn(str, weaknesses)

        self.id = id
        self.name = name
        self.summary = summary
        self.prerequisites = prerequisites
        self.solutions = solutions
        self.weaknesses = list(weaknesses)
Esempio n. 3
0
    def __init__(self,
                 id,
                 summary,
                 vulnerable_configuration,
                 published,
                 modified=None,
                 impact=None,
                 access=None,
                 cvss=None,
                 cwe=None,
                 references=None,
                 cvss_time=None):
        if not references: references = []
        tk.assertType(str, id=id, summary=summary)
        tk.assertType((float, str, None), cvss=cvss)
        tk.assertType(datetime, published=published)
        tk.assertType((datetime, None), modified=modified, cvss_time=cvss_time)
        tk.assertType(list,
                      vulnerable_configuration=vulnerable_configuration,
                      references=references)
        tk.assertType((Impact, None), impact=impact)
        tk.assertType((Access, None), access=access)
        tk.assertType((CWE, None), cwe=cwe)
        tk.assertTypeForAllIn(CPE, vulnerable_configuration)
        tk.assertTypeForAllIn(str, references)

        self.id = id.upper()
        self.cvss = cvss and float(cvss) or None
        self.summary = summary
        self.vulnerable_configuration = vulnerable_configuration
        self.published = published
        self.modified = modified
        self.impact = impact
        self.access = access
        self.cwe = cwe
        self.references = references
        self.cvss_time = cvss_time