Skip to content

Commit

Permalink
Use actually stable UIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
intrigus-lgtm committed Feb 20, 2024
1 parent e14916f commit 8ecbb49
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
10 changes: 8 additions & 2 deletions _calendar/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from ics import Calendar, Event
import requests
import os
import hashlib


@dataclass
Expand Down Expand Up @@ -49,7 +50,9 @@ def main():
c = Calendar()

for event in events:
e = Event()
e = Event(uid="asdasd")
e.uid = None # Explicitly remove the auto-generated uid again. Otherwise we can not distinguish between events
# that have a default uid or one that is based on the ctftime id.

if event.ctftime_id:
ctftime = ctftime_event(event.ctftime_id)
Expand All @@ -64,9 +67,12 @@ def main():
e.end = event.end or e.end
e.location = event.location or e.location
e.description = event.comment
e.uid = e.uid or f"{hash(e.name)}@kitctf.de"
e.uid = e.uid or f"{hashlib.sha256(e.name.encode()).hexdigest()}@kitctf.de"

c.events.add(e)
uids : list[str] = [e.uid for e in c.events]
assert len(uids) == len(set(uids)), "Duplicate UIDs detected" # For future me.
assert all(e.uid is not None for e in c.events), "All UIDs should be set" # For future me.

with open(os.path.dirname(os.path.realpath(__file__)) + '/../hack_harder.ics', 'w') as f:
f.writelines(c.serialize_iter())
Expand Down
18 changes: 9 additions & 9 deletions hack_harder.ics
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ SUMMARY:ENOWARS 7
UID:[email protected]
END:VEVENT
BEGIN:VEVENT
DTEND:20240505T130000Z
DTEND:20240512T130000Z
LOCATION:https://hacking-meisterschaft.de/
DTSTART:20240504T130000Z
DTSTART:20240511T130000Z
SUMMARY:CyberSecurityRumble Quals
UID:[email protected]
END:VEVENT
Expand Down Expand Up @@ -82,7 +82,13 @@ BEGIN:VEVENT
DTEND:20230930T110000Z
DTSTART:20230928T110000Z
SUMMARY:CyberSecurityRumble Finals 2023
UID:[email protected]
UID:254bc97986c9c1e17ed6c58b19067d3f291678c6cfdcbce18202b8e5e9a597ce@kitctf.de
END:VEVENT
BEGIN:VEVENT
DTEND:20230813T000000Z
DTSTART:20230810T000000Z
SUMMARY:DEF CON Finals
UID:19b82d2513f9ee43c5f8a6694c2f06524078a6ebeb8ce376e4445ac17b5a9c2f@kitctf.de
END:VEVENT
BEGIN:VEVENT
DTEND:20230817T220000Z
Expand All @@ -106,12 +112,6 @@ SUMMARY:FAUST CTF 2023
UID:[email protected]
END:VEVENT
BEGIN:VEVENT
DTEND:20230813T000000Z
DTSTART:20230810T000000Z
SUMMARY:DEF CON Finals
UID:[email protected]
END:VEVENT
BEGIN:VEVENT
DTEND:20231029T120000Z
LOCATION:https://platypwn.ctf.platypwnies.de/
DTSTART:20231028T120000Z
Expand Down

0 comments on commit 8ecbb49

Please sign in to comment.