Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Ban Spiders by User Agent Details »»
Ban Spiders by User Agent
Version: 3.1.3, by Simon Lloyd Simon Lloyd is offline
Developer Last Online: May 2023 Show Printable Version Email this Page

Category: Miscellaneous Hacks - Version: 3.8.x Rating:
Released: 06-08-2011 Last Update: 12-17-2014 Installs: 137
Supported Uses Plugins
 

What this mod does
With this mod you can enter User Agents to watch or ban, you can also recieve emails or have an Output.txt created and updated with time and date of visits. It doesn't just have to be spiders, you can watch, log or ban any useragent!

How to install
Simply import the product ban_spider, the mod is active by default but none of the other options are turned on.

What is a UserAgent?
http://en.wikipedia.org/wiki/User_agent

Understanding a UserAgent string
http://user-agent-string.info/parse

Genuine User Getting Blocked?
https://vborg.vbsupport.ru/showpost....&postcount=105

Tools to help
http://whatsmyuseragent.com/SwitchingUserAgents.asp
http://www.botsvsbrowsers.com/SimulateUserAgent.asp

FAQ
https://vborg.vbsupport.ru/showpost....&postcount=137

What's a bot?
http://en.wikipedia.org/wiki/Spambot

How do i ban a bot?
https://vborg.vbsupport.ru/showpost....&postcount=318
https://vborg.vbsupport.ru/showpost....7&postcount=51

Where's output.txt located?
https://vborg.vbsupport.ru/showpost....&postcount=216

Bad bot lists
https://vborg.vbsupport.ru/showpost....&postcount=259
https://vborg.vbsupport.ru/showpost....&postcount=224
https://vborg.vbsupport.ru/showpost....&postcount=281

VB4.x Version of Ban Spiders By User Agent

Tested on vb3.7.x, vB3.8.x but should work on any version.

__________________________________________________ __________________
Special thanks to:
Lior
KH99
BoP5
for helping me sort out a few issues

...and beta testers

ForceHSS (Special thanks to Force for latest testing)
ozzy47
GreyHost

If you use this please mark as INSTALLED

