foodette / yii1-honeypot

Yii 1 honeypot / IP 检查扩展

1.0 2018-11-02 11:43 UTC

This package is auto-updated.

Last update: 2024-09-29 05:28:03 UTC


README

License

HoneyPot 扩展,用于 Yii 1.1 框架。

安装

安装此扩展的首选方式是通过 composer

运行以下命令之一

php composer.phar require --prefer-dist foodette/yii1-honeypot "*"

或者将以下内容添加到你的 composer.json 文件的 require 部分。

"foodette/yii1-honeypot": "*"

to the require section of your composer.json file.

使用

使用您的 access key 创建一个 HttpBlackList 对象

use foodette\extension\yii1-honeypot

$httpBL = new HttpBlackList('youraccesskey');

检查一个 IP 地址

check 方法将返回一个布尔值,指示该 IP 地址是否已知有可疑活动。

$httpBL->check('1.2.3.4');
// returns true|false

查询一个 IP 地址

query 方法将返回一个包含可疑活动详情的数组

$httpBL->check('1.2.3.4');
returns [] when IP is ok
returns [
    'lastActivity'  => 12 // number of days since last activity 
    'threatScore'   => 39 // threat score on a 0-100 scale
    'type'          => 1  // visitor type bit, e.g. Suspicious|Harvester|Comment spam
] when IP is known to have suspicious activity

有关更多信息,请参阅 Project Honey Pot API