Skip to content

Commit

Permalink
chg: [RELEASE] Bumped version number.
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricbonhomme committed Dec 16, 2024
1 parent 5880d71 commit 23cdc05
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
32 changes: 29 additions & 3 deletions fedivuln/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,49 @@ def create_status_content(event_data: str, topic: str) -> str:
status = config.templates.get(topic, "")
match topic:
case "vulnerability":
status = status.replace("<VULNID>", event_dict["payload"]["vulnerability"])
try: # CVE
status = status.replace("<VULNID>", event_dict["cveMetadata"]["cveId"])
status = status.replace(
"<LINK>",
f"https://vulnerability.circl.lu/vuln/{event_dict['cveMetadata']['cveId']}",
)
except Exception:
pass
try: # GHSA, PySec
status = status.replace("<VULNID>", event_dict["id"])
status = status.replace(
"<LINK>", f"https://vulnerability.circl.lu/vuln/{event_dict['id']}"
)
except Exception:
pass
try: # CSAF
status = status.replace(
"<VULNID>", event_dict["document"]["tracking"]["id"]
)
status = status.replace(
"<LINK>",
f"https://vulnerability.circl.lu/vuln/{event_dict['document']['tracking']['id']}",
)
except Exception:
return ""
case "comment":
status = status.replace("<VULNID>", event_dict["payload"]["vulnerability"])
status = status.replace("<TITLE>", event_dict["payload"]["title"])
status = status.replace("<LINK>", event_dict["uri"])
case "bundle":
status = status.replace("<BUNDLETITLE>", event_dict["payload"]["name"])
status = status.replace("<LINK>", event_dict["uri"])
case _:
pass
status = status.replace("<LINK>", event_dict["uri"])
return status


# ### Streaming functions


def publish(message: str) -> None:
mastodon.status_post(message)
if message:
mastodon.status_post(message)


def listen_to_http_event_stream(url, headers=None, params=None, topic="comment"):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "FediVuln"
version = "0.6.0"
version = "0.6.1"
description = "A client to gather vulnerability-related information from the Fediverse."
authors = ["Cédric Bonhomme <[email protected]>"]
license = "GPL-3.0-or-later"
Expand Down

0 comments on commit 23cdc05

Please sign in to comment.