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
This commit is contained in:
2025-11-28 15:40:53 -05:00
parent e51e52129f
commit fecb4229b6
3 changed files with 33 additions and 12 deletions

View File

@@ -399,15 +399,15 @@ async def start_network_scan(request: NetworkScanRequest):
total_hosts = calculate_target_hosts(request.target) total_hosts = calculate_target_hosts(request.target)
# Build nmap command based on scan type # 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 = { scan_commands = {
"ping": f"nmap -sn {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 -O --osscan-limit {request.target} -oX - --stats-every 2s", "quick": f"nmap -T4 -F --top-ports 100 --min-hostgroup 32 {request.target} -oX - --stats-every 1s",
"os": f"nmap -O -sV --version-light {request.target} -oX - --stats-every 2s", "os": f"nmap -T4 -O --osscan-guess --max-os-tries 1 --min-hostgroup 16 {request.target} -oX - --stats-every 2s",
"full": f"nmap -sS -sV -O -p- --version-all {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] = { network_scans[scan_id] = {
"scan_id": scan_id, "scan_id": scan_id,

View File

@@ -836,12 +836,12 @@
</div> </div>
<div class="bg-sp-grey/50 p-3 rounded text-xs text-sp-white-muted"> <div class="bg-sp-grey/50 p-3 rounded text-xs text-sp-white-muted">
<p class="font-semibold text-sp-white mb-1">Scan Options:</p> <p class="font-semibold text-sp-white mb-1">⏱️ Estimated Times (per /24):</p>
<ul class="space-y-1"> <ul class="space-y-1">
<li><strong>Ping Sweep:</strong> Fast host discovery only</li> <li><strong class="text-green-400">Ping Sweep:</strong> ~10-30 seconds</li>
<li><strong>Quick Scan:</strong> Top 100 ports with OS hints</li> <li><strong class="text-blue-400">Quick Scan:</strong> ~1-3 minutes (recommended)</li>
<li><strong>OS Detection:</strong> Detailed OS fingerprinting</li> <li><strong class="text-yellow-400">OS Detection:</strong> ~5-15 minutes</li>
<li><strong>Full Scan:</strong> Complete port + OS (slower)</li> <li><strong class="text-red-400">Full Scan:</strong> ~30-60+ minutes</li>
</ul> </ul>
</div> </div>
</div> </div>
@@ -894,7 +894,7 @@
networkScanProgress: { current: 0, total: 0, currentIp: '', hostsFound: 0 }, networkScanProgress: { current: 0, total: 0, currentIp: '', hostsFound: 0 },
showRangeScanModal: false, showRangeScanModal: false,
rangeScanTarget: '', rangeScanTarget: '',
rangeScanType: 'os', rangeScanType: 'quick',
phases: [ phases: [
{ {

View File

@@ -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"}