Skip to content

Commit

Permalink
fixing out the nucli exposures
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmoudgalalz committed May 20, 2024
1 parent f598798 commit 102e386
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ ipcMain.handle('waybackurls-parameter', async (event, args) => {
return res;
});

ipcMain.handle('general-scan', async (event, args) => {
const { projectName } = args[0];
const res = await generalScanning(`${PROJECT_DIR}/${projectName}`);
return res;
});

ipcMain.handle('get-project-dir', async (event) => {
return PROJECT_DIR;
});
Expand Down
1 change: 1 addition & 0 deletions src/main/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type Channels =
| 'find-secrets'
| 'extra-links'
| 'get-project-scan'
| 'general-scan'
| 'open-link';

const electronHandler = {
Expand Down
9 changes: 6 additions & 3 deletions src/main/scanning/nuclei.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { execSync } from 'child_process';
import path from 'path';
import util from 'util';
import { exec } from 'child_process';
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);

async function runScan(
scanType: string,
outputFileName: string,
Expand All @@ -17,10 +20,10 @@ async function runScan(
error: any;
}> {
const nuclie = toolPath('nuclei');
const command = `${nuclie} -l ${inputFile} ${scanType} -o ${path.join(outputDir, outputFileName)}`;
const command = `${nuclie} -l ${outputDir}/${inputFile} ${scanType} -o ${path.join(outputDir, outputFileName)}`;
console.log(command);
try {
execSync(command);
await execAsync(command);
const numberOfUrls = await countLines(path.join(outputDir, outputFileName));
const db = connectJson(path.join(`${outputDir}/details.json`));
await db.update({
Expand Down
18 changes: 17 additions & 1 deletion src/renderer/views/project/attacks.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
/* eslint-disable react/jsx-props-no-spreading */

import { useState } from 'react';
import { useParams } from 'react-router-dom';
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from '../../components/ui/card';
import { ProjectDetails } from '../../types';
import Exposures from './attacks/exposures';
import MissingHeaders from './attacks/missingHeaders';
import PotentialXss from './attacks/potentialXss';
import SqlInjection from './attacks/sqlInjection';

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

const getDetails = async () => {
const res = await window.electron.ipcRenderer.invoke(
'get-project-details',
projectSlug,
);
setDetails(res);
};
getDetails();
return (
<div className="flex flex-col gap-4">
<h1 className="font-bold text-3xl">Attacks</h1>
Expand All @@ -22,7 +38,7 @@ export default function Attacks() {
<CardDescription>wanna find exposures ?</CardDescription>
</CardHeader>
<CardContent className="flex justify-between">
<Exposures />
<Exposures {...details} />
</CardContent>
</Card>
<Card>
Expand Down
19 changes: 18 additions & 1 deletion src/renderer/views/project/attacks/exposures.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
/* 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 Exposures() {
export default function Exposures(details: ProjectDetails) {
const [Loading, setLoading] = useState<boolean>(false);
const RunExposures = async () => {
setLoading(true);
if (details.name) {
const res = await window.electron.ipcRenderer.invoke('general-scan', {
projectName: details.name,
});
if (res) {
toast({
title: 'sub-domains job compeleted',
});
}
}
setLoading(false);
};
return (
// eslint-disable-next-line react/jsx-no-useless-fragment
Expand Down
1 change: 0 additions & 1 deletion src/renderer/views/project/recon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export default function Recon() {
projectSlug,
);
setDetails(res);
console.log(res);
};

useEffect(() => {
Expand Down
1 change: 0 additions & 1 deletion src/renderer/views/project/status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export default function Status() {
);
if (projectScan !== 'error') {
setScan(projectScan);
console.log(projectScan);
}
setProjects(projectNames);
} catch (error) {
Expand Down

0 comments on commit 102e386

Please sign in to comment.