From 1f9b93b1c6120e246294a8d88ece8af3313baec1 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 18 Dec 2008 22:56:33 +1300 Subject: [PATCH] Add another parameter when watching traffic to external sites. --- testing/watch-port-80.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/testing/watch-port-80.sh b/testing/watch-port-80.sh index df492878..7ec7e856 100755 --- a/testing/watch-port-80.sh +++ b/testing/watch-port-80.sh @@ -2,6 +2,7 @@ PORT=${1:-"80"} IFACE=${2:-"any"} +IP=${3:-""} # Only include packets that contain data NOTSYNFIN=" and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)" @@ -9,7 +10,9 @@ DUMP="tcp port ${PORT}" IPCLAUSE="" if [ "${IFACE}" != "any" ]; then - IP="`ip addr show dev ${IFACE} | grep ' inet ' | tr -s ' ' | cut -f3 -d' ' | cut -f1 -d'/'`" + if [ -z "${IP}" ]; then + IP="`ip addr show dev ${IFACE} | grep ' inet ' | tr -s ' ' | cut -f3 -d' ' | cut -f1 -d'/'`" + fi IPCLAUSE=" and ((src host ${IP} and src port ${PORT}) or (dst host ${IP} and dst port ${PORT}))" fi