A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
fix(transforms): missing imports + remove empty lines
dextmorgnd8bf5287d094
diff --git a/flowsint-transforms/src/flowsint_transforms/organization/to_asn.py b/flowsint-transforms/src/flowsint_transforms/organization/to_asn.pyindex b1eb8986..ca7d36be 100644--- a/flowsint-transforms/src/flowsint_transforms/organization/to_asn.py+++ b/flowsint-transforms/src/flowsint_transforms/organization/to_asn.py@@ -112,17 +112,13 @@ class OrgToAsnTransform(Transform):# Skip if no valid ASN was foundif result_asn.number == 0:continue-if self.neo4j_conn:# Create organization nodeself.create_node(input_org)-# Create ASN nodeself.create_node(result_asn)-# Create relationshipself.create_relationship(input_org, result_asn, "BELONGS_TO")-self.log_graph_message(f"Found for {input_org.name} -> ASN {result_asn.number}")diff --git a/flowsint-transforms/src/flowsint_transforms/organization/to_infos.py b/flowsint-transforms/src/flowsint_transforms/organization/to_infos.pyindex a216aa05..4d2a31a3 100644--- a/flowsint-transforms/src/flowsint_transforms/organization/to_infos.py+++ b/flowsint-transforms/src/flowsint_transforms/organization/to_infos.py@@ -1,6 +1,8 @@from typing import List, Dict, Any, Unionfrom flowsint_core.core.transform_base import Transformfrom flowsint_types.organization import Organization+from flowsint_types.address import Location+from flowsint_types.individual import Individualfrom flowsint_core.core.logger import Loggerfrom tools.organizations.sirene import SireneTool@@ -50,8 +52,6 @@ class OrgToInfosTransform(Transform):# Create Location for siege_geo_adresse if coordinates existsiege_geo_adresse = Noneif siege.get("latitude") and siege.get("longitude"):- from flowsint_types.address import Location-siege_geo_adresse = Location(address=siege.get("adresse", ""),city=siege.get("libelle_commune", ""),@@ -64,8 +64,6 @@ class OrgToInfosTransform(Transform):# Extract dirigeants and convert to Individual objectsdirigeants = []for dirigeant_data in company.get("dirigeants", []):- from flowsint_types.individual import Individual-dirigeant = Individual(first_name=dirigeant_data.get("prenoms", ""),last_name=dirigeant_data.get("nom", ""),@@ -251,58 +249,31 @@ class OrgToInfosTransform(Transform):return resultsfor org in results:- # Create or update the organization node with all SIRENE properties- org_key = f"{org.name}_FR"+ # Create or update the organization node (nested objects are automatically skipped)self.create_node(org)if org.siren:- self.log_graph_message(f"{org.name}: SIREN {org.siren} -> {org.name}")+ self.log_graph_message(f"{org.name}: SIREN {org.siren}")- # Add SIRET as identifier if availableif org.siege_siret:- self.log_graph_message(- f"{org.name}: SIRET {org.siege_siret} -> {org.name}"- )+ self.log_graph_message(f"{org.name}: SIRET {org.siege_siret}")# Add dirigeants (leaders) as Individual nodes with relationshipsif org.dirigeants:for dirigeant in org.dirigeants:self.create_node(dirigeant)-self.create_relationship(org, dirigeant, "HAS_LEADER")- self.log_graph_message(- f"{org.name}: HAS_LEADER -> {dirigeant.full_name}"- )+ self.log_graph_message(f"{org.name}: HAS_LEADER -> {dirigeant.full_name}")# Add siege address as Location node if availableif org.siege_geo_adresse:- address = org.siege_geo_adresse- address_key = f"{address.address}_{address.city}_{address.country}"- self.create_node(address)-- self.create_relationship(org, address, "HAS_ADDRESS")+ self.create_node(org.siege_geo_adresse)+ self.create_relationship(org, org.siege_geo_adresse, "HAS_ADDRESS")self.log_graph_message(- f"{org.name}: HAS_ADDRESS -> {address.address}, {address.city}"+ f"{org.name}: HAS_ADDRESS -> {org.siege_geo_adresse.address}, {org.siege_geo_adresse.city}")-# Add siege location as Location node if coordinates are available but no locationelif org.siege_latitude and org.siege_longitude:- location_key = f"{org.siege_latitude}_{org.siege_longitude}"- self.create_node(- "location",- "location_id",- location_key,- latitude=float(org.siege_latitude),- longitude=float(org.siege_longitude),- address=org.siege_adresse,- city=org.siege_libelle_commune,- country="FR",- zip=org.siege_code_postal,- label=f"{org.siege_adresse or 'Unknown'}, {org.siege_libelle_commune or 'Unknown'}",- caption=f"{org.siege_adresse or 'Unknown'}, {org.siege_libelle_commune or 'Unknown'}",- type="location",- )-location_obj = Location(latitude=float(org.siege_latitude),longitude=float(org.siege_longitude),@@ -311,22 +282,19 @@ class OrgToInfosTransform(Transform):country="FR",zip=org.siege_code_postal,)+ self.create_node(location_obj)self.create_relationship(org, location_obj, "LOCATED_AT")self.log_graph_message(f"{org.name}: LOCATED_AT -> {org.siege_libelle_commune or 'Unknown'}")- # Add activity codes as Activity nodes+ # Log activity codesif org.activite_principale:- self.log_graph_message(- f"{org.name}: HAS_ACTIVITY -> {org.activite_principale}"- )+ self.log_graph_message(f"{org.name}: HAS_ACTIVITY -> {org.activite_principale}")- # Add legal nature as LegalNature node+ # Log legal natureif org.nature_juridique:- self.log_graph_message(- f"{org.name}: HAS_LEGAL_NATURE -> {org.nature_juridique}"- )+ self.log_graph_message(f"{org.name}: HAS_LEGAL_NATURE -> {org.nature_juridique}")return results