2017 © Pedro Peláez
 

library botkicker

Coercive Security BotKicker

image

coercive/botkicker

Coercive Security BotKicker

  • Friday, March 30, 2018
  • by Coercive
  • Repository
  • 1 Watchers
  • 0 Stars
  • 196 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 9 % Grown

The README.md

Coercive Security BotKicker

A simple detection based on black list, (*1)

Get

composer require coercive/botkicker

List infos

  • PERISHABLE PRESS ULTIMATE USER-AGENT BLACKLIST https://perishablepress.com/4g-ultimate-user-agent-blacklist/, (*2)

  • PERISHABLE PRESS ULTIMATE REFERRER BLACKLIST https://perishablepress.com/4g-ultimate-referrer-blacklist/, (*3)

  • CHONGQED REFERER BLACKLIST http://blacklist.chongqed.org/, (*4)

  • MITCHELL KROG - BlackList file from apache set https://github.com/mitchellkrogza, (*5)

Warning info

Some terms where placed in ambiguous list because of too large detection. You can find this ambiguous file are in each list directory. (work in progress), (*6)

Kicker system

Basics, (*7)

use  Coercive\Security\BotKicker\UserAgentKicker;

# Get Instance
$kicker = new UserAgentKicker; // or othe kicker

# Load a default list
$kicker->loadCoerciveLists();
# or load custom list...

# Basic bot detection
if(!$kicker->detect()->getStatus()) {
    echo 'a bot is detected';
}
else {
    # True if in whitelist or not in blacklist
}

You can detect if UA need the robots.txt, (*8)

if($kicker->isRobotsTxtRequested()) { /* do something */ }

(Dis)Allow empty

# You can (dis)allow empty current detection
$kicker->allowEmpty( true | false );

HostKicker only

You can detect host name from an ip list, (*9)

# HostKicker only
$kicker = new HostKicker;

# Set your ip list
$kicker->setHostFromIp( [
    'xxx.xx.xx.x',
    'yy.yyy.y.y',
    '...',
] );

IpKicker only

You can use the auto IP detection from IpKicker, (*10)

# Get auto Ip list detection
$list = (new IpKicker)->getCurrents();

# Set auto ip list
$kicker = new HostKicker;
$kicker->setHostFromIp($list);

IpKicker can now detect Facebookbot and Bingbot, (*11)

# Get auto Ip list detection
$ipk = new IpKicker;

$list = $ipk->getFacebookList();

$list = $ipk->isBing('157.55.39.1', true | false); # Linux Host cmd (true) / NsLookUp (false)

Trigger on custom element

# Example of custom datas
$datas = ['bot1', 'bot2', 'bot3'];

# Override auto detection
$kicker->setCurrents($datas);

# Show detection result
$status = $kicker->detect();
var_dump( $status->getList() );

Handle custom list

You can set your own list (array format), (*12)

$kicker->setBlackList([
    'bad',
    'bad too'
]);
$kicker->setWhiteList([
    'good',
    'good too'
]);

Or from file (txt brut format), (*13)

$kicker->setBlackListFromFiles([
    '/path/file1',
    '/path/file2'
]);
$kicker->setWhiteListFromFiles([
    '/path/file1',
    '/path/file2'
]);

If some list are already loaded, you can add some items like that, (*14)

$kicker->addToBlackList([
    'bad',
    'bad too'
]);
$kicker->addToWhiteList([
    'good',
    'good too'
]);

Handle custom elements to verify

# Example of custom datas
$datas = ['bot1', 'bot2', 'bot3'];

# Override auto detection
$kicker->setCurrents($datas);

# Show detection result
$status = $kicker->detect();

var_dump( $status->getStatus() ); # bool if ok or not
var_dump( $status->getList() ); # array list of match elements
var_dump( $status->getCurrents() ); # array current datas

Host / Ns Look Up

Get the domains list from IP, (*15)

use Coercive\Security\BotKicker\HostLookUp;
use Coercive\Security\BotKicker\NsLookUp;

$look = new HostLookUp;
# OR
$look = new NsLookUp;

$array = $look->getDomains('111.22.33.4');

Get the ip list from domain, (*16)

use Coercive\Security\BotKicker\HostLookUp;
use Coercive\Security\BotKicker\NsLookUp;

$look = new HostLookUp;
# OR
$look = new NsLookUp;

$array = $look->getIps('www.example.com.');

Match item, (*17)

use Coercive\Security\BotKicker\HostLookUp;
use Coercive\Security\BotKicker\NsLookUp;

$look = new HostLookUp;
# OR
$look = new NsLookUp;

# Match ip > domain
$array = $look->match('111.22.33.4', 'www.example.com.');

# OR mactch with reverse (match ip > domain first and domain > ip after)
$array = $look->match('111.22.33.4', 'www.example.com.', true);

The Versions

30/03 2018

dev-master

9999999-dev http://coercive.fr

Coercive Security BotKicker

  Sources   Download

MIT

The Requires

 

30/03 2018

0.0.7

0.0.7.0 http://coercive.fr

Coercive Security BotKicker

  Sources   Download

MIT

The Requires

 

11/03 2018

0.0.6

0.0.6.0 http://coercive.fr

Coercive Security BotKicker

  Sources   Download

MIT

The Requires

 

06/03 2018

0.0.5

0.0.5.0 http://coercive.fr

Coercive Security BotKicker

  Sources   Download

MIT

The Requires

 

26/02 2018

0.0.4

0.0.4.0 http://coercive.fr

Coercive Security BotKicker

  Sources   Download

MIT

The Requires

 

25/02 2018

0.0.3

0.0.3.0 http://coercive.fr

Coercive Security BotKicker

  Sources   Download

MIT

The Requires

 

24/02 2018

0.0.2

0.0.2.0 http://coercive.fr

Coercive Security BotKicker

  Sources   Download

MIT

The Requires

 

15/02 2018

0.0.1

0.0.1.0 http://coercive.fr

Coercive Security BotKicker

  Sources   Download

MIT

The Requires