Skip to content

A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.

feat(enrichers): remove dependency for neo4jConnection

dextmorgnffe220341022
diff --git a/flowsint-enrichers/src/flowsint_enrichers/asn/to_cidrs.py b/flowsint-enrichers/src/flowsint_enrichers/asn/to_cidrs.py
index 48912388..2dc8d487 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/asn/to_cidrs.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/asn/to_cidrs.py
@@ -3,7 +3,6 @@ import os
from typing import List, Dict, Any, Union, Optional
from flowsint_core.core.enricher_base import Enricher
from flowsint_enrichers.registry import flowsint_enricher
-from flowsint_core.core.graph_db import Neo4jConnection
from flowsint_types.cidr import CIDR
from flowsint_types.asn import ASN
from flowsint_core.utils import is_valid_asn, parse_asn
@@ -23,14 +22,12 @@ class AsnToCidrsEnricher(Enricher):
self,
sketch_id: Optional[str] = None,
scan_id: Optional[str] = None,
- neo4j_conn: Optional[Neo4jConnection] = None,
vault=None,
params: Optional[Dict[str, Any]] = None,
):
super().__init__(
sketch_id=sketch_id,
scan_id=scan_id,
- neo4j_conn=neo4j_conn,
params_schema=self.get_params_schema(),
vault=vault,
params=params,
@@ -126,7 +123,7 @@ class AsnToCidrsEnricher(Enricher):
for cidr in cidr_list:
if str(cidr.network) == "0.0.0.0/0":
continue # Skip default CIDR for unknown ASN
- if self.neo4j_conn:
+ if self._graph_service:
self.create_node(asn)
self.create_node(cidr)
@@ -141,7 +138,7 @@ class AsnToCidrsEnricher(Enricher):
for asn, cidr in zip(original_input, results):
if str(cidr.network) == "0.0.0.0/0":
continue # Skip default CIDR for unknown ASN
- if self.neo4j_conn:
+ if self._graph_service:
self.create_node(
"asn",
"number",
diff --git a/flowsint-enrichers/src/flowsint_enrichers/cidr/to_ips.py b/flowsint-enrichers/src/flowsint_enrichers/cidr/to_ips.py
index 5fe28444..e522e5ce 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/cidr/to_ips.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/cidr/to_ips.py
@@ -2,7 +2,6 @@ import os
from typing import Any, Dict, List, Optional, Union
from flowsint_core.core.enricher_base import Enricher
from flowsint_enrichers.registry import flowsint_enricher
-from flowsint_core.core.graph_db import Neo4jConnection
from flowsint_types.cidr import CIDR
from flowsint_types.ip import Ip
from flowsint_core.core.logger import Logger
@@ -21,14 +20,12 @@ class CidrToIpsEnricher(Enricher):
self,
sketch_id: Optional[str] = None,
scan_id: Optional[str] = None,
- neo4j_conn: Optional[Neo4jConnection] = None,
vault=None,
params: Optional[Dict[str, Any]] = None,
):
super().__init__(
sketch_id=sketch_id,
scan_id=scan_id,
- neo4j_conn=neo4j_conn,
params_schema=self.get_params_schema(),
vault=vault,
params=params,
@@ -123,7 +120,7 @@ class CidrToIpsEnricher(Enricher):
f"Found {len(ip_list)} IPs in CIDR {cidr.network}"
)
for ip in ip_list:
- if self.neo4j_conn:
+ if self._graph_service:
# Create CIDR node
self.create_node(cidr)
@@ -135,7 +132,7 @@ class CidrToIpsEnricher(Enricher):
else:
# Fallback: original behavior (one-to-one zip)
for cidr, ip in zip(original_input, results):
- if self.neo4j_conn:
+ if self._graph_service:
# Create CIDR node
self.create_node(cidr)
# Create IP node
diff --git a/flowsint-enrichers/src/flowsint_enrichers/crypto/to_nfts.py b/flowsint-enrichers/src/flowsint_enrichers/crypto/to_nfts.py
index 6ae8d386..3d1676ec 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/crypto/to_nfts.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/crypto/to_nfts.py
@@ -5,7 +5,6 @@ from flowsint_core.core.enricher_base import Enricher
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.wallet import CryptoWallet, CryptoNFT
from flowsint_core.core.logger import Logger
-from flowsint_core.core.graph_db import Neo4jConnection
from dotenv import load_dotenv
load_dotenv()
@@ -23,14 +22,12 @@ class CryptoWalletAddressToNFTs(Enricher):
self,
sketch_id: Optional[str] = None,
scan_id: Optional[str] = None,
- neo4j_conn: Optional[Neo4jConnection] = None,
vault=None,
params: Optional[Dict[str, Any]] = None,
):
super().__init__(
sketch_id=sketch_id,
scan_id=scan_id,
- neo4j_conn=neo4j_conn,
params_schema=self.get_params_schema(),
vault=vault,
params=params,
@@ -121,7 +118,7 @@ class CryptoWalletAddressToNFTs(Enricher):
return nfts
def postprocess(self, results: List[OutputType], original_input: List[InputType]) -> List[OutputType]:
- if not self.neo4j_conn:
+ if not self._graph_service:
return results
for nfts in results:
diff --git a/flowsint-enrichers/src/flowsint_enrichers/crypto/to_transactions.py b/flowsint-enrichers/src/flowsint_enrichers/crypto/to_transactions.py
index b98573d2..8365d6d3 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/crypto/to_transactions.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/crypto/to_transactions.py
@@ -7,7 +7,6 @@ from dotenv import load_dotenv
from flowsint_core.core.enricher_base import Enricher
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.wallet import CryptoWallet, CryptoWalletTransaction
-from flowsint_core.core.graph_db import Neo4jConnection
from flowsint_core.core.logger import Logger
load_dotenv()
@@ -29,14 +28,12 @@ class CryptoWalletAddressToTransactions(Enricher):
self,
sketch_id: Optional[str] = None,
scan_id: Optional[str] = None,
- neo4j_conn: Optional[Neo4jConnection] = None,
vault=None,
params: Optional[Dict[str, Any]] = None,
):
super().__init__(
sketch_id=sketch_id,
scan_id=scan_id,
- neo4j_conn=neo4j_conn,
params_schema=self.get_params_schema(),
vault=vault,
params=params,
@@ -176,7 +173,7 @@ class CryptoWalletAddressToTransactions(Enricher):
return transactions
def postprocess(self, results: List[OutputType], original_input: List[InputType]) -> List[OutputType]:
- if not self.neo4j_conn:
+ if not self._graph_service:
return results
for transactions in results:
@@ -206,7 +203,7 @@ class CryptoWalletAddressToTransactions(Enricher):
tx.caption = $hash,
tx.type = "transaction"
"""
- self.neo4j_conn.query(
+ self._graph_service.query(
tx_query,
{
"hash": tx.hash,
diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_asn.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_asn.py
index 7bb8b50d..b58ff2c9 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_asn.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_asn.py
@@ -4,7 +4,6 @@ import socket
from typing import Any, Dict, List, Optional, Union
from flowsint_core.core.enricher_base import Enricher
from flowsint_enrichers.registry import flowsint_enricher
-from flowsint_core.core.graph_db import Neo4jConnection
from flowsint_types.domain import Domain
from flowsint_types.asn import ASN
from flowsint_core.utils import is_valid_domain
@@ -24,14 +23,12 @@ class DomainToAsnEnricher(Enricher):
self,
sketch_id: Optional[str] = None,
scan_id: Optional[str] = None,
- neo4j_conn: Optional[Neo4jConnection] = None,
vault=None,
params: Optional[Dict[str, Any]] = None,
):
super().__init__(
sketch_id=sketch_id,
scan_id=scan_id,
- neo4j_conn=neo4j_conn,
params_schema=self.get_params_schema(),
vault=vault,
params=params,
@@ -118,7 +115,7 @@ class DomainToAsnEnricher(Enricher):
self, results: List[OutputType], input_data: List[InputType] = None
) -> List[OutputType]:
# Create Neo4j relationships between domains and their corresponding ASNs
- if input_data and self.neo4j_conn:
+ if input_data and self._graph_service:
for domain, asn in zip(input_data, results):
# Create domain node
self.create_node(domain)
diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_history.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_history.py
index 837c92d9..d7af1906 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_history.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_history.py
@@ -12,7 +12,6 @@ from flowsint_types.phone import Phone
from flowsint_core.utils import is_valid_domain, is_root_domain
from flowsint_types.address import Location
from flowsint_core.core.logger import Logger
-from flowsint_core.core.graph_db import Neo4jConnection
from tools.network.whoxy import WhoxyTool
from dotenv import load_dotenv
@@ -30,14 +29,12 @@ class DomainToHistoryEnricher(Enricher):
self,
sketch_id: Optional[str] = None,
scan_id: Optional[str] = None,
- neo4j_conn: Optional[Neo4jConnection] = None,
vault=None,
params: Optional[Dict[str, Any]] = None,
):
super().__init__(
sketch_id=sketch_id,
scan_id=scan_id,
- neo4j_conn=neo4j_conn,
params_schema=self.get_params_schema(),
vault=vault,
params=params,
@@ -394,7 +391,7 @@ class DomainToHistoryEnricher(Enricher):
def postprocess(self, results: List[OutputType], original_input: List[InputType]) -> List[OutputType]:
"""Create Neo4j nodes and relationships from extracted data."""
- if not self.neo4j_conn:
+ if not self._graph_service:
Logger.info(
self.sketch_id,
{"message": "[WHOXY] No Neo4j connection, skipping postprocess"},
diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_root_domain.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_root_domain.py
index 889c6436..eeb236fd 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_root_domain.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_root_domain.py
@@ -56,7 +56,7 @@ class DomainToRootDomain(Enricher):
def postprocess(self, results: List[OutputType], original_input: List[InputType]) -> List[OutputType]:
# Use the mapping we created during scan to create relationships
for original_domain, root_domain in self.domain_root_mapping:
- if not self.neo4j_conn:
+ if not self._graph_service:
continue
# New simplified pattern: pass Pydantic objects directly
diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_subdomains.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_subdomains.py
index e730f3b9..d65d0178 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_subdomains.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_subdomains.py
@@ -92,7 +92,7 @@ class SubdomainEnricher(Enricher):
def postprocess(self, results: List[OutputType], original_input: List[InputType]) -> List[OutputType]:
output: List[OutputType] = []
for domain_obj in results:
- if not self.neo4j_conn:
+ if not self._graph_service:
continue
for subdomain in domain_obj["subdomains"]:
output.append(Domain(domain=subdomain))
diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_website.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_website.py
index c2c9d627..8a247164 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_website.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_website.py
@@ -183,7 +183,7 @@ class DomainToWebsiteEnricher(Enricher):
}
Logger.info(self.sketch_id, redirect_payload)
- if self.neo4j_conn:
+ if self._graph_service:
# Create domain node
self.create_node(website.domain)
diff --git a/flowsint-enrichers/src/flowsint_enrichers/domain/to_whois.py b/flowsint-enrichers/src/flowsint_enrichers/domain/to_whois.py
index 4ab71001..df91076b 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/domain/to_whois.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/domain/to_whois.py
@@ -111,7 +111,7 @@ class WhoisEnricher(Enricher):
def postprocess(self, results: List[OutputType], original_input: List[InputType]) -> List[OutputType]:
for whois_obj in results:
- if not self.neo4j_conn:
+ if not self._graph_service:
continue
# Create domain node
self.create_node(whois_obj.domain)
diff --git a/flowsint-enrichers/src/flowsint_enrichers/email/to_domains.py b/flowsint-enrichers/src/flowsint_enrichers/email/to_domains.py
index 12f4cb6d..d26eca92 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/email/to_domains.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/email/to_domains.py
@@ -9,7 +9,6 @@ from flowsint_types.email import Email
from flowsint_types.phone import Phone
from flowsint_types.address import Location
from flowsint_core.core.logger import Logger
-from flowsint_core.core.graph_db import Neo4jConnection
from tools.network.whoxy import WhoxyTool
from dotenv import load_dotenv
@@ -30,14 +29,12 @@ class EmailToDomainsEnricher(Enricher):
self,
sketch_id: Optional[str] = None,
scan_id: Optional[str] = None,
- neo4j_conn: Optional[Neo4jConnection] = None,
vault=None,
params: Optional[Dict[str, Any]] = None,
):
super().__init__(
sketch_id=sketch_id,
scan_id=scan_id,
- neo4j_conn=neo4j_conn,
params_schema=self.get_params_schema(),
vault=vault,
params=params,
@@ -219,7 +216,7 @@ class EmailToDomainsEnricher(Enricher):
def postprocess(self, results: List[OutputType], original_input: List[InputType]) -> List[OutputType]:
"""Create Neo4j nodes and relationships from extracted data."""
- if not self.neo4j_conn:
+ if not self._graph_service:
return results
# Track processed entities to avoid duplicates
diff --git a/flowsint-enrichers/src/flowsint_enrichers/email/to_gravatar.py b/flowsint-enrichers/src/flowsint_enrichers/email/to_gravatar.py
index 4ddfb96d..81798922 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/email/to_gravatar.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/email/to_gravatar.py
@@ -86,7 +86,7 @@ class EmailToGravatarEnricher(Enricher):
def postprocess(self, results: List[OutputType], original_input: List[InputType]) -> List[OutputType]:
for email_obj, gravatar_obj in zip(original_input, results):
- if not self.neo4j_conn:
+ if not self._graph_service:
continue
# Create email node
self.create_node(email_obj)
diff --git a/flowsint-enrichers/src/flowsint_enrichers/email/to_leaks.py b/flowsint-enrichers/src/flowsint_enrichers/email/to_leaks.py
index 2e8d504f..802c6a8b 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/email/to_leaks.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/email/to_leaks.py
@@ -8,7 +8,6 @@ from flowsint_core.core.logger import Logger
from flowsint_types.email import Email
from flowsint_types.breach import Breach
from dotenv import load_dotenv
-from flowsint_core.core.graph_db import Neo4jConnection
# Load environment variables
load_dotenv()
@@ -27,14 +26,12 @@ class EmailToBreachesEnricher(Enricher):
self,
sketch_id: Optional[str] = None,
scan_id: Optional[str] = None,
- neo4j_conn: Optional[Neo4jConnection] = None,
vault=None,
params: Optional[Dict[str, Any]] = None,
):
super().__init__(
sketch_id=sketch_id,
scan_id=scan_id,
- neo4j_conn=neo4j_conn,
params_schema=self.get_params_schema(),
vault=vault,
params=params,
@@ -136,13 +133,13 @@ class EmailToBreachesEnricher(Enricher):
def postprocess(self, results: List[OutputType], original_input: List[InputType]) -> List[OutputType]:
# Create email nodes first
for email_obj in original_input:
- if not self.neo4j_conn:
+ if not self._graph_service:
continue
self.create_node(email_obj)
# Process all breaches
for email_address, breach_obj in results:
- if not self.neo4j_conn:
+ if not self._graph_service:
continue
# Create breach node
diff --git a/flowsint-enrichers/src/flowsint_enrichers/email/to_username.py b/flowsint-enrichers/src/flowsint_enrichers/email/to_username.py
index f3a01788..43965dc0 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/email/to_username.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/email/to_username.py
@@ -40,7 +40,7 @@ class EmailToUsernameEnricher(Enricher):
self, results: List[OutputType], original_input: List[InputType]
) -> List[OutputType]:
for email_obj, username_obj in zip(original_input, results):
- if not self.neo4j_conn:
+ if not self._graph_service:
continue
# Create email node
self.create_node(email_obj)
diff --git a/flowsint-enrichers/src/flowsint_enrichers/individual/to_domains.py b/flowsint-enrichers/src/flowsint_enrichers/individual/to_domains.py
index 70840c91..f7687c96 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/individual/to_domains.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/individual/to_domains.py
@@ -8,7 +8,6 @@ from flowsint_types.organization import Organization
from flowsint_types.individual import Individual
from flowsint_types.address import Location
from flowsint_core.core.logger import Logger
-from flowsint_core.core.graph_db import Neo4jConnection
from tools.network.whoxy import WhoxyTool
from dotenv import load_dotenv
@@ -29,14 +28,12 @@ class IndividualToDomainsEnricher(Enricher):
self,
sketch_id: Optional[str] = None,
scan_id: Optional[str] = None,
- neo4j_conn: Optional[Neo4jConnection] = None,
vault=None,
params: Optional[Dict[str, Any]] = None,
):
super().__init__(
sketch_id=sketch_id,
scan_id=scan_id,
- neo4j_conn=neo4j_conn,
params_schema=self.get_params_schema(),
vault=vault,
params=params,
@@ -251,7 +248,7 @@ class IndividualToDomainsEnricher(Enricher):
def postprocess(self, results: List[OutputType], original_input: List[InputType]) -> List[OutputType]:
"""Create Neo4j nodes and relationships from extracted data."""
- if not self.neo4j_conn:
+ if not self._graph_service:
return results
# Track processed entities to avoid duplicates
diff --git a/flowsint-enrichers/src/flowsint_enrichers/individual/to_org.py b/flowsint-enrichers/src/flowsint_enrichers/individual/to_org.py
index 199a2a58..42df7104 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/individual/to_org.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/individual/to_org.py
@@ -281,7 +281,7 @@ class IndividualToOrgEnricher(Enricher):
return None
def postprocess(self, results: List[OutputType], original_input: List[InputType]) -> List[OutputType]:
- if not self.neo4j_conn:
+ if not self._graph_service:
return results
# Track processed entities to avoid duplicates
diff --git a/flowsint-enrichers/src/flowsint_enrichers/ip/to_asn.py b/flowsint-enrichers/src/flowsint_enrichers/ip/to_asn.py
index 21b3b2aa..60446268 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/ip/to_asn.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/ip/to_asn.py
@@ -3,7 +3,6 @@ import os
from typing import Any, Dict, List, Optional, Union
from flowsint_core.core.enricher_base import Enricher
from flowsint_enrichers.registry import flowsint_enricher
-from flowsint_core.core.graph_db import Neo4jConnection
from flowsint_types.ip import Ip
from flowsint_types.asn import ASN
from flowsint_core.utils import is_valid_ip
@@ -23,14 +22,12 @@ class IpToAsnEnricher(Enricher):
self,
sketch_id: Optional[str] = None,
scan_id: Optional[str] = None,
- neo4j_conn: Optional[Neo4jConnection] = None,
vault=None,
params: Optional[Dict[str, Any]] = None,
):
super().__init__(
sketch_id=sketch_id,
scan_id=scan_id,
- neo4j_conn=neo4j_conn,
params_schema=self.get_params_schema(),
vault=vault,
params=params,
@@ -113,7 +110,7 @@ class IpToAsnEnricher(Enricher):
self, results: List[OutputType], input_data: List[InputType] = None
) -> List[OutputType]:
# Create Neo4j relationships between IPs and their corresponding ASNs
- if input_data and self.neo4j_conn:
+ if input_data and self._graph_service:
for ip, asn in zip(input_data, results):
# Create IP node
self.create_node(ip)
diff --git a/flowsint-enrichers/src/flowsint_enrichers/ip/to_infos.py b/flowsint-enrichers/src/flowsint_enrichers/ip/to_infos.py
index 9edded47..fe8240df 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/ip/to_infos.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/ip/to_infos.py
@@ -43,7 +43,7 @@ class IpToInfosEnricher(Enricher):
def postprocess(self, results: List[OutputType], original_input: List[InputType]) -> List[OutputType]:
"""Update IP nodes in Neo4j with geolocation information."""
- if self.neo4j_conn:
+ if self._graph_service:
for ip in results:
self.create_node(ip)
self.log_graph_message(
diff --git a/flowsint-enrichers/src/flowsint_enrichers/ip/to_ports.py b/flowsint-enrichers/src/flowsint_enrichers/ip/to_ports.py
index 9a8caaa8..ad738160 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/ip/to_ports.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/ip/to_ports.py
@@ -1,7 +1,6 @@
from typing import Any, Dict, List, Optional, Union
from flowsint_core.core.enricher_base import Enricher
from flowsint_enrichers.registry import flowsint_enricher
-from flowsint_core.core.graph_db import Neo4jConnection
from flowsint_types.ip import Ip
from flowsint_types.port import Port
from flowsint_core.utils import is_valid_ip
@@ -21,14 +20,12 @@ class IpToPortsEnricher(Enricher):
self,
sketch_id: Optional[str] = None,
scan_id: Optional[str] = None,
- neo4j_conn: Optional[Neo4jConnection] = None,
vault=None,
params: Optional[Dict[str, Any]] = None,
):
super().__init__(
sketch_id=sketch_id,
scan_id=scan_id,
- neo4j_conn=neo4j_conn,
params_schema=self.get_params_schema(),
vault=vault,
params=params,
@@ -194,7 +191,7 @@ class IpToPortsEnricher(Enricher):
self, results: List[OutputType], input_data: List[InputType] = None
) -> List[OutputType]:
"""Create Neo4j nodes for ports and relationships with IP addresses"""
- if self.neo4j_conn and results:
+ if self._graph_service and results:
for port in results:
# Get the IP address this port belongs to
ip_address = getattr(port, "_ip_address", None)
diff --git a/flowsint-enrichers/src/flowsint_enrichers/n8n/connector.py b/flowsint-enrichers/src/flowsint_enrichers/n8n/connector.py
index 7fbaf740..e922d8ee 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/n8n/connector.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/n8n/connector.py
@@ -4,7 +4,6 @@ from typing import List, Dict, Any, Optional
from flowsint_core.core.enricher_base import Enricher
from flowsint_enrichers.registry import flowsint_enricher
from flowsint_core.core.logger import Logger
-from flowsint_core.core.graph_db import Neo4jConnection
@flowsint_enricher
@@ -21,14 +20,12 @@ class N8nConnector(Enricher):
self,
sketch_id: Optional[str] = None,
scan_id: Optional[str] = None,
- neo4j_conn: Optional[Neo4jConnection] = None,
vault=None,
params: Optional[Dict[str, Any]] = None,
):
super().__init__(
sketch_id=sketch_id,
scan_id=scan_id,
- neo4j_conn=neo4j_conn,
params_schema=self.get_params_schema(),
vault=vault,
params=params,
diff --git a/flowsint-enrichers/src/flowsint_enrichers/organization/to_asn.py b/flowsint-enrichers/src/flowsint_enrichers/organization/to_asn.py
index b49cd8ab..ea26784e 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/organization/to_asn.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/organization/to_asn.py
@@ -2,7 +2,6 @@ import os
from typing import List, Dict, Any, Union, Optional
from flowsint_core.core.enricher_base import Enricher
from flowsint_enrichers.registry import flowsint_enricher
-from flowsint_core.core.graph_db import Neo4jConnection
from flowsint_types.organization import Organization
from flowsint_types.asn import ASN
from flowsint_core.core.logger import Logger
@@ -21,14 +20,12 @@ class OrgToAsnEnricher(Enricher):
self,
sketch_id: Optional[str] = None,
scan_id: Optional[str] = None,
- neo4j_conn: Optional[Neo4jConnection] = None,
vault=None,
params: Optional[Dict[str, Any]] = None,
):
super().__init__(
sketch_id=sketch_id,
scan_id=scan_id,
- neo4j_conn=neo4j_conn,
params_schema=self.get_params_schema(),
vault=vault,
params=params,
@@ -114,7 +111,7 @@ class OrgToAsnEnricher(Enricher):
# Skip if no valid ASN was found
if result_asn.number == 0:
continue
- if self.neo4j_conn:
+ if self._graph_service:
# Create organization node
self.create_node(input_org)
# Create ASN node
diff --git a/flowsint-enrichers/src/flowsint_enrichers/organization/to_domains.py b/flowsint-enrichers/src/flowsint_enrichers/organization/to_domains.py
index bc6e8bad..58ce5d29 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/organization/to_domains.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/organization/to_domains.py
@@ -9,7 +9,6 @@ from flowsint_types.organization import Organization
from flowsint_types.individual import Individual
from flowsint_types.address import Location
from flowsint_core.core.logger import Logger
-from flowsint_core.core.graph_db import Neo4jConnection
from tools.network.whoxy import WhoxyTool
from flowsint_core.utils import is_valid_domain, is_root_domain
from dotenv import load_dotenv
@@ -29,14 +28,12 @@ class OrgToDomainsEnricher(Enricher):
self,
sketch_id: Optional[str] = None,
scan_id: Optional[str] = None,
- neo4j_conn: Optional[Neo4jConnection] = None,
vault=None,
params: Optional[Dict[str, Any]] = None,
):
super().__init__(
sketch_id=sketch_id,
scan_id=scan_id,
- neo4j_conn=neo4j_conn,
params_schema=self.get_params_schema(),
vault=vault,
params=params,
@@ -390,7 +387,7 @@ class OrgToDomainsEnricher(Enricher):
def postprocess(self, results: List[OutputType], original_input: List[InputType]) -> List[OutputType]:
"""Create Neo4j nodes and relationships from extracted data."""
- if not self.neo4j_conn:
+ if not self._graph_service:
Logger.info(
self.sketch_id,
{"message": "[WHOXY] No Neo4j connection, skipping postprocess"},
diff --git a/flowsint-enrichers/src/flowsint_enrichers/organization/to_infos.py b/flowsint-enrichers/src/flowsint_enrichers/organization/to_infos.py
index 62bf7012..da8232fd 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/organization/to_infos.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/organization/to_infos.py
@@ -247,7 +247,7 @@ class OrgToInfosEnricher(Enricher):
return None
def postprocess(self, results: List[OutputType], original_input: List[InputType]) -> List[OutputType]:
- if not self.neo4j_conn:
+ if not self._graph_service:
return results
for org in results:
diff --git a/flowsint-enrichers/src/flowsint_enrichers/phone/to_infos.py b/flowsint-enrichers/src/flowsint_enrichers/phone/to_infos.py
index d7202947..e9ab8247 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/phone/to_infos.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/phone/to_infos.py
@@ -83,7 +83,7 @@ class IgnorantEnricher(Enricher):
"""
Create Neo4j relationships for found phone accounts.
"""
- if not self.neo4j_conn:
+ if not self._graph_service:
return results
for result in results:
diff --git a/flowsint-enrichers/src/flowsint_enrichers/social/to_maigret.py b/flowsint-enrichers/src/flowsint_enrichers/social/to_maigret.py
index 04a7a4de..a216543f 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/social/to_maigret.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/social/to_maigret.py
@@ -135,7 +135,7 @@ class MaigretEnricher(Enricher):
return results
def postprocess(self, results: List[OutputType], original_input: List[InputType]) -> List[OutputType]:
- if not self.neo4j_conn:
+ if not self._graph_service:
return results
for profile in results:
diff --git a/flowsint-enrichers/src/flowsint_enrichers/social/to_sherlock.py b/flowsint-enrichers/src/flowsint_enrichers/social/to_sherlock.py
index d3666be1..057d0647 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/social/to_sherlock.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/social/to_sherlock.py
@@ -97,7 +97,7 @@ class SherlockEnricher(Enricher):
self, results: List[OutputType], original_input: List[InputType]
) -> List[OutputType]:
"""Create Neo4j relationships for found social accounts."""
- if not self.neo4j_conn:
+ if not self._graph_service:
return results
for social_account in results:
diff --git a/flowsint-enrichers/src/flowsint_enrichers/website/to_crawler.py b/flowsint-enrichers/src/flowsint_enrichers/website/to_crawler.py
index 763efc6c..ab2b222a 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/website/to_crawler.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/website/to_crawler.py
@@ -142,7 +142,7 @@ class WebsiteToCrawler(Enricher):
website_url = str(input_website.url)
# Create website node
- if self.neo4j_conn:
+ if self._graph_service:
self.create_node(input_website)
# Create email nodes and relationships
diff --git a/flowsint-enrichers/src/flowsint_enrichers/website/to_domain.py b/flowsint-enrichers/src/flowsint_enrichers/website/to_domain.py
index 6944ad7d..bab0d615 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/website/to_domain.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/website/to_domain.py
@@ -61,7 +61,7 @@ class WebsiteToDomainEnricher(Enricher):
self, results: List[OutputType], input_data: List[InputType] = None
) -> List[OutputType]:
# Create Neo4j relationships between websites and their corresponding domains
- if input_data and self.neo4j_conn:
+ if input_data and self._graph_service:
for input_website, result in zip(input_data, results):
website_url = str(input_website.url)
domain_name = result.domain
diff --git a/flowsint-enrichers/src/flowsint_enrichers/website/to_links.py b/flowsint-enrichers/src/flowsint_enrichers/website/to_links.py
index 4a4822d5..585b596f 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/website/to_links.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/website/to_links.py
@@ -51,7 +51,7 @@ class WebsiteToLinks(Enricher):
main_domain = self.extract_domain(str(website.url))
# Create main website and domain nodes upfront
- if self.neo4j_conn:
+ if self._graph_service:
self.create_node(website)
if main_domain:
domain_obj = Domain(domain=main_domain)
@@ -74,7 +74,7 @@ class WebsiteToLinks(Enricher):
if domain:
external_domains.add(domain)
# Create external website node immediately
- if self.neo4j_conn:
+ if self._graph_service:
url_obj = Website(url=url)
self.create_node(url_obj)
self.create_relationship(website, url_obj, "LINKS_TO")
@@ -102,7 +102,7 @@ class WebsiteToLinks(Enricher):
else:
internal_urls.append(url)
# Create internal website node immediately
- if self.neo4j_conn and url != str(
+ if self._graph_service and url != str(
website.url
): # Don't create duplicate of main website
internal_website = Website(url=url)
@@ -180,7 +180,7 @@ class WebsiteToLinks(Enricher):
# Still create main website and domain nodes even on error
main_domain = self.extract_domain(str(website.url))
- if self.neo4j_conn:
+ if self._graph_service:
self.create_node(website)
if main_domain:
domain_obj_err = Domain(domain=main_domain)
diff --git a/flowsint-enrichers/src/flowsint_enrichers/website/to_text.py b/flowsint-enrichers/src/flowsint_enrichers/website/to_text.py
index 9f8d8f7e..7e53d40c 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/website/to_text.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/website/to_text.py
@@ -54,7 +54,7 @@ class WebsiteToText(Enricher):
for input_website, result in zip(original_input, results):
website_url = str(input_website.url)
- if self.neo4j_conn:
+ if self._graph_service:
self.create_node(input_website)
# Create relationship with the specific phrase for this website
diff --git a/flowsint-enrichers/src/flowsint_enrichers/website/to_webtrackers.py b/flowsint-enrichers/src/flowsint_enrichers/website/to_webtrackers.py
index 90920c0d..418616de 100644
--- a/flowsint-enrichers/src/flowsint_enrichers/website/to_webtrackers.py
+++ b/flowsint-enrichers/src/flowsint_enrichers/website/to_webtrackers.py
@@ -4,7 +4,6 @@ from flowsint_enrichers.registry import flowsint_enricher
from flowsint_types.website import Website
from flowsint_types.web_tracker import WebTracker
from flowsint_core.core.logger import Logger
-from flowsint_core.core.graph_db import Neo4jConnection
from flowsint_core.core.vault import VaultProtocol
from recontrack import TrackingCodeExtractor
@@ -21,12 +20,11 @@ class WebsiteToWebtrackersEnricher(Enricher):
self,
sketch_id: str,
scan_id: str,
- neo4j_conn: Optional[Neo4jConnection] = None,
params_schema: Optional[List[Dict[str, Any]]] = None,
vault: Optional[VaultProtocol] = None,
params: Optional[Dict[str, Any]] = None,
):
- super().__init__(sketch_id, scan_id, neo4j_conn, params_schema, vault, params)
+ super().__init__(sketch_id, scan_id, params_schema, vault, params)
self.tracker_website_mapping: List[tuple[WebTracker, Website]] = []
@classmethod
@@ -74,7 +72,7 @@ class WebsiteToWebtrackersEnricher(Enricher):
def postprocess(self, results: List[OutputType], original_input: List[InputType]) -> List[OutputType]:
# Create Neo4j relationships between websites and their corresponding trackers
- if self.neo4j_conn:
+ if self._graph_service:
# Group trackers by website using the mapping we created during scan
website_trackers = {}
for tracker, website in self.tracker_website_mapping: