Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Connectors] Re add missing generate_id arguments #2920

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions external-import/crits/src/crits.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
OpenCTIConnectorHelper,
Report,
StixCoreRelationship,
ThreatActor,
ThreatActorGroup,
get_config_variable,
)

Expand Down Expand Up @@ -109,7 +109,7 @@ def actor_to_stix(self, crits_obj, custom_properties):
dynamic_params["created_by_ref"] = custom_properties["created_by_ref"]

return stix2.ThreatActor(
id=ThreatActor.generate_id(name=crits_obj["name"]),
id=ThreatActorGroup.generate_id(name=crits_obj["name"]),
name=crits_obj["name"],
labels=crits_obj.get("bucket_list", []),
object_marking_refs=[self.default_marking],
Expand Down
2 changes: 1 addition & 1 deletion external-import/group-ib/src/data_to_stix2.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ def __init__(

def _generate_sdo(self):
self.stix_main_object = stix2.ThreatActor(
id=pycti.ThreatActor.generate_id(self.name),
id=pycti.ThreatActorGroup.generate_id(self.name),
name=self.name,
description=self.description,
aliases=self.aliases,
Expand Down
2 changes: 1 addition & 1 deletion external-import/ransomwarelive/src/lib/ransom_conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def stix_object_generator(self, item, group_data):
# Creating Threat Actor object
threat_actor_name = item.get("group_name")
threat_actor = ThreatActor(
id=pycti.ThreatActor.generate_id(threat_actor_name),
id=pycti.ThreatActorGroup.generate_id(threat_actor_name),
name=threat_actor_name,
labels=["ransomware"],
created_by_ref=self.author.get("id"),
Expand Down
9 changes: 8 additions & 1 deletion external-import/recorded-future/src/rflib/rf_to_stix2.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,14 @@ class ThreatActor(RFStixEntity):
def create_stix_objects(self):
"""Creates STIX objects from object attributes"""
self.stix_obj = stix2.ThreatActor(
id=pycti.ThreatActor.generate_id(self.name),
id=pycti.ThreatActor.generate_id(
name=self.name,
opencti_type=(
"Threat-Actor-Individual"
if self.type == "Person"
else "Threat-Actor-Group"
),
),
name=self.name,
resource_level="individual" if self.type == "Person" else None,
created_by_ref=self.author.id,
Expand Down
4 changes: 2 additions & 2 deletions internal-enrichment/greynoise/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
OpenCTIConnectorHelper,
StixCoreRelationship,
StixSightingRelationship,
ThreatActor,
ThreatActorGroup,
Tool,
Vulnerability,
get_config_variable,
Expand Down Expand Up @@ -624,7 +624,7 @@ def _generate_stix_threat_actor_with_relationship(self, data: dict):
):
# Generate Threat Actor
stix_threat_actor = stix2.ThreatActor(
id=ThreatActor.generate_id(data["actor"]),
id=ThreatActorGroup.generate_id(data["actor"]),
name=data["actor"],
created_by_ref=self.greynoise_identity["id"],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def _send_knowledge(self, stix_objects, stix_entity, opencti_entity, report):
)
)
malware_analysis = stix2.MalwareAnalysis(
id=MalwareAnalysis.generate_id(result_name),
id=MalwareAnalysis.generate_id(result_name, "HybridAnalysis"),
product="HybridAnalysis",
result_name=result_name,
analysis_started=analysis_started,
Expand Down
4 changes: 3 additions & 1 deletion internal-enrichment/orion-malware/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,9 @@ def _process_json(
json_report.get("overview").get("submissions").get("first_date")
)
malware_analysis = stix2.MalwareAnalysis(
id=pycti.MalwareAnalysis.generate_id(analysis_result_name),
id=pycti.MalwareAnalysis.generate_id(
analysis_result_name, "Orion Malware", analysis_submitted
),
product="Orion Malware",
result_name=analysis_result_name,
created_by_ref=self.identity["standard_id"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def create_stix_objects(self):
"""Creates STIX objects from object attributes"""
self.helper.log_debug("Add Threat Actor.")
self.stix_obj = stix2.ThreatActor(
id=pycti.ThreatActor.generate_id(self.name),
id=pycti.ThreatActorGroup.generate_id(self.name),
name=self.name,
created_by_ref=self.author.id,
)
Expand Down