|
@@ -65,6 +65,11 @@ check_range_syntax() {
|
|
for i in netstat ss; do
|
|
for i in netstat ss; do
|
|
if which "$i" >/dev/null 2>&1 ; then
|
|
if which "$i" >/dev/null 2>&1 ; then
|
|
COMMAND_SYS="$i"
|
|
COMMAND_SYS="$i"
|
|
|
|
+ if [ "$COMMAND_SYS" = "ss" ]; then
|
|
|
|
+ OUTPUT_COLUMN=5
|
|
|
|
+ else
|
|
|
|
+ OUTPUT_COLUMN=4
|
|
|
|
+ fi
|
|
break
|
|
break
|
|
fi
|
|
fi
|
|
done
|
|
done
|
|
@@ -143,7 +148,7 @@ while getopts hw:c:p: f; do
|
|
*)
|
|
*)
|
|
PORT_NUMBER=$( printf "%d" "$OPTARG" )
|
|
PORT_NUMBER=$( printf "%d" "$OPTARG" )
|
|
LABEL="port$PORT_NUMBER"
|
|
LABEL="port$PORT_NUMBER"
|
|
- CPT="$( $COMMAND_SYS -tauen | sed 's/[[:space:]]\+/\t/g' | cut -f 4 | ( grep -c ":$PORT_NUMBER$" || true ) )"
|
|
|
|
|
|
+ CPT="$( $COMMAND_SYS -taun | sed 's/[[:space:]]\+/\t/g' | cut -f "$OUTPUT_COLUMN" | ( grep -c ":$PORT_NUMBER$" || true ) )"
|
|
;;
|
|
;;
|
|
esac
|
|
esac
|
|
|
|
|