enable or disable services

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2025-09-25 16:05:16 +02:00
parent 96d044941d
commit 740bdce215
4 changed files with 176 additions and 121 deletions

View File

@@ -16,6 +16,10 @@ type Query struct {
Text string Text string
Column string // The column to search in (e.g., "email", "password", etc. Column string // The column to search in (e.g., "email", "password", etc.
ExactMatch bool // Whether to search for an exact match ExactMatch bool // Whether to search for an exact match
// Services
Datawells bool // Whether to include datawells in the search
GithubRecon bool // Whether to include github-recon in the search
} }
type Result struct { type Result struct {
@@ -38,8 +42,14 @@ func Search(s *server.Server, q Query, r *Result, mu *sync.RWMutex) {
mu.Unlock() mu.Unlock()
wg.Add(2) wg.Add(2)
go func() { go func() {
if !q.Datawells {
mu.Lock()
r.LeakResult = dataleak.LeakResult{Error: "not enabled"}
mu.Unlock()
wg.Done()
return
}
leakResult := dataleak.Search(s, q.Text, q.Column, q.ExactMatch) leakResult := dataleak.Search(s, q.Text, q.Column, q.ExactMatch)
mu.Lock() mu.Lock()
r.LeakResult = leakResult r.LeakResult = leakResult
@@ -48,6 +58,13 @@ func Search(s *server.Server, q Query, r *Result, mu *sync.RWMutex) {
}() }()
go func() { go func() {
if !q.GithubRecon {
mu.Lock()
r.GithubResult = osint.GithubResult{Error: "not enabled"}
mu.Unlock()
wg.Done()
return
}
githubResult := osint.Search(s, q.Text, q.Column) githubResult := osint.Search(s, q.Text, q.Column)
mu.Lock() mu.Lock()
r.GithubResult = *githubResult r.GithubResult = *githubResult

View File

@@ -1,19 +1,22 @@
<script lang="ts"> <script lang="ts">
import { serverPassword, serverUrl } from "$src/lib/stores/server"; import { serverPassword, serverUrl } from "$src/lib/stores/server";
import { cn } from "$src/lib/utils"; import { cn } from "$src/lib/utils";
import { Equal, EqualNot, Search } from "@lucide/svelte"; import { Equal, EqualNot, Search, Settings } from "@lucide/svelte";
import axios from "axios"; import axios from "axios";
import { navigate } from "sv-router/generated";
import { toast } from "svelte-sonner"; import { toast } from "svelte-sonner";
const { const {
initialQuery = "", initialQuery = "",
initialFilter = "all", initialFilter = "all",
initialExactMatch = false, initialExactMatch = false,
initialDatawells = true,
initialGithubRecon = true,
}: { }: {
initialQuery?: string; initialQuery?: string;
initialFilter?: string; initialFilter?: string;
initialExactMatch?: boolean; initialExactMatch?: boolean;
initialDatawells?: boolean;
initialGithubRecon?: boolean;
} = $props(); } = $props();
let filters = [ let filters = [
@@ -30,12 +33,14 @@
let activeFilter = $state<string>(initialFilter); let activeFilter = $state<string>(initialFilter);
let query = $state<string>(initialQuery); let query = $state<string>(initialQuery);
let exactMatch = $state<boolean>(initialExactMatch); let exactMatch = $state<boolean>(initialExactMatch);
let datawells = $state<boolean>(initialDatawells);
let githubRecon = $state<boolean>(initialGithubRecon);
function NewSearch() { function NewSearch() {
axios axios
.post( .post(
`${$serverUrl}/search`, `${$serverUrl}/search`,
{ Text: query, Column: activeFilter, ExactMatch: exactMatch }, { Text: query, Column: activeFilter, ExactMatch: exactMatch, Datawells: datawells, GithubRecon: githubRecon },
{ {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@@ -58,20 +63,43 @@
</script> </script>
<div class="flex gap-5 flex-col"> <div class="flex gap-5 flex-col">
<div <div class="w-full flex justify-between gap-5">
class="flex gap-3 justify-start items-center w-full overflow-y-hidden overflow-x-auto" <div
> class="flex gap-3 justify-start items-center w-full overflow-y-hidden overflow-x-auto"
{#each filters as filter} >
<button {#each filters as filter}
class={cn( <button
"btn btn-md capitalize", class={cn(
activeFilter === filter "btn btn-md capitalize",
? "btn-primary" activeFilter === filter
: "btn-ghost btn-neutral text-base-content/80 hover:text-neutral-content", ? "btn-primary"
)} : "btn-ghost btn-neutral text-base-content/80 hover:text-neutral-content",
onclick={() => (activeFilter = filter)}>{filter.replace("_", " ")}</button )}
onclick={() => (activeFilter = filter)}
>{filter.replace("_", " ")}</button
>
{/each}
</div>
<details class="dropdown dropdown-end">
<summary class="btn btn-square m-1"><Settings size={16} /></summary>
<ul
class="menu dropdown-content bg-base-200 rounded-box z-1 w-52 p-2 shadow-sm"
> >
{/each} <li>
<label class="label">
<input type="checkbox" bind:checked={datawells} class="checkbox" />
Datawells lookup
</label>
</li>
<li>
<label class="label">
<input type="checkbox" bind:checked={githubRecon} class="checkbox" />
Github Recon
</label>
</li>
</ul>
</details>
</div> </div>
<form <form

View File

@@ -2,6 +2,10 @@ type Query = {
Text: string; Text: string;
Column: string; Column: string;
ExactMatch: boolean; ExactMatch: boolean;
// Services
Datawells: boolean;
GithubRecon: boolean;
}; };
type LeakResult = { type LeakResult = {

View File

@@ -108,6 +108,8 @@
initialQuery={result.Query.Text} initialQuery={result.Query.Text}
initialFilter={result.Query.Column} initialFilter={result.Query.Column}
initialExactMatch={result.Query.ExactMatch} initialExactMatch={result.Query.ExactMatch}
initialDatawells={result.Query.Datawells}
initialGithubRecon={result.Query.GithubRecon}
/> />
</header> </header>
@@ -118,116 +120,120 @@
<Stats {result} /> <Stats {result} />
</div> </div>
<div class="collapse collapse-arrow bg-base-100 border"> {#if result.LeakResult.Error !== "not enabled" }
<input type="radio" name="my-accordion-2" checked={true} /> <div class="collapse collapse-arrow bg-base-100 border">
<div <input type="radio" name="my-accordion-2" checked={true} />
class="collapse-title font-semibold text-xl flex justify-between items-center" <div
> class="collapse-title font-semibold text-xl flex justify-between items-center"
<div class="flex items-center gap-2"> >
<Database size={18} class="text-base-content/60" /> <div class="flex items-center gap-2">
Data wells lookup <Database size={18} class="text-base-content/60" />
</div> Data wells lookup
{#if result.LeakResult.Error !== ""}
<CircleX size={16} class="text-error" />
{:else if result.LeakResult.Duration === 0}
<span class="loading loading-dots loading-xs"></span>
{:else if result.LeakResult.Rows.length > 0}
<CircleCheck size={16} class="text-success" />
{:else}
<CircleMinus size={16} class="text-base-content/60" />
{/if}
</div>
<div class="collapse-content">
{#if result.LeakResult.Error !== ""}
<div role="alert" class="alert alert-soft alert-error">
<CircleAlert size={20} />
<span>Error! {result.LeakResult.Error}</span>
</div> </div>
{:else if result.LeakResult.Duration === 0} {#if result.LeakResult.Error !== ""}
<ul class="list rounded-box"> <CircleX size={16} class="text-error" />
{#each Array(5) as _} {:else if result.LeakResult.Duration === 0}
<div class="list-row text-left"> <span class="loading loading-dots loading-xs"></span>
<div> {:else if result.LeakResult.Rows.length > 0}
<div <CircleCheck size={16} class="text-success" />
class="skeleton size-10 rounded-box items-center justify-center flex" {:else}
></div> <CircleMinus size={16} class="text-base-content/60" />
</div> {/if}
<div> </div>
<div class="skeleton h-5 mb-1 w-52"></div> <div class="collapse-content">
<div {#if result.LeakResult.Error !== ""}
class="text-xs skeleton h-4 w-34 uppercase font-semibold opacity-60" <div role="alert" class="alert alert-soft alert-error">
></div> <CircleAlert size={20} />
</div> <span>Error! {result.LeakResult.Error}</span>
<div class="btn btn-square btn-ghost"> </div>
<ChevronDown size={12} /> {:else if result.LeakResult.Duration === 0}
</div> <ul class="list rounded-box">
</div> {#each Array(5) as _}
{/each} <div class="list-row text-left">
</ul> <div>
{:else} <div
<p class="text-base-content/60"> class="skeleton size-10 rounded-box items-center justify-center flex"
{result.LeakResult.Rows.length} results in {convertNanoSeconds( ></div>
result.LeakResult.Duration, </div>
)} <div>
</p> <div class="skeleton h-5 mb-1 w-52"></div>
{#if result.LeakResult.LimitHit} <div
<div role="alert" class="alert alert-soft my-4"> class="text-xs skeleton h-4 w-34 uppercase font-semibold opacity-60"
<CircleAlert size={20} /> ></div>
<div> </div>
<span class="font-semibold">Limit hit!</span> Consider refining <div class="btn btn-square btn-ghost">
your search query for more specific results. <ChevronDown size={12} />
</div> </div>
</div> </div>
{/each}
</ul>
{:else}
<p class="text-base-content/60">
{result.LeakResult.Rows.length} results in {convertNanoSeconds(
result.LeakResult.Duration,
)}
</p>
{#if result.LeakResult.LimitHit}
<div role="alert" class="alert alert-soft my-4">
<CircleAlert size={20} />
<div>
<span class="font-semibold">Limit hit!</span> Consider refining
your search query for more specific results.
</div>
</div>
{/if}
<Rows {result} />
{/if} {/if}
<Rows {result} />
{/if}
</div>
</div>
<div class="collapse collapse-arrow bg-base-100 border">
<input type="radio" name="my-accordion-2" />
<div
class="collapse-title font-semibold text-xl flex justify-between items-center"
>
<div class="flex items-center gap-2">
<Github size={18} class="text-base-content/60" />
Github Recon
</div> </div>
{#if result.GithubResult.Error !== ""}
<CircleX size={16} class="text-error" />
{:else if result.GithubResult.Duration === 0}
<span class="loading loading-dots loading-xs"></span>
{:else if !result.GithubResult.EmailResult?.Commits && !result.GithubResult.EmailResult?.Spoofing && !result.GithubResult.UsernameResult?.User}
<CircleMinus size={16} class="text-base-content/60" />
{:else if result.GithubResult.UsernameResult || result.GithubResult.EmailResult}
<CircleCheck size={16} class="text-success" />
{/if}
</div> </div>
<div class="collapse-content"> {/if}
{#if result.GithubResult.Error !== ""} {#if result.GithubResult.Error !== "not enabled" }
<div role="alert" class="alert alert-soft alert-error"> <div class="collapse collapse-arrow bg-base-100 border">
<CircleAlert size={20} /> <input type="radio" name="my-accordion-2" />
<span>Error! {result.GithubResult.Error}</span> <div
class="collapse-title font-semibold text-xl flex justify-between items-center"
>
<div class="flex items-center gap-2">
<Github size={18} class="text-base-content/60" />
Github Recon
</div> </div>
{:else if result.GithubResult.Duration === 0} {#if result.GithubResult.Error !== ""}
<div role="alert" class="alert alert-soft"> <CircleX size={16} class="text-error" />
<span class="loading loading-dots loading-sm"></span> {:else if result.GithubResult.Duration === 0}
<span>Loading...</span> <span class="loading loading-dots loading-xs"></span>
</div> {:else if !result.GithubResult.EmailResult?.Commits && !result.GithubResult.EmailResult?.Spoofing && !result.GithubResult.UsernameResult?.User}
{:else if !result.GithubResult.EmailResult?.Commits && !result.GithubResult.EmailResult?.Spoofing && !result.GithubResult.UsernameResult?.User} <CircleMinus size={16} class="text-base-content/60" />
<div role="alert" class="alert alert-soft"> {:else if result.GithubResult.UsernameResult || result.GithubResult.EmailResult}
<CircleMinus size={20} /> <CircleCheck size={16} class="text-success" />
<span>No result</span> {/if}
</div> </div>
{:else} <div class="collapse-content">
<p class="text-base-content/60 mb-4"> {#if result.GithubResult.Error !== ""}
Found a result in {convertNanoSeconds( <div role="alert" class="alert alert-soft alert-error">
result.GithubResult.Duration, <CircleAlert size={20} />
)} <span>Error! {result.GithubResult.Error}</span>
</p> </div>
<GithubResult githubResult={result.GithubResult} /> {:else if result.GithubResult.Duration === 0}
{/if} <div role="alert" class="alert alert-soft">
<span class="loading loading-dots loading-sm"></span>
<span>Loading...</span>
</div>
{:else if !result.GithubResult.EmailResult?.Commits && !result.GithubResult.EmailResult?.Spoofing && !result.GithubResult.UsernameResult?.User}
<div role="alert" class="alert alert-soft">
<CircleMinus size={20} />
<span>No result</span>
</div>
{:else}
<p class="text-base-content/60 mb-4">
Found a result in {convertNanoSeconds(
result.GithubResult.Duration,
)}
</p>
<GithubResult githubResult={result.GithubResult} />
{/if}
</div>
</div> </div>
</div> {/if}
</div> </div>
{/if} {/if}