fix: [stix2 import] Made the stix parser arguments `kwargs` as it is supported, to avoid issues with positional arguments

pull/9044/head
Christian Studer 2023-04-21 15:44:25 +02:00
parent 9fc2a954b2
commit a1b36cfb9c
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 6 additions and 3 deletions

View File

@ -41,10 +41,13 @@ def _process_stix_file(args: argparse.ArgumentParser):
)
stix_version = getattr(bundle, 'version', '2.1')
to_call = 'Internal' if _from_misp(bundle.objects) else 'External'
arguments = [args.galaxies_as_tags, args.distribution]
arguments = {
'distribution': args.distribution,
'galaxies_as_tags': args.galaxies_as_tags
}
if args.distribution == 4 and args.sharing_group_id is not None:
arguments.append(args.sharing_group_id)
parser = globals()[f'{to_call}STIX2toMISPParser'](*arguments)
arguments['sharing_group_id'] = args.sharing_group_id
parser = globals()[f'{to_call}STIX2toMISPParser'](**arguments)
parser.load_stix_bundle(bundle)
parser.parse_stix_bundle()
with open(f'{args.input}.out', 'wt', encoding='utf-8') as f: