|
@@ -1,5 +1,4 @@
|
|
|
#!/bin/bash
|
|
|
-
|
|
|
# GPLv3 or later 2017 Jeff Cliff
|
|
|
#
|
|
|
# See COPYING.GPL
|
|
@@ -7,19 +6,25 @@
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
-network=`/sbin/ifconfig | grep inet | grep -iv inet6 | grep -iv 127.0.0.1 | awk -F' ' '{print $2}' | awk -F'.' '{print $1 "." $2 "." $3 ""}' | sed -s "s/addr://g"`
|
|
|
-echo $network
|
|
|
-for y in $network; do
|
|
|
+DOES_IFCONFIG_EXIST=`which ifconfig`
|
|
|
+if [[ -z $DOES_IFCONFIG_EXIST ]]; then
|
|
|
+IPCOMMAND="ip address"
|
|
|
+else
|
|
|
+IPCOMMAND="ifconfig"
|
|
|
+fi
|
|
|
+echo "IPCOMMAND" $IPCOMMAND
|
|
|
+
|
|
|
+# sometimes ifconfig is available, this is where to find/change it if it is. maybe we should autodetect if it does
|
|
|
|
|
|
-for x in `seq 255` ;
|
|
|
+network=`$IPCOMMAND | grep inet | grep -iv inet6 | grep -iv 127.0.0.1 | awk -F' ' '{print $2}' | awk -F'.' '{print $1 "." $2 "." $3 ""}' | sed -s "s/addr://g"`
|
|
|
+echo $network
|
|
|
+for y in $network; do
|
|
|
+for x in `seq 255` ;
|
|
|
do
|
|
|
#echo "network:" $y
|
|
|
-#echo "x:" $x
|
|
|
+#echo "x:" $x
|
|
|
#echo "network.x:" $y.$x
|
|
|
-
|
|
|
#echo ping -c 1 $y.$x
|
|
|
-
|
|
|
-ping -c 1 $y.$x | grep -i 'ttl' | grep -iv 'Unreachable' &
|
|
|
+ping -c 1 $y.$x | grep -i 'ttl' | grep -iv 'Unreachable' &
|
|
|
done
|
|
|
-
|
|
|
echo $y ; done
|