Parcourir la source

Script hardening: ensure cannot be interpreted as a ping option

Baptiste Jonglez il y a 10 ans
Parent
commit
3521cf9485
2 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 1 1
      templates/cron.sh
  2. 1 1
      templates/run.sh

+ 1 - 1
templates/cron.sh

@@ -42,7 +42,7 @@ read -r id ip < /tmp/"$FAMILY"
 printf "%d" "$id" > /dev/null 2>&1 || exit
 
 # Parsing ping output, for Linux
-output="$($PING -c "$NB_PINGS" "$ip" | grep -A1 "packets transmitted")"
+output="$($PING -c "$NB_PINGS" -- "$ip" | grep -A1 "packets transmitted")"
 echo $output | sed -e 's#^\([0-9]*\) packets transmitted, \([0-9]*\) received.*#\1\t\2#' > /tmp/"$FAMILY"_tmp1
 read sent received < /tmp/"$FAMILY"_tmp1
 if [ "$received" -eq 0 ]

+ 1 - 1
templates/run.sh

@@ -35,7 +35,7 @@ do
     # Make sure "id" is an integer
     printf "%d" "$id" > /dev/null 2>&1 || continue
     # Parsing ping output, for Linux
-    output="$($PING -c "$NB_PINGS" "$ip" | grep -A1 "packets transmitted")"
+    output="$($PING -c "$NB_PINGS" -- "$ip" | grep -A1 "packets transmitted")"
     echo $output | sed -e 's#^\([0-9]*\) packets transmitted, \([0-9]*\) received.*#\1\t\2#' > /tmp/"$FAMILY"_tmp1
     read sent received < /tmp/"$FAMILY"_tmp1
     if [ "$received" -eq 0 ]