• Resolved davidschneider85

    (@davidschneider85)


    Hey,

    is it possible you can add a feature, which bans bots which do a lot of queries on the search engine? Or which get banned, if they do 5 10 clicks in 1 minute or like that.

    They search like this:

    ???1+1?20170519 ???????????
    ?????????? pv&?????/??????? pv&?????/??

    Would be a nice feature!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author nintechnet

    (@nintechnet)

    Hi,

    There is already a rate-limit feature in the premium version of NinjaFirewall.

    But if you just want to block search queries containing several question marks, you can use the .htninja file:

    <?php
    /*
     +===================================================================+
     | NinjaFirewall optional configuration file                         |
     |                                                                   |
     | See: https://nintechnet.com/ninjafirewall/wp-edition/help/?htninja |
     +===================================================================+
    */
    
    // Block search requests containing at least 4 consecutive "?" signs:
    if ( isset( $_GET['s'] ) && strpos( $_GET['s'], '????' ) !== FALSE ) {
       return 'BLOCK'; // reject it
    }
    
    • This reply was modified 7 years, 8 months ago by nintechnet.
    • This reply was modified 7 years, 8 months ago by nintechnet.
    Thread Starter davidschneider85

    (@davidschneider85)

    Hi nintechnet,

    thanks – that works perfect.
    How do i extend this to do the same with all asia letters? My blog is english and i dont want the stats to be messed up with this words.

    Like this:

    美爪屋
    心机少女
    开封奇谈-这个包公不太行

    Thread Starter davidschneider85

    (@davidschneider85)

    …and also russia and turkish letters…

    по волчьим законам
    sevimli kü?ük yalancilar

    Plugin Author nintechnet

    (@nintechnet)

    Use regular expression to check the unicode character, for instance, Han for Chinese:

    
    if ( isset( $_GET['s'] ) && preg_match( '/\p{Han}/u', $_GET['s']) ) {
       return 'BLOCK'; // reject it
    }
    

    Cyrillic should do for Russian. See https://php.net/manual/en/regexp.reference.unicode.php

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Search abused by bots’ is closed to new replies.