Skip to content

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

feat: missing files

dextmorgn870a9abf1d3a
diff --git a/.gitignore b/.gitignore
index 1800114d..966cb107 100644
--- a/.gitignore
+++ b/.gitignore
@@ -171,4 +171,6 @@ cython_debug/
.ruff_cache/
# PyPI configuration file
-.pypirc
\ No newline at end of file
+.pypirc
+
+/certs
\ No newline at end of file
diff --git a/docker-compose.override.yml b/docker-compose.override.yml
index 3bd79b86..f9852fc5 100644
--- a/docker-compose.override.yml
+++ b/docker-compose.override.yml
@@ -10,11 +10,17 @@ services:
- "--providers.docker"
- "--entrypoints.ws.address=:80"
- "--providers.file.watch=true"
+ - "--entryPoints.websecure.address=:443"
+ - "--entrypoints.websecure.http.tls.certresolver=myresolver"
+ - "--providers.file.filename=/etc/traefik/dynamic.yml"
ports:
- "80:80"
+ - "443:443"
- "8080:8080"
restart: unless-stopped
volumes:
+ - ./certs:/etc/traefik/certs
+ - ./dynamic.yml:/etc/traefik/dynamic.yml
- /var/run/docker.sock:/var/run/docker.sock
networks:
- traefik
@@ -35,6 +41,7 @@ services:
- "traefik.enable=true"
- "traefik.http.routers.nextjs.rule=Host(`app.flowsint.localhost`)"
- "traefik.http.services.nextjs.loadbalancer.server.port=3000"
+ - "traefik.http.routers.nextjs.entrypoints=websecure"
# Flask-like application with Celery
api:
@@ -57,6 +64,7 @@ services:
- "traefik.enable=true"
- "traefik.http.routers.app.rule=Host(`api.flowsint.localhost`)"
- "traefik.http.services.app.loadbalancer.server.port=5000"
+ - "traefik.http.routers.app.entrypoints=websecure"
celery:
build:
diff --git a/docker-compose.yml b/docker-compose.yml
index 9c719b32..52837c8d 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -10,11 +10,17 @@ services:
- "--providers.docker"
- "--entrypoints.ws.address=:80"
- "--providers.file.watch=true"
+ - "--entryPoints.websecure.address=:443"
+ - "--entrypoints.websecure.http.tls.certresolver=myresolver"
+ - "--providers.file.filename=/etc/traefik/dynamic.yml"
ports:
- "80:80"
+ - "443:443"
- "8080:8080"
restart: unless-stopped
volumes:
+ - ./certs:/etc/traefik/certs
+ - ./dynamic.yml:/etc/traefik/dynamic.yml
- /var/run/docker.sock:/var/run/docker.sock
networks:
- traefik
@@ -35,6 +41,7 @@ services:
- "traefik.enable=true"
- "traefik.http.routers.nextjs.rule=Host(`app.flowsint.localhost`)"
- "traefik.http.services.nextjs.loadbalancer.server.port=3000"
+ - "traefik.http.routers.nextjs.entrypoints=websecure"
# Flask-like application with Celery
api:
@@ -57,6 +64,7 @@ services:
- "traefik.enable=true"
- "traefik.http.routers.app.rule=Host(`api.flowsint.localhost`)"
- "traefik.http.services.app.loadbalancer.server.port=5000"
+ - "traefik.http.routers.app.entrypoints=websecure"
celery:
build:
@@ -122,6 +130,7 @@ services:
- "traefik.enable=true"
- "traefik.http.routers.studio.rule=Host(`studio.flowsint.localhost`)"
- "traefik.http.services.studio.loadbalancer.server.port=3000"
+ - "traefik.http.routers.studio.entrypoints=websecure"
kong:
container_name: supabase-kong
@@ -153,6 +162,7 @@ services:
- "traefik.enable=true"
- "traefik.http.routers.kong.rule=Host(`kong.flowsint.localhost`)"
- "traefik.http.services.kong.loadbalancer.server.port=8000"
+ - "traefik.http.routers.kong.entrypoints=websecure"
auth:
container_name: supabase-auth
@@ -391,6 +401,7 @@ services:
- "traefik.enable=true"
- "traefik.http.routers.functions.rule=Host(`functions.flowsint.localhost`)"
- "traefik.http.services.functions.loadbalancer.server.port=9000"
+ - "traefik.http.routers.functions.entrypoints=websecure"
analytics:
container_name: supabase-analytics
diff --git a/dynamic.yml b/dynamic.yml
new file mode 100644
index 00000000..76240eae
--- /dev/null
+++ b/dynamic.yml
@@ -0,0 +1,6 @@
+tls:
+ certificates:
+ - certFile: '/etc/traefik/certs/localhost.flowsint.*.cert.pem'
+ keyFile: '/etc/traefik/certs/localhost.flowsint.*.key.pem'
+ stores:
+ - default
diff --git a/flowsint-api/.gitignore b/flowsint-api/.gitignore
index 1800114d..103f4bba 100644
--- a/flowsint-api/.gitignore
+++ b/flowsint-api/.gitignore
@@ -14,7 +14,7 @@ dist/
downloads/
eggs/
.eggs/
-lib/
+# lib/
lib64/
parts/
sdist/
diff --git a/flowsint-web/package.json b/flowsint-web/package.json
index b5734efb..5dd9134f 100644
--- a/flowsint-web/package.json
+++ b/flowsint-web/package.json
@@ -125,4 +125,4 @@
"@tailwindcss/oxide-linux-x64-gnu": "^4.0.1",
"lightningcss-linux-x64-gnu": "^1.29.1"
}
-}
+}
\ No newline at end of file
diff --git a/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/individuals/data-table.tsx b/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/individuals/data-table.tsx
index 1f9ab470..734d2835 100644
--- a/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/individuals/data-table.tsx
+++ b/flowsint-web/src/app/dashboard/projects/[project_id]/investigations/[investigation_id]/individuals/data-table.tsx
@@ -36,8 +36,6 @@ import {
useReactTable,
} from "@tanstack/react-table"
import {
- CheckCircle2Icon,
- CheckCircleIcon,
ChevronDownIcon,
ChevronLeftIcon,
ChevronRightIcon,
@@ -45,25 +43,14 @@ import {
ChevronsRightIcon,
ColumnsIcon,
GripVerticalIcon,
- LoaderIcon,
MoreVerticalIcon,
PlusIcon,
RotateCwIcon,
- TrendingUpIcon,
+ UserIcon,
} from "lucide-react"
-import { Area, AreaChart, CartesianGrid, XAxis } from "recharts"
-import { toast } from "sonner"
import { z } from "zod"
-
-import { useIsMobile } from "@/hooks/use-mobile"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
-import {
- ChartConfig,
- ChartContainer,
- ChartTooltip,
- ChartTooltipContent,
-} from "@/components/ui/chart"
import { Checkbox } from "@/components/ui/checkbox"
import {
DropdownMenu,
@@ -73,7 +60,6 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
-import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import {
Select,
@@ -82,15 +68,11 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select"
-import { Separator } from "@/components/ui/separator"
import {
Sheet,
SheetClose,
SheetContent,
- SheetDescription,
SheetFooter,
- SheetHeader,
- SheetTitle,
SheetTrigger,
} from "@/components/ui/sheet"
import {
@@ -110,18 +92,9 @@ import {
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { formatDistanceToNow } from "date-fns"
import { cn } from "@/lib/utils"
+import { TypeBadge } from "@/components/type-badge"
+import { DialogTitle } from "@radix-ui/react-dialog"
-export const schema = z.object({
- id: z.number(),
- header: z.string(),
- type: z.string(),
- status: z.string(),
- target: z.string(),
- limit: z.string(),
- reviewer: z.string(),
-})
-
-// Create a separate component for the drag handle
function DragHandle({ id }: { id: number }) {
const { attributes, listeners } = useSortable({
id,
@@ -141,7 +114,7 @@ function DragHandle({ id }: { id: number }) {
)
}
-const columns: ColumnDef<z.infer<typeof schema>>[] = [
+const columns: ColumnDef<any>[] = [
{
id: "drag",
header: () => null,
@@ -182,13 +155,23 @@ const columns: ColumnDef<z.infer<typeof schema>>[] = [
<div className="flex items-center gap-2">
<Avatar className="h-7 w-7">
<AvatarImage src={row.original.image_url} alt={row.original.full_name} />
- <AvatarFallback>{row.original.full_name[0]}</AvatarFallback>
+ <AvatarFallback>
+ <UserIcon className="h-4 w-4 opacity-60" />
+ </AvatarFallback>
</Avatar>{row.original.full_name}
</div>
</TableCellViewer>)
},
enableHiding: false,
},
+ {
+ accessorKey: "type",
+ header: "Type",
+ cell: ({ row }: any) => {
+ return <TypeBadge type={"individual"} />
+ },
+ enableHiding: false,
+ },
{
accessorKey: "email",
header: "Email(s)",
@@ -280,7 +263,7 @@ const columns: ColumnDef<z.infer<typeof schema>>[] = [
},
]
-function DraggableRow({ row }: { row: Row<z.infer<typeof schema>> }) {
+function DraggableRow({ row }: { row: Row<any> }) {
const { transform, transition, setNodeRef, isDragging } = useSortable({
id: row.original.id,
})
@@ -313,7 +296,7 @@ export function DataTable({
refetch,
isRefetching
}: {
- data: z.infer<typeof schema>[],
+ data: any[],
pageCount: number
pagination: any
setPagination: any
@@ -616,29 +599,7 @@ export function DataTable({
)
}
-const chartData = [
- { month: "January", desktop: 186, mobile: 80 },
- { month: "February", desktop: 305, mobile: 200 },
- { month: "March", desktop: 237, mobile: 120 },
- { month: "April", desktop: 73, mobile: 190 },
- { month: "May", desktop: 209, mobile: 130 },
- { month: "June", desktop: 214, mobile: 140 },
-]
-
-const chartConfig = {
- desktop: {
- label: "Desktop",
- color: "var(--primary)",
- },
- mobile: {
- label: "Mobile",
- color: "var(--primary)",
- },
-} satisfies ChartConfig
-
-function TableCellViewer({ item, children }: { item: z.infer<typeof schema>, children: React.ReactNode }) {
- const isMobile = useIsMobile()
-
+function TableCellViewer({ item, children }: { item: any, children: React.ReactNode }) {
return (
<Sheet>
<SheetTrigger asChild>
@@ -646,146 +607,16 @@ function TableCellViewer({ item, children }: { item: z.infer<typeof schema>, chi
{children}
</Button>
</SheetTrigger>
- <SheetContent side="right" className="flex flex-">
- <SheetHeader className="gap-1">
- <SheetTitle>{item.header}</SheetTitle>
- <SheetDescription>
- Showing total visitors for the last 6 months
- </SheetDescription>
- </SheetHeader>
- <div className="flex flex-1 flex-col gap-4 col p-4 overflow-y-auto py-4 text-sm">
- {!isMobile && (
- <>
- <ChartContainer config={chartConfig} className="border rounded-md">
- <AreaChart
- accessibilityLayer
- data={chartData}
- margin={{
- left: 0,
- right: 10,
- }}
- >
- <CartesianGrid vertical={false} />
- <XAxis
- dataKey="month"
- tickLine={false}
- axisLine={false}
- tickMargin={8}
- tickFormatter={(value) => value.slice(0, 3)}
- hide
- />
- <ChartTooltip
- cursor={false}
- content={<ChartTooltipContent indicator="dot" />}
- />
- <Area
- dataKey="mobile"
- type="natural"
- fill="var(--color-mobile)"
- fillOpacity={0.6}
- stroke="var(--color-mobile)"
- stackId="a"
- />
- <Area
- dataKey="desktop"
- type="natural"
- fill="var(--color-desktop)"
- fillOpacity={0.4}
- stroke="var(--color-desktop)"
- stackId="a"
- />
- </AreaChart>
- </ChartContainer>
- <Separator />
- <div className="grid gap-2">
- <div className="flex gap-2 font-medium leading-none">
- Trending up by 5.2% this month{" "}
- <TrendingUpIcon className="size-4" />
- </div>
- <div className="text-muted-foreground">
- Showing total visitors for the last 6 months. This is just
- some random text to test the layout. It spans multiple lines
- and should wrap around.
- </div>
- </div>
- <Separator />
- </>
- )}
- <form className="flex flex-col gap-4">
- <div className="flex flex-col gap-3">
- <Label htmlFor="header">Header</Label>
- <Input id="header" defaultValue={item.header} />
- </div>
- <div className="grid grid-cols-2 gap-4">
- <div className="flex flex-col gap-3">
- <Label htmlFor="type">Type</Label>
- <Select defaultValue={item.type}>
- <SelectTrigger id="type" className="w-full">
- <SelectValue placeholder="Select a type" />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="Table of Contents">
- Table of Contents
- </SelectItem>
- <SelectItem value="Executive Summary">
- Executive Summary
- </SelectItem>
- <SelectItem value="Technical Approach">
- Technical Approach
- </SelectItem>
- <SelectItem value="Design">Design</SelectItem>
- <SelectItem value="Capabilities">Capabilities</SelectItem>
- <SelectItem value="Focus Documents">
- Focus Documents
- </SelectItem>
- <SelectItem value="Narrative">Narrative</SelectItem>
- <SelectItem value="Cover Page">Cover Page</SelectItem>
- </SelectContent>
- </Select>
- </div>
- <div className="flex flex-col gap-3">
- <Label htmlFor="status">Status</Label>
- <Select defaultValue={item.status}>
- <SelectTrigger id="status" className="w-full">
- <SelectValue placeholder="Select a status" />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="Done">Done</SelectItem>
- <SelectItem value="In Progress">In Progress</SelectItem>
- <SelectItem value="Not Started">Not Started</SelectItem>
- </SelectContent>
- </Select>
- </div>
- </div>
- <div className="grid grid-cols-2 gap-4">
- <div className="flex flex-col gap-3">
- <Label htmlFor="target">Target</Label>
- <Input id="target" defaultValue={item.target} />
- </div>
- <div className="flex flex-col gap-3">
- <Label htmlFor="limit">Limit</Label>
- <Input id="limit" defaultValue={item.limit} />
- </div>
- </div>
- <div className="flex flex-col gap-3">
- <Label htmlFor="reviewer">Reviewer</Label>
- <Select defaultValue={item.reviewer}>
- <SelectTrigger id="reviewer" className="w-full">
- <SelectValue placeholder="Select a reviewer" />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="Eddie Lake">Eddie Lake</SelectItem>
- <SelectItem value="Jamik Tashpulatov">
- Jamik Tashpulatov
- </SelectItem>
- <SelectItem value="Emily Whalen">Emily Whalen</SelectItem>
- </SelectContent>
- </Select>
- </div>
- </form>
+ <SheetContent side="right" className="flex flex-col">
+ <DialogTitle>
+ {item.full_name}
+ </DialogTitle>
+ <div className="mt-12 p-4">
+ <pre className="overflow-auto rounded-md border bg-muted p-4 text-sm">
+ <code className="language-json">{JSON.stringify(item, null, 2)}</code>
+ </pre>
</div>
<SheetFooter className="mt-auto flex gap-2 sm:flex-col sm:space-x-0">
- <Button className="w-full">Submit</Button>
<SheetClose asChild>
<Button variant="outline" className="w-full">
Done
diff --git a/flowsint-web/src/components/dashboard/sub-nav.tsx b/flowsint-web/src/components/dashboard/sub-nav.tsx
index 80eaddf9..bab91caf 100644
--- a/flowsint-web/src/components/dashboard/sub-nav.tsx
+++ b/flowsint-web/src/components/dashboard/sub-nav.tsx
@@ -4,7 +4,6 @@ import { cn } from "@/lib/utils"
import { Eye, Users, Camera, Database, Settings } from "lucide-react"
import Link from "next/link"
import { usePathname } from "next/navigation"
-import { useState } from "react"
export function SubNav() {
diff --git a/flowsint-web/src/components/investigations/individual-modal.tsx b/flowsint-web/src/components/investigations/individual-modal.tsx
index 4e6dee80..4e588389 100644
--- a/flowsint-web/src/components/investigations/individual-modal.tsx
+++ b/flowsint-web/src/components/investigations/individual-modal.tsx
@@ -24,7 +24,7 @@ const IndividualModal = () => {
const [individualId, setIndividualId] = useQueryState("individual_id")
const { individual, isLoading } = useIndividual(individualId)
const { emails, isLoading: isLoadingEmails } = useEmailsAndBreaches(individualId)
- const platformsIcons = usePlatformIcons("medium")
+ const platformsIcons = usePlatformIcons()
const { relations, isLoading: isLoadingRelations } = useRelations(individualId)
const [editMode, setEditMode] = useState(false)
const [image, setImage] = useState<string | null>("")
diff --git a/flowsint-web/src/components/investigations/new-actions.tsx b/flowsint-web/src/components/investigations/new-actions.tsx
index 483d0b00..3d19f934 100644
--- a/flowsint-web/src/components/investigations/new-actions.tsx
+++ b/flowsint-web/src/components/investigations/new-actions.tsx
@@ -17,7 +17,7 @@ import {
DropdownMenuContent,
DropdownMenuSubContent,
} from "@/components/ui/dropdown-menu"
-import { nodesTypes } from "@/lib/utils"
+import { cn, nodesTypes } from "@/lib/utils"
import { Alert, AlertTitle, AlertDescription } from "../ui/alert"
import { Badge } from "../ui/badge"
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogTitle } from "../ui/dialog"
@@ -95,7 +95,7 @@ export default function NewActions({ addNodes }: { addNodes: any }) {
return (
<DropdownMenuSub key={item.id}>
<DropdownMenuSubTrigger>
- <Icon className="mr-3 h-4 w-4 opacity-50" />
+ <Icon style={{ color: item.color }} className={cn("mr-3 h-4 w-4 opacity-50", item.color)} />
{item.label}
</DropdownMenuSubTrigger>
<DropdownMenuPortal>
@@ -115,7 +115,7 @@ export default function NewActions({ addNodes }: { addNodes: any }) {
onClick={(e) => handleOpenAddNodeModal(e, item.key)}
className="flex items-center"
>
- <Icon className="mr-2 h-4 w-4 opacity-70" />
+ <Icon style={{ color: item.color }} className="h-4 w-4 opacity-70" />
<span className="truncate">{item.label}</span>
{item.comingSoon && (
<Badge variant="outline" className="ml-2">
diff --git a/flowsint-web/src/components/investigations/sketch/graph.tsx b/flowsint-web/src/components/investigations/sketch/graph.tsx
index a57924bb..5014db7a 100644
--- a/flowsint-web/src/components/investigations/sketch/graph.tsx
+++ b/flowsint-web/src/components/investigations/sketch/graph.tsx
@@ -57,6 +57,7 @@ import {
ResizablePanelGroup,
} from "@/components/ui/resizable"
import NodesPanel from "./nodes-panel"
+import ProfilePanel from "./profile-panel"
const edgeTypes = {
custom: CustomEdge,
@@ -305,7 +306,7 @@ const LayoutFlow = ({ refetch, theme }: LayoutFlowProps) => {
const processedNodes = useMemo(() => nodes.map(({ id, data, type }: any) => ({ id, data, type })).sort((a: { type: string }, b: { type: any }) => b.type.localeCompare(a.type))
, [nodes.length]);
return (
- <ResizablePanelGroup direction="horizontal" className="w-screen grow relative overflow-hidden">
+ <ResizablePanelGroup autoSaveId="persistence" direction="horizontal" className="w-screen grow relative overflow-hidden">
<ResizablePanel defaultSize={80}>
<TooltipProvider>
<Dialog>
@@ -351,13 +352,13 @@ const LayoutFlow = ({ refetch, theme }: LayoutFlowProps) => {
</ResizablePanel>
<ResizableHandle />
<ResizablePanel defaultSize={20} className="h-full">
- <ResizablePanelGroup direction="vertical">
- <ResizablePanel defaultSize={80}>
- <NodesPanel nodes={processedNodes} />
- </ResizablePanel>
+ <ResizablePanelGroup autoSaveId="conditional" direction="vertical">
+ {currentNode && <ResizablePanel order={1} id="top" defaultSize={50}>
+ <ProfilePanel data={currentNode.data} type={currentNode.type} />
+ </ResizablePanel>}
<ResizableHandle />
- <ResizablePanel defaultSize={20}>
- two
+ <ResizablePanel order={2} id="bottom" defaultSize={50}>
+ <NodesPanel nodes={processedNodes} />
</ResizablePanel>
</ResizablePanelGroup>
</ResizablePanel>
diff --git a/flowsint-web/src/components/investigations/sketch/nodes-panel.tsx b/flowsint-web/src/components/investigations/sketch/nodes-panel.tsx
index a7289057..69fa5b6a 100644
--- a/flowsint-web/src/components/investigations/sketch/nodes-panel.tsx
+++ b/flowsint-web/src/components/investigations/sketch/nodes-panel.tsx
@@ -1,23 +1,72 @@
-import React, { memo } from 'react'
+import React, { memo, useMemo } from 'react'
import { type Node } from '@xyflow/react'
import { useFlowStore } from '@/store/flow-store'
import { Button } from '@/components/ui/button'
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
import { Badge } from '@/components/ui/badge'
import { TypeBadge } from '@/components/type-badge'
-const NodesPanel = ({ nodes }: { nodes: Node[] }) => {
- const { setCurrentNode } = useFlowStore()
+import { Card, CardContent } from "@/components/ui/card"
+import { AtSignIcon, Mail, User, UserIcon, Users } from "lucide-react"
+import { usePlatformIcons } from '@/lib/hooks/use-platform-icons'
+
+interface NodeProps {
+ node: any,
+ setCurrentNode: (node: Node) => void
+}
+
+const SocialNode = ({ node, setCurrentNode }: NodeProps) => {
+ const platformsIcons = usePlatformIcons()
+ console.log(platformsIcons)
+ const platformIcon = useMemo(() => {
+ // @ts-ignore
+ return platformsIcons?.[node?.data?.platform]?.icon
+ }, [platformsIcons, node?.data?.platform])
return (
- <div className="!overflow-auto h-full flex flex-col w-full !p-0 !m-0">
- {nodes?.map((node: any) => (
- <Button variant={"ghost"} className='flex items-center justify-start p-4 !py-5 rounded-none text-left border-b' onClick={() => setCurrentNode(node)} key={node.id}>
+ <Button variant={"ghost"} className='flex items-center justify-start p-4 !py-5 rounded-none text-left border-b' onClick={() => setCurrentNode(node)}>
+ <Badge variant="secondary" className="h-7 w-7 p-0 rounded-full">
+ {platformIcon}
+ </Badge>
+ <div className='grow truncate text-ellipsis'>{node?.data?.username || <span className='italic opacity-60'>Unknwon</span>}</div>
+ <TypeBadge type={node?.type as string}></TypeBadge>
+ </Button>
+ )
+}
+export function NodeRenderer({ node, setCurrentNode }: NodeProps) {
+ return (
+ <>
+ {node.type === "individual" && (
+ <Button variant={"ghost"} className='flex items-center justify-start p-4 !py-5 rounded-none text-left border-b' onClick={() => setCurrentNode(node)}>
<Avatar className="h-7 w-7">
<AvatarImage src={node?.data?.image_url} alt={node?.data?.full_name} />
- <AvatarFallback>{node?.data?.full_name?.[0]}</AvatarFallback>
+ <AvatarFallback><UserIcon className="h-4 w-4 opacity-60" /></AvatarFallback>
</Avatar>
<div className='grow truncate text-ellipsis'>{node?.data?.full_name || node?.data?.label}</div>
<TypeBadge type={node?.type}></TypeBadge>
</Button>
+ )}
+ {node.type === "social" && (
+ <SocialNode setCurrentNode={setCurrentNode} node={node} />
+ )}
+ {node.type === "email" && (
+ <Button variant={"ghost"} className='flex items-center justify-start p-4 !py-5 rounded-none text-left border-b' onClick={() => setCurrentNode(node)}>
+ <Badge variant="secondary" className="h-7 w-7 p-0 rounded-full">
+ <AtSignIcon className="h-4 w-4 opacity-60" />
+ </Badge>
+ <div className='grow truncate text-ellipsis'>{node?.data?.full_name || node?.data?.label}</div>
+ <TypeBadge type={node?.type}></TypeBadge>
+ </Button>
+ )}
+ </>
+ )
+}
+
+
+const NodesPanel = ({ nodes }: { nodes: Node[] }) => {
+ const { setCurrentNode } = useFlowStore()
+ return (
+ <div className="overflow-auto h-full flex flex-col w-full !p-0 !m-0">
+ {nodes?.map((node: any) => (
+ <NodeRenderer node={node} setCurrentNode={setCurrentNode} key={node.id} />
))}
</div>
)
diff --git a/flowsint-web/src/components/investigations/sketch/nodes/person.tsx b/flowsint-web/src/components/investigations/sketch/nodes/person.tsx
index 9ff1c897..cf43bd8b 100644
--- a/flowsint-web/src/components/investigations/sketch/nodes/person.tsx
+++ b/flowsint-web/src/components/investigations/sketch/nodes/person.tsx
@@ -1,16 +1,17 @@
import React, { memo } from 'react';
import { Handle, Position } from '@xyflow/react';
import { CopyButton } from '@/components/copy';
-import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
+import { Avatar, AvatarImage } from '@/components/ui/avatar';
import { BaseNode } from "@/components/ui/base-node";
+import { UserIcon } from 'lucide-react';
export default memo(({ data, selected }: any) => {
return (
<BaseNode selected={selected}>
<div className="flex gap-2 items-center rounded-full">
- <Avatar className="h-9 w-9">
+ <Avatar className="h-9 w-9 flex items-center justify-center">
<AvatarImage src={data?.image_url} alt={data.full_name} />
- <AvatarFallback>{data.full_name[0]}</AvatarFallback>
+ <UserIcon className="h-4 w-4 opacity-60" />
</Avatar>
<div className="flex items-center gap-1">
<span className="text-sm text-nowrap">{data.full_name}</span>
diff --git a/flowsint-web/src/components/investigations/sketch/profile-panel.tsx b/flowsint-web/src/components/investigations/sketch/profile-panel.tsx
index c688afd6..9efa5727 100644
--- a/flowsint-web/src/components/investigations/sketch/profile-panel.tsx
+++ b/flowsint-web/src/components/investigations/sketch/profile-panel.tsx
@@ -1,6 +1,4 @@
"use client"
-
-import { Card } from "@/components/ui/card"
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Badge } from "@/components/ui/badge"
import { User, MapPin, Globe, Info, AtSign, Phone, Calendar, Link2, Mail, Shield, XIcon } from "lucide-react"
@@ -21,7 +19,7 @@ export default function ProfilePanel({ data, type }: { data: any, type: "individ
if (type === "email") {
return (
- <Card className="w-full bg-background max-w-[400px] relative">
+ <div className="overflow-auto h-full flex flex-col w-full !p-0 !m-0">
<Button className="absolute top-2 right-2" size={"icon"} variant={"ghost"} onClick={closePanel}><XIcon className="h-5 w-5" /></Button>
<div className="p-6 md:p-8">
<div className="grid grid-cols-1 gap-6">
@@ -83,18 +81,18 @@ export default function ProfilePanel({ data, type }: { data: any, type: "individ
</div>
</div>
</div>
- </Card>)
+ </div>)
}
if (type === "individual")
return (
- <Card className="w-full bg-background relative">
+ <div className="overflow-auto h-full flex flex-col w-full !p-0 !m-0">
<Button className="absolute top-2 right-2" size={"icon"} variant={"ghost"} onClick={closePanel}><XIcon className="h-5 w-5" /></Button>
<div className="p-6 md:p-8">
<div className="grid grid-cols-1 gap-2">
{/* Left column with avatar */}
<div className="flex flex-col items-center gap-6">
<div className="relative flex flex-col items-center gap-4">
- <Avatar className="w-40 h-40 border-4 border-primary/20">
+ <Avatar className="w-28 h-28 border-4 border-primary/20">
<AvatarImage src={data.image_url} alt={data.full_name} />
<AvatarFallback className="text-2xl">
{data.full_name
@@ -213,7 +211,7 @@ export default function ProfilePanel({ data, type }: { data: any, type: "individ
</div>
</div>
</div>
- </Card>
+ </div>
)
}
diff --git a/flowsint-web/src/components/nav-main.tsx b/flowsint-web/src/components/nav-main.tsx
deleted file mode 100644
index 1d71af13..00000000
--- a/flowsint-web/src/components/nav-main.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-"use client"
-
-import { ChevronRight, type LucideIcon } from "lucide-react"
-
-import {
- Collapsible,
- CollapsibleContent,
- CollapsibleTrigger,
-} from "@/components/ui/collapsible"
-import {
- SidebarGroup,
- SidebarGroupLabel,
- SidebarMenu,
- SidebarMenuButton,
- SidebarMenuItem,
- SidebarMenuSub,
- SidebarMenuSubButton,
- SidebarMenuSubItem,
-} from "@/components/ui/sidebar"
-
-export function NavMain({
- items,
-}: {
- items: {
- title: string
- url: string
- icon?: LucideIcon
- isActive?: boolean
- items?: {
- title: string
- url: string
- }[]
- }[]
-}) {
- return (
- <SidebarGroup>
- <SidebarGroupLabel>Platform</SidebarGroupLabel>
- <SidebarMenu>
- {items.map((item) => (
- <Collapsible
- key={item.title}
- asChild
- defaultOpen={item.isActive}
- className="group/collapsible"
- >
- <SidebarMenuItem>
- <CollapsibleTrigger asChild>
- <SidebarMenuButton tooltip={item.title}>
- {item.icon && <item.icon />}
- <span>{item.title}</span>
- <ChevronRight className="ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" />
- </SidebarMenuButton>
- </CollapsibleTrigger>
- <CollapsibleContent>
- <SidebarMenuSub>
- {item.items?.map((subItem) => (
- <SidebarMenuSubItem key={subItem.title}>
- <SidebarMenuSubButton asChild>
- <a href={subItem.url}>
- <span>{subItem.title}</span>
- </a>
- </SidebarMenuSubButton>
- </SidebarMenuSubItem>
- ))}
- </SidebarMenuSub>
- </CollapsibleContent>
- </SidebarMenuItem>
- </Collapsible>
- ))}
- </SidebarMenu>
- </SidebarGroup>
- )
-}
diff --git a/flowsint-web/src/components/nav-projects.tsx b/flowsint-web/src/components/nav-projects.tsx
deleted file mode 100644
index 24941979..00000000
--- a/flowsint-web/src/components/nav-projects.tsx
+++ /dev/null
@@ -1,90 +0,0 @@
-"use client"
-
-import {
- Folder,
- Forward,
- MoreHorizontal,
- Trash2,
- type LucideIcon,
-} from "lucide-react"
-
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuSeparator,
- DropdownMenuTrigger,
-} from "@/components/ui/dropdown-menu"
-import {
- SidebarGroup,
- SidebarGroupLabel,
- SidebarMenu,
- SidebarMenuAction,
- SidebarMenuButton,
- SidebarMenuItem,
- useSidebar,
-} from "@/components/ui/sidebar"
-import Link from "next/link"
-
-export function NavProjects({
- projects,
-}: {
- projects: {
- name: string
- url: string
- icon: LucideIcon
- }[]
-}) {
- const { isMobile } = useSidebar()
-
- return (
- <SidebarGroup className="group-data-[collapsible=icon]:hidden">
- <SidebarGroupLabel>Projects</SidebarGroupLabel>
- <SidebarMenu>
- {projects.map((item) => (
- <SidebarMenuItem key={item.name}>
- <SidebarMenuButton asChild>
- <Link href={item.url}>
- <item.icon />
- <span>{item.name}</span>
- </Link>
- </SidebarMenuButton>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <SidebarMenuAction showOnHover>
- <MoreHorizontal />
- <span className="sr-only">More</span>
- </SidebarMenuAction>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- className="w-48 rounded-lg"
- side={isMobile ? "bottom" : "right"}
- align={isMobile ? "end" : "start"}
- >
- <DropdownMenuItem>
- <Folder className="text-muted-foreground" />
- <span>View Project</span>
- </DropdownMenuItem>
- <DropdownMenuItem>
- <Forward className="text-muted-foreground" />
- <span>Share Project</span>
- </DropdownMenuItem>
- <DropdownMenuSeparator />
- <DropdownMenuItem>
- <Trash2 className="text-muted-foreground" />
- <span>Delete Project</span>
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </SidebarMenuItem>
- ))}
- <SidebarMenuItem>
- <SidebarMenuButton className="text-sidebar-foreground/70">
- <MoreHorizontal className="text-sidebar-foreground/70" />
- <span>More</span>
- </SidebarMenuButton>
- </SidebarMenuItem>
- </SidebarMenu>
- </SidebarGroup>
- )
-}
diff --git a/flowsint-web/src/components/team-switcher.tsx b/flowsint-web/src/components/team-switcher.tsx
deleted file mode 100644
index 0238d48d..00000000
--- a/flowsint-web/src/components/team-switcher.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-"use client"
-
-import * as React from "react"
-import { ChevronsUpDown, Plus } from "lucide-react"
-
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuLabel,
- DropdownMenuSeparator,
- DropdownMenuShortcut,
- DropdownMenuTrigger,
-} from "@/components/ui/dropdown-menu"
-import {
- SidebarMenu,
- SidebarMenuButton,
- SidebarMenuItem,
- useSidebar,
-} from "@/components/ui/sidebar"
-import Logo from "./logo"
-import Link from "next/link"
-
-export function TeamSwitcher() {
-
- return (
- <Link className="w-full overflow-hidden flex items-center gap-2" href="/dashboard">
- <Logo /> <span className="text-md font-bold">FLOWSINT</span>
- </Link>
- )
-}
diff --git a/flowsint-web/src/lib/action-items.ts b/flowsint-web/src/lib/action-items.ts
new file mode 100644
index 00000000..4be769dd
--- /dev/null
+++ b/flowsint-web/src/lib/action-items.ts
@@ -0,0 +1,507 @@
+import {
+ Activity,
+ ArrowRightLeft,
+ AtSign,
+ Bike,
+ Bitcoin,
+ Building2,
+ Calendar,
+ Camera,
+ Car,
+ CreditCard,
+ DollarSign,
+ Facebook,
+ FileIcon,
+ Fingerprint,
+ Footprints,
+ Ghost,
+ Github,
+ Globe,
+ GraduationCap,
+ ImageIcon,
+ Instagram,
+ Key,
+ Laptop,
+ Linkedin,
+ Locate,
+ MapPin,
+ MessageCircle,
+ MessageCircleDashed,
+ MessageSquare,
+ Phone,
+ Plane,
+ Sailboat,
+ Send,
+ ShoppingCart,
+ Smartphone,
+ Tablet,
+ Twitch,
+ Twitter,
+ User,
+ Users,
+ Video,
+ Wifi,
+ type LucideIcon,
+} from "lucide-react"
+
+// Enhanced ActionItem type that includes fields from nodesTypes
+export type ActionItem = {
+ id: number
+ type: string
+ table: string
+ icon: LucideIcon
+ color?: string
+ label: string
+ key: string,
+ fields: string[]
+ disabled?: boolean
+ comingSoon?: boolean
+ children?: ActionItem[]
+}
+
+export const actionItems: ActionItem[] = [
+ {
+ id: 1,
+ type: "individual",
+ table: "individuals",
+ key: "individuals",
+ icon: User,
+ label: "New relation",
+ fields: ["full_name"],
+ },
+ {
+ id: 2,
+ type: "phone",
+ table: "phone_numbers",
+ key: "phone_numbers",
+ icon: Phone,
+ label: "Phone number",
+ fields: ["phone_number"],
+ },
+ {
+ id: 3,
+ type: "address",
+ table: "physical_addresses",
+ key: "physical_addresses",
+ icon: MapPin,
+ label: "Physical address",
+ fields: ["address", "city", "country", "zip"],
+ },
+ {
+ id: 4,
+ type: "email",
+ table: "emails",
+ key: "emails",
+ icon: AtSign,
+ label: "Email address",
+ fields: ["email"],
+ },
+ {
+ id: 5,
+ type: "ip",
+ table: "ip_addresses",
+ key: "ip_addresses",
+ icon: Locate,
+ label: "IP address",
+ fields: ["ip_address"],
+ },
+ {
+ id: 6,
+ type: "social_account",
+ table: "",
+ key: "social_account",
+ icon: Send,
+ label: "Social account",
+ fields: [],
+ children: [
+ {
+ id: 7,
+ type: "social",
+ table: "social_accounts",
+ key: "social_accounts_facebook",
+ icon: Facebook,
+ color: "#1d4ed8",
+ label: "Facebook",
+ fields: ["profile_url", "username", "platform:facebook"],
+ },
+ {
+ id: 8,
+ type: "social",
+ table: "social_accounts",
+ key: "social_accounts_instagram",
+ icon: Instagram,
+ color: "#db2777",
+ label: "Instagram",
+ fields: ["profile_url", "username", "platform:instagram"],
+ },
+ {
+ id: 9,
+ type: "social",
+ table: "social_accounts",
+ key: "social_accounts_telegram",
+ icon: Send,
+ color: "#0369a1",
+ label: "Telegram",
+ fields: ["profile_url", "username", "platform:telegram"],
+ },
+ {
+ id: 10,
+ type: "social",
+ table: "social_accounts",
+ key: "social_accounts_signal",
+ icon: MessageCircleDashed,
+ color: "#3B45FC",
+ label: "Signal",
+ fields: ["profile_url", "username", "platform:signal"],
+ },
+ {
+ id: 11,
+ type: "social",
+ table: "social_accounts",
+ key: "social_accounts_snapchat",
+ color: "#FEFC00",
+ icon: Ghost,
+ label: "Snapchat",
+ fields: ["profile_url", "username", "platform:snapchat"],
+ },
+ {
+ id: 12,
+ type: "social",
+ table: "social_accounts",
+ key: "social_accounts_github",
+ icon: Github,
+ label: "Github",
+ fields: ["profile_url", "username", "platform:github"],
+ },
+ {
+ id: 13,
+ type: "social",
+ table: "social_accounts",
+ key: "social_accounts_coco",
+ icon: Send,
+ label: "Coco",
+ fields: ["profile_url", "username", "platform:coco"],
+ disabled: true,
+ comingSoon: true,
+ },
+ {
+ id: 18,
+ type: "social",
+ table: "social_accounts",
+ key: "social_accounts_linkedin",
+ color: "#116AC9",
+ icon: Linkedin,
+ label: "LinkedIn",
+ fields: ["profile_url", "username", "platform:linkedin"],
+ },
+ {
+ id: 19,
+ type: "social",
+ table: "social_accounts",
+ key: "social_accounts_twitter",
+ icon: Twitter,
+ label: "Twitter",
+ fields: ["profile_url", "username", "platform:twitter"],
+ },
+ {
+ id: 20,
+ type: "social",
+ table: "social_accounts",
+ key: "social_accounts_tiktok",
+ icon: Video,
+ label: "TikTok",
+ fields: ["profile_url", "username", "platform:tiktok"],
+ },
+ {
+ id: 21,
+ type: "social",
+ table: "social_accounts",
+ key: "social_accounts_reddit",
+ icon: MessageSquare,
+ color: "#FF4B13",
+ label: "Reddit",
+ fields: ["profile_url", "username", "platform:reddit"],
+ },
+ {
+ id: 22,
+ type: "social",
+ table: "social_accounts",
+ key: "social_accounts_discord",
+ icon: MessageCircle,
+ color: "#525FEE",
+ label: "Discord",
+ fields: ["profile_url", "username", "platform:discord"],
+ },
+ {
+ id: 2343,
+ type: "social",
+ table: "social_accounts",
+ key: "social_accounts_twitch",
+ icon: Twitch,
+ color: "#A96FFF",
+ label: "Twitch",
+ fields: ["profile_url", "username", "platform:twitch"],
+ },
+ ],
+ },
+ {
+ id: 14,
+ type: "vehicle",
+ table: "",
+ icon: Car,
+ label: "Vehicle",
+ key: "vehicle",
+ fields: [],
+ children: [
+ {
+ id: 15,
+ type: "vehicle",
+ table: "vehicles",
+ key: "vehicles_car",
+ icon: Car,
+ label: "Car",
+ fields: ["plate", "model", "brand", "year", "type:car"],
+ },
+ {
+ id: 16,
+ type: "vehicle",
+ table: "vehicles",
+ key: "vehicles_motorcycle",
+ icon: Bike,
+ label: "Motorcycle",
+ fields: ["plate", "model", "brand", "year", "type:motorcycle"],
+ },
+ {
+ id: 17,
+ type: "vehicle",
+ table: "vehicles",
+ key: "vehicles_boat",
+ icon: Sailboat,
+ label: "Boat",
+ fields: ["plate", "model", "brand", "year", "type:boat"],
+ },
+ {
+ id: 23,
+ type: "vehicle",
+ table: "vehicles",
+ key: "vehicles_aircraft",
+ icon: Plane,
+ label: "Aircraft",
+ fields: ["registration", "model", "manufacturer", "year", "type:aircraft"],
+ },
+ ],
+ },
+ {
+ id: 24,
+ type: "organization",
+ table: "organizations",
+ key: "organizations",
+ icon: Building2,
+ label: "Organization",
+ fields: ["name", "registration_number", "founding_date"],
+ },
+ {
+ id: 25,
+ type: "website",
+ table: "websites",
+ key: "websites",
+ icon: Globe,
+ label: "Website",
+ fields: ["url", "registration_date", "registrar", "ip_address"],
+ },
+ {
+ id: 26,
+ type: "document",
+ table: "documents",
+ key: "documents",
+ icon: FileIcon,
+ label: "Document",
+ fields: ["title", "author", "creation_date", "file_hash", "file_type"],
+ },
+ {
+ id: 27,
+ type: "financial",
+ table: "",
+ key: "financial",
+ icon: DollarSign,
+ label: "Financial",
+ fields: [],
+ children: [
+ {
+ id: 28,
+ type: "financial",
+ table: "crypto_wallets",
+ key: "crypto_wallets",
+ icon: Bitcoin,
+ label: "Crypto Wallet",
+ fields: ["address", "currency", "platform"],
+ },
+ {
+ id: 29,
+ type: "financial",
+ table: "bank_accounts",
+ key: "bank_accounts",
+ icon: CreditCard,
+ label: "Bank Account",
+ fields: ["account_number", "bank_name", "iban", "bic"],
+ },
+ {
+ id: 30,
+ type: "financial",
+ table: "transactions",
+ key: "transactions",
+ icon: ArrowRightLeft,
+ label: "Transaction",
+ fields: ["amount", "date", "sender", "recipient", "currency"],
+ },
+ ],
+ },
+ {
+ id: 31,
+ type: "event",
+ table: "events",
+ key: "events",
+ icon: Calendar,
+ label: "Event",
+ fields: ["name", "date", "location", "description", "participants"],
+ },
+ {
+ id: 32,
+ type: "device",
+ table: "",
+ key: "device",
+ icon: Smartphone,
+ label: "Device",
+ fields: [],
+ children: [
+ {
+ id: 33,
+ type: "device",
+ table: "devices",
+ key: "devices_phone",
+ icon: Smartphone,
+ label: "Phone",
+ fields: ["imei", "model", "manufacturer", "serial_number", "type:phone"],
+ },
+ {
+ id: 34,
+ type: "device",
+ table: "devices",
+ key: "devices_computer",
+ icon: Laptop,
+ label: "Computer",
+ fields: ["mac_address", "model", "manufacturer", "serial_number", "type:computer"],
+ },
+ {
+ id: 35,
+ type: "device",
+ table: "devices",
+ key: "devices_tablet",
+ icon: Tablet,
+ label: "Tablet",
+ fields: ["imei", "model", "manufacturer", "serial_number", "type:tablet"],
+ },
+ {
+ id: 36,
+ type: "device",
+ table: "devices",
+ key: "devices_iot",
+ icon: Wifi,
+ label: "IoT Device",
+ fields: ["mac_address", "model", "manufacturer", "serial_number", "type:iot"],
+ },
+ ],
+ },
+ {
+ id: 37,
+ type: "media",
+ table: "media",
+ key: "media",
+ icon: ImageIcon,
+ label: "Media",
+ fields: ["filename", "hash", "creation_date", "location", "exif_data"],
+ },
+ {
+ id: 38,
+ type: "education",
+ table: "education",
+ key: "education",
+ icon: GraduationCap,
+ label: "Education",
+ fields: ["institution", "degree", "field", "start_date", "end_date"],
+ },
+ {
+ id: 39,
+ type: "relationship",
+ table: "relationships",
+ key: "relationships",
+ icon: Users,
+ label: "Relationship",
+ fields: ["type", "entity_a", "entity_b", "start_date", "end_date", "description"],
+ },
+ {
+ id: 40,
+ type: "online_activity",
+ table: "",
+ key: "online_activity",
+ icon: Activity,
+ label: "Online Activity",
+ fields: [],
+ children: [
+ {
+ id: 41,
+ type: "online_activity",
+ table: "forum_posts",
+ key: "forum_posts",
+ icon: MessageSquare,
+ label: "Forum Post",
+ fields: ["forum", "username", "post_date", "post_content", "post_url", "type:forum_post"],
+ },
+ {
+ id: 42,
+ type: "online_activity",
+ table: "comments",
+ key: "comments",
+ icon: MessageCircle,
+ label: "Comment",
+ fields: ["platform", "username", "comment_date", "comment_content", "comment_url", "type:comment"],
+ },
+ {
+ id: 43,
+ type: "online_activity",
+ table: "online_purchases",
+ key: "online_purchases",
+ icon: ShoppingCart,
+ label: "Online Purchase",
+ fields: ["platform", "username", "purchase_date", "item", "price", "type:purchase"],
+ },
+ ],
+ },
+ {
+ id: 44,
+ type: "digital_footprint",
+ table: "digital_footprints",
+ key: "digital_footprints",
+ icon: Footprints,
+ label: "Digital Footprint",
+ fields: ["platform", "username", "date_discovered", "data_type", "source_url"],
+ },
+ {
+ id: 45,
+ type: "biometric",
+ table: "biometric_data",
+ key: "biometric_data",
+ icon: Fingerprint,
+ label: "Biometric Data",
+ fields: ["type", "identifier", "date_collected", "source"],
+ },
+ {
+ id: 46,
+ type: "credential",
+ table: "credentials",
+ key: "credentials",
+ icon: Key,
+ label: "Credential",
+ fields: ["service", "username", "hash", "breach_date", "breach_source"],
+ },
+]
\ No newline at end of file
diff --git a/flowsint-web/src/lib/actions/auth.ts b/flowsint-web/src/lib/actions/auth.ts
new file mode 100644
index 00000000..f8d780f5
--- /dev/null
+++ b/flowsint-web/src/lib/actions/auth.ts
@@ -0,0 +1,70 @@
+'use server'
+
+import { revalidatePath } from 'next/cache'
+import { redirect } from 'next/navigation'
+import { createClient } from '@/lib/supabase/server'
+
+export async function signInWithGithub() {
+ const supabase = await createClient()
+ const { data } = await supabase.auth.signInWithOAuth({
+ provider: 'github',
+ options: {
+ redirectTo: process.env.NEXT_PUBLIC_AUTH_REDIRECT,
+ },
+ })
+ if (data.url) {
+ redirect(data.url)
+ }
+}
+
+export async function login(formData: FormData) {
+ const supabase = await createClient()
+
+ // type-casting here for convenience
+ // in practice, you should validate your inputs
+ const data = {
+ email: formData.get('email') as string,
+ password: formData.get('password') as string,
+ }
+
+ const { error } = await supabase.auth.signInWithPassword(data)
+
+ if (error) {
+ redirect('/error')
+ }
+ // revalidatePath('/', 'layout')
+ // redirect('/')
+}
+
+export async function signup(formData: FormData) {
+ const supabase = await createClient()
+
+ // type-casting here for convenience
+ // in practice, you should validate your inputs
+ const data = {
+ email: formData.get('email') as string,
+ password: formData.get('password') as string,
+ }
+
+ const { error } = await supabase.auth.signUp(data)
+
+ if (error) {
+ redirect('/error')
+ }
+
+ revalidatePath('/', 'layout')
+ redirect('/')
+}
+
+export async function logout() {
+ const supabase = await createClient()
+
+ const { error } = await supabase.auth.signOut()
+
+ if (error) {
+ redirect('/error')
+ }
+
+ revalidatePath('/', 'layout')
+ redirect('/login')
+}
\ No newline at end of file
diff --git a/flowsint-web/src/lib/actions/investigations.ts b/flowsint-web/src/lib/actions/investigations.ts
new file mode 100644
index 00000000..dde18981
--- /dev/null
+++ b/flowsint-web/src/lib/actions/investigations.ts
@@ -0,0 +1,25 @@
+"use server"
+import { createClient } from "../supabase/server"
+import { redirect } from "next/navigation"
+import { revalidatePath } from "next/cache"
+
+export async function createNewCase(formData: FormData, project_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: investigation, error } = await supabase.from("investigations").insert({ ...data, owner_id: session?.user?.id, project_id }).select("id").single()
+ if (error) throw error
+ revalidatePath("/")
+ return { success: true, id: investigation.id }
+ } catch (error) {
+ console.error("Error creating new case:", error)
+ return { success: false, error: "Failed to create new case" }
+ }
+}
diff --git a/flowsint-web/src/lib/actions/search.ts b/flowsint-web/src/lib/actions/search.ts
new file mode 100644
index 00000000..9f567fd9
--- /dev/null
+++ b/flowsint-web/src/lib/actions/search.ts
@@ -0,0 +1,77 @@
+'use server'
+import { createClient } from "../supabase/server";
+
+export async function checkEmail(email: string, investigation_id: string) {
+ const url = `${process.env.NEXT_PUBLIC_DOCKER_FLOWSINT_API}/scan/`;
+ const response = await fetch(url, {
+ method: 'POST',
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ "email": email,
+ "investigation_id": investigation_id
+ })
+ },
+ );
+ return response.json();
+}
+
+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/hooks/individuals/use-emails-breaches.ts b/flowsint-web/src/lib/hooks/individuals/use-emails-breaches.ts
new file mode 100644
index 00000000..245b26b8
--- /dev/null
+++ b/flowsint-web/src/lib/hooks/individuals/use-emails-breaches.ts
@@ -0,0 +1,39 @@
+import { supabase } from "@/lib/supabase/client"
+import { useQuery } from "@supabase-cache-helpers/postgrest-swr"
+
+export function useEmailsAndBreaches(individualId: string | null | undefined) {
+ const { data: emails, error } = useQuery(
+ individualId ? supabase.from("individuals").select(`*, emails(*)`).eq("id", individualId).single() : null,
+ {
+ revalidateOnFocus: false,
+ revalidateOnReconnect: false,
+ },
+ )
+
+ const emailAddresses = emails?.emails?.map(({ email }: { email: string }) => email) || []
+
+ const { data: breaches, error: breachesError, mutate } = useQuery(
+ emailAddresses.length > 0
+ ? supabase.from("accounts_breaches").select(`account, breach:breach_id(raw_content)`).in("account", emailAddresses)
+ : null,
+ {
+ revalidateOnFocus: false,
+ revalidateOnReconnect: false,
+ },
+ )
+
+ const formattedData = emailAddresses.map((email: string) => ({
+ email,
+ breaches: breaches?.filter((breach: any) => breach.account === email).map((breach: any) => breach.breach.raw_content) || [],
+ }))
+
+ const isLoading = !emails && !error
+
+ return {
+ emails: formattedData,
+ isLoading,
+ refetch: mutate,
+ error: error || breachesError,
+ }
+}
+
diff --git a/flowsint-web/src/lib/hooks/individuals/use-individual.ts b/flowsint-web/src/lib/hooks/individuals/use-individual.ts
new file mode 100644
index 00000000..03d9dcb7
--- /dev/null
+++ b/flowsint-web/src/lib/hooks/individuals/use-individual.ts
@@ -0,0 +1,29 @@
+import { supabase } from "@/lib/supabase/client";
+import { useQuery } from "@supabase-cache-helpers/postgrest-swr";
+
+export function useIndividual(individualId: string | null | undefined) {
+ const { data: individual, mutate, isLoading, error } = useQuery(Boolean(individualId) ?
+ supabase
+ .from('individuals')
+ .select(`
+ *,
+ ip_addresses(*),
+ phone_numbers(*),
+ social_accounts(*),
+ emails(*)
+ `)
+ .eq("id", individualId)
+ .single() : null,
+ {
+ revalidateOnFocus: false,
+ revalidateOnReconnect: false,
+ }
+ );
+ return {
+ individual: individual || null,
+ isLoading,
+ refetch: mutate,
+ error: error
+ };
+}
+
diff --git a/flowsint-web/src/lib/hooks/individuals/use-relations.ts b/flowsint-web/src/lib/hooks/individuals/use-relations.ts
new file mode 100644
index 00000000..e05c5909
--- /dev/null
+++ b/flowsint-web/src/lib/hooks/individuals/use-relations.ts
@@ -0,0 +1,36 @@
+import { supabase } from "@/lib/supabase/client";
+import { useQuery } from "@supabase-cache-helpers/postgrest-swr";
+
+export function useRelations(individualId: string | null | undefined) {
+ const { data: individuals, mutate, isLoading, error } = useQuery(
+ Boolean(individualId)
+ ? supabase
+ .from("relationships")
+ .select(`
+ id,
+ individual_a(id, full_name, image_url),
+ individual_b(id, full_name, image_url),
+ relation_type,
+ confidence_level
+ `)
+ .or(`individual_a.eq.${individualId},individual_b.eq.${individualId}`)
+ : null,
+ {
+ revalidateOnFocus: false,
+ revalidateOnReconnect: false,
+ }
+ );
+ const relations = individuals
+ ? individuals.map((rel: { individual_a: any, individual_b: any, relation_type: string }) => {
+ return rel.individual_a?.id === individualId
+ ? { ...rel.individual_b, relation_type: rel.relation_type }
+ : { ...rel.individual_a, relation_type: rel.relation_type }
+ }).filter(Boolean)
+ : [];
+ return {
+ relations,
+ isLoading,
+ refetch: mutate,
+ error
+ };
+}
diff --git a/flowsint-web/src/lib/hooks/investigation/investigation.ts b/flowsint-web/src/lib/hooks/investigation/investigation.ts
new file mode 100644
index 00000000..78df521b
--- /dev/null
+++ b/flowsint-web/src/lib/hooks/investigation/investigation.ts
@@ -0,0 +1,34 @@
+import { supabase } from "@/lib/supabase/client";
+import { useQuery } from "@supabase-cache-helpers/postgrest-swr";
+
+export function useInvestigations(project_id: string) {
+ const { data: investigations, count, mutate, isLoading, error } = useQuery(
+ supabase
+ .from('investigations')
+ .select('id, title, description')
+ .eq("project_id", project_id)
+ .order("last_updated_at", { ascending: false }),
+ {
+ revalidateOnFocus: false,
+ revalidateOnReconnect: false,
+ }
+ );
+
+ return { investigations, count, isLoading, refetch: mutate, error };
+}
+
+export function useInvestigation(investigationId: string | string[] | undefined) {
+ if (!investigationId) return { investigation: null }
+ const { data: investigation, mutate, isLoading, error } = useQuery(
+ supabase
+ .from('investigations')
+ .select('id, title, description')
+ .eq("id", investigationId)
+ .single(),
+ {
+ revalidateOnFocus: false,
+ revalidateOnReconnect: false,
+ }
+ );
+ return { investigation: investigation ?? null, isLoading, refetch: mutate, error };
+}
\ No newline at end of file
diff --git a/flowsint-web/src/lib/hooks/investigation/use-emails.tsx b/flowsint-web/src/lib/hooks/investigation/use-emails.tsx
new file mode 100644
index 00000000..872b70b7
--- /dev/null
+++ b/flowsint-web/src/lib/hooks/investigation/use-emails.tsx
@@ -0,0 +1,25 @@
+import { supabase } from "@/lib/supabase/client";
+import { useQuery } from "@supabase-cache-helpers/postgrest-swr";
+
+export function useEmails(investigationId: string | null | undefined) {
+ const { data: emails, mutate, isLoading, error } = useQuery(Boolean(investigationId) ?
+ supabase
+ .from('emails')
+ .select(`
+ *
+ `)
+ .eq("investigation_id", investigationId)
+ : null,
+ {
+ revalidateOnFocus: false,
+ revalidateOnReconnect: false,
+ }
+ );
+ return {
+ emails: emails || null,
+ isLoading,
+ refetch: mutate,
+ error: error
+ };
+}
+
diff --git a/flowsint-web/src/lib/hooks/investigation/use-individuals.tsx b/flowsint-web/src/lib/hooks/investigation/use-individuals.tsx
new file mode 100644
index 00000000..e74a1cbe
--- /dev/null
+++ b/flowsint-web/src/lib/hooks/investigation/use-individuals.tsx
@@ -0,0 +1,25 @@
+import { supabase } from "@/lib/supabase/client";
+import { useQuery } from "@supabase-cache-helpers/postgrest-swr";
+
+export function useIndividuals(investigationId: string | null | undefined) {
+ const { data: individuals, mutate, isLoading, error } = useQuery(Boolean(investigationId) ?
+ supabase
+ .from('individuals')
+ .select(`
+ *
+ `)
+ .eq("investigation_id", investigationId)
+ : null,
+ {
+ revalidateOnFocus: false,
+ revalidateOnReconnect: false,
+ }
+ );
+ return {
+ individuals: individuals || null,
+ isLoading,
+ refetch: mutate,
+ error: error
+ };
+}
+
diff --git a/flowsint-web/src/lib/hooks/investigation/use-phones.tsx b/flowsint-web/src/lib/hooks/investigation/use-phones.tsx
new file mode 100644
index 00000000..36cc49d4
--- /dev/null
+++ b/flowsint-web/src/lib/hooks/investigation/use-phones.tsx
@@ -0,0 +1,25 @@
+import { supabase } from "@/lib/supabase/client";
+import { useQuery } from "@supabase-cache-helpers/postgrest-swr";
+
+export function usePhones(investigationId: string | null | undefined) {
+ const { data: phones, mutate, isLoading, error } = useQuery(Boolean(investigationId) ?
+ supabase
+ .from('phone_numbers')
+ .select(`
+ *
+ `)
+ .eq("investigation_id", investigationId)
+ : null,
+ {
+ revalidateOnFocus: false,
+ revalidateOnReconnect: false,
+ }
+ );
+ return {
+ phones: phones || null,
+ isLoading,
+ refetch: mutate,
+ error: error
+ };
+}
+
diff --git a/flowsint-web/src/lib/hooks/investigation/use-search-results.tsx b/flowsint-web/src/lib/hooks/investigation/use-search-results.tsx
new file mode 100644
index 00000000..56bc29b9
--- /dev/null
+++ b/flowsint-web/src/lib/hooks/investigation/use-search-results.tsx
@@ -0,0 +1,19 @@
+import { supabase } from "@/lib/supabase/client";
+import { useQuery } from "@supabase-cache-helpers/postgrest-swr";
+
+export function useSearchResults(search: string | undefined, investigationId: string | string[] | undefined) {
+ const { data: results, count, mutate, isLoading, error } = useQuery(search ?
+ supabase
+ .from('individuals')
+ .select('*')
+ .eq("investigation_id", investigationId)
+ .ilike('full_name', `%${search}%`) : null,
+ {
+ revalidateOnFocus: false,
+ revalidateOnReconnect: false,
+ }
+ );
+ if (error) throw error
+
+ return { results, count, isLoading, refetch: mutate, error };
+}
\ No newline at end of file
diff --git a/flowsint-web/src/lib/hooks/investigation/use-socials.ts b/flowsint-web/src/lib/hooks/investigation/use-socials.ts
new file mode 100644
index 00000000..f3afe6a0
--- /dev/null
+++ b/flowsint-web/src/lib/hooks/investigation/use-socials.ts
@@ -0,0 +1,25 @@
+import { supabase } from "@/lib/supabase/client";
+import { useQuery } from "@supabase-cache-helpers/postgrest-swr";
+
+export function useSocials(investigationId: string | null | undefined) {
+ const { data: socials, mutate, isLoading, error } = useQuery(Boolean(investigationId) ?
+ supabase
+ .from('social_accounts')
+ .select(`
+ *
+ `)
+ .eq("investigation_id", investigationId)
+ : null,
+ {
+ revalidateOnFocus: false,
+ revalidateOnReconnect: false,
+ }
+ );
+ return {
+ socials: socials || null,
+ isLoading,
+ refetch: mutate,
+ error: error
+ };
+}
+
diff --git a/flowsint-web/src/lib/hooks/investigation/usernames.tsx b/flowsint-web/src/lib/hooks/investigation/usernames.tsx
new file mode 100644
index 00000000..6d383c9e
--- /dev/null
+++ b/flowsint-web/src/lib/hooks/investigation/usernames.tsx
@@ -0,0 +1,21 @@
+import { supabase } from "@/lib/supabase/client";
+import { useQuery } from "@supabase-cache-helpers/postgrest-swr";
+
+export function useUsernames(investigationId: string | string[] | undefined) {
+ if (!investigationId) return { usernames: [] }
+ const { data: usernames, count, mutate, isLoading, error } = useQuery(
+ supabase
+ .from('social_accounts')
+ .select('id, username')
+ .eq("investigation_id", investigationId)
+ .not('username', 'is', null)
+ .neq('username', ''),
+ {
+ revalidateOnFocus: false,
+ revalidateOnReconnect: false,
+ }
+ );
+ if (error) throw error
+
+ return { usernames, count, isLoading, refetch: mutate, error };
+}
\ No newline at end of file
diff --git a/flowsint-web/src/lib/hooks/use-local-storage.ts b/flowsint-web/src/lib/hooks/use-local-storage.ts
new file mode 100644
index 00000000..c835dd16
--- /dev/null
+++ b/flowsint-web/src/lib/hooks/use-local-storage.ts
@@ -0,0 +1,40 @@
+import { Dispatch, SetStateAction, useEffect, useState } from 'react';
+
+export default function useLocalStorage<T>(key: string, initialValue: T): [T, Dispatch<SetStateAction<T>>] {
+ const [storedValue, setStoredValue] = useState(initialValue);
+ const [firstLoadDone, setFirstLoadDone] = useState(false);
+
+ useEffect(() => {
+ const fromLocal = () => {
+ if (typeof window === 'undefined') {
+ return initialValue;
+ }
+ try {
+ const item = window.localStorage.getItem(key);
+ return item ? JSON.parse(item) as T : initialValue;
+ } catch (error) {
+ console.error(error);
+ return initialValue;
+ }
+ };
+ if (!firstLoadDone) {
+ setStoredValue(fromLocal());
+ setFirstLoadDone(true);
+ }
+ }, [firstLoadDone, initialValue, key]); // Only run when first load is done, initialValue, or key change
+
+ useEffect(() => {
+
+ if (!firstLoadDone) return;
+
+ try {
+ if (typeof window !== 'undefined') {
+ window.localStorage.setItem(key, JSON.stringify(storedValue));
+ }
+ } catch (error) {
+ console.log(error);
+ }
+ }, [storedValue, firstLoadDone, key]); // Update localStorage when storedValue changes
+
+ return [storedValue, setStoredValue];
+}
\ No newline at end of file
diff --git a/flowsint-web/src/lib/hooks/use-platform-icons.tsx b/flowsint-web/src/lib/hooks/use-platform-icons.tsx
new file mode 100644
index 00000000..ad3bd739
--- /dev/null
+++ b/flowsint-web/src/lib/hooks/use-platform-icons.tsx
@@ -0,0 +1,16 @@
+import { JSX, useMemo } from "react";
+import { actionItems, type ActionItem } from "../action-items"
+
+export const usePlatformIcons = () => {
+ return useMemo(() => {
+ if (!actionItems[5]?.children)
+ return {};
+ return actionItems[5].children.reduce((acc: Record<string, { icon: JSX.Element }>, item: ActionItem) => {
+ const platform = item.key.split("_")[2];
+ acc[platform] = {
+ icon: <item.icon style={{ color: item.color }} />,
+ };
+ return acc;
+ }, {} as Record<string, { icon: JSX.Element }>);
+ }, []);
+};
\ No newline at end of file
diff --git a/flowsint-web/src/lib/supabase/client.ts b/flowsint-web/src/lib/supabase/client.ts
new file mode 100644
index 00000000..e823222b
--- /dev/null
+++ b/flowsint-web/src/lib/supabase/client.ts
@@ -0,0 +1,7 @@
+import { createBrowserClient } from '@supabase/ssr'
+
+if (!process.env.NEXT_PUBLIC_SUPABASE_URL || !process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY) {
+ throw new Error('Missing Supabase environment variables');
+}
+
+export const supabase = createBrowserClient(process.env.NEXT_PUBLIC_SUPABASE_URL, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY)
\ No newline at end of file
diff --git a/flowsint-web/src/lib/supabase/middleware.ts b/flowsint-web/src/lib/supabase/middleware.ts
new file mode 100644
index 00000000..21a5df1c
--- /dev/null
+++ b/flowsint-web/src/lib/supabase/middleware.ts
@@ -0,0 +1,65 @@
+import { createServerClient } from '@supabase/ssr'
+import { NextResponse, type NextRequest } from 'next/server'
+
+export async function updateSession(request: NextRequest) {
+ let supabaseResponse = NextResponse.next({
+ request,
+ })
+ const supabase = createServerClient(
+ process.env.NEXT_PUBLIC_DOCKER_SUPABASE_URL!,
+ process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
+ {
+ cookies: {
+ getAll() {
+ return request.cookies.getAll()
+ },
+ setAll(cookiesToSet) {
+ cookiesToSet.forEach(({ name, value, options }) => request.cookies.set(name, value))
+ supabaseResponse = NextResponse.next({
+ request,
+ })
+ cookiesToSet.forEach(({ name, value, options }) =>
+ supabaseResponse.cookies.set(name, value, options)
+ )
+ },
+ },
+ }
+ )
+
+ // Do not run code between createServerClient and
+ // supabase.auth.getUser(). A simple mistake could make it very hard to debug
+ // issues with users being randomly logged out.
+
+ // IMPORTANT: DO NOT REMOVE auth.getUser()
+
+ const {
+ data: { user },
+ } = await supabase.auth.getUser()
+
+ if (
+ !user &&
+ !request.nextUrl.pathname.startsWith('/login') &&
+ !request.nextUrl.pathname.startsWith('/auth') &&
+ !request.nextUrl.pathname.startsWith('/api')
+ ) {
+ // no user, potentially respond by redirecting the user to the login page
+ const url = request.nextUrl.clone()
+ url.pathname = '/login'
+ return NextResponse.redirect(url)
+ }
+
+ // IMPORTANT: You *must* return the supabaseResponse object as it is.
+ // If you're creating a new response object with NextResponse.next() make sure to:
+ // 1. Pass the request in it, like so:
+ // const myNewResponse = NextResponse.next({ request })
+ // 2. Copy over the cookies, like so:
+ // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())
+ // 3. Change the myNewResponse object to fit your needs, but avoid changing
+ // the cookies!
+ // 4. Finally:
+ // return myNewResponse
+ // If this is not done, you may be causing the browser and server to go out
+ // of sync and terminate the user's session prematurely!
+
+ return supabaseResponse
+}
\ No newline at end of file
diff --git a/flowsint-web/src/lib/supabase/server.ts b/flowsint-web/src/lib/supabase/server.ts
new file mode 100644
index 00000000..cbbb6d72
--- /dev/null
+++ b/flowsint-web/src/lib/supabase/server.ts
@@ -0,0 +1,43 @@
+import { createServerClient } from '@supabase/ssr'
+import { cookies } from 'next/headers'
+
+export async function createClient() {
+ const cookieStore = await cookies()
+ const supabaseToken = cookieStore.get('sb-token')?.value
+
+ return createServerClient(
+ process.env.NEXT_PUBLIC_DOCKER_SUPABASE_URL!,
+ process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
+ {
+ auth: {
+ persistSession: false,
+ // Add the token if it exists
+ ...(supabaseToken && {
+ autoRefreshToken: false,
+ detectSessionInUrl: false,
+ storage: {
+ getItem: () => supabaseToken,
+ setItem: () => { },
+ removeItem: () => { },
+ },
+ }),
+ },
+ cookies: {
+ getAll() {
+ return cookieStore.getAll()
+ },
+ setAll(cookiesToSet) {
+ try {
+ cookiesToSet.forEach(({ name, value, options }) =>
+ cookieStore.set(name, value, options)
+ )
+ } catch {
+ // The `setAll` method was called from a Server Component.
+ // This can be ignored if you have middleware refreshing
+ // user sessions.
+ }
+ },
+ },
+ }
+ )
+}
\ No newline at end of file
diff --git a/flowsint-web/src/lib/utils.ts b/flowsint-web/src/lib/utils.ts
new file mode 100644
index 00000000..276c6751
--- /dev/null
+++ b/flowsint-web/src/lib/utils.ts
@@ -0,0 +1,476 @@
+import { clsx, type ClassValue } from "clsx"
+import { twMerge } from "tailwind-merge"
+import Dagre from '@dagrejs/dagre';
+//@ts-ignore
+
+import * as d3 from "d3-force"
+
+export function cn(...inputs: ClassValue[]) {
+ return twMerge(clsx(inputs))
+}
+
+export const zoomSelector = (s: { transform: number[]; }) => s.transform[2] >= 0.6;
+
+import { Position, MarkerType } from '@xyflow/react';
+import { AppNode } from "@/store/flow-store";
+
+// this helper function returns the intersection point
+// of the line between the center of the intersectionNode and the target node
+function getNodeIntersection(intersectionNode: { measured: { width: any; height: any; }; internals: { positionAbsolute: any; }; }, targetNode: { internals: { positionAbsolute: any; }; measured: { width: number; height: number; }; }) {
+ // https://math.stackexchange.com/questions/1724792/an-algorithm-for-finding-the-intersection-point-between-a-center-of-vision-and-a
+ const { width: intersectionNodeWidth, height: intersectionNodeHeight } =
+ intersectionNode.measured;
+ const intersectionNodePosition = intersectionNode.internals.positionAbsolute;
+ const targetPosition = targetNode.internals.positionAbsolute;
+
+ const w = intersectionNodeWidth / 2;
+ const h = intersectionNodeHeight / 2;
+
+ const x2 = intersectionNodePosition.x + w;
+ const y2 = intersectionNodePosition.y + h;
+ const x1 = targetPosition.x + targetNode.measured.width / 2;
+ const y1 = targetPosition.y + targetNode.measured.height / 2;
+
+ const xx1 = (x1 - x2) / (2 * w) - (y1 - y2) / (2 * h);
+ const yy1 = (x1 - x2) / (2 * w) + (y1 - y2) / (2 * h);
+ const a = 1 / (Math.abs(xx1) + Math.abs(yy1));
+ const xx3 = a * xx1;
+ const yy3 = a * yy1;
+ const x = w * (xx3 + yy3) + x2;
+ const y = h * (-xx3 + yy3) + y2;
+
+ return { x, y };
+}
+
+// returns the position (top,right,bottom or right) passed node compared to the intersection point
+function getEdgePosition(node: { internals: { positionAbsolute: any; }; }, intersectionPoint: { x: any; y: any; }) {
+ const n = { ...node.internals.positionAbsolute, ...node };
+ const nx = Math.round(n.x);
+ const ny = Math.round(n.y);
+ const px = Math.round(intersectionPoint.x);
+ const py = Math.round(intersectionPoint.y);
+
+ if (px <= nx + 1) {
+ return Position.Left;
+ }
+ if (px >= nx + n.measured.width - 1) {
+ return Position.Right;
+ }
+ if (py <= ny + 1) {
+ return Position.Top;
+ }
+ if (py >= n.y + n.measured.height - 1) {
+ return Position.Bottom;
+ }
+
+ return Position.Top;
+}
+
+// returns the parameters (sx, sy, tx, ty, sourcePos, targetPos) you need to create an edge
+export function getEdgeParams(source: any, target: any) {
+ const sourceIntersectionPoint = getNodeIntersection(source, target);
+ const targetIntersectionPoint = getNodeIntersection(target, source);
+
+ const sourcePos = getEdgePosition(source, sourceIntersectionPoint);
+ const targetPos = getEdgePosition(target, targetIntersectionPoint);
+
+ return {
+ sx: sourceIntersectionPoint.x,
+ sy: sourceIntersectionPoint.y,
+ tx: targetIntersectionPoint.x,
+ ty: targetIntersectionPoint.y,
+ sourcePos,
+ targetPos,
+ };
+}
+
+export function initialElements() {
+ const nodes = [];
+ const edges = [];
+ const center = { x: window.innerWidth / 2, y: window.innerHeight / 2 };
+
+ nodes.push({ id: 'target', data: { label: 'Target' }, position: center });
+
+ for (let i = 0; i < 8; i++) {
+ const degrees = i * (360 / 8);
+ const radians = degrees * (Math.PI / 180);
+ const x = 250 * Math.cos(radians) + center.x;
+ const y = 250 * Math.sin(radians) + center.y;
+
+ nodes.push({ id: `${i}`, data: { label: 'Source' }, position: { x, y } });
+
+ edges.push({
+ id: `edge-${i}`,
+ target: 'target',
+ source: `${i}`,
+ type: 'floating',
+ markerEnd: {
+ type: MarkerType.Arrow,
+ },
+ });
+ }
+
+ return { nodes, edges };
+}
+
+interface Node {
+ id: string
+ position?: { x: number; y: number }
+ measured?: { width: number; height: number }
+ [key: string]: any
+}
+
+interface Edge {
+ source: string
+ target: string
+ [key: string]: any
+}
+
+interface LayoutOptions {
+ direction?: string
+ strength?: number
+ distance?: number
+ iterations?: number
+}
+
+// export const getLayoutedElements = (
+// nodes: AppNode[],
+// edges: Edge[],
+// options: LayoutOptions = {
+// direction: "LR",
+// strength: -300,
+// distance: 100,
+// iterations: 300,
+// },
+// ) => {
+// // Create a map of node IDs to indices for the simulation
+// const nodeMap = new Map(nodes.map((node, i) => [node.id, i]))
+
+// // Create a copy of nodes with positions for the simulation
+// const nodesCopy = nodes.map((node) => ({
+// ...node,
+// x: node.position?.x || Math.random() * 500,
+// y: node.position?.y || Math.random() * 500,
+// width: node.measured?.width || 0,
+// height: node.measured?.height || 0,
+// }))
+
+// // Create links for the simulation using indices
+// const links = edges.map((edge) => ({
+// source: nodeMap.get(edge.source),
+// target: nodeMap.get(edge.target),
+// original: edge,
+// }))
+
+// // Create the simulation
+// const simulation = d3
+// .forceSimulation(nodesCopy)
+// .force(
+// "link",
+// d3.forceLink(links).id((d: any) => nodeMap.get(d.id)),
+// )
+// .force("charge", d3.forceManyBody().strength(options.strength || -300))
+// .force("center", d3.forceCenter(250, 250))
+// .force(
+// "collision",
+// d3.forceCollide().radius((d: any) => Math.max(d.width, d.height) / 2 + 10),
+// )
+
+// // If direction is horizontal, adjust forces
+// if (options.direction === "LR") {
+// simulation.force("x", d3.forceX(250).strength(0.1))
+// simulation.force("y", d3.forceY(250).strength(0.05))
+// } else {
+// simulation.force("x", d3.forceX(250).strength(0.05))
+// simulation.force("y", d3.forceY(250).strength(0.1))
+// }
+
+// // Run the simulation synchronously
+// simulation.stop()
+// for (let i = 0; i < (options.iterations || 300); i++) {
+// simulation.tick()
+// }
+
+// // Update node positions based on simulation results
+// const updatedNodes = nodesCopy.map((node) => ({
+// ...node,
+// position: {
+// x: node.x - node.width / 2,
+// y: node.y - node.height / 2,
+// },
+// }))
+
+// return {
+// nodes: updatedNodes,
+// edges,
+// }
+// }
+
+export const getLayoutedElements = (nodes: AppNode[],
+ edges: Edge[],
+ options: LayoutOptions = {
+ direction: "TB",
+ strength: -300,
+ distance: 100,
+ iterations: 300,
+ },) => {
+
+ const g = new Dagre.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
+ g.setGraph({ rankdir: options.direction });
+
+ edges.forEach((edge) => g.setEdge(edge.source, edge.target));
+ nodes.forEach((node) =>
+ g.setNode(node.id, {
+ ...node,
+ width: node.measured?.width ?? 0,
+ height: node.measured?.height ?? 0,
+ }),
+ );
+
+ Dagre.layout(g);
+
+ return {
+ nodes: nodes.map((node) => {
+ const position = g.node(node.id);
+ // We are shifting the dagre node position (anchor=center center) to the top left
+ // so it matches the React Flow node anchor point (top left).
+ const x = position.x - (node.measured?.width ?? 0) / 2;
+ const y = position.y - (node.measured?.height ?? 0) / 2;
+
+ return { ...node, position: { x, y } };
+ }),
+ edges,
+ };
+};
+
+
+export const sanitize = (name: string) => {
+ return name
+ .normalize("NFKD") // Decompose special characters (e.g., accents)
+ .replace(/[\u0300-\u036f]/g, "") // Remove accent marks
+ .replace(/[^a-zA-Z0-9.\-_]/g, "_") // Replace invalid characters with underscores
+ .replace(/_{2,}/g, "_") // Replace multiple underscores with a single one
+ .replace(/^_|_$/g, "") // Trim leading or trailing underscores
+ .toLowerCase(); // Convert to lowercase for consistency
+};
+
+export const formatFileSize = (bytes: number) => {
+ if (bytes < 1024) return bytes + " B"
+ else if (bytes < 1048576) return (bytes / 1024).toFixed(1) + " KB"
+ else return (bytes / 1048576).toFixed(1) + " MB"
+}
+
+export const nodesTypes = {
+ // Types existants
+ emails: { table: "emails", type: "email", fields: ["email"] },
+ individuals: { table: "individuals", type: "individual", fields: ["full_name"] },
+ phone_numbers: { table: "phone_numbers", type: "phone", fields: ["phone_number"] },
+ ip_addresses: { table: "ip_addresses", type: "ip", fields: ["ip_address"] },
+ social_accounts_facebook: {
+ table: "social_accounts",
+ type: "social",
+ fields: ["profile_url", "username", "platform:facebook"],
+ },
+ social_accounts_instagram: {
+ table: "social_accounts",
+ type: "social",
+ fields: ["profile_url", "username", "platform:instagram"],
+ },
+ social_accounts_telegram: {
+ table: "social_accounts",
+ type: "social",
+ fields: ["profile_url", "username", "platform:telegram"],
+ },
+ social_accounts_snapchat: {
+ table: "social_accounts",
+ type: "social",
+ fields: ["profile_url", "username", "platform:snapchat"],
+ },
+ social_accounts_signal: {
+ table: "social_accounts",
+ type: "social",
+ fields: ["profile_url", "username", "platform:signal"],
+ },
+ social_accounts_github: {
+ table: "social_accounts",
+ type: "social",
+ fields: ["profile_url", "username", "platform:github"],
+ },
+ physical_addresses: { table: "physical_addresses", type: "address", fields: ["address", "city", "country", "zip"] },
+ vehicles_car: {
+ table: "vehicles",
+ type: "vehicle",
+ fields: ["plate", "model", "year", "brand", "type:car"],
+ },
+ vehicles_motorcycle: {
+ table: "vehicles",
+ type: "vehicle",
+ fields: ["plate", "model", "year", "brand", "type:motorcycle"],
+ },
+ vehicles_boat: {
+ table: "vehicles",
+ type: "vehicle",
+ fields: ["plate", "model", "year", "brand", "type:boat"],
+ },
+
+ // Nouveaux réseaux sociaux
+ social_accounts_linkedin: {
+ table: "social_accounts",
+ type: "social",
+ fields: ["profile_url", "username", "platform:linkedin"],
+ },
+ social_accounts_twitter: {
+ table: "social_accounts",
+ type: "social",
+ fields: ["profile_url", "username", "platform:twitter"],
+ },
+ social_accounts_tiktok: {
+ table: "social_accounts",
+ type: "social",
+ fields: ["profile_url", "username", "platform:tiktok"],
+ },
+ social_accounts_reddit: {
+ table: "social_accounts",
+ type: "social",
+ fields: ["profile_url", "username", "platform:reddit"],
+ },
+ social_accounts_discord: {
+ table: "social_accounts",
+ type: "social",
+ fields: ["profile_url", "username", "platform:discord"],
+ },
+
+ // Nouveaux types de véhicules
+ vehicles_aircraft: {
+ table: "vehicles",
+ type: "vehicle",
+ fields: ["registration", "model", "year", "manufacturer", "type:aircraft"],
+ },
+
+ // Organisation
+ organizations: {
+ table: "organizations",
+ type: "organization",
+ fields: ["name", "registration_number", "founding_date"],
+ },
+
+ // Site web
+ websites: {
+ table: "websites",
+ type: "website",
+ fields: ["url", "registration_date", "registrar", "ip_address"],
+ },
+
+ // Document
+ documents: {
+ table: "documents",
+ type: "document",
+ fields: ["title", "author", "creation_date", "file_hash", "file_type"],
+ },
+
+ // Finances
+ crypto_wallets: {
+ table: "crypto_wallets",
+ type: "financial",
+ fields: ["address", "currency", "platform"],
+ },
+ bank_accounts: {
+ table: "bank_accounts",
+ type: "financial",
+ fields: ["account_number", "bank_name", "iban", "bic"],
+ },
+ transactions: {
+ table: "transactions",
+ type: "financial",
+ fields: ["amount", "date", "sender", "recipient", "currency"],
+ },
+
+ // Événements
+ events: {
+ table: "events",
+ type: "event",
+ fields: ["name", "date", "location", "description", "participants"],
+ },
+
+ // Appareils
+ devices_phone: {
+ table: "devices",
+ type: "device",
+ fields: ["imei", "model", "manufacturer", "serial_number", "type:phone"],
+ },
+ devices_computer: {
+ table: "devices",
+ type: "device",
+ fields: ["mac_address", "model", "manufacturer", "serial_number", "type:computer"],
+ },
+ devices_tablet: {
+ table: "devices",
+ type: "device",
+ fields: ["imei", "model", "manufacturer", "serial_number", "type:tablet"],
+ },
+ devices_iot: {
+ table: "devices",
+ type: "device",
+ fields: ["mac_address", "model", "manufacturer", "serial_number", "type:iot"],
+ },
+
+ // Médias
+ media: {
+ table: "media",
+ type: "media",
+ fields: ["filename", "hash", "creation_date", "location", "exif_data"],
+ },
+
+ // Éducation
+ education: {
+ table: "education",
+ type: "education",
+ fields: ["institution", "degree", "field", "start_date", "end_date"],
+ },
+
+ // Relations
+ relationships: {
+ table: "relationships",
+ type: "relationship",
+ fields: ["type", "entity_a", "entity_b", "start_date", "end_date", "description"],
+ },
+
+ // Activités en ligne
+ forum_posts: {
+ table: "forum_posts",
+ type: "online_activity",
+ fields: ["forum", "username", "post_date", "post_content", "post_url", "type:forum_post"],
+ },
+ comments: {
+ table: "comments",
+ type: "online_activity",
+ fields: ["platform", "username", "comment_date", "comment_content", "comment_url", "type:comment"],
+ },
+ online_purchases: {
+ table: "online_purchases",
+ type: "online_activity",
+ fields: ["platform", "username", "purchase_date", "item", "price", "type:purchase"],
+ },
+
+ // Empreinte numérique
+ digital_footprints: {
+ table: "digital_footprints",
+ type: "digital_footprint",
+ fields: ["platform", "username", "date_discovered", "data_type", "source_url"],
+ },
+
+ // Données biométriques
+ biometric_data: {
+ table: "biometric_data",
+ type: "biometric",
+ fields: ["type", "identifier", "date_collected", "source"],
+ },
+
+ // Identifiants
+ credentials: {
+ table: "credentials",
+ type: "credential",
+ fields: ["service", "username", "hash", "breach_date", "breach_source"],
+ },
+}
+
diff --git a/proxy/docker-compose.yml b/proxy/docker-compose.yml
deleted file mode 100644
index fdd67ffa..00000000
--- a/proxy/docker-compose.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-services:
- reverse-proxy:
- image: traefik:v3.1
- command:
- - "--api.insecure=true"
- - "--providers.docker"
- - "--entrypoints.ws.address=:80"
- # - "--entryPoints.websecure.address=:443"
- # - "--entrypoints.websecure.http.tls.certresolver=myresolver"
- # - "--providers.file.filename=/etc/traefik/dynamic.yml"
- - "--providers.file.watch=true"
- ports:
- # The HTTP port
- - "80:80"
- # - "443:443"
- # The Web UI (enabled by --api.insecure=true)
- - "8080:8080"
- restart: unless-stopped
- volumes:
- # - ./certs:/etc/traefik/certs
- # - ./dynamic.yml:/etc/traefik/dynamic.yml
- - /var/run/docker.sock:/var/run/docker.sock
-networks:
- default:
- name: traefik
- driver: bridge
\ No newline at end of file