coercive / botkicker
Coercive Security BotKicker
0.0.55
2024-09-27 19:34 UTC
Requires
- php: >=7.4
- symfony/yaml: ^2
- dev-master / 1.0.x-dev
- 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-09-27 19:35:27 UTC
README
基于黑名单的简单检测
获取
composer require coercive/botkicker
列出信息
-
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 文件来自 apache set https://github.com/mitchellkrogza
警告信息
由于检测范围过大,一些术语被放置在模糊列表中。您可以在每个列表目录中找到这些模糊文件。(进行中)
踢出系统
基础知识
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 }
您可以检测是否需要UA robots.txt
if($kicker->isRobotsTxtRequested()) { /* do something */ }
(允许/不允许)空
# You can (dis)allow empty current detection $kicker->allowEmpty( true | false );
仅 HostKicker
您可以从IP列表中检测主机名
# HostKicker only $kicker = new HostKicker; # Set your ip list $kicker->setHostFromIp( [ 'xxx.xx.xx.x', 'yy.yyy.y.y', '...', ] );
仅 IpKicker
您可以使用IpKicker的自动IP检测
# Get auto Ip list detection $list = (new IpKicker)->getCurrents(); # Set auto ip list $kicker = new HostKicker; $kicker->setHostFromIp($list);
IpKicker现在可以检测Facebookbot和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)
在自定义元素上触发
# Example of custom datas $datas = ['bot1', 'bot2', 'bot3']; # Override auto detection $kicker->setCurrents($datas); # Show detection result $status = $kicker->detect(); var_dump( $status->getList() );
处理自定义列表
您可以设置自己的列表(数组格式)
$kicker->setBlackList([ 'bad', 'bad too' ]); $kicker->setWhiteList([ 'good', 'good too' ]);
或从文件(txt brut格式)
$kicker->setBlackListFromFiles([ '/path/file1', '/path/file2' ]); $kicker->setWhiteListFromFiles([ '/path/file1', '/path/file2' ]);
如果已加载一些列表,您可以添加一些项目
$kicker->addToBlackList([ 'bad', 'bad too' ]); $kicker->addToWhiteList([ 'good', 'good too' ]);
处理要验证的自定义元素
# 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
主机 / Ns 查找
从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');
从域名获取IP列表
use Coercive\Security\BotKicker\HostLookUp; use Coercive\Security\BotKicker\NsLookUp; $look = new HostLookUp; # OR $look = new NsLookUp; $array = $look->getIps('www.example.com.');
匹配项目
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);