Created
September 5, 2023 07:08
-
-
Save cernoel/dfec18f8dc0127a16f072d5ccc7c83ac to your computer and use it in GitHub Desktop.
quickly check local hosts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HOST_IF="eth0" | |
RANGE="24" | |
if [ "x$1" != "x" ]; then | |
HOST_IF="$1" | |
fi | |
if [ "x$2" != "x" ]; then | |
RANGE="$2" | |
fi | |
IP=$(ip -o -4 addr list $HOST_IF | head -n1 | awk '{print $4}' | cut -d/ -f1) | |
if [ "x$IP" != "x" ]; then | |
echo $IP found. | |
nmap -sP $IP/$RANGE | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment