Skip to content

Commit 49660d4

Browse files
committed
Update zdi_importer.py
Signed-off-by: newklei <magmacicada@proton.me>
1 parent ef6dd16 commit 49660d4

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

vulnerabilities/pipelines/v2_importers/zdi_importer.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,8 @@ def collect_advisories(self) -> Iterable[AdvisoryDataV2]:
7171
def parse_rss_feed(xml_text: str) -> list:
7272
"""
7373
Parse ZDI RSS feed XML text and return a list of raw item dicts.
74-
7574
Each dict has keys: ``title``, ``link``, ``description``, ``pub_date``.
7675
Returns an empty list if the XML is malformed or has no ``<channel>`` element.
77-
78-
>>> xml = (
79-
... '<?xml version="1.0"?><rss version="2.0"><channel>'
80-
... '<item><title>ZDI-25-001: Test</title>'
81-
... '<link>http://www.zerodayinitiative.com/advisories/ZDI-25-001/</link>'
82-
... '<description>CVE-2025-12345</description>'
83-
... '<pubDate>Mon, 06 Jan 2025 00:00:00 -0600</pubDate>'
84-
... '</item></channel></rss>'
85-
... )
86-
>>> items = parse_rss_feed(xml)
87-
>>> len(items)
88-
1
89-
>>> items[0]['title']
90-
'ZDI-25-001: Test'
9176
"""
9277
try:
9378
root = ElementTree.fromstring(xml_text)
@@ -116,22 +101,9 @@ def parse_rss_feed(xml_text: str) -> list:
116101
def parse_advisory_data(item: dict):
117102
"""
118103
Parse a single ZDI RSS item dict into an AdvisoryDataV2 object.
119-
120104
Returns ``None`` if a ZDI advisory ID cannot be extracted from the link URL.
121105
The RSS feed does not carry structured package data, so ``affected_packages``
122106
is always empty.
123-
124-
>>> item = {
125-
... "title": "ZDI-25-001: Example Remote Code Execution",
126-
... "link": "http://www.zerodayinitiative.com/advisories/ZDI-25-001/",
127-
... "description": "CVSS rating of 8.8. CVE-2025-12345.",
128-
... "pub_date": "Mon, 06 Jan 2025 00:00:00 -0600",
129-
... }
130-
>>> result = parse_advisory_data(item)
131-
>>> result.advisory_id
132-
'ZDI-25-001'
133-
>>> result.aliases
134-
['CVE-2025-12345']
135107
"""
136108
link = item.get("link") or ""
137109
title = item.get("title") or ""

0 commit comments

Comments
 (0)