Skip to content

Commit

Permalink
fix: [misp_stix_converter] Handling cases where url or authentication…
Browse files Browse the repository at this point in the history
… key is not provided to connect to MISP
  • Loading branch information
chrisr3d committed Jul 19, 2024
1 parent d8650f8 commit 85c2fe7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion misp_stix_converter/misp_stix_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ def _stix_to_misp(args):
if args.url is not None and args.api_key is not None:
misp = PyMISP(args.url, args.api_key, not args.skip_ssl)
return _process_stix_to_misp_instance(misp, args)
if args.config is not None:
elif args.config is not None:
try:
with open(args.config, 'rt', encoding='utf-8') as f:
config = json.load(f)
Expand All @@ -1085,6 +1085,8 @@ def _stix_to_misp(args):
return _process_stix_to_misp_instance(misp, args)
except (FileNotFoundError, KeyError, json.JSONDecodeError):
msg = 'Unable to read configuration file to connect to MISP -'
else:
msg = 'Missing URL or API key to connect to MISP instance -'
except PyMISPError as error:
msg = f'Unable to connect to MISP instance ({error}) -'
print(f'{msg} Saving MISP results into files instead.')
Expand Down

0 comments on commit 85c2fe7

Please sign in to comment.