Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for systemlogs #1

Merged
merged 2 commits into from
Sep 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions scripts/evtx_dump_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,42 @@ def main(evtx_file,output):
json_subline.update({event_system_subkey[1:]: event_system_subvalue})

else:
# Add information to the JSON object for this specific log
json_subline.update({event_system_key: event_system_value})

# Loop through each key, value pair of the EventData section of the evtx logs
if "EventData" in data_dict['Event'].keys() and data_dict['Event']['EventData'] != None:
for event_data_key, event_data_value in data_dict['Event']['EventData'].items():
for values in event_data_value:

# Loop through each subvalue within the EvenData section to extract necessary information
for event_data_subkey,event_data_subvalue in values.items():
# Check to see if the EventData Data contains a list
if isinstance(event_data_value,list) and event_data_key!="@Name":
for values in event_data_value:

# Loop through each subvalue within the EvenData section to extract necessary information
for event_data_subkey,event_data_subvalue in values.items():
if event_data_subkey == "@Name":
data_name = event_data_subvalue
else:
data_value = event_data_subvalue

# Add information to the JSON object for this specific log
json_subline.update({data_name: data_value})

# Check to see if EventData contains a dictionary
if isinstance(event_data_value,dict) and event_data_key!="@Name":
for event_data_subkey,event_data_subvalue in event_data_value.items():
if event_data_subkey == "@Name":
data_name = event_data_subvalue
else:
else:
data_value = event_data_subvalue

# Add information to the JSON object for this specific log
json_subline.update({data_name: data_value})

# Check to see if EventData contains a string
if isinstance(event_data_value,str) and event_data_key!="@Name":
beautify_event_data_value=event_data_value.replace("<string>","").replace("\n"," ").replace("</string>","")
json_subline.update({event_data_key: beautify_event_data_value})

# Loop through each key, value pair in UserData section, if present
if "UserData" in data_dict["Event"].keys():
Expand Down