Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attacks UI #17

Merged
merged 2 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/main/jsleak/jsleak.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { execSync } from 'child_process';
import path from 'path';
import fs from 'fs';
import { CurrentOS, toolPath } from '../util';
import { PROJECT_DIR } from '../api/project';
import { connectJson } from '../db/connect';
Expand All @@ -11,10 +12,12 @@ export async function findSecret(outputDir: string = PROJECT_DIR): Promise<{
error: any;
}> {
const jsleak = toolPath('jsleak');
const command = `${CurrentOS() === 'win32' ? 'type' : 'cat'} ${path.join(outputDir, 'httpx_live_domains.txt')} | ${jsleak} -s
>> ${path.join(outputDir, 'secrets.txt')}`;
const command = `${CurrentOS() === 'win32' ? 'type' : 'cat'} ${path.join(outputDir, 'httpx_live_domains.txt')} | ${jsleak} -s`;
try {
execSync(command);
fs.writeFileSync(
`${path.join(outputDir, 'secrets.txt')}`,
execSync(command).toString('utf-8'),
);
const numberOfUrls = await countLines(path.join(outputDir, 'secrets.txt'));
const db = connectJson(path.join(`${outputDir}/details.json`));
await db.update({
Expand All @@ -38,10 +41,12 @@ export async function extraLinks(outputDir: string = PROJECT_DIR): Promise<{
error: any;
}> {
const jsleak = toolPath('jsleak');
const command = `${CurrentOS() === 'win32' ? 'type' : 'cat'} ${path.join(outputDir, 'httpx_live_domains.txt')} | ${jsleak} -l | findstr ".js"
>> ${path.join(outputDir, 'extra_links.txt')}`;
const command = `${CurrentOS() === 'win32' ? 'type' : 'cat'} ${path.join(outputDir, 'httpx_live_domains.txt')} | ${jsleak} -l | findstr ".js"`;
try {
execSync(command);
fs.writeFileSync(
`${path.join(outputDir, 'extra_links.txt')}`,
execSync(command).toString('utf-8'),
);
const numberOfUrls = await countLines(
path.join(outputDir, 'extra_links.txt'),
);
Expand Down
2 changes: 1 addition & 1 deletion src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import { liveSubDomains, screenwin } from './recon/httpx';
import { fetchJs, parameter, wwayback } from './recon/waybackurls';
import { returnFile } from './api/serve';
import { findSecret, extraLinks } from './jsleak/jsleak';
import { extraLinks, findSecret } from './jsleak/jsleak';

class AppUpdater {
constructor() {
Expand Down
2 changes: 2 additions & 0 deletions src/main/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export type Channels =
| 'waybackurls-parameter'
| 'get-project-details'
| 'api-call'
| 'find-secrets'
| 'extra-links'
| 'open-link';

const electronHandler = {
Expand Down
5 changes: 3 additions & 2 deletions src/renderer/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { ProjectLayout } from './layout/projectLayout';
import Status from './views/project/status';
import Recon from './views/project/recon';
import { ReconResults } from './views/project/results/recon-results';
import JsLeaks from './views/project/JsLeaks.1';
import JsLeaks from './views/project/JsLeaks';
import Attacks from './views/project/attacks';

function Home() {
return (
Expand All @@ -31,7 +32,7 @@ export default function App() {
<Route path="recon" element={<Recon />} />
<Route path="result" element={<Results />} />
<Route path="result-recon" element={<ReconResults />} />
<Route path="attack" element={<Results />} />
<Route path="attacks" element={<Attacks />} />
<Route path="jsleaks" element={<JsLeaks />} />
</Route>
</Routes>
Expand Down
5 changes: 2 additions & 3 deletions src/renderer/components/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ const dashboardMenu: DashboardMenu[] = [
icon: <PocketKnife className="mr-2 h-4 w-4" />,
},
{
href: 'attack',
title: 'Attack',
Disabled: true,
href: 'attacks',
title: 'Attacks',
icon: <PocketKnife className="mr-2 h-4 w-4" />,
},
{
Expand Down
74 changes: 48 additions & 26 deletions src/renderer/views/project/JsLeaks.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,63 @@
/* eslint-disable react/jsx-props-no-spreading */
/* eslint-disable react-hooks/exhaustive-deps */
import { useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from '../../components/ui/card';
import Secrets from './JsLeaks Jobs/secrets';
import EndPoints from './JsLeaks Jobs/EndPoints';
import Secrets from './jsLeaksJob/secrets';
import EndPoints from './jsLeaksJob/Endpoint';
import { ProjectDetails } from '../../types';

export default function JsLeaks() {
const [details, setDetails] = useState<ProjectDetails>();
const { projectSlug } = useParams();

const getDetails = async () => {
const res = await window.electron.ipcRenderer.invoke(
'get-project-details',
projectSlug,
);
setDetails(res);
console.log(res);
};

useEffect(() => {
getDetails();
}, []);
return (
<div className="flex flex-col gap-4">
<h1 className="font-bold text-3xl">Initiate Recon Attacks</h1>
<div>
<div className="grid grid-flow-row grid-cols-2 gap-4">
<Card>
<CardHeader>
<CardTitle>Find Secrets</CardTitle>
<CardDescription>wanna find secrets ?</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<Secrets />
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Find EndPoints</CardTitle>
<CardDescription>
Unveiling extra and hidden endpoints
</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<EndPoints />
</CardContent>
</Card>
<h1 className="font-bold text-3xl">JsLeaks</h1>
{details && (
<div>
<div className="grid grid-flow-row grid-cols-2 gap-4">
<Card>
<CardHeader>
<CardTitle>Find Secrets</CardTitle>
<CardDescription>wanna find secrets ?</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<Secrets {...details} />
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Find EndPoints</CardTitle>
<CardDescription>
Unveiling extra and hidden endpoints
</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<EndPoints {...details} />
</CardContent>
</Card>
</div>
</div>
</div>
)}
</div>
);
}
61 changes: 61 additions & 0 deletions src/renderer/views/project/attacks.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from '../../components/ui/card';
import Exposures from './attacks/exposures';
import MissingHeaders from './attacks/missingHeaders';
import PotentialXss from './attacks/potentialXss';
import SqlInjection from './attacks/sqlInjection';

export default function Attacks() {
return (
<div className="flex flex-col gap-4">
<h1 className="font-bold text-3xl">Attacks</h1>
<div>
<div className="grid grid-flow-row grid-cols-2 gap-4">
<Card>
<CardHeader>
<CardTitle>Scan for exposures</CardTitle>
<CardDescription>wanna find exposures ?</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<Exposures />
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Scan for missing headers</CardTitle>
<CardDescription>wanna find more ?</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<MissingHeaders />
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Scan the URLs</CardTitle>
<CardDescription>wanna catch potential XSS</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<PotentialXss />
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Scan for SQL Injection</CardTitle>
<CardDescription>
SSTI, Open Redirect & CRLF Injection
</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<SqlInjection />
</CardContent>
</Card>
</div>
</div>
</div>
);
}
23 changes: 23 additions & 0 deletions src/renderer/views/project/attacks/exposures.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Loader2 } from 'lucide-react';
import { useState } from 'react';
import { Button } from '../../../components/ui/button';

export default function Exposures() {
const [Loading, setLoading] = useState<boolean>(false);
const RunExposures = async () => {
setLoading(true);
};
return (
// eslint-disable-next-line react/jsx-no-useless-fragment
<>
{!Loading ? (
<Button onClick={RunExposures}>Process</Button>
) : (
<Button disabled>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Please wait
</Button>
)}
</>
);
}
23 changes: 23 additions & 0 deletions src/renderer/views/project/attacks/missingHeaders.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Loader2 } from 'lucide-react';
import { useState } from 'react';
import { Button } from '../../../components/ui/button';

export default function MissingHeaders() {
const [Loading, setLoading] = useState<boolean>(false);
const RunMissingHeaders = async () => {
setLoading(true);
};
return (
// eslint-disable-next-line react/jsx-no-useless-fragment
<>
{!Loading ? (
<Button onClick={RunMissingHeaders}>Process</Button>
) : (
<Button disabled>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Please wait
</Button>
)}
</>
);
}
23 changes: 23 additions & 0 deletions src/renderer/views/project/attacks/potentialXss.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Loader2 } from 'lucide-react';
import { useState } from 'react';
import { Button } from '../../../components/ui/button';

export default function PotentialXss() {
const [Loading, setLoading] = useState<boolean>(false);
const RunPotentialXss = async () => {
setLoading(true);
};
return (
// eslint-disable-next-line react/jsx-no-useless-fragment
<>
{!Loading ? (
<Button onClick={RunPotentialXss}>Process</Button>
) : (
<Button disabled>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Please wait
</Button>
)}
</>
);
}
23 changes: 23 additions & 0 deletions src/renderer/views/project/attacks/sqlInjection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Loader2 } from 'lucide-react';
import { useState } from 'react';
import { Button } from '../../../components/ui/button';

export default function SqlInjection() {
const [Loading, setLoading] = useState<boolean>(false);
const RunSqlInjection = async () => {
setLoading(true);
};
return (
// eslint-disable-next-line react/jsx-no-useless-fragment
<>
{!Loading ? (
<Button onClick={RunSqlInjection}>Process</Button>
) : (
<Button disabled>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Please wait
</Button>
)}
</>
);
}
17 changes: 16 additions & 1 deletion src/renderer/views/project/jsLeaksJob/Endpoint.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
import { Loader2 } from 'lucide-react';
import { useState } from 'react';
import { Button } from '../../../components/ui/button';
import { useToast } from '../../../components/ui/use-toast';
import { ProjectDetails } from '../../../types';

export default function EndPoints() {
export default function EndPoints(details: ProjectDetails) {
const { name } = details;
const [Loading, setLoading] = useState<boolean>(false);
const { toast } = useToast();
const RunEndPoints = async () => {
setLoading(true);
if (details) {
const res = await window.electron.ipcRenderer.invoke('extra-links', {
projectName: name,
});
if (res) {
toast({
title: 'Endpoints are ready',
});
}
}
setLoading(false);
};
return (
// eslint-disable-next-line react/jsx-no-useless-fragment
Expand Down
15 changes: 14 additions & 1 deletion src/renderer/views/project/jsLeaksJob/secrets.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
import { Loader2 } from 'lucide-react';
import { useState } from 'react';
import { Button } from '../../../components/ui/button';
import { useToast } from '../../../components/ui/use-toast';
import { ProjectDetails } from '../../../types';

export default function Secrets() {
export default function Secrets(details: ProjectDetails) {
const { name } = details;
const [Loading, setLoading] = useState<boolean>(false);
const { toast } = useToast();
const RunSecrets = async () => {
setLoading(true);
const res = await window.electron.ipcRenderer.invoke('find-secrets', {
projectName: name,
});
if (res) {
toast({
title: 'your Secrets are ready',
});
}
setLoading(false);
};
return (
// eslint-disable-next-line react/jsx-no-useless-fragment
Expand Down
Loading