mirror of
https://github.com/mblanke/StrikePackageGPT.git
synced 2026-03-01 14:20:21 -05:00
- Added nmap wrapper to auto-send scan results to Dashboard - Network Map now displays hosts from terminal scans - Scan History tab shows all scans (GUI and terminal) - Load previous scans to Network Map feature - Improved OS detection from nmap output (parses OS details, smb-os-discovery) - Added determine_os_type() with OUI/MAC vendor lookup - Static network map layout (no more jumpy D3 force simulation) - Fixed docker-compose for Ollama connectivity (host.docker.internal) - Added test_services.sh for comprehensive testing
51 lines
1.6 KiB
Bash
51 lines
1.6 KiB
Bash
#!/bin/bash
|
|
# StrikePackageGPT nmap wrapper - sends scan results to Network Map and Scan History automatically
|
|
|
|
DASHBOARD_URL="${DASHBOARD_URL:-http://strikepackage-dashboard:8080}"
|
|
REAL_NMAP="/usr/bin/nmap"
|
|
|
|
# Capture the full command for logging
|
|
full_command="nmap $*"
|
|
|
|
# Determine target (last non-flag argument)
|
|
target="unknown"
|
|
for arg in "$@"; do
|
|
if [[ ! "$arg" =~ ^- ]]; then
|
|
target="$arg"
|
|
fi
|
|
done
|
|
|
|
# Create temp file for output
|
|
tmpfile=$(mktemp)
|
|
trap "rm -f $tmpfile" EXIT
|
|
|
|
# Run the actual nmap and capture output
|
|
"$REAL_NMAP" "$@" 2>&1 | tee "$tmpfile"
|
|
exit_code=${PIPESTATUS[0]}
|
|
|
|
# If successful, send to dashboard
|
|
if [ $exit_code -eq 0 ]; then
|
|
echo "" >&2
|
|
echo "[StrikePackageGPT] Sending results to Dashboard..." >&2
|
|
|
|
# Use jq with file input to avoid argument length limits
|
|
# Send to network map
|
|
jq -Rs --arg source "terminal" '{output: ., source: $source}' "$tmpfile" | \
|
|
curl -s -X POST "${DASHBOARD_URL}/api/network/nmap-results" \
|
|
-H "Content-Type: application/json" \
|
|
-d @- >/dev/null 2>&1
|
|
|
|
# Send to scan history
|
|
response=$(jq -Rs --arg tool "nmap" --arg target "$target" --arg command "$full_command" \
|
|
'{tool: $tool, target: $target, command: $command, output: ., source: "terminal"}' "$tmpfile" | \
|
|
curl -s -X POST "${DASHBOARD_URL}/api/scans/terminal" \
|
|
-H "Content-Type: application/json" \
|
|
-d @- 2>/dev/null)
|
|
|
|
if [ -n "$response" ]; then
|
|
echo "[StrikePackageGPT] ✓ Results saved to Network Map and Scan History" >&2
|
|
fi
|
|
fi
|
|
|
|
exit $exit_code
|