#!/bin/ash

[ -z "`which tcpdump`" ] && exit 0

[ -z "$ROOT" ] && ROOT=/www
SCRIPT=$ROOT/script

pid=`ps | grep "tcpdump" | grep "tcp dst port 80" | awk '{print $1}'`
[ -z "$pid" ] || kill -9 $pid

tcpdump -eni any -v -s1500 'tcp dst port 80 and tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420' 2>/dev/null \
  | awk -f $SCRIPT/collector/ua-dump.awk 2>/dev/null >/dev/null &
