文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>shell脚本对DNS A记录查询量进行统计

shell脚本对DNS A记录查询量进行统计

时间:2010-06-10  来源:lksj

主要步骤是:1 抓包 2 获取包信息 3 写数据库
目前只针对A记录进行统计

#!/bin/sh
while true
do
        `tcpdump dst port 53 -i eth0 > cap` &
        sleep 5
        killall -9 tcpdump
        cut -d' ' -f 9-10 cap | uniq -c > captemp
        while read LINE
        do
                count=`echo $LINE|awk -F ' ' '{print $1}'`
                type=`echo $LINE|awk -F ' ' '{print $2}'`
                url=`echo $LINE|awk -F ' ' '{print $3}'`
                var=`mysql -e "select url from CountURL.urlInfo where url='$url'
"`
                if [[ $type == "A?" ]]
                then
                        if [[ "$var" == "" ]]
                        then
                                mysql -e "insert into CountURL.urlInfo(count,url
) values($count,'$url')"

                        else
                                mysql -e "update CountURL.urlInfo set count=count+$count where url='$url'"
                        fi
                fi
        done < captemp
        rm -f cap
        rm -f captemp
done


相关阅读 更多 +
排行榜 更多 +
方块枪战战场安卓版

方块枪战战场安卓版

飞行射击 下载
战斗火力射击安卓版

战斗火力射击安卓版

飞行射击 下载
空中防御战安卓版

空中防御战安卓版

飞行射击 下载