Skip to content

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

feat: fast api tests

dextmorgne40f91483456
diff --git a/flowsint-api/app/core/auth.py b/flowsint-api/app/core/auth.py
index 23a27df0..40abd9c8 100644
--- a/flowsint-api/app/core/auth.py
+++ b/flowsint-api/app/core/auth.py
@@ -124,7 +124,7 @@ def get_current_user(
credentials: HTTPAuthorizationCredentials = Depends(http_bearer)
) -> Dict[str, Any]:
"""
- Dependency pour obtenir l'utilisateur courant à partir du token d'authentification.
+ Dependencies to get the current user from the JWT token.
Usage: user = Depends(get_current_user)
"""
token = credentials.credentials
@@ -132,7 +132,7 @@ def get_current_user(
# Fonction utilitaire pour extraire les informations utilisateur du token JWT
def get_user_info(token_data: Dict[str, Any]) -> Dict[str, Any]:
- """Extrait les informations utilisateur du token décodé."""
+ """Extracts user infos from the JWT token data."""
user_info = {
"user_id": token_data.get("sub"),
"email": token_data.get("email"),
diff --git a/flowsint-api/app/main.py b/flowsint-api/app/main.py
index 2aedc503..376f244e 100644
--- a/flowsint-api/app/main.py
+++ b/flowsint-api/app/main.py
@@ -1,16 +1,22 @@
from fastapi import FastAPI, HTTPException, Depends
-from pydantic import BaseModel
+from pydantic import BaseModel, Field
from app.core.celery import celery_app
from app.scanners.registry import ScannerRegistry
+from app.scanners.orchestrator import TransformOrchestrator
from app.core.auth import get_current_user
+from app.models.types import OSINTTypeUtils
+from typing import List
app = FastAPI()
class ScanRequest(BaseModel):
- value: str
+ values: List[str]
sketch_id: str
scanner: str
+class TransformValidateRequest(BaseModel):
+ scanners: List[str] = Field(..., description="Ordered list of scanners to apply")
+
@app.post("/scan")
async def scan(
item: ScanRequest,
@@ -20,22 +26,53 @@ async def scan(
if not ScannerRegistry.scanner_exists(name=item.scanner):
raise HTTPException(status_code=400, detail="Scanner not found")
# user_id = user.get("sub")
- task = celery_app.send_task("run_scan", args=[item.scanner, item.value, item.sketch_id])
+ task = celery_app.send_task("run_scan", args=[item.scanner, item.values, item.sketch_id])
return {"id": task.id}
except HTTPException:
raise
except Exception as e:
print(e)
raise HTTPException(status_code=500, detail=f"Server error: {str(e)}")
-
+
@app.get("/scanners")
async def get_scans_list():
- return {"scans": ScannerRegistry.list()}
+ return {"scanners": ScannerRegistry.list()}
+
[email protected]("/transforms/validate")
+async def scan(
+ transform: TransformValidateRequest,
+):
+ try:
+ orchestrator = TransformOrchestrator("",
+ scanner_names=transform.scanners)
+ is_valid = orchestrator.preprocess()
+ return {"valid": is_valid}
+ except Exception as e:
+ return {"valid": False, "reason": str(e)}
@app.get("/transforms/nodes")
async def get_scans_list():
- return {"items": ScannerRegistry.list_by_category()}
+ scanners = ScannerRegistry.list_by_category()
+
+ # Aplatir les scanners par catégorie en une liste
+ flattened_scanners = {
+ category: [
+ {
+ "class_name": scanner["class_name"],
+ "name": scanner["name"],
+ "module": scanner["module"],
+ "doc": scanner["doc"],
+ "key": scanner["key"]
+ }
+ for scanner in scanner_list
+ ]
+ for category, scanner_list in scanners.items()
+ }
+
+ # Ajouter la clé "types" avec les types OSINT
+ flattened_scanners["types"] = OSINTTypeUtils.get_osint_type_nodes()
+ return {"items": flattened_scanners}
@app.get("/health")
async def health():
return {"status": "ok"}
diff --git a/flowsint-api/app/models/types.py b/flowsint-api/app/models/types.py
new file mode 100644
index 00000000..c5a97e2b
--- /dev/null
+++ b/flowsint-api/app/models/types.py
@@ -0,0 +1,90 @@
+from enum import Enum
+from typing import List, Dict
+
+
+class OSINTType(str, Enum):
+ EMAIL = "email"
+ USERNAME = "username"
+ PHONE_NUMBER = "phone_number"
+ URL = "url"
+ DOMAIN = "domain"
+ IP_ADDRESS = "ip_address"
+ FULL_NAME = "full_name"
+ TEXT = "text"
+ ARRAY = "array"
+ SOCIAL_PROFILE = "social_profile"
+ LEAK_INFO = "leak_info"
+
+
+OSINT_TYPE_METADATA = {
+ OSINTType.EMAIL: {
+ "label": "Email address",
+ "regex": r"^[^@]+@[^@]+\.[^@]+$",
+ "description": "A standard email address like [email protected]"
+ },
+ OSINTType.USERNAME: {
+ "label": "Username",
+ "regex": r"^[a-zA-Z0-9_.-]+$",
+ "description": "A generic username used on platforms and forums"
+ },
+ OSINTType.PHONE_NUMBER: {
+ "label": "Phone number",
+ "regex": r"^\+?[0-9]{7,15}$",
+ "description": "A phone number with optional international prefix"
+ },
+ OSINTType.URL: {
+ "label": "Website URL",
+ "regex": r"^https?://.+",
+ "description": "A fully qualified website URL starting with http(s)"
+ },
+ OSINTType.DOMAIN: {
+ "label": "Domain",
+ "regex": r"^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$",
+ "description": "A domain like example.com"
+ },
+ OSINTType.IP_ADDRESS: {
+ "label": "IP address",
+ "regex": r"^\d{1,3}(\.\d{1,3}){3}$",
+ "description": "An IPv4 address"
+ },
+ OSINTType.FULL_NAME: {
+ "label": "Full name",
+ "regex": r"^[\p{L} .'-]{2,}$",
+ "description": "A person's full name"
+ },
+ OSINTType.TEXT: {
+ "label": "Text",
+ "regex": r"^.*$",
+ "description": "Any free text input"
+ },
+ OSINTType.ARRAY: {
+ "label": "Array",
+ "regex": r"^\[.*\]$",
+ "description": "A JSON array of values"
+ },
+ OSINTType.SOCIAL_PROFILE: {
+ "label": "Social profile",
+ "regex": r"^https?://(?:www\.)?[a-z0-9.-]+\.[a-z]{2,}(?:/[^\s]*)?$",
+ "description": "A URL pointing to a social media profile"
+ },
+ OSINTType.LEAK_INFO: {
+ "label": "Leak info",
+ "regex": r"^.*$",
+ "description": "Information extracted from data breaches"
+ }
+}
+
+
+class OSINTTypeUtils:
+ @staticmethod
+ def get_osint_type_nodes() -> List[Dict[str, str]]:
+ return [
+ {
+ "id": f"type::{t.value}",
+ "class_name": meta["label"],
+ "description": meta["description"],
+ "regex": meta["regex"],
+ "name": t.value,
+ }
+ for t, meta in OSINT_TYPE_METADATA.items()
+ ]
diff --git a/flowsint-api/app/scanners/base.py b/flowsint-api/app/scanners/base.py
index 8f71bc7e..facabda2 100644
--- a/flowsint-api/app/scanners/base.py
+++ b/flowsint-api/app/scanners/base.py
@@ -1,5 +1,6 @@
from abc import ABC, abstractmethod
-from typing import Dict, Any, Optional
+from typing import List, Dict, Any
+from app.models.types import OSINT_TYPE_METADATA, OSINTType
class Scanner(ABC):
def __init__(self, scan_id: str):
@@ -18,25 +19,57 @@ class Scanner(ABC):
@classmethod
@abstractmethod
def key(self) -> str:
- ## This is the key used to identify the items' key to search for. Ex:
- ## Individual -> full_name
- ## Phone -> phone_number
+ """
+ This is the key used to identify the items' key to search for. Ex:
+ Individual -> full_name
+ Phone -> phone_number
+ """
pass
+ @classmethod
+ @abstractmethod
+ def input_schema(cls) -> Dict[str, str]:
+ """
+ Returns the input fields and their types.
+ Example: { "email": "string" }
+ """
+ pass
+
+ @classmethod
@abstractmethod
- def scan(self, value: str) -> Dict[str, Any]:
+ def output_schema(cls) -> Dict[str, str]:
+ """
+ Returns the output fields and their types.
+ Example: { "leaks": "array", "sources": "array" }
+ """
pass
- def preprocess(self, value: str) -> str:
- return value
+ @abstractmethod
+ def scan(self, values: List[str]) -> List[Dict[str, Any]]:
+ """
+ The actual scanning logic that operates on the list of values provided.
+ """
+ pass
- def postprocess(self, results: Dict[str, Any]) -> Dict[str, Any]:
+ def preprocess(self, values: List[str]) -> List[str]:
+ """
+ Preprocess the values according to their types.
+ Validates if the values match the expected format for the given types.
+ """
+ return values
+
+ def postprocess(self, results: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
+ """
+ Post-process the scan results if necessary (e.g., format them).
+ """
return results
- def execute(self, value: str) -> Dict[str, Any]:
- preprocessed = self.preprocess(value)
+ def execute(self, values: List[str]) -> List[Dict[str, Any]]:
+ """
+ Execute the scanning process by first preprocessing, then scanning, and finally postprocessing.
+ """
+ preprocessed = self.preprocess(values)
results = self.scan(preprocessed)
results = self.postprocess(results)
return results
-
diff --git a/flowsint-api/app/scanners/domains/domain_infos.py b/flowsint-api/app/scanners/domains/domain_infos.py
new file mode 100644
index 00000000..6e44b727
--- /dev/null
+++ b/flowsint-api/app/scanners/domains/domain_infos.py
@@ -0,0 +1,103 @@
+import json
+import uuid
+from typing import Dict, Any, List
+import requests
+import whois
+import pydig
+from app.utils import is_valid_url
+from app.scanners.base import Scanner
+
+
+class DomainInfosScanner(Scanner):
+ """Scan for WHOIS, DNS, subdomains, and geolocation data of a domain."""
+
+ @classmethod
+ def name(cls) -> str:
+ return "domain_infos_scanner"
+
+ @classmethod
+ def category(cls) -> str:
+ return "websites"
+
+ @classmethod
+ def key(cls) -> str:
+ return "url"
+
+ @classmethod
+ def input_schema(cls) -> Dict[str, str]:
+ """Defines expected input format."""
+ return {
+ "domains": "array"
+ }
+
+ @classmethod
+ def output_schema(self) -> Dict[str, str]:
+ """Defines the structure of the data returned by the scan."""
+ return {
+ "output": "dict", # A list of results for each username scan
+ }
+
+ def _get_subdomains_from_crtsh(self, domain: str) -> List[str]:
+ url = f"https://crt.sh/?q=%25.{domain}&output=json"
+ try:
+ resp = requests.get(url, timeout=100)
+ if resp.status_code != 200:
+ return []
+
+ data = resp.json()
+ subdomains = set()
+
+ for entry in data:
+ name = entry.get("name_value")
+ if name:
+ for sub in name.splitlines():
+ sub = sub.strip().lower().lstrip('*.')
+ if sub.endswith(domain):
+ subdomains.add(sub)
+
+ return sorted(subdomains)
+ except Exception as e:
+ return [f"[crt.sh] Error: {str(e)}"]
+
+ def preprocess(self, domains: List[str]) -> List[str]:
+ """Preprocess the domains by validating them."""
+ return [is_valid_url(domain) for domain in domains]
+
+ def scan(self, domains: List[str]) -> List[Dict[str, Any]]:
+ """Scan multiple domains and return a list of results."""
+ results = []
+ for domain in domains:
+ result = {"domain": domain }
+ # WHOIS info
+ try:
+ w = whois.whois(domain)
+ result["whois_raw"] = json.dumps(w, default=str, indent=2)
+ except Exception as e:
+ result["whois_raw"] = json.dumps({"error": str(e)})
+
+ # DNS lookup
+ try:
+ result["ips"] = pydig.query(domain, 'A')
+ except Exception as e:
+ result["ips"] = []
+ result["ips_error"] = f"[error] {str(e)}"
+
+ # IP Geolocation
+ ipinfo_data = []
+ for ip in result.get("ips", []):
+ try:
+ resp = requests.get(f"https://ipinfo.io/{ip}/json", timeout=10)
+ ipinfo_data.append(resp.json())
+ except Exception:
+ ipinfo_data.append({"ip": ip, "error": "Failed to fetch ipinfo"})
+ result["ipinfo"] = ipinfo_data
+ # Subdomains
+ result["subdomains"] = self._get_subdomains_from_crtsh(domain)
+
+ results.append(result)
+
+ return results
+
+ def postprocess(self, results: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
+ """Post-process the results by adding additional information."""
+ return {"output": {"domains": results}}
diff --git a/flowsint-api/app/scanners/domains/domain_infos_scanner.py b/flowsint-api/app/scanners/domains/domain_infos_scanner.py
deleted file mode 100644
index 6c507860..00000000
--- a/flowsint-api/app/scanners/domains/domain_infos_scanner.py
+++ /dev/null
@@ -1,88 +0,0 @@
-import json
-import uuid
-from typing import Dict, Any, List
-import requests
-import whois
-import pydig
-from app.utils import extract_domain
-from app.scanners.base import Scanner
-
-
-class DomainInfosScanner(Scanner):
- """Scan for subdomains via crt.sh and certificate transparency logs."""
-
- @classmethod
- def name(self) -> str:
- return "domain_infos_scanner"
- @classmethod
- def category(self) -> str:
- return "websites"
- @classmethod
- def key(self) -> str:
- return "url"
-
- def _get_subdomains_from_crtsh(self, domain: str) -> List[str]:
- url = f"https://crt.sh/?q=%25.{domain}&output=json"
- try:
- resp = requests.get(url, timeout=100)
- if resp.status_code != 200:
- return []
-
- data = resp.json()
- subdomains = set()
-
- for entry in data:
- name = entry.get("name_value")
- if name:
- for sub in name.splitlines():
- sub = sub.strip().lower().lstrip('*.')
- if sub.endswith(domain):
- subdomains.add(sub)
-
- return sorted(subdomains)
- except Exception as e:
- return [f"[crt.sh] Error: {str(e)}"]
-
- def scan(self, domain: str) -> Dict[str, Any]:
- report_id = str(uuid.uuid4())
- clean_domain = extract_domain(domain)
- result = {"domain": clean_domain, "report_id": report_id}
-
- # WHOIS info (python-whois)
- try:
- w = whois.whois(clean_domain)
- result["whois_raw"] = json.dumps(w, default=str, indent=2)
- except Exception as e:
- result["whois_raw"] = json.dumps({"error": str(e)})
-
- # DNS lookup (IP) via pydig
- try:
- ips = pydig.query(clean_domain, 'A')
- result["ips"] = ips
- except Exception as e:
- result["ips"] = []
- result["ips_error"] = f"[error] {str(e)}"
-
- # IP Geolocation info via ipinfo.io
- ipinfo_data = []
- for ip in result.get("ips", []):
- try:
- resp = requests.get(f"https://ipinfo.io/{ip}/json", timeout=10)
- ipinfo_data.append(resp.json())
- except Exception:
- ipinfo_data.append({"ip": ip, "error": "Failed to fetch ipinfo"})
- result["ipinfo"] = ipinfo_data
-
- # crt.sh subdomains
- try:
- result["subdomains"] = self._get_subdomains_from_crtsh(clean_domain)
- except Exception as e:
- result["subdomains"] = [f"[crt.sh] Error: {str(e)}"]
-
- return result
-
- def postprocess(self, results: Dict[str, Any]) -> Dict[str, Any]:
- results["scanner"] = "domain_infos_scanner"
- results["count_ips"] = len(results.get("ips", []))
- results["count_subdomains"] = len(results.get("subdomains", []))
- return results
diff --git a/flowsint-api/app/scanners/emails/ghunt.py b/flowsint-api/app/scanners/emails/ghunt.py
new file mode 100644
index 00000000..a687a634
--- /dev/null
+++ b/flowsint-api/app/scanners/emails/ghunt.py
@@ -0,0 +1,88 @@
+import asyncio
+import json
+import uuid
+from typing import Dict, Any, List
+from pathlib import Path
+from app.scanners.base import Scanner
+from app.models.types import OSINTType
+from app.utils import DataType
+import tempfile
+
+class GHuntGmailScanner(Scanner):
+ @classmethod
+ def name(self) -> str:
+ return "ghunt_gmail_scanner"
+
+ @classmethod
+ def category(self) -> str:
+ return "emails"
+
+ @classmethod
+ def key(self) -> str:
+ return "email"
+
+ @classmethod
+ def input_schema(self) -> Dict[str, str]:
+ return { "emails": "array" } # Liste d'emails
+
+ @classmethod
+ def output_schema(self) -> Dict[str, str]:
+ """Defines the structure of the data returned by the scan."""
+ return {
+ "output": "array", # A list of results for each username scan
+ }
+
+ async def scan(self, emails: List[str]) -> List[Dict[str, Any]]:
+ """
+ Effectue la recherche GHunt pour chaque email de la liste.
+ """
+ results = []
+
+ # Création d'un fichier temporaire pour chaque email
+ for email in emails:
+ report_id = str(uuid.uuid4())
+
+ # Création d'un fichier temporaire pour stocker le résultat de la recherche
+ with tempfile.NamedTemporaryFile(delete=False) as temp_file:
+ output_file = temp_file.name
+
+ try:
+ from ghunt.modules import email as email_module
+ # Appel à la fonction asynchrone de GHunt
+ await email_module.hunt(None, email, output_file)
+
+ # Vérification si le fichier de sortie existe et est valide
+ if not Path(output_file).exists():
+ results.append({
+ "email": email,
+ "error": "GHunt did not produce any output file."
+ })
+ continue
+
+ # Lecture des résultats du fichier
+ with open(output_file, "r") as f:
+ scan_results = json.load(f)
+
+ results.append({
+ "email": email,
+ "report_id": report_id,
+ "scanner": self.name(),
+ "results": scan_results
+ })
+
+ except Exception as e:
+ results.append({
+ "email": email,
+ "error": f"Exception during GHunt Gmail scan: {str(e)}"
+ })
+
+ return results
+
+ def postprocess(self, results: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
+ """
+ Ajoute des métadonnées supplémentaires aux résultats.
+ """
+ for result in results:
+ result["scanner"] = "ghunt_gmail"
+ result["count"] = len(result.get("results", {}).get("found", [])) # Ajusté en fonction de la structure de résultats
+ return {"output":results}
diff --git a/flowsint-api/app/scanners/emails/ghunt_gmail_scanner.py b/flowsint-api/app/scanners/emails/ghunt_gmail_scanner.py
deleted file mode 100644
index 37c0adeb..00000000
--- a/flowsint-api/app/scanners/emails/ghunt_gmail_scanner.py
+++ /dev/null
@@ -1,50 +0,0 @@
-import asyncio
-import json
-import uuid
-from typing import Dict, Any
-from pathlib import Path
-from app.scanners.base import Scanner
-
-
-class GHuntGmailScanner(Scanner):
- @classmethod
- def name(self) -> str:
- return "ghunt_gmail_scanner"
- @classmethod
- def category(self) -> str:
- return "emails"
- @classmethod
- def key(self) -> str:
- return "email"
-
- def scan(self, email: str) -> Dict[str, Any]:
- report_id = str(uuid.uuid4())
- report_id = str(uuid.uuid4())
- output_file = Path(f"/tmp/ghunt_{email}_email.json")
- try:
- from ghunt.modules import email as email_module
- asyncio.run(email_module.hunt(None, email, output_file))
- if not output_file.exists():
- return {
- "error": "Maigret did not produce any output file."
- }
-
- results = {}
- with open(output_file, "r") as f:
- results = json.load(f)
- return {
- "email": email,
- "report_id": report_id,
- "scanner": self.name,
- "results": results
- }
- except Exception as e:
- return {"error": f"Exception during GHunt Gmail scan: {str(e)}"}
-
- def postprocess(self, results: Dict[str, Any]) -> Dict[str, Any]:
- """
- Ajoute des métadonnées supplémentaires aux résultats.
- """
- results["scanner"] = "ghunt_gmail"
- results["count"] = len(results.get("found", {}))
- return results
\ No newline at end of file
diff --git a/flowsint-api/app/scanners/emails/holehe.py b/flowsint-api/app/scanners/emails/holehe.py
new file mode 100644
index 00000000..ca621468
--- /dev/null
+++ b/flowsint-api/app/scanners/emails/holehe.py
@@ -0,0 +1,102 @@
+from typing import Dict, Any, List
+from app.scanners.base import Scanner
+from app.models.types import OSINTType
+from app.utils import DataType
+
+class HoleheScanner(Scanner):
+ @classmethod
+ def name(self) -> str:
+ return "holehe_scanner"
+
+ @classmethod
+ def category(self) -> str:
+ return "emails"
+
+ @classmethod
+ def key(self) -> str:
+ return "email"
+
+ @classmethod
+ def input_schema(self) -> Dict[str, str]:
+ return { "emails": "array" } # Liste d'emails
+
+ @classmethod
+ def output_schema(self) -> Dict[str, str]:
+ """Defines the structure of the data returned by the scan."""
+ return {
+ "output": "dict", # A list of results for each username scan
+ }
+
+ async def scan(self, emails: List[str]) -> List[Dict[str, Any]]:
+ """
+ Effectue la recherche Holehe pour chaque email de la liste.
+ """
+ results = []
+ for email in emails:
+ try:
+ result = await self._perform_holehe_research(email)
+ results.append(result)
+ except Exception as e:
+ results.append({"email": email, "error": f"Unexpected error in Holehe scan: {str(e)}"})
+
+ return results
+
+ async def _perform_holehe_research(self, email: str) -> Dict[str, Any]:
+ """
+ Recherche asynchrone sur le réseau social et autres plateformes.
+ """
+ from holehe.modules.social_media import instagram, twitter, snapchat, bitmoji, crevado, discord, strava, imgur, myspace, fanpop, taringa, tellonym, tumblr, odnoklassniki, wattpad, xing, vsco
+ from holehe.modules.shopping import amazon, ebay, deliveroo, garmin, vivino
+ from holehe.modules.mails import google, yahoo, protonmail, mail_ru
+ from holehe.modules.osint import rocketreach
+ import httpx
+
+ # Initialise le client httpx pour les requêtes HTTP asynchrones
+ async with httpx.AsyncClient() as client:
+ results = []
+
+ # Liste des modules à tester
+ modules = [
+ amazon.amazon, google.google, yahoo.yahoo, protonmail.protonmail,
+ instagram.instagram, twitter.twitter, snapchat.snapchat,
+ rocketreach.rocketreach
+ ]
+
+ # Exécution des requêtes pour chaque module
+ for module in modules:
+ module_result = []
+ try:
+ await module(email, client, module_result)
+ if module_result and module_result[0].get("exists") is not None:
+ results.append(module_result[0])
+ except Exception as e:
+ results.append({"error": f"Error in {module.__name__}: {str(e)}"})
+
+ return {"email": email, "results": results}
+
+ def postprocess(self, results: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
+ """
+ Transformation des résultats après le scan.
+ Ajout de la catégorie et des plateformes trouvées.
+ """
+ for result in results:
+ result["scanner"] = "holehe"
+
+ # Ajoute une liste des plateformes dans le résultat
+ if "found" in result and isinstance(result["found"], dict):
+ result["platforms"] = list(result["found"].keys())
+
+ categories = {
+ "social_media": ["instagram", "twitter", "snapchat", "facebook"],
+ "email": ["protonmail", "gmail", "yahoo", "outlook"],
+ "products": ["adobe", "amazon", "spotify", "netflix"]
+ }
+
+ # Classification des plateformes dans les catégories définies
+ result["categories"] = {}
+ for category, platforms in categories.items():
+ result["categories"][category] = [
+ p for p in result["platforms"] if p in platforms
+ ]
+
+ return {"output":results}
diff --git a/flowsint-api/app/scanners/emails/holehe_scanner.py b/flowsint-api/app/scanners/emails/holehe_scanner.py
deleted file mode 100644
index 009314b2..00000000
--- a/flowsint-api/app/scanners/emails/holehe_scanner.py
+++ /dev/null
@@ -1,195 +0,0 @@
-# app/scanners/holehe_scanner.py
-import asyncio
-from typing import Dict, Any
-from app.scanners.base import Scanner
-
-class HoleheScanner(Scanner):
- @classmethod
- def name(self) -> str:
- return "holehe_scanner"
- @classmethod
- def category(self) -> str:
- return "emails"
- @classmethod
- def key(self) -> str:
- return "email"
-
- def scan(self, email: str) -> Dict[str, Any]:
- try:
- # Puisque scan est synchrone mais holehe est asynchrone,
- # nous devons utiliser asyncio.run
- return asyncio.run(self._perform_holehe_research(email))
- except Exception as e:
- return {"error": f"Unexpected error in Holehe scan: {str(e)}"}
-
- async def _perform_holehe_research(self, email: str) -> Dict[str, Any]:
- try:
- from holehe.modules.social_media import instagram, twitter, snapchat, bitmoji, crevado, discord, strava, imgur, myspace, fanpop, taringa, tellonym, tumblr, odnoklassniki, wattpad, xing, vsco
- from holehe.modules.shopping import amazon, armurerieauxerre, naturabuy, envato, deliveroo, ebay, garmin, dominosfr, vivino
- from holehe.modules.mails import google, yahoo, laposte, mail_ru, protonmail
- from holehe.modules.osint import rocketreach
- from holehe.modules.cms import gravatar, atlassian, wordpress, voxmedia
- from holehe.modules.company import aboutme
- from holehe.modules.crm import amocrm, axonaut, zoho, teamleader, insightly, pipedrive, hubspot, nimble, nocrm, nutshell
- from holehe.modules.jobs import coroflot, freelancer, seoclerks
- from holehe.modules.crowfunding import buymeacoffee
- from holehe.modules.forum import babeshows, badeggsonline, biosmods, biotechnologyforums, blackworldforum, blitzortung, bluegrassrivals, thecardboard, therianguide, thevapingforum, cracked_to, onlinesequencer, demonforums, freiberg, koditv, mybb, cambridgemt, chinaphonearena, clashfarmer, codeigniter, cpaelites, cpahero, nattyornot, ndemiccreations, nextpvr
- from holehe.modules.learning import diigo, quora
- from holehe.modules.medias import ello, flickr, komoot, rambler, sporcle
- from holehe.modules.medical import caringbridge, sevencups
- from holehe.modules.music import blip, lastfm, smule, soundcloud, spotify, tunefind
- from holehe.modules.payment import venmo
- from holehe.modules.sport import bodybuilding
- from holehe.modules.porn import pornhub, redtube, xnxx, xvideos
- from holehe.modules.programing import codecademy, codepen, devrant, github, replit, teamtreehouse
- from holehe.modules.productivity import anydo, evernote
- from holehe.modules.products import samsung, eventbrite, nike
- import httpx
- client = httpx.AsyncClient()
- results = []
-
- modules = [
- armurerieauxerre.armurerieauxerre,
- naturabuy.naturabuy,
- garmin.garmin,
- dominosfr.dominosfr,
- deliveroo.deliveroo,
- ebay.ebay,
- vivino.vivino,
- envato.envato,
- amazon.amazon,
- google.google,
- yahoo.yahoo,
- laposte.laposte,
- mail_ru.mail_ru,
- protonmail.protonmail,
- instagram.instagram,
- twitter.twitter,
- snapchat.snapchat,
- bitmoji.bitmoji,
- crevado.crevado,
- discord.discord,
- strava.strava,
- imgur.imgur,
- myspace.myspace,
- fanpop.fanpop,
- taringa.taringa,
- tellonym.tellonym,
- tumblr.tumblr,
- odnoklassniki.odnoklassniki,
- wattpad.wattpad,
- xing.xing,
- vsco.vsco,
- rocketreach.rocketreach,
- gravatar.gravatar,
- atlassian.atlassian,
- wordpress.wordpress,
- voxmedia.voxmedia,
- aboutme.aboutme,
- amocrm.amocrm,
- axonaut.axonaut,
- zoho.zoho,
- teamleader.teamleader,
- insightly.insightly,
- pipedrive.pipedrive,
- hubspot.hubspot,
- nimble.nimble,
- nocrm.nocrm,
- nutshell.nutshell,
- coroflot.coroflot,
- freelancer.freelancer,
- seoclerks.seoclerks,
- buymeacoffee.buymeacoffee,
- babeshows.babeshows,
- badeggsonline.badeggsonline,
- biosmods.biosmods,
- biotechnologyforums.biotechnologyforums,
- blackworldforum.blackworldforum,
- blitzortung.blitzortung,
- bluegrassrivals.bluegrassrivals,
- thecardboard.thecardboard,
- therianguide.therianguide,
- thevapingforum.thevapingforum,
- cracked_to.cracked_to,
- onlinesequencer.onlinesequencer,
- demonforums.demonforums,
- freiberg.freiberg,
- koditv.koditv,
- mybb.mybb,
- cambridgemt.cambridgemt,
- chinaphonearena.chinaphonearena,
- clashfarmer.clashfarmer,
- codeigniter.codeigniter,
- cpaelites.cpaelites,
- cpahero.cpahero,
- nattyornot.nattyornot,
- ndemiccreations.ndemiccreations,
- nextpvr.nextpvr,
- diigo.diigo,
- quora.quora,
- ello.ello,
- flickr.flickr,
- komoot.komoot,
- rambler.rambler,
- sporcle.sporcle,
- caringbridge.caringbridge,
- sevencups.sevencups,
- blip.blip,
- lastfm.lastfm,
- smule.smule,
- soundcloud.soundcloud,
- spotify.spotify,
- tunefind.tunefind,
- venmo.venmo,
- bodybuilding.bodybuilding,
- pornhub.pornhub,
- redtube.redtube,
- xnxx.xnxx,
- xvideos.xvideos,
- codecademy.codecademy,
- codepen.codepen,
- devrant.devrant,
- github.github,
- replit.replit,
- teamtreehouse.teamtreehouse,
- anydo.anydo,
- evernote.evernote,
- samsung.samsung,
- eventbrite.eventbrite,
- nike.nike
- ]
-
- results = []
- for module in modules:
- module_result = []
- try:
- await module(email, client, module_result)
- if module_result and module_result[0].get("exists") is not None:
- results.append(module_result[0])
- except Exception as e:
- results.append({"error": f"Error in {module.__name__}: {str(e)}"})
-
- return {"results": results}
-
- except Exception as e:
- return {"error": f"Error in Holehe research: {str(e)}"}
-
- def postprocess(self, results: Dict[str, Any]) -> Dict[str, Any]:
-
- results["scanner"] = "holehe"
- if "found" in results and isinstance(results["found"], dict):
- results["platforms"] = list(results["found"].keys())
-
- categories = {
- "social_media": ["instagram", "twitter", "snapchat", "facebook"],
- "email": ["protonmail", "gmail", "yahoo", "outlook"],
- "products": ["adobe", "amazon", "spotify", "netflix"]
- }
-
- results["categories"] = {}
- for category, platforms in categories.items():
- results["categories"][category] = [
- p for p in results["platforms"] if p in platforms
- ]
-
- return results
\ No newline at end of file
diff --git a/flowsint-api/app/scanners/leaks/hibp.py b/flowsint-api/app/scanners/leaks/hibp.py
new file mode 100644
index 00000000..6832ea83
--- /dev/null
+++ b/flowsint-api/app/scanners/leaks/hibp.py
@@ -0,0 +1,82 @@
+import json
+import uuid
+from typing import Dict, Any, List
+import hibpwned
+from app.scanners.base import Scanner
+import os
+from dotenv import load_dotenv
+
+# Load environment variables
+load_dotenv()
+
+HIBP_API_KEY = os.getenv("HIBP_API_KEY")
+
+class HibpScanner(Scanner):
+ """Queries HaveIBeenPwned for potential leaks."""
+
+ @classmethod
+ def name(self) -> str:
+ return "hibp_scanner"
+
+ @classmethod
+ def category(self) -> str:
+ return "leaks"
+
+ @classmethod
+ def key(self) -> str:
+ return "email"
+
+ @classmethod
+ def input_schema(self) -> Dict[str, str]:
+ """Defines the parameters expected for the scan."""
+ return {
+ "emails": "array" # Liste d'emails
+ }
+
+ @classmethod
+ def output_schema(self) -> Dict[str, str]:
+ """Defines the structure of the data returned by the scan."""
+ return {
+ "output": "dict", # A list of results for each username scan
+ }
+
+ def scan(self, emails: List[str]) -> List[Dict[str, Any]]:
+ """Performs a search on HaveIBeenPwned for a list of emails."""
+ results = []
+ for email in emails:
+ report_id = str(uuid.uuid4())
+ try:
+ result = hibpwned.Pwned(email, "MyHIBPChecker", HIBP_API_KEY)
+
+ # Clear data structure for results
+ breaches = result.search_all_breaches()
+ pastes = result.search_pastes()
+ password = result.search_password("BadPassword")
+ hashes = result.search_hashes("21BD1")
+
+ email_result = {
+ "email": email,
+ "breaches": breaches if breaches else [],
+ "adobe": result.single_breach("adobe") or {},
+ "data": result.data_classes() or [],
+ "pastes": pastes if pastes else [],
+ "password": password if password else {},
+ "hashes": hashes if hashes else [],
+ "report_id": report_id
+ }
+ results.append(email_result)
+ except Exception as e:
+ results.append({
+ "email": email,
+ "error": f"Error during scan: {str(e)}",
+ "report_id": report_id
+ })
+
+ return results
+
+ def postprocess(self, results: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
+ """Adds additional metadata to the results."""
+ for result in results:
+ result["scanner"] = "hibp_scanner"
+ result["count"] = len(result.get("breaches", [])) # Count the number of breaches
+ return {"output":results}
diff --git a/flowsint-api/app/scanners/leaks/hibp_scanner.py b/flowsint-api/app/scanners/leaks/hibp_scanner.py
deleted file mode 100644
index 6ccc2bd1..00000000
--- a/flowsint-api/app/scanners/leaks/hibp_scanner.py
+++ /dev/null
@@ -1,50 +0,0 @@
-import json
-import uuid
-from typing import Dict, Any
-import hibpwned
-from app.scanners.base import Scanner
-import os
-from dotenv import load_dotenv
-
-load_dotenv()
-
-HIBP_API_KEY = os.getenv("HIBP_API_KEY")
-
-class HibpScanner(Scanner):
- """Queries HaveIBeenPawned for portential leaks."""
-
- @classmethod
- def name(self) -> str:
- return "hibp_scanner"
- @classmethod
- def category(self) -> str:
- return "leaks"
- @classmethod
- def key(self) -> str:
- return "email"
-
- def scan(self, value: str) -> Dict[str, Any]:
- report_id = str(uuid.uuid4())
- try:
- results = hibpwned.Pwned(value, "MyHIBPChecker", HIBP_API_KEY)
- return {
- "breaches": results.search_all_breaches(),
- "breaches" :results.all_breaches(),
- "adobe" :results.single_breach("adobe"),
- "data" :results.data_classes(),
- "pastes" :results.search_pastes(),
- "password" :results.search_password("BadPassword"),
- "hashes" :results.search_hashes("21BD1"),
- "report_id": report_id
- }
- except Exception as e:
- return {
- "error": str(e),
- "report_id": report_id
- }
-
-
- def postprocess(self, results: Dict[str, Any]) -> Dict[str, Any]:
- results["scanner"] = "hibp_scanner"
- results["count"] = len(results)
- return results
diff --git a/flowsint-api/app/scanners/orchestrator.py b/flowsint-api/app/scanners/orchestrator.py
new file mode 100644
index 00000000..abbb7b99
--- /dev/null
+++ b/flowsint-api/app/scanners/orchestrator.py
@@ -0,0 +1,60 @@
+from typing import List, Dict, Any
+from app.scanners.base import Scanner
+from app.scanners.registry import ScannerRegistry
+
+class TransformOrchestrator(Scanner):
+ def __init__(self, scan_id: str, scanner_names: List[str]):
+ super().__init__(scan_id)
+ self.scanner_names = scanner_names
+ self.scanners = []
+
+ def _load_scanners(self) -> List[Scanner]:
+ scanners = []
+ if (self.scanner_names is None) or (len(self.scanner_names) == 0):
+ raise ValueError("No scanners provided")
+ for name in self.scanner_names:
+ if not ScannerRegistry.scanner_exists(name):
+ raise ValueError(f"Scanner '{name}' not found in registry")
+ scanners.append(ScannerRegistry.get_scanner(name, self.scan_id))
+ return scanners
+
+ @classmethod
+ def name(cls) -> str:
+ return "transform_orchestrator"
+
+ @classmethod
+ def category(cls) -> str:
+ return "composite"
+
+ @classmethod
+ def key(cls) -> str:
+ return "value"
+
+ @classmethod
+ def input_schema(cls) -> Dict[str, str]:
+ return {"value": "string"}
+
+ @classmethod
+ def output_schema(cls) -> Dict[str, str]:
+ return {"scanners": "array", "results": "dict"}
+
+ def preprocess(cls) -> Dict[str, Any]:
+ cls.scanners = cls._load_scanners()
+ return True
+
+ def scan(self, value: str) -> Dict[str, Any]:
+ results = {
+ "value": value,
+ "scanners": [],
+ "results": {}
+ }
+
+ for scanner in self.scanners:
+ try:
+ res = scanner.execute(value)
+ results["scanners"].append(scanner.name())
+ results["results"][scanner.name()] = res
+ except Exception as e:
+ results["results"][scanner.name()] = {"error": str(e)}
+
+ return results
diff --git a/flowsint-api/app/scanners/phones/ignorant.py b/flowsint-api/app/scanners/phones/ignorant.py
new file mode 100644
index 00000000..967ad426
--- /dev/null
+++ b/flowsint-api/app/scanners/phones/ignorant.py
@@ -0,0 +1,90 @@
+import asyncio
+from typing import Dict, Any, List
+from app.scanners.base import Scanner
+from app.utils import is_valid_phone_number
+import httpx
+
+class IgnorantScanner(Scanner):
+ @classmethod
+ def name(self) -> str:
+ return "ignorant_scanner"
+
+ @classmethod
+ def category(self) -> str:
+ return "phones"
+
+ @classmethod
+ def key(self) -> str:
+ return "phone_number"
+
+ @classmethod
+ def input_schema(self) -> Dict[str, str]:
+ """Defines the expected input schema for the scan."""
+ return {
+ "phone_numbers": "array" # List of phone numbers to scan
+ }
+
+ @classmethod
+ def output_schema(self) -> Dict[str, str]:
+ """Defines the structure of the data returned by the scan."""
+ return {
+ "output": "dict"
+ }
+
+ async def scan(self, phone_numbers: List[str]) -> List[Dict[str, Any]]:
+ """
+ Performs the Ignorant search for each specified phone number.
+ """
+ results = []
+ for phone in phone_numbers:
+ try:
+ cleaned_phone = is_valid_phone_number(phone)
+ if cleaned_phone:
+ result = await self._perform_ignorant_research(cleaned_phone)
+ results.append(result)
+ else:
+ results.append({
+ "phone_number": phone,
+ "error": "Invalid phone number"
+ })
+ except Exception as e:
+ results.append({
+ "phone_number": phone,
+ "error": f"Unexpected error in Ignorant scan: {str(e)}"
+ })
+ return results
+
+ async def _perform_ignorant_research(self, phone: str) -> Dict[str, Any]:
+ try:
+ # Import necessary modules for each platform
+ from ignorant.modules.shopping.amazon import amazon
+ from ignorant.modules.social_media.instagram import instagram
+ from ignorant.modules.social_media.snapchat import snapchat
+
+ # Create an HTTP client for asynchronous requests
+ async with httpx.AsyncClient() as client:
+ results = []
+ modules = [amazon, snapchat, instagram]
+
+ # Execute the modules in parallel
+ tasks = [module(phone, "+33", client) for module in modules]
+ responses = await asyncio.gather(*tasks)
+
+ # Add results from each module
+ for response in responses:
+ if response:
+ results.append(response)
+
+ return results
+
+ except Exception as e:
+ return {
+ "phone_number": phone,
+ "error": f"Error in Ignorant research: {str(e)}"
+ }
+
+ def postprocess(self, results: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
+ """
+ Adds additional metadata to the results.
+ """
+ return { "output": {"phones": results } }
diff --git a/flowsint-api/app/scanners/phones/ignorant_scanner.py b/flowsint-api/app/scanners/phones/ignorant_scanner.py
deleted file mode 100644
index 01d554bf..00000000
--- a/flowsint-api/app/scanners/phones/ignorant_scanner.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# app/scanners/holehe_scanner.py
-import asyncio
-from typing import Dict, Any
-from app.scanners.base import Scanner
-
-class IgnorantScanner(Scanner):
- @classmethod
- def name(self) -> str:
- return "ignorant_scanner"
- @classmethod
- def category(self) -> str:
- return "phones"
- @classmethod
- def key(self) -> str:
- return "phone_number"
-
- def scan(self, phone: str) -> Dict[str, Any]:
- try:
- return asyncio.run(self._perform_ignorant_research(phone))
- except Exception as e:
- return {"error": f"Unexpected error in Ingorant scan: {str(e)}"}
-
- async def _perform_ignorant_research(self, phone: str) -> Dict[str, Any]:
- try:
- from ignorant.modules.shopping.amazon import amazon
- from ignorant.modules.social_media.instagram import instagram
- from ignorant.modules.social_media.snapchat import snapchat
- import httpx
- client = httpx.AsyncClient()
- results = []
- modules = [
- amazon, snapchat, instagram
- ]
-
- results = []
- for module in modules:
- module_result = []
- try:
- await module(phone, "+33", client, module_result)
- results.append(module_result)
- except Exception as e:
- results.append({"error": f"Error in {module.__name__}: {str(e)}"})
-
- return {"results": results}
-
- except Exception as e:
- return {"error": f"Error in Ignorant research: {str(e)}"}
-
- def postprocess(self, results: Dict[str, Any]) -> Dict[str, Any]:
- results["scanner"] = "ignorant"
- results["count"] = len(results.get("found", {}))
- return results
-
- return results
\ No newline at end of file
diff --git a/flowsint-api/app/scanners/registry.py b/flowsint-api/app/scanners/registry.py
index 67d9072c..5895719f 100644
--- a/flowsint-api/app/scanners/registry.py
+++ b/flowsint-api/app/scanners/registry.py
@@ -1,13 +1,13 @@
from typing import Dict, Type
from app.scanners.base import Scanner
-from app.scanners.usernames.sherlock_scanner import SherlockScanner
-from app.scanners.usernames.maigret_scanner import MaigretScanner
-from app.scanners.emails.holehe_scanner import HoleheScanner
-from app.scanners.domains.domain_infos_scanner import DomainInfosScanner
-from app.scanners.emails.ghunt_gmail_scanner import GHuntGmailScanner
-from app.scanners.phones.ignorant_scanner import IgnorantScanner
-from app.scanners.leaks.hibp_scanner import HibpScanner
+from app.scanners.usernames.sherlock import SherlockScanner
+from app.scanners.usernames.maigret import MaigretScanner
+from app.scanners.emails.holehe import HoleheScanner
+from app.scanners.domains.domain_infos import DomainInfosScanner
+from app.scanners.emails.ghunt import GHuntGmailScanner
+from app.scanners.phones.ignorant import IgnorantScanner
+from app.scanners.leaks.hibp import HibpScanner
class ScannerRegistry:
diff --git a/flowsint-api/app/scanners/usernames/maigret.py b/flowsint-api/app/scanners/usernames/maigret.py
new file mode 100644
index 00000000..756449ef
--- /dev/null
+++ b/flowsint-api/app/scanners/usernames/maigret.py
@@ -0,0 +1,88 @@
+import json
+import subprocess
+import uuid
+from pathlib import Path
+from typing import Dict, Any, List
+from app.utils import is_valid_username
+from app.scanners.base import Scanner
+
+class MaigretScanner(Scanner):
+ """Scans the usernames for associated social accounts using maigret."""
+
+ @classmethod
+ def name(self) -> str:
+ return "maigret_scanner"
+
+ @classmethod
+ def category(self) -> str:
+ return "social_account"
+
+ @classmethod
+ def key(self) -> str:
+ return "username"
+
+ @classmethod
+ def input_schema(self) -> Dict[str, str]:
+ """Defines the expected input schema for the scan."""
+ return {
+ "usernames": "array" # The schema expects an array of usernames
+ }
+
+ @classmethod
+ def output_schema(self) -> Dict[str, str]:
+ """Defines the structure of the data returned by the scan."""
+ return {
+ "output": "dict", # A list of results for each username scan
+ }
+
+ def preprocess(self, usernames: List[str]) -> List[str]:
+ """Validates the list of usernames before scanning."""
+ valid_usernames = [is_valid_username(username) for username in usernames]
+ return valid_usernames
+
+ def scan(self, usernames: List[str]) -> Dict[str, Any]:
+ """Performs the scan using Maigret on the list of usernames."""
+ results_list = [] # List to store scan results for each username
+
+ for username in usernames:
+ folder_output = "/tmp" # Temporary folder to store the output
+ output_file = Path(f"/tmp/report_{username}_simple.json") # Output file path
+
+ try:
+ # Running the Maigret command to perform the scan
+ result = subprocess.run(
+ ["maigret", username, "-J", "simple", "-fo", folder_output],
+ capture_output=True,
+ text=True,
+ timeout=100 # 100 seconds timeout for the scan
+ )
+
+ if result.returncode != 0:
+ results_list.append({
+ "error": f"Maigret failed for {username}: {result.stderr.strip()}"
+ })
+ continue
+
+ if not output_file.exists():
+ results_list.append({
+ "error": f"Maigret did not produce any output file for {username}."
+ })
+ continue
+
+ # Reading the output from the generated JSON file
+ with open(output_file, "r") as f:
+ results = json.load(f)
+ results["username"] = username # Add the username to the results
+
+ results_list.append(results) # Add the result for this username
+
+ except subprocess.TimeoutExpired:
+ results_list.append({"error": f"Maigret scan for {username} timed out."})
+ except Exception as e:
+ results_list.append({"error": f"Unexpected error in Maigret scan for {username}: {str(e)}"})
+
+ return results_list
+
+ def postprocess(self, results: Dict[str, Any]) -> Dict[str, Any]:
+ """Adds additional metadata to the results."""
+ return { "output": results }
diff --git a/flowsint-api/app/scanners/usernames/maigret_scanner.py b/flowsint-api/app/scanners/usernames/maigret_scanner.py
deleted file mode 100644
index ac627168..00000000
--- a/flowsint-api/app/scanners/usernames/maigret_scanner.py
+++ /dev/null
@@ -1,63 +0,0 @@
-import json
-import subprocess
-import uuid
-from pathlib import Path
-from typing import Dict, Any
-
-from app.scanners.base import Scanner
-
-class MaigretScanner(Scanner):
- """Scans the username for associated social accounts using maigret."""
- @classmethod
- def name(self) -> str:
- return "maigret_scanner"
- @classmethod
- def category(self) -> str:
- return "social_account"
- @classmethod
- def key(self) -> str:
- return "username"
-
- def scan(self, username: str) -> Dict[str, Any]:
- report_id = str(uuid.uuid4())
- folder_output = "/tmp"
- output_file = Path(f"/tmp/report_{username}_simple.json")
-
- try:
- result = subprocess.run(
- ["maigret", username, "-J" "simple", "-fo", folder_output],
- capture_output=True,
- text=True,
- timeout=100 # 5 minutes timeout
- )
-
- if result.returncode != 0:
- return {
- "error": f"Maigret failed: {result.stderr.strip()}"
- }
-
- if not output_file.exists():
- return {
- "error": "Maigret did not produce any output file."
- }
-
- results = {}
- with open(output_file, "r") as f:
- results = json.load(f)
-
- return {
- "username": username,
- "report_id": report_id,
- "results": results
- }
-
- except subprocess.TimeoutExpired:
- return {"error": "Maigret scan timed out."}
- except Exception as e:
- return {"error": f"Unexpected error in Maigret scan: {str(e)}"}
-
- def postprocess(self, results: Dict[str, Any]) -> Dict[str, Any]:
-
- results["scanner"] = "maigret"
- results["count"] = len(results.get("found", {}))
- return results
diff --git a/flowsint-api/app/scanners/usernames/sherlock.py b/flowsint-api/app/scanners/usernames/sherlock.py
new file mode 100644
index 00000000..2c26204c
--- /dev/null
+++ b/flowsint-api/app/scanners/usernames/sherlock.py
@@ -0,0 +1,92 @@
+import subprocess
+import uuid
+from pathlib import Path
+from typing import Dict, Any, List
+from app.utils import is_valid_username
+from app.scanners.base import Scanner
+
+class SherlockScanner(Scanner):
+ """Scans the usernames for associated social accounts using Sherlock."""
+
+ @classmethod
+ def name(self) -> str:
+ return "sherlock_scanner"
+
+ @classmethod
+ def category(self) -> str:
+ return "social_account"
+
+ @classmethod
+ def key(self) -> str:
+ return "username"
+
+ @classmethod
+ def input_schema(self) -> Dict[str, str]:
+ """Defines the expected input schema."""
+ return {
+ "usernames": "array" # The schema expects an array of usernames
+ }
+
+ @classmethod
+ def output_schema(self) -> Dict[str, str]:
+ """Defines the structure of the data returned by the scan."""
+ return {
+ "output": "dict", # A list of results for each username scan
+ }
+
+ def preprocess(self, usernames: List[str]) -> List[str]:
+ """Validates the list of usernames before scanning."""
+ valid_usernames = [is_valid_username(username) for username in usernames]
+ return valid_usernames
+
+ def scan(self, usernames: List[str]) -> Dict[str, Any]:
+ """Performs the scan using Sherlock on the list of usernames."""
+ results_list = [] # List to store scan results for each username
+
+ for username in usernames:
+ output_file = Path(f"/tmp/sherlock_{username}.txt") # Output file path
+
+ try:
+ # Running the Sherlock command to perform the scan
+ result = subprocess.run(
+ ["sherlock", username, "-o", str(output_file)],
+ capture_output=True,
+ text=True,
+ timeout=100
+ )
+
+ if result.returncode != 0:
+ results_list.append({
+ "error": f"Sherlock failed for {username}: {result.stderr.strip()}"
+ })
+ continue
+
+ if not output_file.exists():
+ results_list.append({
+ "error": f"Sherlock did not produce any output file for {username}."
+ })
+ continue
+
+ found_accounts = {}
+ with open(output_file, "r") as f:
+ for line in f:
+ line = line.strip()
+ if line and line.startswith("http"):
+ platform = line.split("/")[2] # Example: twitter.com
+ found_accounts[platform] = line
+
+ results_list.append({
+ "username": username,
+ "output": found_accounts
+ })
+
+ except subprocess.TimeoutExpired:
+ results_list.append({"error": f"Sherlock scan for {username} timed out."})
+ except Exception as e:
+ results_list.append({"error": f"Unexpected error in Sherlock scan for {username}: {str(e)}"})
+
+ return results_list
+
+ def postprocess(self, results: Dict[str, Any]) -> Dict[str, Any]:
+ """Adds additional metadata to the results."""
+ return {"output": results}
diff --git a/flowsint-api/app/scanners/usernames/sherlock_scanner.py b/flowsint-api/app/scanners/usernames/sherlock_scanner.py
deleted file mode 100644
index 64ec6cdc..00000000
--- a/flowsint-api/app/scanners/usernames/sherlock_scanner.py
+++ /dev/null
@@ -1,67 +0,0 @@
-import subprocess
-import uuid
-from pathlib import Path
-from typing import Dict, Any
-
-from app.scanners.base import Scanner
-
-class SherlockScanner(Scanner):
- """Scans the username for associated social accounts."""
- @classmethod
- def name(self) -> str:
- return "sherlock_scanner"
- @classmethod
- def category(self) -> str:
- return "social_account"
- @classmethod
- def key(self) -> str:
- return "username"
-
- def scan(self, username: str) -> Dict[str, Any]:
- report_id = str(uuid.uuid4())
- output_file = Path(f"/tmp/sherlock_{report_id}.txt")
-
- try:
- result = subprocess.run(
- ["sherlock", username, "-o", str(output_file)],
- capture_output=True,
- text=True,
- timeout=100 # 5 minutes timeout
- )
-
- if result.returncode != 0:
- return {
- "error": f"Sherlock failed: {result.stderr.strip()}"
- }
-
- if not output_file.exists():
- return {
- "error": "Sherlock did not produce any output file."
- }
-
- found_accounts = {}
- with open(output_file, "r") as f:
- for line in f:
- line = line.strip()
- if line and line.startswith("http"):
- platform = line.split("/")[2] # Extract domain name as platform
- found_accounts[platform] = line
-
- return {
- "username": username,
- "report_id": report_id,
- "results": found_accounts
- }
-
- except subprocess.TimeoutExpired:
- return {"error": "Sherlock scan timed out."}
- except Exception as e:
- return {"error": f"Unexpected error in Sherlock scan: {str(e)}"}
-
- def postprocess(self, results: Dict[str, Any]) -> Dict[str, Any]:
- """
- Ajoute des métadonnées supplémentaires aux résultats.
- """
- results["scanner"] = "sherlock"
- results["count"] = len(results.get("found", {}))
- return results
diff --git a/flowsint-api/app/tasks/scanner.py b/flowsint-api/app/tasks/scanner.py
index 88399909..900c72c6 100644
--- a/flowsint-api/app/tasks/scanner.py
+++ b/flowsint-api/app/tasks/scanner.py
@@ -3,20 +3,22 @@ from app.scanners.registry import ScannerRegistry
import traceback
from celery import states
from app.core.db import get_db
+from typing import List
+
@celery_app.task(name="run_scan", bind=True)
-def run_scan(self, scanner_name: str, value: str, sketch_id: str):
+def run_scan(self, scanner_name: str, values: List[str], sketch_id: str):
db=get_db()
try:
db.table("scans").insert({
"id": self.request.id,
"status": "pending",
"scan_name": scanner_name,
- "value": value,
+ "values": values,
"sketch_id": sketch_id,
"results": []
}).execute()
scanner = ScannerRegistry.get_scanner(scanner_name, self.request.id)
- results = scanner.execute(value)
+ results = scanner.execute(values)
status = "finished" if "error" not in results else "error"
db.table("scans").update({
"status": status,
diff --git a/flowsint-api/app/utils.py b/flowsint-api/app/utils.py
index 8890a7e8..82bc033b 100644
--- a/flowsint-api/app/utils.py
+++ b/flowsint-api/app/utils.py
@@ -1,4 +1,46 @@
from urllib.parse import urlparse
-def extract_domain(url_or_domain: str) -> str:
+from enum import Enum
+import phonenumbers
+from phonenumbers import NumberParseException
+
+from urllib.parse import urlparse
+import re
+
+def is_valid_username(username: str) -> bool:
+ if not re.match(r"^[a-zA-Z0-9_-]{3,30}$", username):
+ raise ValueError(
+ f"Invalid username '{username}': must be 3–30 characters, no spaces, only letters, numbers, - or _."
+ )
+ return username
+
+def is_valid_url(url_or_domain: str) -> str:
+ """
+ Extracts the hostname from a URL or domain-like input.
+ Raises a ValueError if the domain is clearly invalid.
+ """
parsed = urlparse(url_or_domain if "://" in url_or_domain else "http://" + url_or_domain)
- return parsed.hostname or url_or_domain
+ hostname = parsed.hostname or url_or_domain
+ if not hostname or "." not in hostname:
+ raise ValueError(f"Invalid domain: {url_or_domain}")
+ if not re.match(r"^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$", hostname):
+ raise ValueError(f"Malformed domain: {hostname}")
+ return hostname
+
+def is_valid_phone_number(phone: str, region: str = "FR") -> None:
+ """
+ Validates a phone number. Raises InvalidPhoneNumberError if invalid.
+ - `region` should be ISO 3166-1 alpha-2 country code (e.g., 'FR' for France)
+ """
+ try:
+ parsed = phonenumbers.parse(phone, region)
+ if not phonenumbers.is_valid_number(parsed):
+ raise ValueError(f"Invalid phone number: {phone}")
+ except NumberParseException:
+ raise ValueError(f"Invalid phone number: {phone}")
+
+class DataType(str, Enum):
+ STRING = "string"
+ NUMBER = "number"
+ BOOLEAN = "boolean"
+ ARRAY = "array"
+ OBJECT = "object"
diff --git a/flowsint-api/requirements.txt b/flowsint-api/requirements.txt
index 1c73ca24..f2729266 100644
--- a/flowsint-api/requirements.txt
+++ b/flowsint-api/requirements.txt
@@ -1,4 +1,4 @@
-fastapi==0.108.0
+fastapi
redis==5.0.1
supabase==2.13.0
celery==5.3.6
@@ -16,3 +16,4 @@ pydig
ghunt
ignorant
hibpwned
+phonenumbers
\ No newline at end of file
diff --git a/flowsint-api/tests/__init__.py b/flowsint-api/tests/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/flowsint-api/tests/api/__init__.py b/flowsint-api/tests/api/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/flowsint-api/tests/api/test_api.py b/flowsint-api/tests/api/test_api.py
new file mode 100644
index 00000000..967ef27f
--- /dev/null
+++ b/flowsint-api/tests/api/test_api.py
@@ -0,0 +1,87 @@
+from fastapi.testclient import TestClient
+from app.main import app
+
+client = TestClient(app)
+
+def test_start_scan_no_body():
+ body = {}
+ response = client.post("/scan", data=body)
+ assert response.status_code == 403
+ data = response.json()
+ assert(data["detail"] == "Not authenticated")
+ assert data is not None
+
+def test_get_scans_list():
+ response = client.get("/scanners")
+ assert response.status_code == 200
+ data = response.json()
+
+ assert "scanners" in data
+ assert isinstance(data["scanners"], dict)
+ for key in data["scanners"].keys():
+ scanner = data["scanners"][key]
+ assert isinstance(scanner, dict)
+ assert "class_name" in scanner
+ assert "name" in scanner
+ assert "module" in scanner
+ assert "key" in scanner
+
+def test_get_scans_list_for_editor():
+ response = client.get("/transforms/nodes")
+ assert response.status_code == 200
+ data = response.json()
+
+ assert "items" in data
+ assert isinstance(data["items"], dict)
+
+ categories = ["social_account", "emails", "websites", "phones", "leaks"]
+ for category in categories:
+ assert category in data["items"]
+ assert isinstance(data["items"][category], list)
+ assert len(data["items"][category]) > 0
+
+ for scanner in data["items"][category]:
+ assert isinstance(scanner, dict)
+ assert "class_name" in scanner
+ assert "name" in scanner
+ assert "module" in scanner
+ assert "key" in scanner
+
+ assert isinstance(scanner["class_name"], str)
+ assert len(scanner["class_name"]) > 0
+ assert isinstance(scanner["name"], str)
+ assert len(scanner["name"]) > 0
+
+ assert "types" in data["items"]
+ assert isinstance(data["items"]["types"], list)
+ assert len(data["items"]["types"]) > 0
+
+ for osint_type in data["items"]["types"]:
+ assert isinstance(osint_type, dict)
+ assert "name" in osint_type
+ assert "regex" in osint_type
+ assert "description" in osint_type
+
+ assert isinstance(osint_type["regex"], str)
+ assert len(osint_type["regex"]) > 0
+
+
+def test_vaildate_transform_no_scans():
+ body = {"scanners": []}
+ response = client.post("/transforms/validate", json=body)
+ data = response.json()
+ assert(data["valid"] == False)
+ assert(data["reason"] == "No scanners provided")
+
+def test_vaildate_transform_invalid_scans():
+ body = {"scanners": ["sherlock_scanner", "maigret_scanner", "dummy_scanner"]}
+ response = client.post("/transforms/validate", json=body)
+ data = response.json()
+ assert(data["valid"] == False)
+ assert(data["reason"] == "Scanner 'dummy_scanner' not found in registry")
+
+def test_vaildate_transform_valid_scans():
+ body = {"scanners": ["sherlock_scanner", "maigret_scanner", "ignorant_scanner"]}
+ response = client.post("/transforms/validate", json=body)
+ data = response.json()
+ assert(data["valid"] == True)
\ No newline at end of file
diff --git a/flowsint-api/tests/scanners/__init__.py b/flowsint-api/tests/scanners/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/flowsint-api/tests/scanners/test_domain_infos_scanner.py b/flowsint-api/tests/scanners/test_domain_infos_scanner.py
new file mode 100644
index 00000000..9679d9cd
--- /dev/null
+++ b/flowsint-api/tests/scanners/test_domain_infos_scanner.py
@@ -0,0 +1,44 @@
+import pytest
+from app.scanners.domains.domain_infos import DomainInfosScanner
+
+SCAN_ID = "1234567890"
+VALID_DOMAIN = "example.com"
+INVALID_DOMAIN = "thisisnotadomain"
+
+def scanner():
+ return DomainInfosScanner(SCAN_ID)
+
+def test_name(scanner):
+ assert scanner.name() == "domain_infos_scanner"
+
+def test_category(scanner):
+ assert scanner.category() == "websites"
+
+def test_key(scanner):
+ assert scanner.key() == "url"
+
+def test_input_schema(scanner):
+ assert scanner.input_schema() == {"domains": "array"}
+
+def test_output_schema(scanner):
+ assert "output" in scanner.output_schema()
+
[email protected](True, reason="Skip long-running test")
+def test_scan_valid_domain(scanner):
+ results = scanner.execute([VALID_DOMAIN])
+ assert isinstance(results.get("output", {}), dict)
+
+def test_preprocess(scanner):
+ with pytest.raises(ValueError, match="Invalid domain"):
+ scanner.preprocess([INVALID_DOMAIN])
+
+def test_postprocess(scanner):
+ raw_results = [{'domain': 'example.com', 'whois_raw': '', 'subdomains': ['dev.example.com', 'm.example.com']}]
+ enriched = scanner.postprocess(raw_results)
+ assert isinstance(enriched["output"], dict)
+ assert enriched["output"]["domains"][0]["domain"] == "example.com"
+ assert len(enriched["output"]["domains"]) == 1
+ assert isinstance(enriched["output"]["domains"][0]["whois_raw"], str)
+ assert isinstance(enriched["output"]["domains"][0]["subdomains"], list)
+
diff --git a/flowsint-api/tests/scanners/test_ignorant_scanner.py b/flowsint-api/tests/scanners/test_ignorant_scanner.py
new file mode 100644
index 00000000..7ab8c51f
--- /dev/null
+++ b/flowsint-api/tests/scanners/test_ignorant_scanner.py
@@ -0,0 +1,35 @@
+import pytest
+from app.scanners.phones.ignorant import IgnorantScanner
+
+SCAN_ID = "1234567890"
+VALID_PHONE_NUMBER = "0621218225"
+INVALID_PHONE_NUMBER = "WHAT IS THIS #@!$"
+
+def scanner():
+ return IgnorantScanner(SCAN_ID)
+
+def test_name(scanner):
+ assert scanner.name() == "ignorant_scanner"
+
+def test_category(scanner):
+ assert scanner.category() == "phones"
+
+def test_key(scanner):
+ assert scanner.key() == "phone_number"
+
+def test_input_schema(scanner):
+ assert scanner.input_schema() == {"phone_numbers": "array"}
+
+def test_output_schema(scanner):
+ assert "output" in scanner.output_schema()
+
[email protected](True, reason="Skip long-running test")
+def test_scan_valid_username(scanner):
+ results = scanner.execute([VALID_PHONE_NUMBER])
+ assert isinstance(results.get("output", {}), dict)
+
+def test_postprocess(scanner):
+ raw_results = []
+ enriched = scanner.postprocess(raw_results)
+ assert isinstance(enriched.get("output", {}), dict)
diff --git a/flowsint-api/tests/scanners/test_maigret_scanner.py b/flowsint-api/tests/scanners/test_maigret_scanner.py
new file mode 100644
index 00000000..db07fc23
--- /dev/null
+++ b/flowsint-api/tests/scanners/test_maigret_scanner.py
@@ -0,0 +1,53 @@
+import pytest
+from app.scanners.usernames.maigret import MaigretScanner
+
+SCAN_ID = "1234567890"
+VALID_USERNAME = "toto123"
+INVALID_USERNAME = "Wow this is wrong #@!$"
+
+def scanner():
+ return MaigretScanner(SCAN_ID)
+
+def test_name(scanner):
+ assert scanner.name() == "maigret_scanner"
+
+def test_category(scanner):
+ assert scanner.category() == "social_account"
+
+def test_key(scanner):
+ assert scanner.key() == "username"
+
+def test_input_schema(scanner):
+ assert scanner.input_schema() == {"usernames": "array"}
+
+def test_output_schema(scanner):
+ assert "output" in scanner.output_schema()
+
[email protected](True, reason="Skip long-running test")
+def test_scan_valid_username(scanner):
+ results = scanner.execute([VALID_USERNAME])
+ assert isinstance(results.get("output", {}), dict)
+
+def test_postprocess(scanner):
+ raw_results = {
+ "BikeRadar": {
+ "rank": 14858,
+ "site": {
+ "url": "https://forum.bikeradar.com/profile/{username}",
+ "tags": [
+ "forum",
+ "gb",
+ "us"
+ ],
+ "urlMain": "https://forum.bikeradar.com",
+ "alexaRank": 14858,
+ "checkType": "status_code",
+ "usernameClaimed": "adam",
+ "usernameUnclaimed": "noonewouldeverusethis7"
+ }}}
+
+ enriched = scanner.postprocess(raw_results)
+ assert isinstance(enriched["output"], dict)
+
+
diff --git a/flowsint-api/tests/scanners/test_sherlock_scanner.py b/flowsint-api/tests/scanners/test_sherlock_scanner.py
new file mode 100644
index 00000000..cc187ce2
--- /dev/null
+++ b/flowsint-api/tests/scanners/test_sherlock_scanner.py
@@ -0,0 +1,43 @@
+import pytest
+from app.scanners.usernames.sherlock import SherlockScanner
+
+SCAN_ID = "1234567890"
+VALID_USERNAME = "toto123"
+INVALID_USERNAME = "Wow this is wrong #@!$"
+
+def scanner():
+ return SherlockScanner(SCAN_ID)
+
+def test_name(scanner):
+ assert scanner.name() == "sherlock_scanner"
+
+def test_category(scanner):
+ assert scanner.category() == "social_account"
+
+def test_key(scanner):
+ assert scanner.key() == "username"
+
+def test_input_schema(scanner):
+ assert scanner.input_schema() == {"usernames": "array"}
+
+def test_output_schema(scanner):
+ assert "output" in scanner.output_schema()
+
[email protected](True, reason="Skip long-running test")
+def test_scan_valid_username(scanner):
+ results = scanner.execute(VALID_USERNAME)
+ assert isinstance(results.get("output", []), dict)
+
+def test_postprocess(scanner):
+ raw_results = {
+ "x.com":"https://x.com/toto123",
+ "music.yandex":"https://music.yandex/users/toto123/playlists",
+ "www.smule.com":"https://www.smule.com/toto123"
+ }
+
+ enriched = scanner.postprocess(raw_results)
+ assert isinstance(enriched["output"], dict)
+
+
+
diff --git a/flowsint-api/tests/scanners/test_transform_orchestrator b/flowsint-api/tests/scanners/test_transform_orchestrator
new file mode 100644
index 00000000..5baa67e8
--- /dev/null
+++ b/flowsint-api/tests/scanners/test_transform_orchestrator
@@ -0,0 +1,37 @@
+import pytest
+from app.scanners.orchestrator import TransformOrchestrator
+
+VALID_USERNAME = "johnsmith"
+INVALID_SCANNER_NAME = "does_not_exist"
+
+def test_transform_orchestrator_valid_execution():
+ orchestrator = TransformOrchestrator(
+ scan_id="test-scan-123",
+ scanner_names=["sherlock_scanner", "maigret_scanner"]
+ )
+ results = orchestrator.execute(VALID_USERNAME)
+
+ assert results["value"] == VALID_USERNAME
+ assert "scanners" in results
+ assert "results" in results
+ assert "sherlock_scanner" in results["results"]
+ assert "maigret_scanner" in results["results"]
+
+def test_transform_orchestrator_with_invalid_scanner_name():
+ with pytest.raises(ValueError) as exc:
+ TransformOrchestrator(
+ scan_id="test-scan-456",
+ scanner_names=["sherlock_scanner", INVALID_SCANNER_NAME]
+ )
+ assert "not found in registry" in str(exc.value)
+
+def test_transform_orchestrator_output_structure():
+ orchestrator = TransformOrchestrator(
+ scan_id="test-scan-789",
+ scanner_names=["sherlock_scanner"]
+ )
+ results = orchestrator.execute(VALID_USERNAME)
+
+ assert isinstance(results, dict)
+ assert isinstance(results["scanners"], list)
+ assert isinstance(results["results"], dict)
diff --git a/flowsint-web/src/components/sketches/scan-drawer.tsx b/flowsint-web/src/components/sketches/scan-drawer.tsx
index 3e15f070..04241853 100644
--- a/flowsint-web/src/components/sketches/scan-drawer.tsx
+++ b/flowsint-web/src/components/sketches/scan-drawer.tsx
@@ -617,14 +617,15 @@ export function ScanDrawer() {
{currentScan?.status === "pending" ? (
<div className="p-4">
<div>Results are not there yet. They should appear soon.</div>
- </div>
- ) : scanFormat === "holehe" ? (
- <HoleheDrawer />
- ) : scanFormat === "maigret" ? (
- <MaigretDrawer />
- ) : (
- <RawResults />
- )}
+ </div>)
+ // ) : scanFormat === "holehe" ? (
+ // <HoleheDrawer />
+ // ) : scanFormat === "maigret" ? (
+ // <MaigretDrawer />
+ // ) : (
+ : (
+ <RawResults />
+ )}
</>
)}
</DrawerContent>
diff --git a/flowsint-web/src/components/sketches/sketch/nodes/node-context-menu.tsx b/flowsint-web/src/components/sketches/sketch/nodes/node-context-menu.tsx
index fe3d76ba..8c50c53d 100644
--- a/flowsint-web/src/components/sketches/sketch/nodes/node-context-menu.tsx
+++ b/flowsint-web/src/components/sketches/sketch/nodes/node-context-menu.tsx
@@ -24,7 +24,6 @@ import { Button } from "@/components/ui/button"
import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert"
import { AlertCircle } from "lucide-react"
import { NodeNotesEditor } from "./node-notes-editor"
-import { performSearch } from "@/lib/actions/search"
import { nodesTypes } from "@/lib/utils"
import { actionItems, type ActionItem } from "@/lib/action-items"
import { useLaunchSan } from "@/hooks/use-launch-scan"
@@ -275,10 +274,10 @@ const NodeContextMenu = memo(({ x, y, onClose }: NodeContextMenuProps) => {
style={{ top: y, left: x }}
>
{Boolean(currentNode?.data?.email) && (
- <DropdownMenuItem onClick={() => launchScan("email", currentNode?.data?.email as string, sketch_id as string)}>Search {nodeToInsert}</DropdownMenuItem>
+ <DropdownMenuItem onClick={() => launchScan("email", [currentNode?.data?.email as string], sketch_id as string)}>Search {nodeToInsert}</DropdownMenuItem>
)}
{Boolean(currentNode?.data?.username) && (
- <DropdownMenuItem onClick={() => launchScan("username", currentNode?.data?.username as string, sketch_id as string)}>Search {nodeToInsert}</DropdownMenuItem>
+ <DropdownMenuItem onClick={() => launchScan("username", [currentNode?.data?.username as string], sketch_id as string)}>Search {nodeToInsert}</DropdownMenuItem>
)}
{["individual", "organization"].includes(currentNode?.data?.type as string) && (
<DropdownMenuSub>
diff --git a/flowsint-web/src/components/templates/controls.tsx b/flowsint-web/src/components/templates/controls.tsx
index 699e4002..beafd152 100644
--- a/flowsint-web/src/components/templates/controls.tsx
+++ b/flowsint-web/src/components/templates/controls.tsx
@@ -17,7 +17,7 @@ export const FlowControls = memo(({
<Panel position="top-left" className="flex flex-col items-center gap-1">
<FullscreenButton />
</Panel>
- <Panel position="top-right" className="flex items-center gap-1">
+ <Panel position="top-right" className="flex items-center gap-2">
<Tooltip>
<TooltipTrigger asChild>
<Button
diff --git a/flowsint-web/src/components/templates/editor.tsx b/flowsint-web/src/components/templates/editor.tsx
index 46d85949..3844dafe 100644
--- a/flowsint-web/src/components/templates/editor.tsx
+++ b/flowsint-web/src/components/templates/editor.tsx
@@ -198,8 +198,8 @@ const FlowEditor = memo(({ nodesData, initialEdges, initialNodes, theme }: { nod
return (
<ResizablePanelGroup autoSaveId="persistence" direction="horizontal" className="w-screen grow relative overflow-hidden">
- <ResizablePanel defaultSize={20} className="h-full bg-card p-4 overflow-y-auto">
- <div className="h-full">
+ <ResizablePanel defaultSize={20}>
+ <div className="h-[calc(100vh_-_52px)] bg-card p-4 overflow-y-auto">
<div className="relative mb-4">
<Search className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
<Input
diff --git a/flowsint-web/src/hooks/use-launch-scan.ts b/flowsint-web/src/hooks/use-launch-scan.ts
index 1c01d840..694e6e1d 100644
--- a/flowsint-web/src/hooks/use-launch-scan.ts
+++ b/flowsint-web/src/hooks/use-launch-scan.ts
@@ -5,9 +5,9 @@ import { useConfirm } from "@/components/use-confirm-dialog"
import { scans } from "@/lib/utils"
export function useLaunchSan() {
const { confirm } = useConfirm()
- const launchScan = async (scan_name: string, value: string, sketch_id: string) => {
+ const launchScan = async (scan_name: string, values: string[], sketch_id: string) => {
const scan = scans.find((s) => s.name === scan_name)
- if (!value || !scan) {
+ if (!values.length || !scan) {
return toast.error("The item you want to search for was not found.")
}
const confirmed = await confirm({
@@ -15,9 +15,9 @@ export function useLaunchSan() {
message: scan.description,
})
if (!confirmed) return
- toast.promise(performSearch(value, scan.scan_name, sketch_id), {
+ toast.promise(performSearch(values, scan.scan_name, sketch_id), {
loading: "Loading...",
- success: () => `Scan on "${value}" has been launched.`,
+ success: () => `Scan on "${values.join(", ")}" has been launched.`,
error: (error: any) => `An error occurred: ${JSON.stringify(error)}`,
})
}
diff --git a/flowsint-web/src/lib/actions/search.ts b/flowsint-web/src/lib/actions/search.ts
index b5cf1e0f..2915f836 100644
--- a/flowsint-web/src/lib/actions/search.ts
+++ b/flowsint-web/src/lib/actions/search.ts
@@ -1,7 +1,7 @@
'use server'
import { createClient } from "@/lib/supabase/server";
import { scans } from "@/lib/utils";
-export async function performSearch(value: string, scan_name: string, sketch_id: string) {
+export async function performSearch(values: string[], scan_name: string, sketch_id: string) {
const supabase = await createClient()
await supabase.auth.refreshSession()
const { data: { session } } = await supabase.auth.getSession();
@@ -14,7 +14,7 @@ export async function performSearch(value: string, scan_name: string, sketch_id:
const body = JSON.stringify({
scanner: scan.scan_name,
sketch_id: sketch_id,
- value: value
+ values: values
})
const response = await fetch(url, {
method: 'POST',