This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix geomodel alert and update mozdef-util (#1614)
- Loading branch information
Showing
6 changed files
with
547 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,21 @@ | ||
def dict2List(inObj): | ||
'''given a dictionary, potentially with multiple sub dictionaries | ||
return a list of the dict keys and values | ||
from datetime import datetime | ||
|
||
|
||
def dict2List(value): | ||
'''Convert dictionaries into a list of keys and values, | ||
with strings in lowercase and datetimes converted to isoformat. | ||
''' | ||
if isinstance(inObj, dict): | ||
for key, value in inObj.items(): | ||
if isinstance(value, dict): | ||
for d in dict2List(value): | ||
yield d | ||
elif isinstance(value, list): | ||
yield key.lower() | ||
for l in dict2List(value): | ||
yield l | ||
else: | ||
yield key.lower() | ||
if isinstance(value, str): | ||
yield value.lower() | ||
else: | ||
yield value | ||
elif isinstance(inObj, list): | ||
for v in inObj: | ||
if isinstance(v, str): | ||
yield v.lower() | ||
elif isinstance(v, list): | ||
for l in dict2List(v): | ||
yield l | ||
elif isinstance(v, dict): | ||
for l in dict2List(v): | ||
yield l | ||
else: | ||
yield v | ||
|
||
if isinstance(value, dict): | ||
for key, val in value.items(): | ||
yield from dict2List(key) | ||
yield from dict2List(val) | ||
elif isinstance(value, (list, tuple)): | ||
for val in value: | ||
yield from dict2List(val) | ||
elif isinstance(value, datetime): | ||
yield value.isoformat() | ||
elif isinstance(value, str): | ||
yield value.lower() | ||
else: | ||
yield '' | ||
yield value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.