From f598798cf9d2809beab23637198a9ccc3eba3c11 Mon Sep 17 00:00:00 2001 From: Mahmoud Galal Date: Tue, 21 May 2024 01:40:47 +0300 Subject: [PATCH] adding the ui of the scan feature --- src/main/api/project.ts | 9 +++++ src/main/main.ts | 7 ++++ src/main/preload.ts | 1 + src/renderer/views/project/status.tsx | 53 ++++++++++++++++++++++++++- 4 files changed, 68 insertions(+), 2 deletions(-) diff --git a/src/main/api/project.ts b/src/main/api/project.ts index 9a596f1..5f137d4 100644 --- a/src/main/api/project.ts +++ b/src/main/api/project.ts @@ -165,3 +165,12 @@ export function projectDetails(projectName: string) { throw new Error('Project Cannot be created'); } } + +export function projectScan(projectName: string) { + try { + const db = connectJson(`${PROJECT_DIR}/${projectName}/cf_scan.json`); + return db.read(); + } catch (error) { + return 'error'; + } +} diff --git a/src/main/main.ts b/src/main/main.ts index 3b5dbe1..382fd54 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -22,6 +22,7 @@ import { createProjectDir, createRequestToUrlScanner, projectDetails, + projectScan, readDirectoryNames, } from './api/project'; import { liveSubDomains, screenwin } from './recon/httpx'; @@ -105,6 +106,12 @@ ipcMain.handle('get-project-details', async (event, args) => { return data; }); +ipcMain.handle('get-project-scan', async (event, args) => { + const projectName = args[0]; + const data = projectScan(projectName); + return data; +}); + ipcMain.handle('list-projects', async (event) => { const dirs = readDirectoryNames(); return dirs; diff --git a/src/main/preload.ts b/src/main/preload.ts index 4780754..d6c1b74 100644 --- a/src/main/preload.ts +++ b/src/main/preload.ts @@ -16,6 +16,7 @@ export type Channels = | 'api-call' | 'find-secrets' | 'extra-links' + | 'get-project-scan' | 'open-link'; const electronHandler = { diff --git a/src/renderer/views/project/status.tsx b/src/renderer/views/project/status.tsx index 73e8355..f46966a 100644 --- a/src/renderer/views/project/status.tsx +++ b/src/renderer/views/project/status.tsx @@ -9,12 +9,21 @@ import { ProjectDetails } from '../../types'; export default function Status() { const { projectSlug } = useParams(); const [project, setProjects] = useState(); + const [scan, setScan] = useState(); const list = async () => { try { const projectNames = await window.electron.ipcRenderer.invoke( 'get-project-details', projectSlug, ); + const projectScan = await window.electron.ipcRenderer.invoke( + 'get-project-scan', + projectSlug, + ); + if (projectScan !== 'error') { + setScan(projectScan); + console.log(projectScan); + } setProjects(projectNames); } catch (error) { console.error('Error listing projects:', error); @@ -25,8 +34,48 @@ export default function Status() { list(); }, []); return ( -
- {project && } +
+ {scan && ( +
+

Target Information

+
+

Tech Stack

+
    + {scan && + scan.scan.meta.processors.tech.map((tech: any) => { + return ( +
  • + {tech.name} +

    {tech.name}

    +
  • + ); + })} +
+
+
+

Target Ips

+
    + {scan && + Object.entries(scan.scan.ips).map(([key, value]) => { + return ( +
  • +

    + {value.ipVersion}: {key} +

    +
  • + ); + })} +
+
+
+ )} +
+ {project && } +
); }