homelab-automation/scripts/scan-lan.sh
Benjamin Hays bd06770c7a
Some checks failed
Ansible Deploy / deploy (ansible/playbooks/debian.yml) (push) Failing after 2m23s
Ansible Deploy / deploy (ansible/playbooks/proxmox.yml) (push) Failing after 1m9s
Ansible Lint / build (push) Successful in 1m22s
fix strange folder naming error
2025-05-18 10:25:12 -04:00

26 lines
661 B
Bash
Executable File

#!/bin/sh
if [ "$#" -eq 0 ]; then
echo "Usage: $0 (--install-deps) <cidr-range>"
exit 1
fi
if [ "$1" = "--install-deps" ]; then
echo "[+] Installing dependencies"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if lsb_release -a 2>/dev/null | grep -q 'Debian'; then
sudo apt-get update && sudo apt-get install -y nmap
elif lsb_release -a 2>/dev/null | grep -q 'Fedora'; then
sudo dnf install -y nmap
elif lsb_release -a 2>/dev/null | grep -q 'Arch\|Manjaro'; then
sudo pacman -Syu nmap
fi
fi
cidr="$2"
else
cidr="$1"
fi
nmap -sS -T4 -A $cidr -oN nmap.log -oX nmap.xml