Skip to content

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

feat: transform editor

dextmorgndd9c9e60428a
diff --git a/flowsint-api/app/core/celery.py b/flowsint-api/app/core/celery.py
index 8dc08d80..8630b082 100644
--- a/flowsint-api/app/core/celery.py
+++ b/flowsint-api/app/core/celery.py
@@ -2,7 +2,7 @@ from celery import Celery
celery_app = Celery(
"flowsint",
- broker="redis://redis:6379/0",
- backend="redis://redis:6379/0",
+ broker="redis://127.0.0.1:6379/0",
+ backend="redis://127.0.0.1:6379/0",
include=["app.tasks.scanner"]
)
\ No newline at end of file
diff --git a/flowsint-api/app/main.py b/flowsint-api/app/main.py
index b91e98a5..2aedc503 100644
--- a/flowsint-api/app/main.py
+++ b/flowsint-api/app/main.py
@@ -1,6 +1,5 @@
from fastapi import FastAPI, HTTPException, Depends
from pydantic import BaseModel
-
from app.core.celery import celery_app
from app.scanners.registry import ScannerRegistry
from app.core.auth import get_current_user
@@ -20,9 +19,8 @@ async def scan(
try:
if not ScannerRegistry.scanner_exists(name=item.scanner):
raise HTTPException(status_code=400, detail="Scanner not found")
- user_id = user.get("sub")
+ # user_id = user.get("sub")
task = celery_app.send_task("run_scan", args=[item.scanner, item.value, item.sketch_id])
- print(user_id)
return {"id": task.id}
except HTTPException:
raise
@@ -30,6 +28,14 @@ async def scan(
print(e)
raise HTTPException(status_code=500, detail=f"Server error: {str(e)}")
[email protected]("/scanners")
+async def get_scans_list():
+ return {"scans": ScannerRegistry.list()}
+
[email protected]("/transforms/nodes")
+async def get_scans_list():
+ return {"items": ScannerRegistry.list_by_category()}
+
@app.get("/health")
async def health():
return {"status": "ok"}
diff --git a/flowsint-api/app/scanners/base.py b/flowsint-api/app/scanners/base.py
index 289b792d..8f71bc7e 100644
--- a/flowsint-api/app/scanners/base.py
+++ b/flowsint-api/app/scanners/base.py
@@ -5,11 +5,24 @@ class Scanner(ABC):
def __init__(self, scan_id: str):
self.scan_id = scan_id
- @property
+ @classmethod
@abstractmethod
def name(self) -> str:
pass
+ @classmethod
+ @abstractmethod
+ def category(self) -> str:
+ pass
+
+ @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
+ pass
+
@abstractmethod
def scan(self, value: str) -> Dict[str, Any]:
pass
diff --git a/flowsint-api/app/scanners/domains/domain_infos_scanner.py b/flowsint-api/app/scanners/domains/domain_infos_scanner.py
index abc06433..6c507860 100644
--- a/flowsint-api/app/scanners/domains/domain_infos_scanner.py
+++ b/flowsint-api/app/scanners/domains/domain_infos_scanner.py
@@ -11,9 +11,15 @@ from app.scanners.base import Scanner
class DomainInfosScanner(Scanner):
"""Scan for subdomains via crt.sh and certificate transparency logs."""
- @property
+ @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"
@@ -45,9 +51,9 @@ class DomainInfosScanner(Scanner):
# WHOIS info (python-whois)
try:
w = whois.whois(clean_domain)
- result["whois_raw"] = str(w)
+ result["whois_raw"] = json.dumps(w, default=str, indent=2)
except Exception as e:
- result["whois_raw"] = f"[error] {str(e)}"
+ result["whois_raw"] = json.dumps({"error": str(e)})
# DNS lookup (IP) via pydig
try:
diff --git a/flowsint-api/app/scanners/emails/ghunt_gmail_scanner.py b/flowsint-api/app/scanners/emails/ghunt_gmail_scanner.py
new file mode 100644
index 00000000..3a9be84c
--- /dev/null
+++ b/flowsint-api/app/scanners/emails/ghunt_gmail_scanner.py
@@ -0,0 +1,50 @@
+import asyncio
+import json
+import uuid
+from typing import Dict, Any
+from pathlib import Path
+from ghunt.modules import email as email_module
+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:
+ 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_scanner.py b/flowsint-api/app/scanners/emails/holehe_scanner.py
index d3912969..009314b2 100644
--- a/flowsint-api/app/scanners/emails/holehe_scanner.py
+++ b/flowsint-api/app/scanners/emails/holehe_scanner.py
@@ -4,9 +4,15 @@ from typing import Dict, Any
from app.scanners.base import Scanner
class HoleheScanner(Scanner):
- @property
+ @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:
diff --git a/flowsint-api/app/scanners/leaks/hibp_scanner.py b/flowsint-api/app/scanners/leaks/hibp_scanner.py
new file mode 100644
index 00000000..6ccc2bd1
--- /dev/null
+++ b/flowsint-api/app/scanners/leaks/hibp_scanner.py
@@ -0,0 +1,50 @@
+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/phones/ignorant_scanner.py b/flowsint-api/app/scanners/phones/ignorant_scanner.py
new file mode 100644
index 00000000..01d554bf
--- /dev/null
+++ b/flowsint-api/app/scanners/phones/ignorant_scanner.py
@@ -0,0 +1,54 @@
+# 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 97a4be9f..67d9072c 100644
--- a/flowsint-api/app/scanners/registry.py
+++ b/flowsint-api/app/scanners/registry.py
@@ -5,16 +5,18 @@ 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
class ScannerRegistry:
_scanners: Dict[str, Type[Scanner]] = {}
+ @classmethod
@classmethod
def register(cls, scanner_class: Type[Scanner]) -> None:
-
- instance = scanner_class("")
- cls._scanners[instance.name] = scanner_class
+ cls._scanners[scanner_class.name()] = scanner_class
@classmethod
def scanner_exists(cls, name: str) -> bool:
@@ -28,7 +30,40 @@ class ScannerRegistry:
raise Exception(f"Scanner '{name}' not found")
return cls._scanners[name](scan_id)
+ @classmethod
+ def list(cls) -> Dict[str, Dict[str, str]]:
+ return {
+ name: {
+ "class_name": scanner.__name__,
+ "name": scanner.name(),
+ "category": scanner.category(),
+ "module": scanner.__module__,
+ "doc": scanner.__doc__,
+ "key": scanner.key(),
+ }
+ for name, scanner in cls._scanners.items()
+ }
+
+ @classmethod
+ def list_by_category(cls) -> Dict[str, Dict[str, str]]:
+ scanners_by_category = {}
+ for _, scanner in cls._scanners.items():
+ category = scanner.category()
+ if category not in scanners_by_category:
+ scanners_by_category[category] = []
+ scanners_by_category[category].append({
+ "class_name": scanner.__name__,
+ "name": scanner.name(),
+ "module": scanner.__module__,
+ "doc": scanner.__doc__,
+ "key": scanner.key(),
+ })
+ return scanners_by_category
+
ScannerRegistry.register(SherlockScanner)
ScannerRegistry.register(HoleheScanner)
ScannerRegistry.register(MaigretScanner)
-ScannerRegistry.register(DomainInfosScanner)
\ No newline at end of file
+ScannerRegistry.register(DomainInfosScanner)
+ScannerRegistry.register(GHuntGmailScanner)
+ScannerRegistry.register(IgnorantScanner)
+ScannerRegistry.register(HibpScanner)
\ No newline at end of file
diff --git a/flowsint-api/app/scanners/usernames/maigret_scanner.py b/flowsint-api/app/scanners/usernames/maigret_scanner.py
index 68084609..ac627168 100644
--- a/flowsint-api/app/scanners/usernames/maigret_scanner.py
+++ b/flowsint-api/app/scanners/usernames/maigret_scanner.py
@@ -8,9 +8,15 @@ from app.scanners.base import Scanner
class MaigretScanner(Scanner):
"""Scans the username for associated social accounts using maigret."""
- @property
+ @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())
diff --git a/flowsint-api/app/scanners/usernames/sherlock_scanner.py b/flowsint-api/app/scanners/usernames/sherlock_scanner.py
index bd2e9d98..64ec6cdc 100644
--- a/flowsint-api/app/scanners/usernames/sherlock_scanner.py
+++ b/flowsint-api/app/scanners/usernames/sherlock_scanner.py
@@ -7,9 +7,15 @@ from app.scanners.base import Scanner
class SherlockScanner(Scanner):
"""Scans the username for associated social accounts."""
- @property
+ @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())
diff --git a/flowsint-api/requirements.txt b/flowsint-api/requirements.txt
index bce4e919..1c73ca24 100644
--- a/flowsint-api/requirements.txt
+++ b/flowsint-api/requirements.txt
@@ -13,3 +13,6 @@ requests
git+https://github.com/soxoj/maigret
python-whois
pydig
+ghunt
+ignorant
+hibpwned
diff --git a/flowsint-web/src/app/dashboard/sources/page.tsx b/flowsint-web/src/app/dashboard/sources/page.tsx
deleted file mode 100644
index 71df0a9c..00000000
--- a/flowsint-web/src/app/dashboard/sources/page.tsx
+++ /dev/null
@@ -1,69 +0,0 @@
-import React from 'react'
-import { Tool } from "@/types"
-import { ToolCard } from '@/components/tool-card'
-const tools: Tool[] = [
- {
- name: "Maigret",
- path: "/tools/maigret",
- description: "Search for profiles across more than 500 sites based on a username.",
- },
- {
- name: "Holehe",
- path: "/tools/holehe",
- description: "Check if an email address is associated with accounts on various websites.",
- },
- {
- name: "PhoneInfoga",
- path: "/tools/phoneinfoga",
- description: "Gather information from phone numbers.",
- },
- {
- name: "EmailRep",
- path: "/tools/emailrep",
- description: "Analyze the reputation of an email address (scam, social, etc.).",
- },
- {
- name: "Sherlock",
- path: "/tools/sherlock",
- description: "Search for user accounts across social networks.",
- },
- {
- name: "GHunt",
- path: "/tools/ghunt",
- description: "Analyze Google metadata (Gmail, Docs, Photos, etc.).",
- },
- {
- name: "theHarvester",
- path: "/tools/theharvester",
- description: "Collect emails, domain names, IPs from public sources.",
- },
- {
- name: "Sublist3r",
- path: "/tools/sublist3r",
- description: "Enumerate subdomains from a domain name.",
- },
- {
- name: "DnsDumpster",
- path: "/tools/dnsdumpster",
- description: "DNS reconnaissance and network mapping from a domain.",
- },
- {
- name: "ExifTool",
- path: "/tools/exiftool",
- description: "Extract metadata from files (images, documents, etc.).",
- }
-]
-
-const SourcesPage = () => {
- return (
- <div className="w-full space-y-8 container mx-auto py-12 px-8">
- <div className='w-full grid md:grid-cols-3 sm:grid-cols-2 grid-cols-1 lg:grid-cols-4 gap-4'>
- {tools.map((tool) => (
- <ToolCard key={tool.name} tool={tool} />
- ))}
- </div>
- </div>
- )
-}
-
-export default SourcesPage
\ No newline at end of file
diff --git a/flowsint-web/src/app/dashboard/templates/editor/page.tsx b/flowsint-web/src/app/dashboard/templates/editor/page.tsx
new file mode 100644
index 00000000..15611f24
--- /dev/null
+++ b/flowsint-web/src/app/dashboard/templates/editor/page.tsx
@@ -0,0 +1,16 @@
+import TransformEditor from "@/components/templates/editor"
+import { notFound } from "next/navigation"
+
+async function fetchNodes() {
+ const res = await fetch(`${process.env.NEXT_PUBLIC_DOCKER_FLOWSINT_API}/transforms/nodes`, {
+ next: { revalidate: 3600 }
+ })
+ if (!res.ok) {
+ notFound()
+ }
+ return res.json()
+}
+export default async function Editor() {
+ const nodesData = await fetchNodes()
+ return <TransformEditor nodesData={nodesData} />
+}
\ No newline at end of file
diff --git a/flowsint-web/src/app/dashboard/tools/page.tsx b/flowsint-web/src/app/dashboard/tools/page.tsx
new file mode 100644
index 00000000..6e2225ab
--- /dev/null
+++ b/flowsint-web/src/app/dashboard/tools/page.tsx
@@ -0,0 +1,109 @@
+import React from 'react'
+import { Tool } from "@/types"
+import { ToolCard } from '@/components/tool-card'
+const tools: Tool[] = [
+ {
+ name: "Maigret",
+ path: "/tools/maigret",
+ description: "Search for profiles across more than 500 sites based on a username.",
+ active: true,
+ repo: "https://github.com/soxoj/maigret",
+ avatar: "https://raw.githubusercontent.com/soxoj/maigret/main/static/maigret.png"
+ },
+ {
+ name: "Holehe",
+ path: "/tools/holehe",
+ description: "Check if an email address is associated with accounts on various websites.",
+ active: true,
+ repo: "https://github.com/megadose/holehe",
+ avatar: "https://media.licdn.com/dms/image/v2/D560BAQEJNEwF0E6QyA/company-logo_200_200/company-logo_200_200/0/1731244005282/osint_industries_logo?e=1750896000&v=beta&t=2-4rC5YaEp5Rmt48ijR46XhB-Y4iPaQ3qBDQbVNAVFU"
+ },
+ {
+ name: "PhoneInfoga",
+ path: "/tools/phoneinfoga",
+ description: "Gather information from phone numbers.",
+ active: false,
+ repo: "https://github.com/sundowndev/phoneinfoga",
+ },
+ {
+ name: "EmailRep",
+ path: "/tools/emailrep",
+ description: "Analyze the reputation of an email address (scam, social, etc.).",
+ active: false,
+ repo: "https://github.com/sublime-security/emailrep.io",
+ avatar: "https://user-images.githubusercontent.com/11003450/115128085-5805da00-9fa9-11eb-8c7a-dc8b708053ee.png"
+ },
+ {
+ name: "Sherlock",
+ path: "/tools/sherlock",
+ description: "Search for user accounts across social networks.",
+ active: true,
+ repo: "https://github.com/sherlock-project/sherlock",
+ avatar: "https://avatars.githubusercontent.com/u/48293496?s=200&v=4"
+ },
+ {
+ name: "GHunt",
+ path: "/tools/ghunt",
+ description: "Analyze Google metadata (Gmail, Docs, Photos, etc.).",
+ active: true,
+ repo: "https://github.com/mxrch/GHunt",
+ avatar: "https://media.licdn.com/dms/image/v2/D560BAQEJNEwF0E6QyA/company-logo_200_200/company-logo_200_200/0/1731244005282/osint_industries_logo?e=1750896000&v=beta&t=2-4rC5YaEp5Rmt48ijR46XhB-Y4iPaQ3qBDQbVNAVFU"
+ },
+ {
+ name: "theHarvester",
+ path: "/tools/theharvester",
+ description: "Collect emails, domain names, IPs from public sources.",
+ active: false,
+ repo: "https://github.com/laramies/theHarvester",
+ },
+ {
+ name: "Subfinder",
+ path: "/tools/subfinder",
+ description: "Fast passive subdomain enumeration tool.",
+ active: false,
+ repo: "https://github.com/projectdiscovery/subfinder",
+ avatar: "https://avatars.githubusercontent.com/u/50994705?s=280&v=4"
+ },
+ {
+ name: "DnsDumpster",
+ path: "/tools/dnsdumpster",
+ description: "DNS reconnaissance and network mapping from a domain.",
+ active: false,
+ repo: "https://github.com/PaulSec/API-dnsdumpster.com",
+ },
+ {
+ name: "ExifTool",
+ path: "/tools/exiftool",
+ description: "Extract metadata from files (images, documents, etc.).",
+ active: false,
+ repo: "https://github.com/exiftool/exiftool",
+ avatar: "https://avatars.githubusercontent.com/u/8656631?s=200&v=4"
+ },
+ {
+ name: "API Sirene open data",
+ path: "/tools/api-sirene-open-data",
+ description: "The Sirene API allows you to query the Sirene directory of businesses and establishments, managed by Insee.",
+ active: false,
+ repo: "https://www.data.gouv.fr/fr/dataservices/api-sirene-open-data/",
+ avatar: "https://www.portlarochelle.com/wp-content/uploads/2020/11/logo-Marianne.jpg"
+ }
+]
+
+
+const ToolsPage = () => {
+ return (
+ <div className="w-full space-y-8 container mx-auto py-12 px-8">
+ <div>
+ <h1 className="font-semibold text-2xl">Tools</h1>
+ <p className="opacity-60 mt-3">Here are the tools used to gather informations.</p>
+ </div>
+ <div className='w-full grid lg:grid-cols-3 md:grid-cols-2 grid-cols-1 xl:grid-cols-4 gap-4'>
+ {tools.map((tool) => (
+ <ToolCard key={tool.name} tool={tool} />
+ ))}
+ </div>
+ </div>
+ )
+}
+
+export default ToolsPage
\ No newline at end of file
diff --git a/flowsint-web/src/components/dashboard/main-nav.tsx b/flowsint-web/src/components/dashboard/main-nav.tsx
index bade5144..e35c99ee 100644
--- a/flowsint-web/src/components/dashboard/main-nav.tsx
+++ b/flowsint-web/src/components/dashboard/main-nav.tsx
@@ -4,46 +4,70 @@ import Link from "next/link"
import { cn } from "@/lib/utils"
import InvestigationSelector from "../investigations/investigation-selector"
import CaseSelector from "../sketches/case-selector"
-import { useParams } from "next/navigation"
+import { useParams, usePathname } from "next/navigation"
export function MainNav({ className, ...props }: React.HTMLAttributes<HTMLElement>) {
const { sketch_id, investigation_id } = useParams()
+ const pathname = usePathname()
- if (investigation_id) return (
- <div className='flex gap-1 items-center p-2'>
- <InvestigationSelector />{sketch_id && <><span className='opacity-60 text-sm'>
- /</span><CaseSelector /></>
- }
- </div >
- )
+ const isActive = (path: string) => {
+ if (path === "/dashboard") {
+ return pathname === "/dashboard"
+ }
+ return pathname.startsWith(path)
+ }
+
+ if (investigation_id)
+ return (
+ <div className="flex gap-1 items-center p-2">
+ <InvestigationSelector />
+ {sketch_id && (
+ <>
+ <span className="opacity-60 text-sm">/</span>
+ <CaseSelector />
+ </>
+ )}
+ </div>
+ )
return (
<nav className={cn("md:flex hidden w-full items-center space-x-4 lg:space-x-6", className)} {...props}>
<Link
href="/dashboard"
- className="text-sm font-medium transition-colors hover:text-primary bg-muted/50 px-3 py-1.5 rounded-md"
+ className={cn(
+ "text-sm font-medium transition-colors hover:text-primary px-3 py-1.5 rounded-md",
+ isActive("/dashboard") ? "bg-muted/50" : "text-muted-foreground",
+ )}
>
Dashboard
</Link>
<Link
- href="/dashboard/sources"
- className="text-sm font-medium text-muted-foreground transition-colors hover:text-primary px-3 py-1.5 rounded-md"
+ href="/dashboard/tools"
+ className={cn(
+ "text-sm font-medium transition-colors hover:text-primary px-3 py-1.5 rounded-md",
+ isActive("/dashboard/tools") ? "bg-muted/50" : "text-muted-foreground",
+ )}
>
- Sources
+ Tools
</Link>
<Link
href="/dashboard/analysis"
- className="text-sm font-medium text-muted-foreground transition-colors hover:text-primary px-3 py-1.5 rounded-md"
+ className={cn(
+ "text-sm font-medium transition-colors hover:text-primary px-3 py-1.5 rounded-md",
+ isActive("/dashboard/analysis") ? "bg-muted/50" : "text-muted-foreground",
+ )}
>
Analyses
</Link>
<Link
href="/dashboard/templates"
- className="text-sm font-medium text-muted-foreground transition-colors hover:text-primary px-3 py-1.5 rounded-md"
+ className={cn(
+ "text-sm font-medium transition-colors hover:text-primary px-3 py-1.5 rounded-md",
+ isActive("/dashboard/templates") ? "bg-muted/50" : "text-muted-foreground",
+ )}
>
Templates
</Link>
</nav>
)
}
-
diff --git a/flowsint-web/src/components/sketches/sketch-navigation.tsx b/flowsint-web/src/components/sketches/sketch-navigation.tsx
index ef17583f..7719b4b8 100644
--- a/flowsint-web/src/components/sketches/sketch-navigation.tsx
+++ b/flowsint-web/src/components/sketches/sketch-navigation.tsx
@@ -35,13 +35,14 @@ function SketchNavigation({ investigation_id, sketch_id, sketch, user_id }: { in
name: "Map",
href: `/dashboard/investigations/${investigation_id}/sketches/${sketch_id}/map`,
icon: MapIcon,
+ disabled: true,
},
{
id: "timeline",
name: "Timeline",
href: `/dashboard/investigations/${investigation_id}/sketches/${sketch_id}/timeline`,
icon: TimerIcon,
- "disabled": true,
+ disabled: true,
}
], [investigation_id, sketch_id]);
diff --git a/flowsint-web/src/components/sketches/sketch/graph.tsx b/flowsint-web/src/components/sketches/sketch/graph.tsx
index 15ce1cdb..f334ed16 100644
--- a/flowsint-web/src/components/sketches/sketch/graph.tsx
+++ b/flowsint-web/src/components/sketches/sketch/graph.tsx
@@ -82,7 +82,7 @@ const stateSelector = (state: { currentNode: any; setCurrentNode: any; resetNode
})
// Properly memoized FlowControls component
-const FlowControls = memo(({
+export const FlowControls = memo(({
onLayout,
fitView,
handleRefetch,
diff --git a/flowsint-web/src/components/sketches/sketch/profile-panel.tsx b/flowsint-web/src/components/sketches/sketch/profile-panel.tsx
index 654222e9..982ded98 100644
--- a/flowsint-web/src/components/sketches/sketch/profile-panel.tsx
+++ b/flowsint-web/src/components/sketches/sketch/profile-panel.tsx
@@ -13,16 +13,17 @@ import {
} from "@/components/ui/dropdown-menu"
import Link from "next/link"
import { useLaunchSan } from "@/hooks/use-launch-scan"
-
+import { scans } from "@/lib/utils"
export default function ProfilePanel({ data }: { data: any }) {
const { sketch_id, investigation_id } = useParams()
const { launchScan } = useLaunchSan()
+ const scanner = scans.find((scan) => scan.name === data?.type)
return (
<div className=" overflow-y-auto overflow-x-hidden h-full">
<div className="flex items-center sticky bg-card top-0 border-b justify-between px-4 py-2 gap-2 z-50">
<h1 className="text-md font-semibold truncate">{data?.label}</h1>
<div className="flex items-center gap-2">
- {data?.type === "organization" ?
+ {data?.type === "organization" &&
<Link href={`/dashboard/investigations/${investigation_id}/organigrams/${data.id}`}>
<Button
className="relative min-w-[80px] h-8 overflow-hidden truncate bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary transition-all duration-300 px-6 py-2 text-white border-none font-medium rounded-full"
@@ -33,41 +34,19 @@ export default function ProfilePanel({ data }: { data: any }) {
</span>
<span className="absolute inset-0 bg-black opacity-0 hover:opacity-10 transition-opacity duration-300" />
</Button>
- </Link>
- : data?.type === "email" ?
- <Button
- onClick={() => launchScan("email", data?.email, sketch_id as string)}
- disabled={data?.type !== "email"}
- className="relative min-w-[80px] h-8 overflow-hidden truncate bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary transition-all duration-300 px-6 py-2 text-white border-none font-medium rounded-full"
- >
- <span className="flex items-center gap-2">
- <Sparkles className={'h-4 w-4 transition-transform duration-300'} />
- <span>Search</span>
- </span>
- <span className="absolute inset-0 bg-black opacity-0 hover:opacity-10 transition-opacity duration-300" />
- </Button>
- : data?.type === "social" ?
- <Button
- onClick={() => launchScan("username", data?.username, sketch_id as string)}
- disabled={!data?.username}
- className="relative min-w-[80px] h-8 overflow-hidden truncate bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary transition-all duration-300 px-6 py-2 text-white border-none font-medium rounded-full"
- >
- <span className="flex items-center gap-2">
- <Sparkles className={'h-4 w-4 transition-transform duration-300'} />
- <span>Search</span>
- </span>
- <span className="absolute inset-0 bg-black opacity-0 hover:opacity-10 transition-opacity duration-300" />
- </Button> : data?.type === "website" ? <Button
- onClick={() => launchScan("website", data?.url, sketch_id as string)}
- disabled={!data?.url}
- className="relative min-w-[80px] h-8 overflow-hidden truncate bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary transition-all duration-300 px-6 py-2 text-white border-none font-medium rounded-full"
- >
- <span className="flex items-center gap-2">
- <Sparkles className={'h-4 w-4 transition-transform duration-300'} />
- <span>Search</span>
- </span>
- <span className="absolute inset-0 bg-black opacity-0 hover:opacity-10 transition-opacity duration-300" />
- </Button> : null}
+ </Link>}
+ {scanner &&
+ <Button
+ onClick={() => launchScan(scanner.name, data?.[scanner?.key], sketch_id as string)}
+ disabled={!data?.[scanner?.key]}
+ className="relative min-w-[80px] h-8 overflow-hidden truncate bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary transition-all duration-300 px-6 py-2 text-white border-none font-medium rounded-full"
+ >
+ <span className="flex items-center gap-2">
+ <Sparkles className={'h-4 w-4 transition-transform duration-300'} />
+ <span>Search</span>
+ </span>
+ <span className="absolute inset-0 bg-black opacity-0 hover:opacity-10 transition-opacity duration-300" />
+ </Button>}
<DropdownMenu>
<DropdownMenuTrigger asChild><Button variant={"ghost"} size={"icon"}><MoreHorizontalIcon /></Button></DropdownMenuTrigger>
<DropdownMenuContent>
diff --git a/flowsint-web/src/components/templates/controls.tsx b/flowsint-web/src/components/templates/controls.tsx
new file mode 100644
index 00000000..699e4002
--- /dev/null
+++ b/flowsint-web/src/components/templates/controls.tsx
@@ -0,0 +1,79 @@
+import { memo } from "react";
+import { Button } from "@/components/ui/button";
+import { MaximizeIcon, ZoomInIcon, ZoomOutIcon, NetworkIcon, PlayIcon, SaveIcon } from "lucide-react";
+import FullscreenButton from "../full-screen-button";
+import { Panel } from "@xyflow/react";
+import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip";
+export const FlowControls = memo(({
+ handleSaveSimulation,
+ loading,
+ onLayout,
+ fitView,
+ zoomIn,
+ zoomOut,
+}: any) => {
+ return (
+ <>
+ <Panel position="top-left" className="flex flex-col items-center gap-1">
+ <FullscreenButton />
+ </Panel>
+ <Panel position="top-right" className="flex items-center gap-1">
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ disabled
+ >
+ Start simulation<PlayIcon className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>Start simulation</TooltipContent>
+ </Tooltip>
+ <Button
+ variant="outline"
+ disabled={loading}
+ onClick={handleSaveSimulation}
+ >
+ Save transform<SaveIcon className="h-4 w-4" />
+ </Button>
+ </Panel>
+ <Panel position="bottom-left" className="flex flex-col items-center gap-1">
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ size="icon"
+ variant="outline"
+ onClick={() => onLayout()}
+ >
+ <NetworkIcon className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>Auto layout</TooltipContent>
+ </Tooltip>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button size="icon" variant="outline" onClick={fitView}>
+ <MaximizeIcon className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>Center view</TooltipContent>
+ </Tooltip>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button size="icon" variant="outline" onClick={zoomIn}>
+ <ZoomInIcon className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>Zoom in</TooltipContent>
+ </Tooltip>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button size="icon" variant="outline" onClick={() => zoomOut()}>
+ <ZoomOutIcon className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>Zoom out</TooltipContent>
+ </Tooltip>
+ </Panel>
+ </>
+ )
+});
\ No newline at end of file
diff --git a/flowsint-web/src/components/templates/editor.tsx b/flowsint-web/src/components/templates/editor.tsx
new file mode 100644
index 00000000..20aa3553
--- /dev/null
+++ b/flowsint-web/src/components/templates/editor.tsx
@@ -0,0 +1,320 @@
+"use client"
+
+import type React from "react"
+import { useState, useCallback, useRef, useEffect, memo, useMemo } from "react"
+import {
+ ReactFlow,
+ ReactFlowProvider,
+ Panel,
+ Background,
+ type NodeTypes,
+ useNodesState,
+ useEdgesState,
+ addEdge,
+ type Edge,
+ MarkerType,
+ type Node,
+ type OnConnect,
+ type NodeMouseHandler,
+ useReactFlow,
+} from "@xyflow/react"
+import "@xyflow/react/dist/style.css"
+import { Input } from "@/components/ui/input"
+import { X, Search } from "lucide-react"
+import { Button } from "@/components/ui/button"
+import { useTheme } from "next-themes"
+import Loader from "../loader"
+import ScannerNode, { type ScannerNodeData } from "./scanner-node"
+import ScannerItem, { type Scanner } from "./scanner-item"
+import { categoryColors } from "./scanner-data"
+import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "../ui/resizable"
+import { FlowControls } from "./controls"
+import { getDagreLayoutedElements } from "@/lib/utils"
+import { supabase } from "@/lib/supabase/client"
+import { toast } from "sonner"
+import { useRouter } from "next/navigation"
+
+const nodeTypes: NodeTypes = {
+ scanner: ScannerNode,
+}
+
+const FlowEditor = memo(({ nodesData, theme }: { nodesData: { items: any[] }, theme: any }) => {
+ const { fitView, zoomIn, zoomOut, setCenter } = useReactFlow()
+ const [nodes, setNodes, onNodesChange] = useNodesState<any>([])
+ const [edges, setEdges, onEdgesChange] = useEdgesState<Edge<Record<string, unknown>>>([])
+ const [selectedNode, setSelectedNode] = useState<Node<any> | null>(null)
+ const [loading, setLoading] = useState<boolean>(false)
+ const [mounted, setMounted] = useState(false)
+ const [searchTerm, setSearchTerm] = useState("")
+ const reactFlowWrapper = useRef<HTMLDivElement>(null)
+ const [reactFlowInstance, setReactFlowInstance] = useState<any>(null)
+ const router = useRouter()
+
+ useEffect(() => {
+ setMounted(true)
+ }, [])
+
+ // Filter scanners based on search term
+ const filteredScanners = useMemo(() => {
+ const result: Record<string, Scanner[]> = {}
+ if (!searchTerm.trim()) {
+ return nodesData.items
+ }
+ const term = searchTerm.toLowerCase()
+
+ Object.entries(nodesData.items).forEach(([category, items]) => {
+ const filtered = items.filter(
+ (item: any) =>
+ item.name.toLowerCase().includes(term) ||
+ item.class_name.toLowerCase().includes(term) ||
+ (item.doc && item.doc.toLowerCase().includes(term)),
+ )
+
+ if (filtered.length > 0) {
+ result[category] = filtered
+ }
+ })
+
+ return result
+ }, [searchTerm])
+
+ // Connection handler
+ const onConnect: OnConnect = useCallback(
+ (params) =>
+ setEdges((eds) =>
+ addEdge(
+ {
+ ...params,
+ animated: true,
+ style: { stroke: "#64748b" },
+ markerEnd: {
+ type: MarkerType.ArrowClosed,
+ width: 15,
+ height: 15,
+ color: "#64748b",
+ },
+ },
+ eds,
+ ),
+ ),
+ [setEdges],
+ )
+
+ const onDragOver = useCallback((event: React.DragEvent<HTMLDivElement>) => {
+ event.preventDefault()
+ event.dataTransfer.dropEffect = "move"
+ }, [])
+
+ const onDrop = useCallback(
+ (event: React.DragEvent<HTMLDivElement>) => {
+ event.preventDefault()
+ if (!reactFlowWrapper.current || !reactFlowInstance) return
+ const reactFlowBounds = reactFlowWrapper.current.getBoundingClientRect()
+ const scannerData = JSON.parse(event.dataTransfer.getData("application/json")) as Scanner & { category: string }
+ const position = reactFlowInstance.screenToFlowPosition({
+ x: event.clientX - reactFlowBounds.left,
+ y: event.clientY - reactFlowBounds.top,
+ })
+ const newNode: Node<ScannerNodeData> = {
+ id: `${scannerData.name}-${Date.now()}`,
+ type: "scanner",
+ position,
+ data: {
+ ...scannerData,
+ color: categoryColors[scannerData.category] || "#94a3b8",
+ },
+ }
+ setNodes((nds) => nds.concat(newNode))
+ },
+ [reactFlowInstance, setNodes],
+ )
+
+ // Node selection handler
+ const onNodeClick: NodeMouseHandler = useCallback((_, node) => {
+ setSelectedNode(node as Node<ScannerNodeData>)
+ const nodeWidth = node.measured?.width ?? 0;
+ const nodeHeight = node.measured?.height ?? 0;
+ setCenter(
+ node.position.x + nodeWidth / 2,
+ node.position.y + nodeHeight / 2 + 20,
+ {
+ duration: 500,
+ zoom: 1.5,
+ }
+ );
+ }, [setCenter, setSelectedNode])
+
+ // Background click handler (deselection)
+ const onPaneClick = useCallback(() => {
+ setSelectedNode(null)
+ }, [])
+ const onLayout = useCallback(() => {
+ const { nodes: newNodes, edges: newEdges } = getDagreLayoutedElements(nodes, edges, { direction: "LR" });
+ setNodes(newNodes);
+ setEdges(newEdges as Edge<Record<string, unknown>>[]);
+ window.requestAnimationFrame(() => {
+ fitView();
+ });
+ }, [nodes, edges, setNodes, setEdges, fitView, getDagreLayoutedElements]);
+
+ // Node deletion handler
+ const handleDeleteNode = useCallback(() => {
+ if (selectedNode) {
+ setNodes((nodes) => nodes.filter((node) => node.id !== selectedNode.id))
+ setEdges((edges: Edge[]) =>
+ edges.filter((edge) => edge.source !== selectedNode.id && edge.target !== selectedNode.id),
+ )
+ setSelectedNode(null)
+ }
+ }, [selectedNode, setNodes, setEdges])
+
+ const handleSaveSimulation = useCallback(async () => {
+ setLoading(true)
+ try {
+ const { data: newTransfrorm } = await supabase.from("transforms").insert({
+ name: "My Simulation",
+ transform_schema: {
+ nodes, edges
+ }
+ }).select("id").single()
+ toast.success("Simulation saved successfully.")
+ newTransfrorm && router.push(`/transform/${newTransfrorm.id}`)
+ } catch (error) {
+ toast.error("Error saving simulation")
+ } finally {
+ setLoading(false)
+ }
+ }, [setLoading, router, nodes, edges])
+
+ if (!mounted) {
+ return (
+ <div className="grow w-full flex items-center justify-center">
+ <Loader /> Loading...
+ </div>
+ )
+ }
+
+ 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">
+ <div className="relative mb-4">
+ <Search className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
+ <Input
+ type="text"
+ placeholder="Search scanners..."
+ className="pl-8"
+ value={searchTerm}
+ onChange={(e) => setSearchTerm(e.target.value)}
+ />
+ {searchTerm && (
+ <Button
+ variant="ghost"
+ size="icon"
+ className="absolute right-1 top-1.5 h-6 w-6"
+ onClick={() => setSearchTerm("")}
+ >
+ <X className="h-4 w-4" />
+ </Button>
+ )}
+ </div>
+ <div className="space-y-4">
+ {Object.entries(filteredScanners).map(([category, scanners]) => (
+ <div key={category} className="space-y-2">
+ <h3 className="text-sm font-medium capitalize pb-1">{category.replace("_", " ")}</h3>
+ <div className="space-y-2">
+ {scanners.map((scanner: Scanner) => (
+ <ScannerItem
+ key={scanner.name}
+ scanner={scanner}
+ category={category}
+ color={categoryColors[category] || "#94a3b8"}
+ />
+ ))}
+ </div>
+ </div>
+ ))}
+ {Object.keys(filteredScanners).length === 0 && (
+ <div className="text-center py-4 text-muted-foreground">No scanners found matching "{searchTerm}"</div>
+ )}
+ </div>
+ </div>
+ </ResizablePanel>
+ <ResizableHandle withHandle />
+ <ResizablePanel>
+ <div ref={reactFlowWrapper} className="w-full h-full bg-background">
+ <ReactFlow
+ nodes={nodes}
+ edges={edges}
+ onNodesChange={onNodesChange}
+ onEdgesChange={onEdgesChange}
+ onConnect={onConnect}
+ onInit={setReactFlowInstance}
+ onDrop={onDrop}
+ onDragOver={onDragOver}
+ onNodeClick={onNodeClick}
+ onPaneClick={onPaneClick}
+ nodeTypes={nodeTypes}
+ fitView
+ proOptions={{ hideAttribution: true }}
+ colorMode={theme}
+ >
+ <FlowControls loading={loading} handleSaveSimulation={handleSaveSimulation} onLayout={onLayout} fitView={fitView} zoomIn={zoomIn} zoomOut={zoomOut} />
+ <Background bgColor="var(--background)" />
+ {/* Selected node information panel */}
+ {selectedNode && (
+ <Panel position="bottom-right" className="bg-card p-3 rounded-md shadow-md border w-72">
+ <div className="flex justify-between items-start mb-2">
+ <h3 className="font-medium">{selectedNode.data.class_name}</h3>
+ <Button variant="ghost" size="icon" className="h-6 w-6" onClick={handleDeleteNode}>
+ <X className="h-4 w-4" />
+ </Button>
+ </div>
+ <div className="text-sm space-y-2">
+ <p>
+ <span className="font-medium">Module:</span> {selectedNode.data.module}
+ </p>
+ <p>
+ <span className="font-medium">Key:</span> {selectedNode.data.key}
+ </p>
+ {selectedNode.data.doc && (
+ <p>
+ <span className="font-medium">Description:</span> {selectedNode.data.doc}
+ </p>
+ )}
+ </div>
+ </Panel>
+ )}
+ </ReactFlow>
+ </div>
+ </ResizablePanel>
+ </ResizablePanelGroup >
+ )
+})
+
+FlowEditor.displayName = "FlowEditor"
+
+function TransformEditor({ nodesData }: { nodesData: { items: any[] } }) {
+ const [mounted, setMounted] = useState(false);
+ const { resolvedTheme } = useTheme();
+
+ useEffect(() => {
+ setMounted(true);
+ }, []);
+
+ if (!mounted) {
+ return (
+ <div className="grow w-full flex items-center justify-center">
+ <Loader /> Loading...
+ </div>
+ );
+ }
+
+ return (
+ <ReactFlowProvider>
+ <FlowEditor nodesData={nodesData} theme={resolvedTheme || "light"} />
+ </ReactFlowProvider>
+ );
+}
+
+export default memo(TransformEditor);
\ No newline at end of file
diff --git a/flowsint-web/src/components/templates/scanner-data.tsx b/flowsint-web/src/components/templates/scanner-data.tsx
new file mode 100644
index 00000000..228a43d3
--- /dev/null
+++ b/flowsint-web/src/components/templates/scanner-data.tsx
@@ -0,0 +1,25 @@
+// Types for the scanners
+export interface Scanner {
+ class_name: string
+ name: string
+ module: string
+ doc: string | null
+ key: string
+ }
+
+ export interface ScansData {
+ [category: string]: Scanner[]
+ }
+
+ export interface ScannerData {
+ items: ScansData
+ }
+
+ // Colors for each category
+ export const categoryColors: Record<string, string> = {
+ social_account: "#3b82f6", // blue-500
+ emails: "#10b981", // emerald-500
+ websites: "#f59e0b", // amber-500
+ phones: "#8b5cf6", // violet-500
+ leaks: "#ef4444", // red-500
+ }
\ No newline at end of file
diff --git a/flowsint-web/src/components/templates/scanner-item.tsx b/flowsint-web/src/components/templates/scanner-item.tsx
new file mode 100644
index 00000000..7f30dc08
--- /dev/null
+++ b/flowsint-web/src/components/templates/scanner-item.tsx
@@ -0,0 +1,82 @@
+"use client"
+
+import type React from "react"
+import { memo, useCallback } from "react"
+import { Button } from "@/components/ui/button"
+import { Info } from "lucide-react"
+import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"
+
+// Types for the scanner
+export interface Scanner {
+ class_name: string
+ name: string
+ module: string
+ doc: string | null
+ key: string
+}
+
+interface ScannerItemProps {
+ scanner: Scanner
+ category: string
+ color: string
+}
+
+// Custom equality function for ScannerItem
+function areEqual(prevProps: ScannerItemProps, nextProps: ScannerItemProps) {
+ return (
+ prevProps.scanner.class_name === nextProps.scanner.class_name &&
+ prevProps.scanner.name === nextProps.scanner.name &&
+ prevProps.scanner.module === nextProps.scanner.module &&
+ prevProps.scanner.doc === nextProps.scanner.doc &&
+ prevProps.scanner.key === nextProps.scanner.key &&
+ prevProps.category === nextProps.category &&
+ prevProps.color === nextProps.color
+ )
+}
+
+// Memoized scanner item component for the sidebar
+const ScannerItem = memo(({ scanner, category, color }: ScannerItemProps) => {
+ // Handler for drag start - using useCallback to prevent recreation on each render
+ const onDragStart = useCallback(
+ (event: React.DragEvent<HTMLDivElement>) => {
+ const data = { ...scanner, category }
+ event.dataTransfer.setData("application/json", JSON.stringify(data))
+ event.dataTransfer.effectAllowed = "move"
+ },
+ [scanner, category],
+ )
+
+ return (
+ <TooltipProvider>
+ <div
+ draggable
+ onDragStart={onDragStart}
+ className="p-3 rounded-md cursor-grab bg-card border hover:shadow-md transition-shadow"
+ style={{ borderLeftWidth: "4px", borderLeftColor: color, cursor: "grab" }}
+ >
+ <div className="flex justify-between items-start">
+ <div>
+ <h3 className="text-sm font-medium">{scanner.class_name}</h3>
+ <p className="text-xs text-muted-foreground">{scanner.name}</p>
+ </div>
+ {scanner.doc && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button variant="ghost" size="icon" className="h-6 w-6">
+ <Info className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p className="max-w-xs text-xs">{scanner.doc}</p>
+ </TooltipContent>
+ </Tooltip>
+ )}
+ </div>
+ </div>
+ </TooltipProvider>
+ )
+}, areEqual)
+
+ScannerItem.displayName = "ScannerItem"
+
+export default ScannerItem
diff --git a/flowsint-web/src/components/templates/scanner-node.tsx b/flowsint-web/src/components/templates/scanner-node.tsx
new file mode 100644
index 00000000..2f07df62
--- /dev/null
+++ b/flowsint-web/src/components/templates/scanner-node.tsx
@@ -0,0 +1,70 @@
+import { memo } from "react"
+import { Handle, Position } from "@xyflow/react"
+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
+import { Badge } from "@/components/ui/badge"
+
+// Types for the scanner node
+export interface ScannerNodeData extends Record<string, unknown> {
+ class_name: string
+ name: string
+ module: string
+ doc: string | null
+ key: string
+ category: string
+ color: string
+}
+
+interface ScannerNodeProps {
+ data: ScannerNodeData
+ isConnectable?: boolean
+}
+
+// Custom equality function to prevent unnecessary re-renders
+function areEqual(prevProps: ScannerNodeProps, nextProps: ScannerNodeProps) {
+ return (
+ prevProps.data.class_name === nextProps.data.class_name &&
+ prevProps.data.name === nextProps.data.name &&
+ prevProps.data.module === nextProps.data.module &&
+ prevProps.data.doc === nextProps.data.doc &&
+ prevProps.data.key === nextProps.data.key &&
+ prevProps.data.category === nextProps.data.category &&
+ prevProps.data.color === nextProps.data.color &&
+ prevProps.isConnectable === nextProps.isConnectable
+ )
+}
+
+// Memoized scanner node component with custom equality check
+const ScannerNode = memo(({ data, isConnectable }: ScannerNodeProps) => {
+ return (
+ <div className="relative">
+ <Card className="w-64 shadow-md border-l-2" style={{ borderLeftColor: data.color }}>
+ <CardHeader className="p-3 pb-0">
+ <div className="flex justify-between items-start">
+ <div>
+ <CardTitle className="text-sm font-medium">{data.class_name}</CardTitle>
+ <CardDescription className="text-xs">{data.name}</CardDescription>
+ </div>
+ <Badge variant="outline" className="text-xs">
+ {data.category || "unknown"}
+ </Badge>
+ </div>
+ </CardHeader>
+ <CardContent className="p-3 pt-1">
+ {data.doc && <p className="text-xs text-muted-foreground mb-2">{data.doc}</p>}
+ <div className="flex items-center gap-2">
+ <Badge variant="secondary" className="text-xs">
+ Key: {data.key}
+ </Badge>
+ </div>
+ </CardContent>
+ </Card>
+ <Handle type="source" position={Position.Right} className="w-3 h-3 bg-gray-400" isConnectable={isConnectable} />
+ <Handle type="target" position={Position.Left} className="w-3 h-3 bg-gray-400" isConnectable={isConnectable} />
+
+ </div>
+ )
+}, areEqual)
+
+ScannerNode.displayName = "ScannerNode"
+
+export default ScannerNode
diff --git a/flowsint-web/src/components/tool-card.tsx b/flowsint-web/src/components/tool-card.tsx
index b511d822..814138df 100644
--- a/flowsint-web/src/components/tool-card.tsx
+++ b/flowsint-web/src/components/tool-card.tsx
@@ -1,9 +1,9 @@
-import Link from "next/link"
import { Terminal } from "lucide-react"
-
-import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
+import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Badge } from "@/components/ui/badge"
import type { Tool } from "@/types"
+import { cn } from "@/lib/utils"
+import { Avatar, AvatarImage } from "./ui/avatar"
interface ToolCardProps {
tool: Tool
@@ -11,24 +11,32 @@ interface ToolCardProps {
export function ToolCard({ tool }: ToolCardProps) {
return (
- <Card className="flex flex-col shadow-none bg-card rounded-md">
+ <Card className="flex flex-col shadow-none bg-card rounded-md relative">
<CardHeader>
<CardTitle className="flex items-center gap-2">
- <Terminal className="h-5 w-5" />
+ {tool.avatar ?
+ <Avatar
+ className={cn(
+ 'h-8 w-8',
+ "border-2 border bg-background relative",
+ "transition-transform",
+ "ring-0 ring-offset-0",
+ )}
+ >
+ <AvatarImage src={tool.avatar} alt={tool.name} />
+ </Avatar> :
+ <Terminal className="h-5 w-5" />}
{tool.name}
</CardTitle>
</CardHeader>
<CardContent className="flex-1">
{tool.description && <p className="text-sm text-muted-foreground">{tool.description}</p>}
</CardContent>
- {/* <CardFooter>
- <a href={tool?.url || "#"} className="w-full">
- <Badge variant="secondary" className="w-full justify-center">
- View Details
- </Badge>
- </a>
- </CardFooter> */}
- </Card>
+ <div className="absolute top-2 right-2">
+ {tool.active ? <Badge className="bg-green-500/15 text-green-500 text-xs shadow-none border-green-500/30">Active</Badge> :
+ <Badge className="bg-orange-500/15 text-orange-500 text-xs shadow-none border-orange-500/30">Coming soon</Badge>}
+ </div>
+ </Card >
)
}
diff --git a/flowsint-web/src/lib/actions/search.ts b/flowsint-web/src/lib/actions/search.ts
index 3b49da89..b5cf1e0f 100644
--- a/flowsint-web/src/lib/actions/search.ts
+++ b/flowsint-web/src/lib/actions/search.ts
@@ -26,67 +26,6 @@ export async function performSearch(value: string, scan_name: string, sketch_id:
},
);
const resp = await response.json()
- console.log(resp)
if (response.status !== 200) throw Error(`Error: received status ${response.status}`)
return { ...resp, status: response.status };
-}
-
-
-async function checkBreachedAccount(account: string | number | boolean, apiKey: string, appName: string) {
- const url = `https://haveibeenpwned.com/api/v3/breachedaccount/${encodeURIComponent(account)}?truncateResponse=false`;
- const supabase = await createClient()
- try {
- const response = await fetch(url, {
- method: 'GET',
- headers: {
- 'hibp-api-key': apiKey,
- 'user-agent': appName
- }
- });
-
- if (response.ok) {
- const data = await response.json() as any[];
- for (const breach of data) {
- // insert a new breach if not exist
- const { error } = await supabase.from('breaches').upsert({
- name: breach.Name, description: breach.Description, raw_content: breach
- }, { onConflict: 'name' })
- if (error) return error
- // then get the breach and upsert a new relation with account
- const { data: br, error: breachError } = await supabase.from('breaches')
- .select('id')
- .eq("name", breach.Name).single()
- if (breachError) return breachError
- if (br) {
- // finally insert new relation between account and breach
- const { error: relationError } = await supabase.from('accounts_breaches').upsert({
- account: account, breach_id: br.id
- }, {
- onConflict: 'account,breach_id'
- })
- if (relationError) return relationError
- }
-
- }
- return data;
- } else if (response.status === 404) {
- return `Good news! Account ${account} hasn't been found in any breaches.`;
- } else {
- return `Error: ${response.status} - ${response.statusText}`;
- }
- } catch (error) {
- console.error('An error occurred:', error);
- return null;
- }
-}
-
-const apiKey = process.env.HIBP_API_KEY || ""
-const appName = 'MyHIBPChecker';
-
-export async function investigateHIBPwd(username: string) {
- if (!username) {
- throw new Error("Malformed query.")
- }
- return checkBreachedAccount(username, apiKey, appName);
-
}
\ No newline at end of file
diff --git a/flowsint-web/src/lib/utils.ts b/flowsint-web/src/lib/utils.ts
index abed7d69..06257eba 100644
--- a/flowsint-web/src/lib/utils.ts
+++ b/flowsint-web/src/lib/utils.ts
@@ -516,18 +516,33 @@ export function encodedRedirect(
export const scans = [
{
name: "email",
- scan_name: "holehe_scanner",
- description: "Check if an email address is associated with existing online accounts using Holehe."
+ scan_name: "hibp_scanner",
+ description: "Check if an email address is associated with existing online accounts using Holehe.",
+ key: "email"
},
{
name: "username",
scan_name: "maigret_scanner",
- description: "Search for social media and online platform accounts associated with a given username using Maigret."
+ description: "Search for social media and online platform accounts associated with a given username using Maigret.",
+ key: "username"
},
{
name: "website",
scan_name: "domain_infos_scanner",
- description: "Gather public information about a domain, including IP addresses, WHOIS data, geolocation, and subdomains."
+ description: "Gather public information about a domain, including IP addresses, WHOIS data, geolocation, and subdomains.",
+ key: "url"
+ },
+ {
+ name: "individual",
+ scan_name: "ghunt_people_scanner",
+ description: "",
+ key: "full_name"
+ },
+ {
+ name: "phone",
+ scan_name: "ignorant_scanner",
+ description: "",
+ key: "phone_number"
}
]
diff --git a/flowsint-web/src/store/sketch-store.ts b/flowsint-web/src/store/sketch-store.ts
index 726bfe17..9821f547 100644
--- a/flowsint-web/src/store/sketch-store.ts
+++ b/flowsint-web/src/store/sketch-store.ts
@@ -46,8 +46,6 @@ interface SketchState {
}
}
-const isServer = typeof window === "undefined"
-
export const useSketchStore = create(
persist<SketchState>(
(set, get) => ({
diff --git a/flowsint-web/src/types/index.ts b/flowsint-web/src/types/index.ts
index dc8dbfb7..c22ab308 100644
--- a/flowsint-web/src/types/index.ts
+++ b/flowsint-web/src/types/index.ts
@@ -33,7 +33,10 @@ export type InvestigationGraph = {
export interface Tool {
name: string
path: string
- description?: string
+ description?: string,
+ active: boolean
+ repo?: string
+ avatar?: string
}
export interface ToolCategory {