Skip to content

Commit

Permalink
turn scan moudel into execAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
haithamAbuElnasr committed May 23, 2024
1 parent 102e386 commit b97c1ff
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 7 deletions.
42 changes: 41 additions & 1 deletion src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down Expand Up @@ -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;
});
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
2 changes: 1 addition & 1 deletion src/main/scanning/nuclei.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b97c1ff

Please sign in to comment.