From b97c1ffffc23bf00dff6ac3acfe0402689ab128b Mon Sep 17 00:00:00 2001 From: Haitham Mohamed Date: Thu, 23 May 2024 15:56:26 +0300 Subject: [PATCH] turn scan moudel into execAsync --- src/main/main.ts | 42 ++++++++++++++++++++++++++++++++++++- src/main/scanning/dalfox.ts | 14 ++++++++----- src/main/scanning/nuclei.ts | 2 +- 3 files changed, 51 insertions(+), 7 deletions(-) diff --git a/src/main/main.ts b/src/main/main.ts index 8315b29..44d39d8 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -54,17 +54,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}`); @@ -96,12 +99,49 @@ 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('scanning_for_exposures', async (event, args) => { + const { projectName } = args[0]; + const res = await scanningForExposures(`${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('subdomain_takeovers', async (event, args) => { + const { projectName } = args[0]; + const res = await subdomainTakeovers(`${PROJECT_DIR}/${projectName}`); + return res; +}); + +ipcMain.handle('scanning_CVEs', async (event, args) => { + const { projectName } = args[0]; + const res = await scanningCVEs(`${PROJECT_DIR}/${projectName}`); + return res; +}); + +ipcMain.handle('scanning_for_LFI', async (event, args) => { + const { projectName } = args[0]; + const res = await scanningForLFI(`${PROJECT_DIR}/${projectName}`); + return res; +}); +// end of nuclei ipcMain.handle('get-project-dir', async (event) => { return PROJECT_DIR; }); diff --git a/src/main/scanning/dalfox.ts b/src/main/scanning/dalfox.ts index 656621c..45eec99 100644 --- a/src/main/scanning/dalfox.ts +++ b/src/main/scanning/dalfox.ts @@ -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`)); @@ -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'), ); diff --git a/src/main/scanning/nuclei.ts b/src/main/scanning/nuclei.ts index 0a6f743..5f3945a 100644 --- a/src/main/scanning/nuclei.ts +++ b/src/main/scanning/nuclei.ts @@ -20,7 +20,7 @@ async function runScan( error: any; }> { const nuclie = toolPath('nuclei'); - const command = `${nuclie} -l ${outputDir}/${inputFile} ${scanType} -o ${path.join(outputDir, outputFileName)}`; + const command = `${nuclie} -l ${path.join(outputDir, inputFile)} ${scanType} -o ${path.join(outputDir, outputFileName)}`; console.log(command); try { await execAsync(command);