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,6 +63,7 @@
</script> </script>
<div class="flex gap-5 flex-col"> <div class="flex gap-5 flex-col">
<div class="w-full flex justify-between gap-5">
<div <div
class="flex gap-3 justify-start items-center w-full overflow-y-hidden overflow-x-auto" class="flex gap-3 justify-start items-center w-full overflow-y-hidden overflow-x-auto"
> >
@@ -69,11 +75,33 @@
? "btn-primary" ? "btn-primary"
: "btn-ghost btn-neutral text-base-content/80 hover:text-neutral-content", : "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} {/each}
</div> </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"
>
<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>
<form <form
class="join w-full" class="join w-full"
onsubmit={(e) => { onsubmit={(e) => {

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,6 +120,7 @@
<Stats {result} /> <Stats {result} />
</div> </div>
{#if result.LeakResult.Error !== "not enabled" }
<div class="collapse collapse-arrow bg-base-100 border"> <div class="collapse collapse-arrow bg-base-100 border">
<input type="radio" name="my-accordion-2" checked={true} /> <input type="radio" name="my-accordion-2" checked={true} />
<div <div
@@ -183,6 +186,8 @@
{/if} {/if}
</div> </div>
</div> </div>
{/if}
{#if result.GithubResult.Error !== "not enabled" }
<div class="collapse collapse-arrow bg-base-100 border"> <div class="collapse collapse-arrow bg-base-100 border">
<input type="radio" name="my-accordion-2" /> <input type="radio" name="my-accordion-2" />
<div <div
@@ -228,6 +233,7 @@
{/if} {/if}
</div> </div>
</div> </div>
{/if}
</div> </div>
{/if} {/if}