From 4d8ff7d7b87f04561112c1a08ca2d954d502549d Mon Sep 17 00:00:00 2001 From: zeus Date: Sun, 24 Jan 2021 16:17:50 +0100 Subject: [PATCH] pingscan --- almost_oneliners/pingscan.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 almost_oneliners/pingscan.sh 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