<%
'《58天搜索引擎蜘蛛爬行访问记录日志插件》免费版
'官方网站：58天网络科技www.58day.com
dim botDBPath,oConnStr,oConn
	botDBPath="botdb.mdb"
	oConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(botDBPath)  
	Set oConn = Server.CreateObject("ADODB.Connection") 
	oConn.open oConnStr 
function spiderbot()
	Dim FromUrl,GetLocationURL,BotID
	Dim ServerPort,ServerName,ScriptName,QueryString,serverip
	ServerName = Request.ServerVariables("SERVER_NAME")       '获取服务器IP
	ServerPort = Request.ServerVariables("SERVER_PORT")       '服务器处理请求的端口
	ScriptName = Request.ServerVariables("SCRIPT_NAME")       '记录网址URL
	'ScriptName = Request.ServerVariables("HTTP_X_REWRITE_URL")       '记录网址URL，伪静态方式执行脚本的名称，会浏览html的路径形式，如果使用此方式，请注释掉下面的【判断所访问的地址是否带有参数】这行代码
	QueryString = Request.ServerVariables("QUERY_STRING")      '查询字符串内容
	serverip = Request.ServerVariables("REMOTE_ADDR")           '获取访问IP
	FromUrl="http://"&ServerName 
	'If ServerPort <> "80" Then FromUrl = FromUrl & ":" & ServerPort     '判断端口是否为80，如果不是就填上端口号
	FromUrl=FromUrl&ScriptName 
	If QueryString <>"" Then FromUrl=FromUrl&"?"& QueryString           '判断所访问的地址是否带有参数
	GetLocationURL=FromUrl 
	dim agent: agent = lcase(request.servervariables("http_user_agent"))   '获取返回内容并赋值
	dim Bot: Bot = ""
    if instr(agent, "bot") > 0 then Bot = "其它蜘蛛"
BotID=agent
'从返回值中判断是什么蜘蛛
	if instr(agent, "googlebot") > 0 then Bot = "○Google谷歌○":BotID="googlebot"
	if instr(agent, "baiduspider") > 0 then Bot = "★百度★":BotID="baiduspider"
	if instr(agent, "360") > 0 then Bot = "360搜索":BotID="360Spider"
	if instr(agent, "haosouspider") > 0 then Bot = "好搜":BotID="haosouspider"
	if instr(agent, "Sogou News Spider") > 0 then Bot = "新搜狗":BotID="Sogou News Spider"
	if instr(agent, "yahoo") > 0 then Bot = "雅虎":BotID="yahoo"
	if instr(agent, "msn") > 0 then Bot = "MSN":BotID="msn"
	if instr(agent, "ia_archiver") > 0 then Bot = "Alexa":BotID="ia_archiver"
	if instr(agent, "iaarchiver") > 0 then Bot = "Alexa":BotID="iaarchiver"
	if instr(agent, "sohu") > 0 then Bot = "搜狐":BotID="sohu"
	if instr(agent, "sqworm") > 0 then Bot = "AOL":BotID="sqworm"
	if instr(agent, "yodaobot") > 0 then Bot = "有道":BotID="yodaobot"
	if instr(agent, "iaskspider") > 0 then Bot = "新浪爱问":BotID="iaskspider"
	if instr(agent, "mediapartners-google") > 0 then Bot = "Google广告":BotID="mediapartners-google"
	if instr(agent, "bingbot") > 0 then Bot = "必应":BotID="bingbot"
