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
Column string // The column to search in (e.g., "email", "password", etc.
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 {
@@ -38,8 +42,14 @@ func Search(s *server.Server, q Query, r *Result, mu *sync.RWMutex) {
mu.Unlock()
wg.Add(2)
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)
mu.Lock()
r.LeakResult = leakResult
@@ -48,6 +58,13 @@ func Search(s *server.Server, q Query, r *Result, mu *sync.RWMutex) {
}()
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)
mu.Lock()
r.GithubResult = *githubResult

View File

@@ -1,19 +1,22 @@
<script lang="ts">
import { serverPassword, serverUrl } from "$src/lib/stores/server";
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 { navigate } from "sv-router/generated";
import { toast } from "svelte-sonner";
const {
initialQuery = "",
initialFilter = "all",
initialExactMatch = false,
initialDatawells = true,
initialGithubRecon = true,
}: {
initialQuery?: string;
initialFilter?: string;
initialExactMatch?: boolean;
initialDatawells?: boolean;
initialGithubRecon?: boolean;
} = $props();
let filters = [
@@ -30,12 +33,14 @@
let activeFilter = $state<string>(initialFilter);
let query = $state<string>(initialQuery);
let exactMatch = $state<boolean>(initialExactMatch);
let datawells = $state<boolean>(initialDatawells);
let githubRecon = $state<boolean>(initialGithubRecon);
function NewSearch() {
axios
.post(
`${$serverUrl}/search`,
{ Text: query, Column: activeFilter, ExactMatch: exactMatch },
{ Text: query, Column: activeFilter, ExactMatch: exactMatch, Datawells: datawells, GithubRecon: githubRecon },
{
headers: {
"Content-Type": "application/json",
@@ -58,6 +63,7 @@
</script>
<div class="flex gap-5 flex-col">
<div class="w-full flex justify-between gap-5">
<div
class="flex gap-3 justify-start items-center w-full overflow-y-hidden overflow-x-auto"
>
@@ -69,11 +75,33 @@
? "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"
>
<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
class="join w-full"
onsubmit={(e) => {

View File

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

View File

@@ -108,6 +108,8 @@
initialQuery={result.Query.Text}
initialFilter={result.Query.Column}
initialExactMatch={result.Query.ExactMatch}
initialDatawells={result.Query.Datawells}
initialGithubRecon={result.Query.GithubRecon}
/>
</header>
@@ -118,6 +120,7 @@
<Stats {result} />
</div>
{#if result.LeakResult.Error !== "not enabled" }
<div class="collapse collapse-arrow bg-base-100 border">
<input type="radio" name="my-accordion-2" checked={true} />
<div
@@ -183,6 +186,8 @@
{/if}
</div>
</div>
{/if}
{#if result.GithubResult.Error !== "not enabled" }
<div class="collapse collapse-arrow bg-base-100 border">
<input type="radio" name="my-accordion-2" />
<div
@@ -228,6 +233,7 @@
{/if}
</div>
</div>
{/if}
</div>
{/if}