Skip to content

Commit 5642edf

Browse files
committed
fix: [stix2 import] Fixed undefined variable name when parsing ip addresses belonging to autonomous system observable objects
1 parent 408a719 commit 5642edf

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

misp_stix_converter/stix2misp/converters/stix2_observable_objects_converter.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ def _parse_email_message_observable_object(
506506

507507
def _parse_ip_addresses_belonging_to_AS(
508508
self, AS_id: str, indicator_ref: str | tuple) -> Iterator[dict]:
509-
for content in self.main_parser._observable.values():
509+
for observable_id, content in self.main_parser._observable.items():
510510
observable = content['observable']
511511
if observable.type not in ('ipv4-addr', 'ipv6-addr'):
512512
continue
@@ -520,9 +520,14 @@ def _parse_ip_addresses_belonging_to_AS(
520520
**self._mapping.subnet_announced_attribute()
521521
}
522522
if to_ids:
523-
object_id = f"{' - '.join(indicator_id)} - {object_id}"
523+
object_id = f"{' - '.join(indicator_id)} - {observable_id}"
524+
attribute['uuid'] = self.main_parser._create_v5_uuid(
525+
f'{object_id} - subnet-announced - {observable.value}'
526+
)
527+
yield attribute
528+
continue
524529
attribute['uuid'] = self.main_parser._create_v5_uuid(
525-
f'{object_id} - subnet-announced - {observable.value}'
530+
f'{observable_id} - subnet-announced - {observable.value}'
526531
)
527532
yield attribute
528533

0 commit comments

Comments
 (0)