<commit_before>from stix.extensions.identity.ciq_identity_3_0 import (CIQIdentity3_0Instance, STIXCIQIdentity3_0, OrganisationInfo, PartyName, Address, ElectronicAddressIdentifier, FreeTextAddress)
from stix.common import Identity

def resolveIdentityAttribute(incident, attribute):
    ciq_identity = CIQIdentity3_0Instance()
    identity_spec = STIXCIQIdentity3_0()
    if attribute["type"] == 'target-user':
            identity_spec.party_name = PartyName(person_names = [attribute["value"]])
    elif attribute["type"] == 'target-external': 
        # we don't know if target-external is a person or an organisation, so as described at http://docs.oasis-open.org/ciq/v3.0/prd03/specs/ciq-specs-v3-prd3.html#_Toc207716018, use NameLine
        identity_spec.party_name = PartyName(name_lines = ["External target: " + attribute["value"]])
    elif attribute["type"] == 'target-org':
        identity_spec.party_name = PartyName(organisation_names = [attribute["value"]])
    elif attribute["type"] == 'target-location':
        identity_spec.add_address(Address(FreeTextAddress(address_lines = [attribute["value"]])))
    elif attribute["type"] == 'target-email': 
        identity_spec.add_electronic_address_identifier(ElectronicAddressIdentifier(value = attribute["value"]))
    ciq_identity.specification = identity_spec

    ciq_identity.id_ = "example:Identity-" + attribute["uuid"]

    # is this a good idea?
    ciq_identity.name = "MISP Attribute #" + attribute["id"] + " uuid: " + attribute["uuid"]
    incident.add_victim(ciq_identity)<commit_msg>More informative CIQ titles<commit_after>from stix.extensions.identity.ciq_identity_3_0 import (CIQIdentity3_0Instance, STIXCIQIdentity3_0, OrganisationInfo, PartyName, Address, ElectronicAddressIdentifier, FreeTextAddress)
from stix.common import Identity

def resolveIdentityAttribute(incident, attribute):
    ciq_identity = CIQIdentity3_0Instance()
    identity_spec = STIXCIQIdentity3_0()
    if attribute["type"] == 'target-user':
            identity_spec.party_name = PartyName(person_names = [attribute["value"]])
    elif attribute["type"] == 'target-external': 
        # we don't know if target-external is a person or an organisation, so as described at http://docs.oasis-open.org/ciq/v3.0/prd03/specs/ciq-specs-v3-prd3.html#_Toc207716018, use NameLine
        identity_spec.party_name = PartyName(name_lines = ["External target: " + attribute["value"]])
    elif attribute["type"] == 'target-org':
        identity_spec.party_name = PartyName(organisation_names = [attribute["value"]])
    elif attribute["type"] == 'target-location':
        identity_spec.add_address(Address(FreeTextAddress(address_lines = [attribute["value"]])))
    elif attribute["type"] == 'target-email': 
        identity_spec.add_electronic_address_identifier(ElectronicAddressIdentifier(value = attribute["value"]))
    ciq_identity.specification = identity_spec

    ciq_identity.id_ = "example:Identity-" + attribute["uuid"]

    # is this a good idea?
    ciq_identity.name = attribute["type"] + ": " + attribute["value"] + " (MISP Attribute #" + attribute["id"] + ")"
    incident.add_victim(ciq_identity)
{'fraction_non_alphanumeric': 0.1265022137887413, 'fraction_numerical': 0.015812776723592662, 'mean_word_length': 5.12984496124031, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3075882', 'n_tokens_mistral': 980, 'n_tokens_neox': 933, 'n_words': 174}