'扩展蜘蛛全集
 if instr(agent, "baiduspider") > 0 then Bot = "★百度★":BotID="baiduspider"
 if instr(agent, "baidu-yunguance-slabo") > 0 then Bot = "百度云观测-可用性检测":BotID="baidu-yunguance-slabot"
 if instr(agent, "baidu-yunguance-scanbot") > 0 then Bot = "百度云观测-安全检测":BotID="baidu-yunguance-scanbot"
 if instr(agent, "Baidu-YunGuance-PerfBot") > 0 then Bot = "百度云观测-速度检测":BotID="Baidu-YunGuance-PerfBot"
 if instr(agent, "Baidu-YunGuance-VSBot") > 0 then Bot = "百度云观测-认证服务":BotID="Baidu-YunGuance-VSBot"
 if instr(agent, "Baidu-YunGuance-RSBot") > 0 then Bot = "百度云观测-即时速度检测":BotID="Baidu-YunGuance-RSBot"
 if instr(agent, "baiducustomer") > 0 then Bot = "BaiduCustomer":BotID="baiducustomer"
 if instr(agent, "baidu-thumbnail") > 0 then Bot = "百度图片":BotID="baidu-thumbnail"
 if instr(agent, "baiduspider-mobile-gate") > 0 then Bot = "百度移动":BotID="baiduspider-mobile-gate"
 if instr(agent, "baidu-transcoder/1.0.6.0") > 0 then Bot = "百度转码/1.0.6.0":BotID="baidu-transcoder/1.0.6.0"
 '谷歌google
 if instr(agent, "googlebot/2.1") > 0 then Bot = "○Google谷歌○2.1":BotID="googlebot/2.1"
 if instr(agent, "googlebot-image/1.0") > 0 then Bot = "谷歌图片":BotID="googlebot-image/1.0"
 if instr(agent, "feedfetcher-google") > 0 then Bot = "Feedfetcher-Google":BotID="feedfetcher-google"
 if instr(agent, "mediapartners-google") > 0 then Bot = "Google广告":BotID="mediapartners-google"
 if instr(agent, "adsbot-google") > 0 then Bot = "Google AdWords":BotID="adsbot-google"
 if instr(agent, "googlebot-mobile/2.1") > 0 then Bot = "Google移动":BotID="googlebot-mobile/2.1"
 if instr(agent, "googlefriendconnect/1.0") > 0 then Bot = "GoogleFriendConnect/1.0":BotID="googlefriendconnect/1.0"
 '雅虎yahoo
 if instr(agent, "yahoo!") > 0 then Bot = "Yahoo!雅虎":BotID="yahoo!"
 if instr(agent, "yahoo! slurp") > 0 then Bot = "Yahoo!雅虎":BotID="yahoo! slurp"
 if instr(agent, "yahoo! slurp/3.0") > 0 then Bot = "Yahoo!雅虎3.0":BotID="yahoo! slurp/3.0"
 if instr(agent, "yahoo! slurp china") > 0 then Bot = "Yahoo!雅虎中国":BotID="yahoo! slurp china"
 if instr(agent, "yahoofeedseeker/2.0") > 0 then Bot = "YahooFeedSeeker/2.0":BotID="yahoofeedseeker/2.0"
 if instr(agent, "yahoo-blogs") > 0 then Bot = "Yahoo Blogs":BotID="yahoo-blogs"
 if instr(agent, "yahoo-mmcrawler") > 0 then Bot = "Yahoo Image":BotID="yahoo-mmcrawler"
 if instr(agent, "yahoo contentmatch crawler") > 0 then Bot = "Yahoo AD":BotID="yahoo contentmatch crawler"
 '微软bing
 if instr(agent, "msnbot") > 0 then Bot = "MSN":BotID="msnbot"
 if instr(agent, "msnbot/1.1") > 0 then Bot = "MSN1.1":BotID="msnbot/1.1"
 if instr(agent, "msnbot/2.0b") > 0 then Bot = "MSN2.0b":BotID="msnbot/2.0b"
 if instr(agent, "msrabot/2.0/1.0") > 0 then Bot = "msrabot/2.0/1.0":BotID="msrabot/2.0/1.0"
 if instr(agent, "msnbot-media/1.0") > 0 then Bot = "msnbot-media/1.0":BotID="msnbot-media/1.0"
 if instr(agent, "msnbot-media") > 0 then Bot = "msnbot-media":BotID="msnbot-media"
 if instr(agent, "msnbot-products") > 0 then Bot = "MSNBot-Products":BotID="msnbot-products"
 if instr(agent, "msnbot-academic") > 0 then Bot = "MSNBot-Academic":BotID="msnbot-academic"
 if instr(agent, "msnbot-newsblogs") > 0 then Bot = "MSNBot-NewsBlogs":BotID="msnbot-newsblogs"
 '腾讯搜搜soso
 if instr(agent, "sosospider") > 0 then Bot = "Soso腾讯搜搜":BotID="sosospider"
 if instr(agent, "sosoblogspider") > 0 then Bot = "Sosoblogspider":BotID="sosoblogspider"
 if instr(agent, "sosoimagespider") > 0 then Bot = "Sosoimagespider":BotID="sosoimagespider"
