Skip to content

Commit

Permalink
Merge pull request #4 from yazanessam/Recon-UI
Browse files Browse the repository at this point in the history
Recon UI
  • Loading branch information
Mahmoudgalalz authored Feb 19, 2024
2 parents c3c43d6 + 9dfdd37 commit abb0c70
Show file tree
Hide file tree
Showing 13 changed files with 486 additions and 29 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-navigation-menu": "^1.1.4",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-toast": "^1.1.5",
"class-variance-authority": "^0.7.0",
Expand Down
15 changes: 10 additions & 5 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,28 @@ ipcMain.on('subfinder-process', async (event, args) => {
event.returnValue = res;
});
ipcMain.on('httpx-live-domain', async (event, args) => {
const res = liveSubDomains();
const { projectName } = args[0];
const res = liveSubDomains(`${PROJECT_DIR}/${projectName}`);
event.returnValue = res;
});
ipcMain.on('httpx-screens', async (event, args) => {
const res = screenwin();
const { projectName } = args[0];
const res = screenwin(`${PROJECT_DIR}/${projectName}`);
event.returnValue = res;
});
ipcMain.on('waybackurls-archive', async (event, args) => {
const res = wwayback();
const { projectName } = args[0];
const res = wwayback(`${PROJECT_DIR}/${projectName}`);
event.returnValue = res;
});
ipcMain.on('waybackurls-js', async (event, args) => {
const res = fetchJs();
const { projectName } = args[0];
const res = fetchJs(`${PROJECT_DIR}/${projectName}`);
event.returnValue = res;
});
ipcMain.on('waybackurls-parameter', async (event, args) => {
const res = parameter();
const { projectName } = args[0];
const res = parameter(`${PROJECT_DIR}/${projectName}`);
event.returnValue = res;
});

