Example #1
0
    def to_cve(self, item):
        cve = CVEInfo()
        cve.src = self.NAME_CH()

        _id = item.xpath("./title")[0].text
        cve.id = re.sub(r' \(.*?\)', '', _id)
        cve.url = self.url_cve + cve.id

        _time = item.xpath("./dc_date")[0].text
        cve.time = _time.replace('T', ' ').replace('Z', ' ')

        cve.info = item.xpath("./description")[0].text
        cve.title = cve.info
        return cve
Example #2
0
    def to_cve(self, item):
        cve = CVEInfo()
        cve.src = self.NAME_CH()
        cve.id = item.xpath("./title")[0].text
        cve.url = item.xpath("./link")[0].text

        _time = item.xpath("./pubDate")[0].text
        cve.time = datetime.strptime(_time, '%a, %d %b %Y %H:%M:%S GMT')

        _desc = item.xpath("./description")[0].text
        _desc = _desc.replace('\r', '').replace('\n', '')
        cve.info = re.findall(r'Description</h3>\s*<p>(.*?)</p>', _desc,
                              re.DOTALL)[0].strip()
        cve.title = cve.info
        return cve
Example #3
0
    def to_cve(self, json_obj):
        cve = CVEInfo()
        cve.src = self.name_ch
        cve.url = self.url_cve + (json_obj.get("id") or "")
        cve.info = (json_obj.get("description")
                    or "").strip().replace("\n\n", "\n")

        seconds = json_obj.get("update_time") or 0
        localtime = time.localtime(seconds)
        cve.time = time.strftime("%Y-%m-%d %H:%M:%S", localtime)

        title = json_obj.get("title") or ""
        cve.title = re.sub(r"CVE-\d+-\d+:", "", title).strip()

        rst = re.findall(r"(CVE-\d+-\d+)", title)
        cve.id = rst[0] if rst else ""
        return cve
Example #4
0
    def to_cve(self, json_obj):
        cve = CVEInfo()
        cve.src = self.NAME_CH()
        cve.url = self.url_cve + (json_obj.get('id') or '')
        cve.info = (json_obj.get('description')
                    or '').strip().replace('\n\n', '\n')

        seconds = json_obj.get('update_time') or json_obj.get('add_time') or 0
        localtime = time.localtime(seconds)
        cve.time = time.strftime('%Y-%m-%d %H:%M:%S', localtime)

        title = json_obj.get('title') or ''
        cve.title = re.sub(r'CVE-\d+-\d+:', '', title).strip()

        rst = re.findall(r'(CVE-\d+-\d+)', title)
        cve.id = rst[0] if rst else ''
        return cve
Example #5
0
    def to_cve(self, json_obj, title):
        cve = CVEInfo()
        cve.src = self.name_ch
        cve.url = json_obj.get("permlink") or ""
        cve.info = (json_obj.get("abstract")
                    or "").strip().replace("\n\n", "\n")
        cve.title = title.strip()

        utc_time = json_obj.get("publish_time") or ""  # utc_time to datetime
        cve.time = utc_time.replace("T", " ").replace(".000Z", "")

        content = json_obj.get("content")
        rst = re.findall(r"ID(</strong>)?</td>\n<td>(.*?)</td>", content)
        if rst:
            if "<br>" in rst[0][1]:
                ids = rst[0][1].split("<br>")
            else:
                ids = rst[0][1].split(" ")
            cve.id = ", ".join(ids)
        return cve
Example #6
0
    def to_cve(self, json_obj, title):
        cve = CVEInfo()
        cve.src = self.NAME_CH()
        cve.url = json_obj.get('permlink') or ''
        cve.info = (json_obj.get('abstract')
                    or '').strip().replace('\n\n', '\n')
        cve.title = title.strip()

        utc_time = json_obj.get('publish_time') or ''  # utc_time to datetime
        cve.time = utc_time.replace('T', ' ').replace('.000Z', '')

        content = json_obj.get('content')
        rst = re.findall(r'ID(</strong>)?</td>\n<td>(.*?)</td>', content)
        if rst:
            if '<br>' in rst[0][1]:
                ids = rst[0][1].split('<br>')
            else:
                ids = rst[0][1].split(' ')
            cve.id = ', '.join(ids)
        return cve