@@ -1543,6 +1543,80 @@ def _check_user_account_twitter_fields(self, misp_object, user_account, object_i
15431543 uuid5 (UUIDv4 , f'{ object_id } - user-id - { user_id .value } ' )
15441544 )
15451545
1546+ def _check_wrapped_attribute (self , attribute_uuid , object_id , relation , value ):
1547+ self .assertEqual (
1548+ attribute_uuid ,
1549+ uuid5 (UUIDv4 , f'{ object_id } - { relation } - { value } ' )
1550+ )
1551+
1552+ def _check_wrapped_attributes (self , object_id , * attributes ):
1553+ for attribute in attributes :
1554+ self ._check_wrapped_attribute (
1555+ attribute .uuid , object_id ,
1556+ attribute .object_relation , attribute .value
1557+ )
1558+
1559+ def _check_wrapped_email_object (self , misp_object , object_id , from_id , to_id , cc_id , artifact_id , file_id ):
1560+ * attributes , from_addr , from_dn , to_addr , to_dn , cc_addr , cc_dn , body = misp_object .attributes
1561+ self ._check_wrapped_attributes (object_id , * attributes )
1562+ self .assertEqual (
1563+ from_addr .uuid ,
1564+ uuid5 (UUIDv4 , f'{ object_id } - { from_id } - from - { from_addr .value } ' )
1565+ )
1566+ self .assertEqual (
1567+ from_dn .uuid ,
1568+ uuid5 (UUIDv4 , f'{ object_id } - { from_id } - from-display-name - { from_dn .value } ' )
1569+ )
1570+ self .assertEqual (
1571+ to_addr .uuid ,
1572+ uuid5 (UUIDv4 , f'{ object_id } - { to_id } - to - { to_addr .value } ' )
1573+ )
1574+ self .assertEqual (
1575+ to_dn .uuid ,
1576+ uuid5 (UUIDv4 , f'{ object_id } - { to_id } - to-display-name - { to_dn .value } ' )
1577+ )
1578+ self .assertEqual (
1579+ cc_addr .uuid ,
1580+ uuid5 (UUIDv4 , f'{ object_id } - { cc_id } - cc - { cc_addr .value } ' )
1581+ )
1582+ self .assertEqual (
1583+ cc_dn .uuid ,
1584+ uuid5 (UUIDv4 , f'{ object_id } - { cc_id } - cc-display-name - { cc_dn .value } ' )
1585+ )
1586+ self ._check_wrapped_attribute (
1587+ body .uuid , f'{ object_id } - body_multipart - 0' ,
1588+ body .object_relation , body .value
1589+ )
1590+ self .assertEqual (len (misp_object .references ), 2 )
1591+ artifact_ref , file_ref = misp_object .references
1592+ self .assertEqual (artifact_ref .referenced_uuid , artifact_id )
1593+ self .assertEqual (file_ref .referenced_uuid , file_id )
1594+ self ._assert_multiple_equal (
1595+ artifact_ref .relationship_type ,
1596+ file_ref .relationship_type ,
1597+ 'contains'
1598+ )
1599+
1600+ def _check_wrapped_network_traffic_object (self , misp_object , object_id , src_id , dst_id , * references ):
1601+ * attributes , src_ip , dst_ip = misp_object .attributes
1602+ for attribute in attributes :
1603+ self .assertEqual (
1604+ attribute .uuid ,
1605+ uuid5 (UUIDv4 , f'{ object_id } - { attribute .object_relation } - { attribute .value } ' )
1606+ )
1607+ self .assertEqual (
1608+ src_ip .uuid ,
1609+ uuid5 (UUIDv4 , f'{ object_id } - { src_id } - src_ip - { src_ip .value } ' )
1610+ )
1611+ self .assertEqual (
1612+ dst_ip .uuid ,
1613+ uuid5 (UUIDv4 , f'{ object_id } - { dst_id } - dst_ip - { dst_ip .value } ' )
1614+ )
1615+ self .assertEqual (len (misp_object .references ), len (references ))
1616+ for reference , (ref_id , relation ) in zip (misp_object .references , references ):
1617+ self .assertEqual (reference .referenced_uuid , ref_id )
1618+ self .assertEqual (reference .relationship_type , relation )
1619+
15461620 def _check_x509_fields (self , misp_object , x509 , object_id = None ):
15471621 if object_id is None :
15481622 object_id = x509 .id
0 commit comments