Skip to content

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

feat: latest commit

dextmorgna2637d51597c
diff --git a/flowsint-api/app/core/celery.py b/flowsint-api/app/core/celery.py
index aeb9c81a..8dc08d80 100644
--- a/flowsint-api/app/core/celery.py
+++ b/flowsint-api/app/core/celery.py
@@ -4,5 +4,5 @@ celery_app = Celery(
"flowsint",
broker="redis://redis:6379/0",
backend="redis://redis:6379/0",
- include=["app.tasks.email_scanner", "app.tasks.username_scanner"]
+ 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 07062d5d..a8085a95 100644
--- a/flowsint-api/app/main.py
+++ b/flowsint-api/app/main.py
@@ -6,52 +6,26 @@ from supabase import Client
app = FastAPI()
-class EmailScanItem(BaseModel):
- email: str
- sketch_id:str
-
-class UsernameScanItem(BaseModel):
- username: str
- sketch_id:str
+class ScanRequest(BaseModel):
+ value: str
+ sketch_id: str
+ scanner: str
[email protected]("/scan/email")
-async def scan(item: EmailScanItem, db: Client = Depends(get_db)):
- task_name = "email_scan"
- assert item.email is not None
- assert item.sketch_id is not None
- task = celery_app.send_task(task_name, args=[item.email])
+async def scan(item: ScanRequest, db: Client = Depends(get_db)):
try:
- response = db.table("scans").insert({
- "id": task.id,
- "status": "pending",
- "scan_name": task_name,
- "value":item.email,
- "sketch_id": item.sketch_id
- }).execute()
- return {"id": task.id, "response": response}
- except Exception as e:
- raise HTTPException(status_code=500, detail=f"Server error: {str(e)}")
-
-
[email protected]("/scan/username")
-async def scan(item: UsernameScanItem, db: Client = Depends(get_db)):
- task_name = "username_scan"
- assert item.username is not None
- assert item.sketch_id is not None
- task = celery_app.send_task(task_name, args=[item.username])
- try:
- response = db.table("scans").insert({
- "id": task.id,
- "status": "pending",
- "scan_name": task_name,
- "value":item.username,
- "sketch_id": item.sketch_id
- }).execute()
- return {"id": task.id, "response": response}
+ assert item.value is not None
+ assert item.sketch_id is not None
+ assert item.scanner is not None
+
+ task = celery_app.send_task("run_scan", args=[item.scanner, item.value])
+
+ return {"id": task.id }
+
except Exception as e:
raise HTTPException(status_code=500, detail=f"Server error: {str(e)}")
@app.get("/health")
async def health():
- return {"status": "ok"}
+ return {"status": "ok"}
\ No newline at end of file
diff --git a/flowsint-api/app/scanners/base.py b/flowsint-api/app/scanners/base.py
new file mode 100644
index 00000000..5a7d98e3
--- /dev/null
+++ b/flowsint-api/app/scanners/base.py
@@ -0,0 +1,40 @@
+# app/scanners/base.py
+from abc import ABC, abstractmethod
+from typing import Dict, Any, Optional
+from supabase import Client
+
+class Scanner(ABC):
+ def __init__(self, scan_id: str):
+ self.scan_id = scan_id
+
+ @property
+ @abstractmethod
+ def name(self) -> str:
+ pass
+
+ @abstractmethod
+ def scan(self, value: str) -> Dict[str, Any]:
+ pass
+
+ def preprocess(self, value: str) -> str:
+ return value
+
+ def postprocess(self, results: Dict[str, Any]) -> Dict[str, Any]:
+ return results
+
+ def execute(self, value: str, db: Optional[Client] = None, sketch_id: Optional[str] = None) -> Dict[str, Any]:
+ preprocessed = self.preprocess(value)
+ results = self.scan(preprocessed)
+ results = self.postprocess(results)
+
+ if db and sketch_id:
+ db.table("scans").insert({
+ "id": self.scan_id,
+ "status": "completed" if "error" not in results else "error",
+ "scan_name": self.name,
+ "value": value,
+ "sketch_id": sketch_id,
+ "data": results
+ }).execute()
+
+ return results
diff --git a/flowsint-api/app/scanners/holehe_scanner.py b/flowsint-api/app/scanners/holehe_scanner.py
new file mode 100644
index 00000000..cd52e239
--- /dev/null
+++ b/flowsint-api/app/scanners/holehe_scanner.py
@@ -0,0 +1,189 @@
+# app/scanners/holehe_scanner.py
+import asyncio
+from typing import Dict, Any
+from app.scanners.base import Scanner
+
+class HoleheScanner(Scanner):
+ @property
+ def name(self) -> str:
+ return "holehe_scanner"
+
+ 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/registry.py b/flowsint-api/app/scanners/registry.py
new file mode 100644
index 00000000..0c0ee0e2
--- /dev/null
+++ b/flowsint-api/app/scanners/registry.py
@@ -0,0 +1,24 @@
+from typing import Dict, Type
+
+from app.scanners.base import Scanner
+from app.scanners.sherlock_scanner import SherlockScanner
+from app.scanners.holehe_scanner import HoleheScanner
+
+class ScannerRegistry:
+
+ _scanners: Dict[str, Type[Scanner]] = {}
+
+ @classmethod
+ def register(cls, scanner_class: Type[Scanner]) -> None:
+
+ instance = scanner_class("")
+ cls._scanners[instance.name] = scanner_class
+
+ @classmethod
+ def get_scanner(cls, name: str, scan_id: str) -> Scanner:
+ if name not in cls._scanners:
+ raise KeyError(f"Scanner '{name}' not found")
+ return cls._scanners[name](scan_id)
+
+ScannerRegistry.register(SherlockScanner)
+ScannerRegistry.register(HoleheScanner)
\ No newline at end of file
diff --git a/flowsint-api/app/scanners/sherlock_scanner.py b/flowsint-api/app/scanners/sherlock_scanner.py
new file mode 100644
index 00000000..f11cfaa8
--- /dev/null
+++ b/flowsint-api/app/scanners/sherlock_scanner.py
@@ -0,0 +1,61 @@
+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."""
+ @property
+ def name(self) -> str:
+ return "sherlock_scanner"
+
+ 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,
+ "found": 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/email_scanner.py b/flowsint-api/app/tasks/email_scanner.py
deleted file mode 100644
index a3fa63dd..00000000
--- a/flowsint-api/app/tasks/email_scanner.py
+++ /dev/null
@@ -1,39 +0,0 @@
-from app.core.db import get_db
-from app.core.celery import celery_app
-import traceback
-import asyncio
-from celery import states
-from app.workers.email_scanner import perform_holehe_research
-
-@celery_app.task(name="email_scan", bind=True)
-def email_scan(self, email: str):
- db = get_db()
- try:
- # Run the Holehe research
- results = asyncio.run(perform_holehe_research(email))
- # Update database with results
- status = "finished" if "error" not in results else "error"
- db.table("scans").update({
- "status": status,
- "results": results
- }).eq("id", self.request.id).execute()
-
- return {"result": results}
-
- except Exception as ex:
- error_logs = traceback.format_exc().split("\n")
- print(f"Error in task: {error_logs}")
-
- db.table("scans").update({
- "status": "error",
- "results": {"error": error_logs}
- }).eq("id", self.request.id).execute()
-
- self.update_state(
- state=states.FAILURE,
- meta={
- "exc_type": type(ex).__name__,
- "exc_message": error_logs,
- },
- )
- raise ex
diff --git a/flowsint-api/app/tasks/username_scanner.py b/flowsint-api/app/tasks/scanner.py
similarity index 75%
rename from flowsint-api/app/tasks/username_scanner.py
rename to flowsint-api/app/tasks/scanner.py
index 471e033b..cdf566a3 100644
--- a/flowsint-api/app/tasks/username_scanner.py
+++ b/flowsint-api/app/tasks/scanner.py
@@ -1,33 +1,29 @@
-from app.core.db import get_db
from app.core.celery import celery_app
-import asyncio
+from app.core.db import get_db
+from app.scanners.registry import ScannerRegistry
import traceback
from celery import states
-from app.workers.username_scanner import perform_sherlock_research
-@celery_app.task(name="username_scan", bind=True)
-def username_scan(self, username: str):
+@celery_app.task(name="run_scan", bind=True)
+def run_scan(self, scanner_name: str, value: str):
db = get_db()
try:
- results = asyncio.run(perform_sherlock_research(username))
-
+ scanner = ScannerRegistry.get_scanner(scanner_name, self.request.id)
+ results = scanner.execute(value)
status = "finished" if "error" not in results else "error"
db.table("scans").update({
"status": status,
"results": results
}).eq("id", self.request.id).execute()
-
return {"result": results}
-
+
except Exception as ex:
error_logs = traceback.format_exc().split("\n")
print(f"Error in task: {error_logs}")
-
db.table("scans").update({
"status": "error",
"results": {"error": error_logs}
}).eq("id", self.request.id).execute()
-
self.update_state(
state=states.FAILURE,
meta={
@@ -35,4 +31,4 @@ def username_scan(self, username: str):
"exc_message": error_logs,
},
)
- raise ex
+ raise ex
\ No newline at end of file
diff --git a/flowsint-api/app/workers/__init__.py b/flowsint-api/app/workers/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/flowsint-api/app/workers/email_scanner.py b/flowsint-api/app/workers/email_scanner.py
deleted file mode 100644
index e4d04941..00000000
--- a/flowsint-api/app/workers/email_scanner.py
+++ /dev/null
@@ -1,157 +0,0 @@
-from typing import Dict, List, Any
-
-# Separate research function using Holehe
-async def perform_holehe_research(email: str) -> List[Dict[str, Any]]:
- """
- Uses Holehe to search for email accounts across multiple websites.
- Returns the results of the search.
- """
- 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
-]
-
- 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"Failed to initialize Holehe: {str(e)}"}
\ No newline at end of file
diff --git a/flowsint-api/app/workers/username_scanner.py b/flowsint-api/app/workers/username_scanner.py
deleted file mode 100644
index 12e82354..00000000
--- a/flowsint-api/app/workers/username_scanner.py
+++ /dev/null
@@ -1,39 +0,0 @@
-import subprocess
-import uuid
-from pathlib import Path
-
-def perform_sherlock_research(username: str) -> dict:
- 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,
- )
-
- if result.returncode != 0:
- raise RuntimeError(f"Sherlock failed:\n{result.stderr.strip()}")
-
- if not output_file.exists():
- raise RuntimeError("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,
- "found": found_accounts
- }
-
- except subprocess.TimeoutExpired:
- raise TimeoutError("Sherlock scan timed out.")
- except Exception as e:
- raise RuntimeError(f"Unexpected error in Sherlock scan: {str(e)}")
diff --git a/flowsint-api/entrypoint.sh b/flowsint-api/entrypoint.sh
index 5fcde455..48ac634c 100755
--- a/flowsint-api/entrypoint.sh
+++ b/flowsint-api/entrypoint.sh
@@ -6,9 +6,7 @@ if [ "$1" = "app" ]; then
exec uvicorn app.main:app --host 0.0.0.0 --port 5000
elif [ "$1" = "celery" ]; then
echo "Démarrage de Celery..."
- exec celery -A app.core.celery worker --loglevel=info
- celery -A celery_app worker --loglevel=info
-
+ exec celery -A app.core.celery worker --loglevel=debug
else
exec "$@"
fi
diff --git a/flowsint-web/src/lib/actions/sketches.ts b/flowsint-web/src/lib/actions/sketches.ts
new file mode 100644
index 00000000..7ac3d0c0
--- /dev/null
+++ b/flowsint-web/src/lib/actions/sketches.ts
@@ -0,0 +1,26 @@
+"use server"
+import { createClient } from "../supabase/server"
+import { redirect } from "next/navigation"
+import { revalidatePath } from "next/cache"
+
+export async function createNewSketch(formData: FormData, investigation_id: string) {
+ const supabase = await createClient()
+ const { data: session, error: userError } = await supabase.auth.getUser()
+ if (userError || !session?.user) {
+ redirect('/login')
+ }
+ const data = {
+ title: formData.get("title"),
+ description: formData.get("description"),
+ }
+ try {
+ const { data: sketch, error } = await supabase.from("sketches").insert({ ...data, owner_id: session?.user?.id, investigation_id }).select("id").single()
+ if (error) throw error
+ revalidatePath("/")
+ return { success: true, id: sketch.id }
+ } catch (error) {
+ if ((error as { code?: string })?.code === "42501")
+ return { success: false, error: "Missing permission to create a new sketch." }
+ return { success: false, error: "Failed to create new sketch." }
+ }
+}
diff --git a/flowsint-web/src/lib/hooks/sketches.ts b/flowsint-web/src/lib/hooks/sketches.ts
new file mode 100644
index 00000000..b0c9410d
--- /dev/null
+++ b/flowsint-web/src/lib/hooks/sketches.ts
@@ -0,0 +1,34 @@
+import { supabase } from "@/lib/supabase/client";
+import { useQuery } from "@supabase-cache-helpers/postgrest-swr";
+
+export function useSketches(investigation_id: string) {
+ const { data: sketches, count, mutate, isLoading, error } = useQuery(
+ supabase
+ .from('sketches')
+ .select('id, title, description')
+ .eq("investigation_id", investigation_id)
+ .order("last_updated_at", { ascending: false }),
+ {
+ revalidateOnFocus: false,
+ revalidateOnReconnect: false,
+ }
+ );
+
+ return { sketches, count, isLoading, refetch: mutate, error };
+}
+
+export function useSketch(sketch_id: string | string[] | undefined) {
+ if (!sketch_id) return { investigation: null }
+ const { data: sketch, mutate, isLoading, error } = useQuery(
+ supabase
+ .from('sketches')
+ .select('id, title, description')
+ .eq("id", sketch_id)
+ .single(),
+ {
+ revalidateOnFocus: false,
+ revalidateOnReconnect: false,
+ }
+ );
+ return { sketch: sketch ?? null, isLoading, refetch: mutate, error };
+}
\ No newline at end of file