shell批量检查IP是否是百度蜘蛛

2025-04-09 09:19:14

用shell脚本:批量检查网站日记中的Baiduspider的真假

工具/原料

或安装cygwin

或 搭建虚拟机 安装censtos.7

收集整理

1、案例展示# cat u_ex161127.log|grep Baiduspider|head -1u_ex161127.log 是日志文件

shell批量检查IP是否是百度蜘蛛

2、收集所有的Baiduspider的ip,展示前10个。# cat u_ex161127.log|grep Baiduspider|awk '{print $9}'|sort|uniq|head -10

shell批量检查IP是否是百度蜘蛛

3、将所有IP存入ip.txt# cat u_ex161127.log|grep 幞洼踉残Baiduspider|awk '{print 改怊眶峋$9}'|sort|uniq > ip.txt查看ip.txt中的ip数量# cat ip.txt|wc -l

shell批量检查IP是否是百度蜘蛛

批量检查

1、# 反查ip命令nslookup ip

shell批量检查IP是否是百度蜘蛛

2、# 批量检查ip是否是真实Baiduspider,存入Baidu-ip.txt# cat ip.txt|while read line;do nslookup $line|grep baiduspider|awk -F "baiduspider-" '{print $2}'|awk -F "." '{print $1}'|sed 's/-/\./g';done > baidu-ip.txt注:while .. ;do ...;done 是循环语句

shell批量检查IP是否是百度蜘蛛
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