-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile_loader.py
More file actions
37 lines (26 loc) · 1015 Bytes
/
profile_loader.py
File metadata and controls
37 lines (26 loc) · 1015 Bytes
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
37
import json
import os
DEFAULT_ANALYST_PROFILE = {
"analyst": "",
"organization": "",
"classification": "",
"default_report_title": "Encoded Command Analyzer Triage Report"
}
def load_analyst_profile(profile_path="config/analyst_profile.json"):
"""
Loads default analyst/report profile settings from config/analyst_profile.json.
If the file is missing, empty, or invalid, safe defaults are returned.
"""
if not os.path.exists(profile_path):
return DEFAULT_ANALYST_PROFILE.copy()
try:
with open(profile_path, "r", encoding="utf-8") as profile_file:
profile = json.load(profile_file)
if not isinstance(profile, dict):
return DEFAULT_ANALYST_PROFILE.copy()
loaded_profile = DEFAULT_ANALYST_PROFILE.copy()
loaded_profile.update(profile)
return loaded_profile
except Exception as error:
print(f"[!] Failed to load analyst profile: {error}")
return DEFAULT_ANALYST_PROFILE.copy()