From fecb4229b6bec889c779c517dc13015e51af9bb6 Mon Sep 17 00:00:00 2001 From: mblanke Date: Fri, 28 Nov 2025 15:40:53 -0500 Subject: [PATCH] perf: Optimize network scan speed and defaults - Change default scan type from 'os' to 'quick' (much faster) - Add -T4 timing template for aggressive speed - Add --min-hostgroup for parallel host scanning - Remove slow OS detection from quick scan - Add time estimates in UI: ping ~30s, quick ~1-3min, os ~5-15min - Color-coded scan options by speed - ping scan: fastest, just host discovery - quick scan: top 100 ports, no OS detection --- services/dashboard/app/main.py | 12 +++++------ services/dashboard/templates/index.html | 12 +++++------ .../app/from fastapi import FastAPI.py | 21 +++++++++++++++++++ 3 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 services/hackgpt-api/app/from fastapi import FastAPI.py diff --git a/services/dashboard/app/main.py b/services/dashboard/app/main.py index 9436acf..bb3a522 100644 --- a/services/dashboard/app/main.py +++ b/services/dashboard/app/main.py @@ -399,15 +399,15 @@ async def start_network_scan(request: NetworkScanRequest): total_hosts = calculate_target_hosts(request.target) # Build nmap command based on scan type - # Use --stats-every to get progress updates + # Use -T4 for faster timing, --stats-every for progress, --min-hostgroup for parallel scanning scan_commands = { - "ping": f"nmap -sn {request.target} -oX - --stats-every 2s", - "quick": f"nmap -T4 -F -O --osscan-limit {request.target} -oX - --stats-every 2s", - "os": f"nmap -O -sV --version-light {request.target} -oX - --stats-every 2s", - "full": f"nmap -sS -sV -O -p- --version-all {request.target} -oX - --stats-every 2s" + "ping": f"nmap -sn -T4 --min-hostgroup 64 {request.target} -oX - --stats-every 1s", + "quick": f"nmap -T4 -F --top-ports 100 --min-hostgroup 32 {request.target} -oX - --stats-every 1s", + "os": f"nmap -T4 -O --osscan-guess --max-os-tries 1 --min-hostgroup 16 {request.target} -oX - --stats-every 2s", + "full": f"nmap -T4 -sS -sV -O --version-light -p- --min-hostgroup 8 {request.target} -oX - --stats-every 2s" } - command = scan_commands.get(request.scan_type, scan_commands["os"]) + command = scan_commands.get(request.scan_type, scan_commands["quick"]) network_scans[scan_id] = { "scan_id": scan_id, diff --git a/services/dashboard/templates/index.html b/services/dashboard/templates/index.html index a3b6741..0913c79 100644 --- a/services/dashboard/templates/index.html +++ b/services/dashboard/templates/index.html @@ -836,12 +836,12 @@
-

Scan Options:

+

⏱️ Estimated Times (per /24):

@@ -894,7 +894,7 @@ networkScanProgress: { current: 0, total: 0, currentIp: '', hostsFound: 0 }, showRangeScanModal: false, rangeScanTarget: '', - rangeScanType: 'os', + rangeScanType: 'quick', phases: [ { diff --git a/services/hackgpt-api/app/from fastapi import FastAPI.py b/services/hackgpt-api/app/from fastapi import FastAPI.py new file mode 100644 index 0000000..fd2e48c --- /dev/null +++ b/services/hackgpt-api/app/from fastapi import FastAPI.py @@ -0,0 +1,21 @@ +from fastapi import FastAPI +from starlette.middleware.cors import CORSMiddleware +import os + +app = FastAPI() + +# CORS middleware +app.add_middleware( + CORSMiddleware, + allow_origins=["*"], # Allows all origins + allow_credentials=True, + allow_methods=["*"], # Allows all methods + allow_headers=["*"], # Allows all headers +) + +LLM_ROUTER_URL = os.getenv("LLM_ROUTER_URL", "http://strikepackage-llm-router:8000") + + +@app.get("/") +async def root(): + return {"message": "Hello World"} \ No newline at end of file