Revision: 70109
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 23, 2015 21:40 by iMezouar
Initial Code
#!/bin/bash
NETWORK="192.168.1.0/24"
#Output formatting
BOLD="\033[1m"
WHITE_ON_GREY="\033[100;97m"
RESET="\033[0m"
sudo nmap -sn -PO "$NETWORK" \
| grep -oE "[a-zA-Z0-9\.\-]+\s\(([0-9]{1,3}\.){3}[0-9]{1,3}\)" \
| sed 's/[)(]//g' \
| awk -v bold="$BOLD" -v fg="$WHITE_ON_GREY" -v reset="$RESET" -f <(cat - <<-'EOD'
BEGIN{
OFS="\t";
}
{ print $2,$1; }
END{
print bold fg NR" Hosts are up" reset;
}
EOD
)
Initial URL
Initial Description
Bash script to list all devices (ip and hostname) connected to your local network. Some formatting is done, and a summary is printed at the end. Requires nmap.
Initial Title
List all devices connected to local network
Initial Tags
Bash
Initial Language
Bash