'网易有道
 if instr(agent, "youdaobot/1.0") > 0 then Bot = "有道1.0":BotID="youdaobot/1.0"
 if instr(agent, "yodaobot-image/1.0") > 0 then Bot = "YodaoBot Image/1.0":BotID="yodaobot-image/1.0"
 if instr(agent, "yodaobot-reader/1.0") > 0 then Bot = "YodaoBot-Reader/1.0":BotID="yodaobot-reader/1.0"
 '搜狐搜狗
  if instr(agent, "sogou") > 0 then bot = "搜狗":BotID="sogou"
  	if instr(agent, "sogou spider") > 0 then Bot = "搜狗":BotID="sogou spider"
 if instr(agent, "sogou web robot") > 0 then bot = "搜狗网页":BotID="sogou web robot"
 if instr(agent, "sogou web spider/3.0") > 0 then Bot = "搜狗3.0":BotID="sogou web spider/3.0"
 if instr(agent, "sogou web spider/4.0") > 0 then Bot = "搜狗4.0":BotID="sogou web spider/4.0"
 if instr(agent, "sogou head spider/3.0") > 0 then Bot = "Sogou head spider/3.0":BotID="sogou head spider/3.0"
 if instr(agent, "sogou-test-spider/4.0") > 0 then Bot = "Sogou-Test-Spider/4.0":BotID="sogou-test-spider/4.0"
 if instr(agent, "sogou orion spider/4.0") > 0 then Bot = "Sogou Orion spider/4.0":BotID="sogou orion spider/4.0"
 'Alexa
 if instr(agent, "ia_archiver") > 0 then Bot = "Ia_archiver":BotID="ia_archiver"
 if instr(agent, "iaarchiver") > 0 then Bot = "Iaarchiver":BotID="iaarchiver"
 'Cuil
 if instr(agent, "twiceler-0.9") > 0 then Bot = "推特" :BotID="twiceler-0.9"
 '奇虎
 if instr(agent, "qihoo") > 0 then Bot = "奇虎":BotID="qihoo"
 'ASK.com
 if instr(agent, "ask jeeves/teoma") > 0 then Bot = "Ask Jeeves/Teoma"
 if instr(agent, "50.nu/0.01") > 0 then Bot = "50.nu/0.01"
 if instr(agent, "aspseek") > 0 then Bot = "ASPSeek"
 if instr(agent, "betabot") > 0 then Bot = "betaBot"
 if instr(agent, "blogpulselive") > 0 then Bot = "BlogPulseLive"
 if instr(agent, "blogpulse (isspider-3.0)") > 0 then Bot = "BlogPulse (ISSpider-3.0)"
 if instr(agent, "blogvibebot-v1.1") > 0 then Bot = "BlogVibeBot-v1.1"
 if instr(agent, "blogsearch/2") > 0 then Bot = "BlogSearch/2"
 if instr(agent, "builtwith/0.3") > 0 then Bot = "BuiltWith/0.3"
 if instr(agent, "buzzbot/1.0") > 0 then Bot = "BuzzBot/1.0"
 if instr(agent, "daumoa/2.0") > 0 then Bot = "Daumoa/2.0"
 if instr(agent, "domaintools") > 0 then Bot = "DomainTools"
 if instr(agent, "dotbot/1.1") > 0 then Bot = "DotBot/1.1"
 if instr(agent, "eapollobot") > 0 then Bot = "eApolloBot"
 if instr(agent, "exabot") > 0 then Bot = "Exabot"
 if instr(agent, "fast-webcrawler") > 0 then Bot = "Alltheweb"
 if instr(agent, "feedburner/1.0") > 0 then Bot = "FeedBurner/1.0"
 if instr(agent, "followsite bot") > 0 then Bot = "FollowSite Bot"
 if instr(agent, "gaisbot/3.0") > 0 then Bot = "Gaisbot/3.0"
 if instr(agent, "gigabot") > 0 then Bot = "Gigabot"
 if instr(agent, "gingercrawler/1.0") > 0 then Bot = "GingerCrawler/1.0"
 if instr(agent, "hitcrawler_0.1") > 0 then Bot = "hitcrawler_0.1"
 if instr(agent, "iaskspider/1.0") > 0 then Bot = "iaskspider/1.0"
 if instr(agent, "iaskspider/2.0") > 0 then Bot = "iaskspider/2.0"
 if instr(agent, "iearthworm") > 0 then Bot = "iearthworm"
 if instr(agent, "jyxobot/1") > 0 then Bot = "Jyxobot/1"
 if instr(agent, "larbin") > 0 then Bot = "Larbin"
 if instr(agent, "lanshanbot") > 0 then Bot = "lanshanbot"
 if instr(agent, "lycos_spider_(t-rex)") > 0 then Bot = "Lycos"
 if instr(agent, "markmonitor robots") > 0 then Bot = "MarkMonitor Robots"
 if instr(agent, "mj12bot/v1.2.1") > 0 then Bot = "MJ12bot/v1.2.1"
 if instr(agent, "mj12bot/v1.2.2") > 0 then Bot = "MJ12bot/v1.2.2"
 if instr(agent, "mj12bot/v1.2.3") > 0 then Bot = "MJ12bot/v1.2.3"
 if instr(agent, "mj12bot/v1.2.4") > 0 then Bot = "MJ12bot/v1.2.4"
 if instr(agent, "mj12bot/v1.2.5") > 0 then Bot = "MJ12bot/v1.2.5"
 if instr(agent, "naverbot/1.0") > 0 then Bot = "NaverBot/1.0"
 if instr(agent, "netcraftsurveyagent/1.0") > 0 then Bot = "NetcraftSurveyAgent/1.0"
 if instr(agent, "netcraft web server survey") > 0 then Bot = "Netcraft Web Server Survey"
 if instr(agent, "page2rss/0.5") > 0 then Bot = "Page2RSS/0.5"
 if instr(agent, "panscient.com") > 0 then Bot = "panscient.com"'恶意爬虫
 if instr(agent, "pku student spider") > 0 then Bot = "PKU Student Spider"
 if instr(agent, "psbot/0.1") > 0 then Bot = "psbot/0.1"
 if instr(agent, "scooter") > 0 then Bot = "Altavista"
 if instr(agent, "servage robot") > 0 then Bot = "Servage Robot"
 if instr(agent, "snapbot") > 0 then Bot = "Snapbot"
 if instr(agent, "spinn3r") > 0 then Bot = "Spinn3r"
 if instr(agent, "sqworm") > 0 then Bot = "AOL"
 if instr(agent, "stealer") > 0 then Bot = "Stealer"
 if instr(agent, "tagoobot/3.0") > 0 then Bot = "Tagoobot/3.0"
 if instr(agent, "twingly recon") > 0 then Bot = "Twingly Recon"
 if instr(agent, "urlfan-bot/1.0") > 0 then Bot = "urlfan-bot/1.0"
 if instr(agent, "webalta") > 0 then Bot = "WebAlta"
 if instr(agent, "yandex/1.01.001") > 0 then Bot = "Yandex/1.01.001"
 if instr(agent, "yeti/1.0") > 0 then Bot = "Yeti/1.0"
 if instr(agent, "mj12bot") > 0 then Bot = "美国蜘蛛":BotID="mj12bot"
 if instr(agent, "mail.ru_bot/2.0") > 0 then Bot = "俄罗斯邮件蜘蛛":BotID="mail.ru_bot/2.0"
 if instr(agent, "YisouSpider") > 0 then Bot = "丧心病狂蜘蛛":BotID="YisouSpider"
 if instr(agent, "safednsbot") > 0 then Bot = "美国safedns蜘蛛":BotID="safednsbot"
 if instr(agent, "spbot/5.0.2") > 0 then Bot = "openlinkprofiler.org":BotID="spbot/5.0.2"

if len(Bot) > 0 then
'数据入库

spiderbot=1
     oconn.execute ("insert into bot(bot,agent,shijian,url,serverip) values('"&bot&"','"&BotID&"','"&now()&"','"&GetLocationURL&"','"&serverip&"')")
else
spiderbot=0
end if
end function
%>
<%call spiderbot()%>