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

Fix import failure of threat-profile overrides #96

Merged
merged 2 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
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
21 changes: 20 additions & 1 deletion exporting/special_treatment_objects.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from utils import debug_log


def handle_fields(obj):
if obj["type"] == "threat-profile":
new_items = {}
Expand All @@ -11,7 +14,23 @@ def handle_fields(obj):
for index in range(len(obj[key])):
for sub_index in range(len(obj[key][index]["values"])):
new_items[new_key].append({"category": obj[key][index]["name"],
"name": obj[key][index]["values"][sub_index]["name"]})
"name": obj[key][index]["values"][sub_index]["name"]})

if key == "overrides":
new_overrides = []
for override in obj[key]:
protection = override["protection"]
override_obj = override["override"]

new_override = {"protection": protection}
for k, v in override_obj.items():
new_override[k] = v

new_overrides.append(new_override)

obj[key] = new_overrides

debug_log(f"threat profile overrides: {obj[key]}")
for key in old_keys:
obj.pop(key)
for new_key, new_item in new_items.items():
Expand Down
2 changes: 1 addition & 1 deletion import_export_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_version(client):
if sys.version_info < (3, 7):
raise Exception("Min Python version required is 3.7")

arg_parser = argparse.ArgumentParser(description="R80.X Policy Package Export/Import Tool, V6")
arg_parser = argparse.ArgumentParser(description="R80.X Policy Package Export/Import Tool, V6.1.0")
args = process_arguments(arg_parser)
if args.force:
args.unsafe_auto_accept = True
Expand Down
Loading