#!/bin/sh
echo "" > temp.1
echo "" > temp.3
#´Ë´¦Ã»ÓÐÏÞÖƶàÉÙ¸ömsnÊý¾Ý°ü
tcpdump -f -lnx -s 0 host 192.168.0.1 and port 1863 > temp.0
lines=`cat temp.0 | wc -l`
line=1
while [ $line -le $lines ]
do
#´Ë´¦»ñȡʱ¼äÊÕ·¢ipµÈÐÅÏ¢
memo=`sed -n ''"$line"'p' temp.0 | gawk '{if (!~/^0x/)print ,,,,,,,,,,," "}'`
memo=$"aaaaaaaa"
if [ "$memo" = "aaaaaaaa" ]
then
#½ØÈ¡Êý¾Ý°üÖÐÊý¾Ý²¿·Ö
out=`sed -n ''"$line"'p' temp.0 | cut -c"11-14, 16-19, 21-24, 26-29, 31-34, 36-39, 41-44, 46-49"`
echo -n "$out" >> temp.1
else
echo "" >> temp.1
out=`sed -n ''"$line"'p' temp.0 | gawk '{if (!~/^0x/)print ,,,,,,,,,,," "}'`
echo -n "$out" >> temp.1
fi
line=`expr $line + 1`
done
echo "" >> temp.1
#ɾ³ý¿ÕÐкÍÇ°Á½ÐÐ
sed '/^&/d' temp.1 | sed '1,2d' > temp.2
lines=`cat temp.2 | wc -l`
line=1
while [ $line -le $lines ]
do
#»ñÈ¡ÒªÏÖʵµÄÄÚÈÝ
TIME=`sed -n ''"$line"'p' temp.2 | gawk '{print }' | gawk -F "." '{print }'`
FROM=`sed -n ''"$line"'p' temp.2 | gawk '{print }'`
TO=`sed -n ''"$line"'p' temp.2 | gawk '{print }'`
#¸ù¾Ý±ê־λȷ¶¨²¢½ØÈ¡msnÊý¾Ý
DATA0=`sed -n ''"$line"'p' temp.2 | awk '{print }' | gawk -F "0d0a0d0a" '{print }' | sed '/^0d0a$/d' | sed 's/../%&/g'`
#½«½Ø»ñµÄutf-8Ê®Áù½øÖÆÊý½»ÓÉperlµÄURI::EscapeÄ£¿é´¦Àí²¢ÏÔʾÖÐÓ¢ÎÄ
DATA=`perl -e "use URI::Escape; print uri_unescape('$DATA0');"`
isnull=`echo $DATA | wc -m`
if [ $isnull -gt 1 ]
then
echo "$ FROM $ TO $ DATA: $"
fi
line=`expr $line + 1`
done
rm -f temp.*
fanpei ÓÚ 2010-12-14 11:31:39·¢±í:
ÍÛÍÛ Â¥Ö÷ ÎÒ°®ËÀÄãÀÖ£¡ÎÒ×ÜËãÕÒµ½Ôõô¼àÌý80¶Ë¿ÚµÄÓï·¨ÀÖ ÔÀ´»¹µÃ¼ÓÉÏ ¡°and¡±
spark ÓÚ 2006-11-21 16:20:33·¢±í:
ºÃ¶«¶«£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