Skip to content

Commit

Permalink
Merge pull request #24 from haithamAbuElnasr/haitham-dev
Browse files Browse the repository at this point in the history
solve conflict in main.ts
  • Loading branch information
Mahmoudgalalz authored Jun 21, 2024
2 parents 102e386 + 1441445 commit 4663d9b
Show file tree
Hide file tree
Showing 16 changed files with 464 additions and 79 deletions.
49 changes: 48 additions & 1 deletion src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
scanningForLFI,
subdomainTakeovers,
} from './scanning/nuclei';
import { scanningForXSS, multiScans } from './scanning/dalfox';

class AppUpdater {
constructor() {
Expand All @@ -54,17 +55,20 @@ ipcMain.handle('api-call', async (event, args) => {
const res = returnFile(`${projectName}/${location}`, type);
return res;
});

// jeslack
ipcMain.handle('find-secrets', async (event, args) => {
const { projectName } = args[0];
const res = findSecret(`${PROJECT_DIR}/${projectName}`);
return res;
});

ipcMain.handle('extra-links', async (event, args) => {
const { projectName } = args[0];
const res = extraLinks(`${PROJECT_DIR}/${projectName}`);
return res;
});
// end of jeslack

ipcMain.handle('subfinder-process', async (event, args) => {
const { domain, projectName } = args[0];
const res = subFinder(domain, `${PROJECT_DIR}/${projectName}`);
Expand Down Expand Up @@ -96,11 +100,54 @@ ipcMain.handle('waybackurls-parameter', async (event, args) => {
return res;
});

/// nuclei
ipcMain.handle('general-scan', async (event, args) => {
const { projectName } = args[0];
const res = await generalScanning(`${PROJECT_DIR}/${projectName}`);
return res;
});
ipcMain.handle('exposed-panels', async (event, args) => {
const { projectName } = args[0];
const res = await exposedPanels(`${PROJECT_DIR}/${projectName}`);
return res;
});
ipcMain.handle('default-credentials', async (event, args) => {
const { projectName } = args[0];
const res = await defaultCredentials(`${PROJECT_DIR}/${projectName}`);
return res;
});
ipcMain.handle('exposures', async (event, args) => {
const { projectName } = args[0];
const res = await scanningForExposures(`${PROJECT_DIR}/${projectName}`);
return res;
});
ipcMain.handle('lfi', async (event, args) => {
const { projectName } = args[0];
const res = await scanningForLFI(`${PROJECT_DIR}/${projectName}`);
return res;
});
ipcMain.handle('potential-xss', async (event, args) => {
const { projectName } = args[0];
const res = await scanningForXSS(`${PROJECT_DIR}/${projectName}`);
return res;
});
ipcMain.handle('multi-scans', async (event, args) => {
const { projectName } = args[0];
const res = await multiScans(`${PROJECT_DIR}/${projectName}`);
return res;
});
ipcMain.handle('subdomain-takeovers', async (event, args) => {
const { projectName } = args[0];
const res = await subdomainTakeovers(`${PROJECT_DIR}/${projectName}`);
return res;
});
ipcMain.handle('vulns-cves', async (event, args) => {
const { projectName } = args[0];
const res = await scanningCVEs(`${PROJECT_DIR}/${projectName}`);
return res;
});

// end of nuclei

ipcMain.handle('get-project-dir', async (event) => {
return PROJECT_DIR;
Expand Down
10 changes: 9 additions & 1 deletion src/main/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ export type Channels =
| 'extra-links'
| 'get-project-scan'
| 'general-scan'
| 'open-link';
| 'open-link'
| 'exposed-panels'
| 'default-credentials'
| 'subdomain-takeovers'
| 'exposures'
| 'vulns-cves'
| 'lfi'
| 'potential-xss'
| 'multi-scans';

const electronHandler = {
ipcRenderer: {
Expand Down
14 changes: 9 additions & 5 deletions src/main/scanning/dalfox.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import { execSync } from 'child_process';
import { exec } from 'child_process';
import util from 'util';

import path from 'path';
import { toolPath } from '../util';
import { PROJECT_DIR } from '../api/project';
import { connectJson } from '../db/connect';
import { countLines } from '../results/countResults';

const execAsync = util.promisify(exec);

export async function scanningForXSS(outputDir: string = PROJECT_DIR): Promise<{
message: string;
success: boolean;
error: any;
}> {
const dalfox = toolPath('dalfox');
const command = `${dalfox} file ${path.join(outputDir, 'httpx_live_domains.txt')} --skip-bav
const command = `${dalfox} file ${path.join(outputDir, 'waybackurls_archive.txt')} --skip-bav
>> ${path.join(outputDir, 'XSS.txt')}`;
try {
execSync(command);
await execAsync(command);
console.log(command);
const numberOfUrls = await countLines(path.join(outputDir, 'XSS.txt'));
const db = connectJson(path.join(`${outputDir}/details.json`));
Expand All @@ -38,10 +42,10 @@ export async function multiScans(outputDir: string = PROJECT_DIR): Promise<{
error: any;
}> {
const dalfox = toolPath('dalfox');
const command = `${dalfox} file ${path.join(outputDir, 'httpx_live_domains.txt')}
const command = `${dalfox} file ${path.join(outputDir, 'waybackurls_archive.txt')}
>> ${path.join(outputDir, 'multi_scans.txt')}`;
try {
execSync(command);
await execAsync(command);
const numberOfUrls = await countLines(
path.join(outputDir, 'multi_scans.txt'),
);
Expand Down
5 changes: 3 additions & 2 deletions src/main/scanning/nuclei.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ async function runScan(
error: any;
}> {
const nuclie = toolPath('nuclei');
const command = `${nuclie} -l ${outputDir}/${inputFile} ${scanType} -o ${path.join(outputDir, outputFileName)}`;
const outputFileNameJson: string = outputFileName.replace('txt', 'json');
const command = `${nuclie} -l ${path.join(outputDir, inputFile)} ${scanType} -je ${path.join(outputDir, outputFileNameJson)}`;
console.log(command);
try {
await execAsync(command);
Expand Down Expand Up @@ -129,7 +130,7 @@ export async function scanningForLFI(outputDir: string = PROJECT_DIR): Promise<{
error: any;
}> {
return runScan(
'-tag lfi',
'-tags lfi',
'LFI.txt',
'scanningForLFI',
outputDir,
Expand Down
1 change: 0 additions & 1 deletion src/renderer/views/project/JsLeaks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ 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();
Expand Down
157 changes: 115 additions & 42 deletions src/renderer/views/project/attacks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ import {
CardTitle,
} from '../../components/ui/card';
import { ProjectDetails } from '../../types';
import GeneralScan from './attacks/generalScan';
import ExposedPanels from './attacks/exposedPanels';
import DefaultCredentials from './attacks/defaultCredentials';
import SubdomainTakeovers from './attacks/subdomainTakeovers';
import Exposures from './attacks/exposures';
import MissingHeaders from './attacks/missingHeaders';
import VulnsCves from './attacks/vulns&Cves';
import Lfi from './attacks/lfi';
import PotentialXss from './attacks/potentialXss';
import SqlInjection from './attacks/sqlInjection';

Expand All @@ -30,48 +35,116 @@ 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 {...details} />
</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>
{details && (
<div>
<h2 className="font-bold text-2xl mb-4 text-center">General</h2>
<div className="mb-8">
<div className="grid grid-flow-row grid-cols-2 gap-4">
<Card>
<CardHeader>
<CardTitle>General Scanning</CardTitle>
<CardDescription>wanna scan?</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<GeneralScan {...details} />
</CardContent>
</Card>
</div>
</div>
<h2 className="font-bold text-2xl mb-4 text-center">
Misconfigurations and Easy Wins
</h2>
<div className="mb-8">
<div className="grid grid-flow-row grid-cols-2 gap-4">
<Card>
<CardHeader>
<CardTitle>Hunting Exposed panels</CardTitle>
<CardDescription>wanna find exposed panels ?</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<ExposedPanels {...details} />
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Hunting Default Credentials</CardTitle>
<CardDescription>
wanna find Default Credentials ?
</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<DefaultCredentials {...details} />
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Hunting subdomain takeovers</CardTitle>
<CardDescription>
wanna find subdomain takeovers ?
</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<SubdomainTakeovers {...details} />
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Hunting for exposures</CardTitle>
<CardDescription>wanna scan for Exposures ?</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<Exposures {...details} />
</CardContent>
</Card>
</div>
</div>
<h2 className="font-bold text-2xl mb-4 text-center">
Testing for Vulnerabilities
</h2>
<div className="mb-8">
<div className="grid grid-flow-row grid-cols-2 gap-4">
<Card>
<CardHeader>
<CardTitle>Scanning for Known Vulns and CVEs</CardTitle>
<CardDescription>wanna find a Vuln or CVE ?</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<VulnsCves {...details} />
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Testing for LFI</CardTitle>
<CardDescription>wanna test for LFI ?</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<Lfi {...details} />
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Hunting XSS</CardTitle>
<CardDescription>wanna catch potential XSS</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<PotentialXss {...details} />
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Scan for SQL Injection</CardTitle>
<CardDescription>
SSTI, Open Redirect & CRLF Injection
</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<SqlInjection {...details} />
</CardContent>
</Card>
</div>
</div>
</div>
</div>
)}
</div>
);
}
43 changes: 43 additions & 0 deletions src/renderer/views/project/attacks/defaultCredentials.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* eslint-disable react/destructuring-assignment */
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable react/jsx-no-useless-fragment */
/* eslint-disable react-hooks/rules-of-hooks */
import { Loader2 } from 'lucide-react';
import { useState } from 'react';
import { Button } from '../../../components/ui/button';
import { ProjectDetails } from '../../../types';
import { toast } from '../../../components/ui/use-toast';

export default function DefaultCredentials(details: ProjectDetails) {
const [Loading, setLoading] = useState<boolean>(false);
const RunDefaultCredentials = async () => {
setLoading(true);
if (details.name) {
const res = await window.electron.ipcRenderer.invoke(
'default-credentials',
{
projectName: details.name,
},
);
if (res) {
toast({
title: 'Subdomain Takeovers job compeleted',
});
}
}
setLoading(false);
};
return (
// eslint-disable-next-line react/jsx-no-useless-fragment
<>
{!Loading ? (
<Button onClick={RunDefaultCredentials}>Process</Button>
) : (
<Button disabled>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Please wait
</Button>
)}
</>
);
}
Loading

0 comments on commit 4663d9b

Please sign in to comment.