Files
iknowyou/back/internal/search/demo.go
2026-04-06 15:12:34 +02:00

115 lines
5.0 KiB
Go

package search
import (
"context"
"time"
"github.com/google/uuid"
"github.com/anotherhadi/iknowyou/internal/tools"
)
func ptr(n int) *int { return &n }
func (m *Manager) InjectDemoSearches() {
now := time.Now()
_, cancel1 := context.WithCancel(context.Background())
s1 := &Search{
ID: uuid.NewString(),
Target: "john.doe@example.com",
InputType: tools.InputTypeEmail,
Profile: "default",
StartedAt: now.Add(-2 * time.Hour),
PlannedTools: []ToolStatus{
{Name: "user-scanner", ResultCount: ptr(10)},
{Name: "github-recon", ResultCount: ptr(3)},
},
cancelFn: cancel1,
status: StatusDone,
finishedAt: now.Add(-2*time.Hour + 18*time.Second),
}
s1.events = []tools.Event{
{Tool: "user-scanner", Type: tools.EventTypeOutput, Payload: "\x1b[35m== ADULT SITES ==\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Xvideos (john.doe@example.com): Registered\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Pornhub (john.doe@example.com): Registered\x1b[0m\n" +
"\x1b[0m\n" +
"\x1b[35m== CREATOR SITES ==\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Adobe (john.doe@example.com): Registered\x1b[0m\n" +
"\x1b[0m\n" +
"\x1b[35m== MUSIC SITES ==\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Spotify (john.doe@example.com): Registered\x1b[0m\n" +
"\x1b[0m\n" +
"\x1b[35m== LEARNING SITES ==\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Duolingo (john.doe@example.com): Registered\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Vedantu (john.doe@example.com): Registered\n \x1b[36m└── Phone: +9112****07\x1b[0m\n" +
"\x1b[0m\n" +
"\x1b[35m== SOCIAL SITES ==\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Pinterest (john.doe@example.com): Registered\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Facebook (john.doe@example.com): Registered\x1b[0m\n" +
"\x1b[0m\n" +
"\x1b[35m== GAMING SITES ==\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Chess.com (john.doe@example.com): Registered\x1b[0m\n" +
"\x1b[0m\n" +
"\x1b[35m== SHOPPING SITES ==\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Amazon (john.doe@example.com): Registered\x1b[0m\n"},
{Tool: "user-scanner", Type: tools.EventTypeDone},
{Tool: "github-recon", Type: tools.EventTypeOutput, Payload: "\x1b[1;38;2;113;135;253m👤 Commits author\x1b[0m\n\n" +
" \x1b[38;2;125;125;125mName:\x1b[0m \x1b[38;2;166;227;161m\"fastHack2025\"\x1b[0m\n" +
" \x1b[38;2;125;125;125mEmail:\x1b[0m \x1b[38;2;166;227;161m\"john.doe@example.com\"\x1b[0m\n" +
" \x1b[38;2;125;125;125mUsername:\x1b[0m \x1b[38;2;166;227;161m\"Unknown\"\x1b[0m\n" +
" \x1b[38;2;125;125;125mOccurrences:\x1b[0m \x1b[38;2;166;227;161m36\x1b[0m\n\n" +
" \x1b[38;2;125;125;125mName:\x1b[0m \x1b[38;2;166;227;161m\"Anthony\"\x1b[0m\n" +
" \x1b[38;2;125;125;125mEmail:\x1b[0m \x1b[38;2;166;227;161m\"john.doe@example.com\"\x1b[0m\n" +
" \x1b[38;2;125;125;125mUsername:\x1b[0m \x1b[38;2;166;227;161m\"Unknown\"\x1b[0m\n" +
" \x1b[38;2;125;125;125mOccurrences:\x1b[0m \x1b[38;2;166;227;161m52\x1b[0m\n\n" +
" \x1b[38;2;125;125;125mName:\x1b[0m \x1b[38;2;166;227;161m\"Gill\"\x1b[0m\n" +
" \x1b[38;2;125;125;125mEmail:\x1b[0m \x1b[38;2;166;227;161m\"john.doe@example.com\"\x1b[0m\n" +
" \x1b[38;2;125;125;125mUsername:\x1b[0m \x1b[38;2;166;227;161m\"johndoe\"\x1b[0m\n" +
" \x1b[38;2;125;125;125mOccurrences:\x1b[0m \x1b[38;2;166;227;161m60\x1b[0m"},
{Tool: "github-recon", Type: tools.EventTypeDone},
}
_, cancel2 := context.WithCancel(context.Background())
s2 := &Search{
ID: uuid.NewString(),
Target: "janedoe",
InputType: tools.InputTypeUsername,
Profile: "default",
StartedAt: now.Add(-30 * time.Minute),
PlannedTools: []ToolStatus{
{Name: "user-scanner", ResultCount: ptr(10)},
{Name: "github-recon", ResultCount: ptr(0)},
},
cancelFn: cancel2,
status: StatusDone,
finishedAt: now.Add(-30*time.Minute + 22*time.Second),
}
s2.events = []tools.Event{
{Tool: "user-scanner", Type: tools.EventTypeOutput, Payload: "\x1b[35m== SOCIAL SITES ==\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Reddit (janedoe): Found\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Threads (janedoe): Found\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] X (twitter) (janedoe): Found\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Youtube (janedoe): Found\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Telegram (janedoe): Found\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Tiktok (janedoe): Found\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Instagram (janedoe): Found\x1b[0m\n" +
"\x1b[0m\n" +
"\x1b[35m== GAMING SITES ==\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Chess.com (janedoe): Found\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Roblox (janedoe): Found\x1b[0m\n" +
"\x1b[0m\n" +
"\x1b[35m== EMAIL SITES ==\x1b[0m\n" +
"\x1b[0m \x1b[32m[✔] Protonmail (janedoe): Found\x1b[0m"},
{Tool: "user-scanner", Type: tools.EventTypeDone},
{Tool: "github-recon", Type: tools.EventTypeOutput, Payload: "\x1b[1;38;2;113;135;253m👤 User informations\x1b[0m\n\n" +
" \x1b[38;2;125;125;125mNo data found\x1b[0m"},
{Tool: "github-recon", Type: tools.EventTypeDone},
}
m.mu.Lock()
m.searches[s1.ID] = s1
m.searches[s2.ID] = s2
m.mu.Unlock()
}