turbo124 / waf
v1.0.0
2024-03-28 21:24 UTC
Requires
- guzzlehttp/guzzle: ^7.5
- illuminate/collections: ^10
- nesbot/carbon: 2.x-dev
Requires (Dev)
- monolog/monolog: ^3.0@dev
- phpstan/phpstan: 1.11.x-dev
- phpunit/phpunit: ^10.1
- vlucas/phpdotenv: ^5.6@dev
This package is auto-updated.
Last update: 2024-08-28 22:27:18 UTC
README
Cloudflare WAF 的包装器。
在网络边缘阻止威胁,而不是在您的应用程序中。
在网络边缘禁止 IP 地址
初始化 Cloudflare WAF
$zone = The Cloudflare Zone ID
$account_id = The Cloudflare Account ID;
$email = The email address associated with the cloudflare account;
$api_key = The cloudflare API key (must have permissions with write Zone Rulesets and Rules);
初始化 WAF
$waf = new \Turbo124\Waf\Waf($api_key, $email, $zone, $account_id);
禁止一个 IP 地址
$waf->unbanIp('103.15.248.112');
解禁一个 IP 地址
$waf->unbanIp('103.15.248.112');
禁止一个 ASN
$waf->banAsn('10343');
解禁一个 ASN
$waf->unbanAsn('10343');
根据 ISO 3166 2 国家代码禁止一个国家
$waf->banCountry('DE');
根据 ISO 3166 2 国家代码解禁一个国家
$waf->unbanCountry('DE');
管理挑战一个 IP 地址
$waf->challengeIp('103.15.248.112');
在一个 IP 地址上禁用管理挑战
$waf->unchallengeIp('103.15.248.112');
额外的智能助手。
Cloudflare 为某些域名和 IP 地址提供了一些实用的智能指标,并可以提供风险评级。
获取域名信息
$waf->meta->getDomainInfo('example.com');
响应
[ "domain" => "puabook.com", "ip" => "51.254.35.55", "risk_type_string" => "Parked & For Sale Domains,Security Risks", "risk_type" => [ [ "id" => 128, "super_category_id" => 32, "name" => "Parked & For Sale Domains", ], [ "id" => 32, "name" => "Security Risks", ], ], "content_catgories" => [], "content_category_string" => "", ]
获取 IP 信息
$waf->meta->getIpInfo('210.140.43.55');
响应
[ "ip" => "210.140.43.55", "asn" => 4694, "country" => "JP", "risk_types" => [], ]