-
Notifications
You must be signed in to change notification settings - Fork 517
/
calendar_file_mod.py
36 lines (27 loc) · 1.15 KB
/
calendar_file_mod.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License
# 2.0; you may not use this file except in compliance with the Elastic License
# 2.0.
from pathlib import Path
from . import common
from . import RtaMetadata
metadata = RtaMetadata(
uuid="44345dc0-883f-41b7-ad34-1d84cfd57129",
platforms=["macos"],
endpoint=[],
siem=[{"rule_name": "Suspicious Calendar File Modification", "rule_id": "cb71aa62-55c8-42f0-b0dd-afb0bb0b1f51"}],
techniques=["T1546"],
)
@common.requires_os(*metadata.platforms)
def main():
cal_dir = Path(f"{Path.home()}/Library/Calendars/")
cal_calendar = cal_dir.joinpath("test.calendar", "Events")
cal_calendar.mkdir(parents=True, exist_ok=True)
cal_path = str(cal_calendar.joinpath("test.ics"))
common.log(f"Executing file modification on {cal_path} to mimic suspicious calendar file modification")
common.temporary_file_helper("testing", file_name=cal_path)
# cleanup
common.remove_directory(str(cal_calendar))
common.remove_directory(str(cal_dir))
if __name__ == "__main__":
exit(main())