Expand Down
4 changes: 2 additions & 2 deletions src/main/recon/httpx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function liveSubDomains(outputDir: string = PROJECT_DIR): {
const httprobeWPath = toolPath('httpx');
const command = `${httprobeWPath} -l ${path.join(
outputDir,
'domains.txt',
'recon_subdomins.txt',
)} -o ${path.join(outputDir, 'httpx_live_domains.txt')}`;
try {
execSync(command);
Expand All @@ -30,7 +30,7 @@ export function screenwin(outputDir: string = PROJECT_DIR): {

const command = `${httpxPath} -ss -l ${path.join(
outputDir,
'domains.txt',
'recon_subdomins.txt',
)} -srd ${path.join(outputDir, 'httpx_screen')}`;
try {
execSync(command);
Expand Down
6 changes: 3 additions & 3 deletions src/main/recon/waybackurls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function wwayback(outputDir: string = PROJECT_DIR): {
const wwaybackPath = toolPath('waybackurls');
const command = `cat "${path.join(
outputDir,
'domains.txt',
'recon_subdomins.txt',
)}" | ${wwaybackPath} >> ${path.join(outputDir, 'waybackurls_archive.txt')}`;

// 'type "D:\\recon_result\\domains.txt" | D:\\05-Haitham\\Projects\\hunter\\bin\\waybackurls >> "D:\\recon_result\\archive.txt"';
Expand All @@ -31,7 +31,7 @@ export function fetchJs(outputDir: string = PROJECT_DIR): {
const wwaybackPath = toolPath('waybackurls');
const command = `cat "${path.join(
outputDir,
'domains.txt',
'recon_subdomins.txt',
)}" | ${wwaybackPath} | findstr ".js" >> ${path.join(outputDir, 'waybackurls_js.txt')}`;
try {
execSync(command);
Expand All @@ -49,7 +49,7 @@ export function parameter(outputDir: string = PROJECT_DIR): {

const command = `cat "${path.join(
outputDir,
'domains.txt',
'recon_subdomins.txt',
)}" | ${wwaybackPath} | findstr "=" >> ${path.join(
outputDir,
'waybackurls_parameter.txt',
Expand Down
128 changes: 128 additions & 0 deletions src/renderer/components/ui/navigation-menu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import * as React from "react"
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu"
import { cva } from "class-variance-authority"
import { ChevronDown } from "lucide-react"

import { cn } from "src/renderer/lib/utils"

const NavigationMenu = React.forwardRef<
React.ElementRef<typeof NavigationMenuPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>
>(({ className, children, ...props }, ref) => (
<NavigationMenuPrimitive.Root
ref={ref}
className={cn(
"relative z-10 flex max-w-max flex-1 items-center justify-center",
className
)}
{...props}
>
{children}
<NavigationMenuViewport />
</NavigationMenuPrimitive.Root>
))
NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName

const NavigationMenuList = React.forwardRef<
React.ElementRef<typeof NavigationMenuPrimitive.List>,
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>
>(({ className, ...props }, ref) => (
<NavigationMenuPrimitive.List
ref={ref}
className={cn(
"group flex flex-1 list-none items-center justify-center space-x-1",
className
)}
{...props}
/>
))
NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName

const NavigationMenuItem = NavigationMenuPrimitive.Item

const navigationMenuTriggerStyle = cva(
"group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50"
)

const NavigationMenuTrigger = React.forwardRef<
React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>
>(({ className, children, ...props }, ref) => (
<NavigationMenuPrimitive.Trigger
ref={ref}
className={cn(navigationMenuTriggerStyle(), "group", className)}
{...props}
>
{children}{" "}
<ChevronDown
className="relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180"
aria-hidden="true"
/>
</NavigationMenuPrimitive.Trigger>
))
NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName

const NavigationMenuContent = React.forwardRef<
React.ElementRef<typeof NavigationMenuPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>
>(({ className, ...props }, ref) => (
<NavigationMenuPrimitive.Content
ref={ref}
className={cn(
"left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",
className
)}
{...props}
/>
))
NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName

const NavigationMenuLink = NavigationMenuPrimitive.Link

const NavigationMenuViewport = React.forwardRef<
React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>
>(({ className, ...props }, ref) => (
<div className={cn("absolute left-0 top-full flex justify-center")}>
<NavigationMenuPrimitive.Viewport
className={cn(
"origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",
className
)}
ref={ref}
{...props}
/>
</div>
))
NavigationMenuViewport.displayName =
NavigationMenuPrimitive.Viewport.displayName

const NavigationMenuIndicator = React.forwardRef<
React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>
>(({ className, ...props }, ref) => (
<NavigationMenuPrimitive.Indicator
ref={ref}
className={cn(
"top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",
className
)}
{...props}
>
<div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md" />
</NavigationMenuPrimitive.Indicator>
))
NavigationMenuIndicator.displayName =
NavigationMenuPrimitive.Indicator.displayName

export {
navigationMenuTriggerStyle,
NavigationMenu,
NavigationMenuList,
NavigationMenuItem,
NavigationMenuContent,
NavigationMenuTrigger,
NavigationMenuLink,
NavigationMenuIndicator,
NavigationMenuViewport,
}
51 changes: 51 additions & 0 deletions src/renderer/views/project/jobs/httpxScreens.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable react/jsx-no-useless-fragment */
/* eslint-disable react-hooks/rules-of-hooks */
import { useEffect, useState } from 'react';
import { Loader2 } from 'lucide-react';
import { useParams } from 'react-router-dom';
import { Button } from '../../../components/ui/button';
import { useToast } from '../../../components/ui/use-toast';
import { ProjectDetails } from '../../../types';

export default function HttpxScreensJob() {
const { projectSlug } = useParams();
const [projectDetails, setDetails] = useState<ProjectDetails>();
useEffect(() => {
const details: ProjectDetails = window.electron.ipcRenderer.sendSync(
'get-project-details',
projectSlug,
);
setDetails(details);
}, []);

const [Loading, setLoading] = useState<boolean>(false);
const { toast } = useToast();
const RunHttpxScreens = () => {
setLoading(true);
if (projectDetails) {
const res = window.electron.ipcRenderer.sendSync('httpx-screens', {
projectName: projectDetails.name,
domain: projectDetails.domain,
});
if (res) {
toast({
title: 'Screenshots are ready',
});
}
}
setLoading(false);
};
return (
<>
{!Loading ? (
<Button onClick={RunHttpxScreens}>Process</Button>
) : (
<Button disabled>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Please wait
</Button>
)}
</>
);
}
51 changes: 51 additions & 0 deletions src/renderer/views/project/jobs/liveSubDomains.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable react/jsx-no-useless-fragment */
/* eslint-disable react-hooks/rules-of-hooks */
import { useEffect, useState } from 'react';
import { Loader2 } from 'lucide-react';
import { useParams } from 'react-router-dom';
import { Button } from '../../../components/ui/button';
import { useToast } from '../../../components/ui/use-toast';
import { ProjectDetails } from '../../../types';

export default function LiveSubdomainsJob() {
const { projectSlug } = useParams();
const [projectDetails, setDetails] = useState<ProjectDetails>();
useEffect(() => {
const details: ProjectDetails = window.electron.ipcRenderer.sendSync(
'get-project-details',
projectSlug,
);
setDetails(details);
}, []);

const [Loading, setLoading] = useState<boolean>(false);
const { toast } = useToast();
const RunLiveSubDomains = () => {
setLoading(true);
if (projectDetails) {
const res = window.electron.ipcRenderer.sendSync('httpx-live-domain', {
projectName: projectDetails.name,
domain: projectDetails.domain,
});
if (res) {
toast({
title: 'live sub-domains are ready',
});
}
}
setLoading(false);
};
return (
<>
{!Loading ? (
<Button onClick={RunLiveSubDomains}>Process</Button>
) : (
<Button disabled>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Please wait
</Button>
)}
</>
);
}
2 changes: 1 addition & 1 deletion src/renderer/views/project/jobs/subfinder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function SubFinderJob() {
return (
<>
{!Loading ? (
<Button onClick={RunSubFinder}>Run Job</Button>
<Button onClick={RunSubFinder}>Process</Button>
) : (
<Button disabled>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Expand Down
51 changes: 51 additions & 0 deletions src/renderer/views/project/jobs/waybackurlsArchive.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable react/jsx-no-useless-fragment */
/* eslint-disable react-hooks/rules-of-hooks */
import { useEffect, useState } from 'react';
import { Loader2 } from 'lucide-react';
import { useParams } from 'react-router-dom';
import { Button } from '../../../components/ui/button';
import { useToast } from '../../../components/ui/use-toast';
import { ProjectDetails } from '../../../types';

export default function WaybackurlsArchiveJob() {
const { projectSlug } = useParams();
const [projectDetails, setDetails] = useState<ProjectDetails>();
useEffect(() => {
const details: ProjectDetails = window.electron.ipcRenderer.sendSync(
'get-project-details',
projectSlug,
);
setDetails(details);
}, []);

const [Loading, setLoading] = useState<boolean>(false);
const { toast } = useToast();
const RunWaybackurlsArchive = () => {
setLoading(true);
if (projectDetails) {
const res = window.electron.ipcRenderer.sendSync('waybackurls-archive', {
projectName: projectDetails.name,
domain: projectDetails.domain,
});
if (res) {
toast({
title: 'Archive is ready',
});
}
}
setLoading(false);
};
return (
<>
{!Loading ? (
<Button onClick={RunWaybackurlsArchive}>Process</Button>
) : (
<Button disabled>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Please wait
</Button>
)}
</>
);
}
Loading

0 comments on commit abb0c70

Please sign in to comment.