diff --git a/src/main/main.ts b/src/main/main.ts index 382fd54..8315b29 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -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; }); diff --git a/src/main/preload.ts b/src/main/preload.ts index d6c1b74..27d97de 100644 --- a/src/main/preload.ts +++ b/src/main/preload.ts @@ -17,6 +17,7 @@ export type Channels = | 'find-secrets' | 'extra-links' | 'get-project-scan' + | 'general-scan' | 'open-link'; const electronHandler = { diff --git a/src/main/scanning/nuclei.ts b/src/main/scanning/nuclei.ts index 9637f7b..0a6f743 100644 --- a/src/main/scanning/nuclei.ts +++ b/src/main/scanning/nuclei.ts @@ -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, @@ -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({ diff --git a/src/renderer/views/project/attacks.tsx b/src/renderer/views/project/attacks.tsx index 9291ad4..5f78bfc 100644 --- a/src/renderer/views/project/attacks.tsx +++ b/src/renderer/views/project/attacks.tsx @@ -1,3 +1,7 @@ +/* eslint-disable react/jsx-props-no-spreading */ + +import { useState } from 'react'; +import { useParams } from 'react-router-dom'; import { Card, CardContent, @@ -5,12 +9,24 @@ import { 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(); + const { projectSlug } = useParams(); + + const getDetails = async () => { + const res = await window.electron.ipcRenderer.invoke( + 'get-project-details', + projectSlug, + ); + setDetails(res); + }; + getDetails(); return (

Attacks

@@ -22,7 +38,7 @@ export default function Attacks() { wanna find exposures ? - + diff --git a/src/renderer/views/project/attacks/exposures.tsx b/src/renderer/views/project/attacks/exposures.tsx index 538635b..9877048 100644 --- a/src/renderer/views/project/attacks/exposures.tsx +++ b/src/renderer/views/project/attacks/exposures.tsx @@ -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(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 diff --git a/src/renderer/views/project/recon.tsx b/src/renderer/views/project/recon.tsx index 5fb5a57..633c68f 100644 --- a/src/renderer/views/project/recon.tsx +++ b/src/renderer/views/project/recon.tsx @@ -28,7 +28,6 @@ export default function Recon() { projectSlug, ); setDetails(res); - console.log(res); }; useEffect(() => { diff --git a/src/renderer/views/project/status.tsx b/src/renderer/views/project/status.tsx index f46966a..58e072d 100644 --- a/src/renderer/views/project/status.tsx +++ b/src/renderer/views/project/status.tsx @@ -22,7 +22,6 @@ export default function Status() { ); if (projectScan !== 'error') { setScan(projectScan); - console.log(projectScan); } setProjects(projectNames); } catch (error) {