vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Miscellaneous Hacks - Ban Spiders by User Agent (https://vborg.vbsupport.ru/showthread.php?t=264932)

Simon Lloyd 07-13-2012 04:21 AM

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.

Max Taxable 07-13-2012 02:01 PM

Quote:

Originally Posted by Simon Lloyd (Post 2347488)
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.

Simon Lloyd 07-13-2012 02:48 PM

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 :)

Simon Lloyd 07-13-2012 05:16 PM

@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!

Max Taxable 07-13-2012 08:17 PM

Thanks Simon! I was content to wait though.:D

ChiNa 08-20-2012 12:24 AM

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

Simon Lloyd 08-20-2012 06:20 AM

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 :)

Max Taxable 08-25-2012 02:33 PM

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?

Simon Lloyd 08-25-2012 04:54 PM

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!

Max Taxable 08-26-2012 02:29 AM

Quote:

Originally Posted by Simon Lloyd (Post 2359928)
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.


All times are GMT. The time now is 03:29 AM.

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.01117 seconds
  • Memory Usage 1,771KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete