diff --git a/almost_oneliners/pingscan.sh b/almost_oneliners/pingscan.sh new file mode 100755 index 0000000..ed70c65 --- /dev/null +++ b/almost_oneliners/pingscan.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# ping-scan subnet without other fancy tools +for i in $1.{1..255} + do + if + ping -c 1 -W 1 $i >/dev/null + then + echo "$i: online, hostname: $(host $i | cut -d " " -f 5)" + else + [[ $2 = offlinealso ]] && echo "$i: offline, hostname: $(host $i | cut -d " " -f 5)" + fi + done +exit 0