保护网站安全——拦截非法爬虫

互联网上,有各大搜索引擎的蜘蛛爬虫,例如Googlebot、Baiduspider、bingbot,还有一些为采集数据使用的脚本爬虫,如python-requests、Go-http-client、Scrapy、curl、wget、Apache-HttpClient等,还有一些公司为收集数据的扫描器,如CensysInspect、MJ12Bot等。本人结合了长达7个月的日志抓取分析,给出常见的非法爬虫的User-Agent,供添加拦截使用。拦截时,不要错误的将搜索引擎蜘蛛拦截,如何避免请看我之前的文章分辨百度、谷歌、必应、DuckDuckGo蜘蛛,同时也要防范网页被挂马,具体请看保护网站安全——针对pbootcms木马分析

非法脚本

  • Apache-HttpClient
  • colly
  • curl
  • okhttp
  • Go-http-client
  • python-requests
  • Python-urllib
  • python-httpx
  • Scrapy
  • aiohttp
  • Nmap Scripting Engine
  • Java
  • fasthttp
  • Wget

非法扫描器

  • CensysInspect
  • intelx.io_bot
  • InternetMeasurement
  • ips-agent
  • MJ12Bot
  • NetcraftSurveyAgent
  • SemrushBot
  • l9scan
  • SEOlyt
  • kirkland-signature
  • ZoominfoBot
  • Expanse, a Palo Alto Networks company, searches across the global IPv4 space multiple times per day to identify customers’ presences on the Internet.
  • CheckMarkNetwork
  • dotbot
  • Pandalytics
  • Screaming Frog SEO Spider
  • W3C_CSS_Validator_JFouffa
  • 2ip bot
  • AhrefsBot
  • rb.gy
  • GPTBot
  • scanner.ducks.party
  • SMTBot

伪造的User-Agent

有些非法爬虫会伪造浏览器的User-Agent,这些不容易分辨,但是有些使用的浏览器版本太低了,比如IE6、IE8浏览器,现在不会有人使用,记录下来一些具有特异性的User-Agent,有需要的也可以拦截

  • Dalvik/2.1.0 (Linux; U; Android 9.0; ZTE BA520 Build/MRA58K) //正常的安卓手机基本上没有使用此User-Agent的
  • msnbot //必应弃用的蜘蛛User-Agent头,但还被一些伪造自己是必应蜘蛛的客户端使用
  • Gregarius
  • Mozilla/4.0 //主要屏蔽一些低版本浏览器
  • SonyEricsson
  • Nokia
  • BlackBerry

发表评论