Created
August 10, 2016 08:02
-
-
Save jorben/f58f0bdbfc902cc7e6b17979ad58ee35 to your computer and use it in GitHub Desktop.
根据端口抓捕低频发包进程
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
i=1 | |
while(($i>0)) | |
do | |
pid='' | |
PSPID='' | |
GOTED=`ss -natp|grep ESTAB|grep -E ":9003 "` | |
if [ -n "$GOTED" ]; then | |
pid=`echo $GOTED|awk '{print $6}'|awk -F"," '{print $2}'` | |
fi | |
if [ -n "$pid" ]; then | |
PSPID=`ps aux|grep -v 'grep'|grep $pid` | |
fi | |
if [ -n "$GOTED$PSPID" ]; then | |
echo "==================" >> ./tmp.txt | |
echo `date` >> ./tmp.txt | |
echo "ss by port : "$GOTED >> ./tmp.txt | |
echo "ps by pid : "$PSPID >> ./tmp.txt | |
fi | |
sleep 2s | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment