Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Search Abuse Rate Topic   - - - - -

 
  • ypg
  • Member
  • Members
  • Join Date: 16-Nov 06
  • 69 posts

Posted 03 October 2018 - 05:28 PM #1

Hello everyone, 

For last few days our website was  experiencing very heavy load. We checked visitor log and found that a thousands of searches being performed in the format like this.

 

 

 

 

It appears that many bots/spiders and proxies are reaching search bar.

 

I have spoken to web hosting company who have suggested to add some kind of security such as captcha to the search bar.

I would highly appreciate if anyone can suggest how to achieve this or any other solution to stop bots/spider to abuse search function.

 

Thanks

YPG



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19056 posts

Posted 04 October 2018 - 06:18 AM #2

try the following
 
- install and activate My change module
- create the app/addons/my_changes/controllers/frontend/products.pre.php file with the following content
 
 

<?php

if (!defined('BOOTSTRAP')) { die('Access denied'); }

if ($mode == 'search') {
    if (defined('CRAWLER')) {
        exit;
    }
}

return;

- monitor your logs

 

(!) Not tested


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • ypg
  • Member
  • Members
  • Join Date: 16-Nov 06
  • 69 posts

Posted 04 October 2018 - 11:34 AM #3

try the following
 
- install and activate My change module
- create the app/addons/my_changes/controllers/frontend/products.pre.php file with the following content
 
 

<?php

if (!defined('BOOTSTRAP')) { die('Access denied'); }

if ($mode == 'search') {
    if (defined('CRAWLER')) {
        exit;
    }
}

return;

- monitor your logs

 

(!) Not tested

 

Thanks for valuable code. Just applied, the server load appears to be down for the moment.

Will continue to monitor. 

 

I wonder if we can apply goggle reCaptcha to search bar, as a result such crawlers would not be able to proceed.

 

 

YPG



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19056 posts

Posted 04 October 2018 - 02:15 PM #4

Yes, it can be done with simple modification. But search bar with reCaptcha will look ugly


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • ypg
  • Member
  • Members
  • Join Date: 16-Nov 06
  • 69 posts

Posted 05 October 2018 - 10:49 AM #5

Yes, it can be done with simple modification. But search bar with reCaptcha will look ugly

 

The solution provided by you is  working perfect. I think this code  should be part of original cs-cart installation. There is no need for captcha as it would look very ugly. 



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19056 posts

Posted 05 October 2018 - 01:17 PM #6

I am glad to hear that our solution helped you


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • ypg
  • Member
  • Members
  • Join Date: 16-Nov 06
  • 69 posts

Posted 11 October 2018 - 09:54 AM #7

Unfortunately after few days they are back again today. I wonder it it is possible to allow product search only for customer who are logged in.

 

YPG



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19056 posts

Posted 11 October 2018 - 01:31 PM #8

In this case use in the same file
<?php
 
use Tygh\Registry;
 
if (!defined('BOOTSTRAP')) { die('Access denied'); }
 
if ($mode == 'search') {
    if (defined('CRAWLER')) {
        exit;
    }
    if (empty($auth['user_id'])) {
        return array(
            CONTROLLER_STATUS_REDIRECT,
            'auth.login_form?return_url=' . urlencode(Registry::get('config.current_url'))
        );
    }
}
 
return;

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • ypg
  • Member
  • Members
  • Join Date: 16-Nov 06
  • 69 posts

Posted 11 October 2018 - 05:22 PM #9

 

In this case use in the same file

<?php

if (!defined('BOOTSTRAP')) { die('Access denied'); }

if ($mode == 'search') {
    if (defined('CRAWLER')) {
        exit;
    }
    if (empty($auth['user_id'])) {
        return array(
            CONTROLLER_STATUS_REDIRECT,
            'auth.login_form?return_url=' . urlencode(Registry::get('config.current_url'))
        );
    }
}

return;

Applied the code but this loads  'Sorry, service is temporarily unavailable.' page for everyone once you perform search.



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19056 posts

Posted 12 October 2018 - 06:44 AM #10

I have corrected my post. It should work now


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • ypg
  • Member
  • Members
  • Join Date: 16-Nov 06
  • 69 posts

Posted 12 October 2018 - 10:18 AM #11

I have corrected my post. It should work now

Thanks, it is working now. But there should be some other way out to stop this.



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19056 posts

Posted 12 October 2018 - 01:30 PM #12

Try to display issue to the bug tracker. May be CS-Cart developers will add something to the code


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • P-Pharma
  • Junior Member
  • Members
  • Join Date: 30-Jun 10
  • 1136 posts

Posted 12 October 2018 - 07:27 PM #13

Add CloudFlare.