coercive / botkicker
Coercive Security BotKicker
Requires
- php: >=7.4
- symfony/yaml: ^2
- dev-master / 1.0.x-dev
- 0.0.56
- 0.0.55
- 0.0.54
- 0.0.53
- 0.0.52
- 0.0.51
- 0.0.50
- 0.0.49
- 0.0.48
- 0.0.47
- 0.0.46
- 0.0.45
- 0.0.44
- 0.0.43
- 0.0.42
- 0.0.41
- 0.0.40
- 0.0.39
- 0.0.38
- 0.0.37
- 0.0.36
- 0.0.35
- 0.0.34
- 0.0.33
- 0.0.32
- 0.0.31
- 0.0.30
- 0.0.29
- 0.0.28
- 0.0.27
- 0.0.26
- 0.0.25
- 0.0.24
- 0.0.23
- 0.0.22
- 0.0.21
- 0.0.20
- 0.0.19
- 0.0.18
- 0.0.17
- 0.0.16
- 0.0.15
- 0.0.14
- 0.0.13
- 0.0.12
- 0.0.11
- 0.0.10
- 0.0.9
- 0.0.8
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
This package is auto-updated.
Last update: 2024-11-04 08:59:38 UTC
README
A simple detection based on black list
Get
composer require coercive/botkicker
List infos
-
PERISHABLE PRESS ULTIMATE USER-AGENT BLACKLIST https://perishablepress.com/4g-ultimate-user-agent-blacklist/
-
PERISHABLE PRESS ULTIMATE REFERRER BLACKLIST https://perishablepress.com/4g-ultimate-referrer-blacklist/
-
CHONGQED REFERER BLACKLIST http://blacklist.chongqed.org/
-
MITCHELL KROG - BlackList file from apache set https://github.com/mitchellkrogza
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)
Kicker system
Basics
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
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
# 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
# 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
# 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)
$kicker->setBlackList([ 'bad', 'bad too' ]); $kicker->setWhiteList([ 'good', 'good too' ]);
Or from file (txt brut format)
$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
$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
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
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
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);