History
9th June 2011 Orginal xml added
12th June 2011 Added both email notification and text file logging
22nd June 2011 Version 2.0.0, Added create thread on activity
  1. Added match facility you can now use something like Yandex and it will match MOZILLA/5.0 (COMPATIBLE; YANDEXBOT/3.0; +HTTP://YANDEX.COM/BOTS)
  2. Added clickable link to visited thread
22nd September 2011 added user redirect url selection
08th October Beta testing started for thread creation.
20th October Beta testing started for emailing.
21st October Beta testing complete Ver 3.0.0 uploaded
29th October minor fix added to cope with empty userid on thread creation
30th October Beta testing automatic redirection to spiders/bots IP
31st October New xml uploaded with automatic redirect to IP
25th November Minor fix for blank forumid fixed
26th November 2011 Fixed version check & create thread Off by default
17th December 2014 Version 3.1.0 uploaded, Extra logging and statistics added by Ozzy47 (Chris)
18th December 2014 Version 3.1.2 uploaded, due to rogue process from other mod
18th December 2014 Version 3.1.3 uploaded, due to previous one being VB4 mistakingly uploaded

The Bad Bots list is now included in the product
Please prune out all those that you wish to be able to see your site (i suggest you definately prune out "DA" and "Custo" :

Support will now only be given to those who have this mod marked as INSTALLED

Download Now

File Type: xml product-ban_spider.xml (30.5 KB, 146 views)

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #82  
Old 07-13-2012, 04:21 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sure, are you sure you want to create threads? you'd get soooooo many of them, remember i added the thread making and logging for test purposes so folk could see that it was working for their selected spiders are being dealt with.
Reply With Quote
  #83  
Old 07-13-2012, 02:01 PM
Max Taxable's Avatar
Max Taxable Max Taxable is offline
 
Join Date: Feb 2011
Posts: 3,134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Simon Lloyd View Post
Sure, are you sure you want to create threads? you'd get soooooo many of them, remember i added the thread making and logging for test purposes so folk could see that it was working for their selected spiders are being dealt with.
Yes I have had this Mod working for so long, the really bad spiders like Baidu have stopped visiting completely. This Mod generated only 88 threads yesterday. I plan to turn the thread making feature on and off periodically, just for occasional monitoring purposes.

The IPs in the post would be great, if it's not too difficult and if you please.

Edit: It would be nice too if we could make it post everything in the same thread in addition to the option of creating a new topic for each bot.
Reply With Quote
  #84  
Old 07-13-2012, 02:48 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, if you can wait until next week as i've promised my wife that i'll give the computer a rest for a week (other than important stuff) so i'll get to it after then
Reply With Quote
Благодарность от:
Max Taxable
  #85  
Old 07-13-2012, 05:16 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@Max Taxable for now (just because i can't make you wait ) go to admincp>plugins & products>Plugin Manager find the Ban Spiders mod's plugins and look for Post UA Activity to thread and replace all of the code you see there for this
PHP Code:
if ($vbulletin->options['bsactive'] AND $vbulletin->options['bs_report_createthread'])
{
$agentip strtoupper($_SERVER['REMOTE_ADDR']);
$DateOfRequest date('m-d-Y H:i:s');
$user_agent1 strtoupper($_SERVER['HTTP_USER_AGENT']);
$bots1 explode("\r\n"$vbulletin->options['bs_sel_list']); 
$n sizeof($bots1);
for (
$i=0;$i<$n;$i++) {
if (
stristr($user_agent1,$bots1[$i])) 
{
    
// Backend Files
    
require_once('./global.php');
    require_once(
'./includes/class_dm.php');
    require_once(
'./includes/class_dm_threadpost.php');
    require_once(
'./includes/functions_databuild.php');

$threaddm =& datamanager_init('Thread_FirstPost'$vbulletinERRTYPE_ARRAY'threadpost');
$threadinfo = array();
$vboptions =& $vbulletin->options;
$username $vbulletin->userinfo['username']; 
$forumid $vbulletin->options['bs_report_forumid']; 
$foruminfo fetch_foruminfo($foruminfo['forumid']);
$title "Activity from Bot No. $i ($bots1[$i]) in your list";   
$userid $vbulletin->options['bs_report_userthread'];
if (
$userid == '')
{
  
$userid=1;
}
if (
$forumid =='')
{
exit;
}
$pagetext "[b]Date and Time:[/b] $DateOfRequest\n[b]Associated Username (if any): [/b]$username\n[b]Matched bots[$i]:[/b] $bots1[$i] \n[b]With User Agent:[/b] $user_agent1\n\n[b]Their IP:[/b]$agentip\n\n[b]They visited:[/b]\n[url]$_SERVER[SERVER_NAME]$_SERVER[REQUEST_URI][/url]\n\n"
$posticon $vbulletin->options['subthread_posticon'];
$allowsmilie '1';
$visible '1';

$threaddm->set_info('forum'$foruminfo);
$threaddm->set_info('thread'$threadinfo);
$threaddm->setr('forumid'$forumid);
$threaddm->setr('userid'$userid);
$threaddm->setr('pagetext'$pagetext);
$threaddm->setr('title'$title);
$threaddm->set('iconid'$posticon);
$threaddm->set('allowsmilie'$allowsmilie);
$threaddm->set('visible'$visible);

 
// Lets see what happens if we save the page
$threaddm->pre_save();
if(
count($threaddm->errors) < 1) {
    
// Basically if the page will save without errors then let do it for real this time
    
$threadid $threaddm->save();
    unset(
$threaddm);
    
build_thread_counters($threaddm);
    
build_forum_counters($forumid);
    
build_forum_counters($threadinfo['forumid']);
   
// unset($threaddm);
} else {
    
// There was errors in the practice run, so lets display them
    
var_dump ($threaddm->errors);
}
 
 }
 }

You'll now get their ip in the thread thats created

The posting to same thread for each bot will require queries to the database, we'd have to add a column to store thread id's against bot names...etc, it could work out kinda messy and resource expensive, but, i'll still look in to it!
Reply With Quote
  #86  
Old 07-13-2012, 08:17 PM
Max Taxable's Avatar
Max Taxable Max Taxable is offline
 
Join Date: Feb 2011
Posts: 3,134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Simon! I was content to wait though.
Reply With Quote
  #87  
Old 08-20-2012, 12:24 AM
ChiNa ChiNa is offline
 
Join Date: Jul 2012
Posts: 457
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Simon, Can you maybe give us a link to some newer bad behavior bots.
I did check your links for the Bad Bots, I just dont know if you already have banned those bots in the links, and how to bann a bot using a webhost, which says "dreamhost.com" fake google?
But it will not make problems for me to bann a REAL hosting company?

Waiting for a reply befor I install it! Thank you
Reply With Quote
  #88  
Old 08-20-2012, 06:20 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Read the links properly, i have linked you to the "how do i ban a bot?" and links to some maintained lists, and as i have said repeatedly banning bots/spiders/UAs is a personal thing
Reply With Quote
  #89  
Old 08-25-2012, 02:33 PM
Max Taxable's Avatar
Max Taxable Max Taxable is offline
 
Join Date: Feb 2011
Posts: 3,134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Simon...

Is there a quick line of code we can add that captures User Agent info as well as IP, and includes this info in the email?
Reply With Quote
  #90  
Old 08-25-2012, 04:54 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Isn't it already included in an email?

This will show the useragent:
With User Agent: $user_agent1\n\

Add it anywhere under Matched Bots in the email message, should be good, i dont have time right now to check it properly as i've been up 21 hours now and desperately need sleep!
Reply With Quote
Благодарность от:
Max Taxable
  #91  
Old 08-26-2012, 02:29 AM
Max Taxable's Avatar
Max Taxable Max Taxable is offline
 
Join Date: Feb 2011
Posts: 3,134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Simon Lloyd View Post
Isn't it already included in an email?

This will show the useragent:
With User Agent: $user_agent1\n\

Add it anywhere under Matched Bots in the email message, should be good, i dont have time right now to check it properly as i've been up 21 hours now and desperately need sleep!
It's not but I'll play around with this and let you know what works. Thanks for the quick response.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:31 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.09045 seconds
  • Memory Usage 2,377KB
  • Queries Executed 27 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (2)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete