文档中心 API文档 查询WAF触发规则/策略

查询WAF触发规则/策略

更新时间:2023-01-12 14:01:45

适用产品

WEB应用防火墙

接口描述

查询WAF触发规则/策略。

推荐使用 Open API在线调试

Open API在线调试功能提供可视化界面在线调试API、支持生成代码示例、快速检索查看API文档等能力。前往调试

请求参数

Body 参数

参数名称描述
*domainsList
域名,数组。
*startTimeString
开始时间,yyyy-MM-dd HH:mm:ss。
*endTimeString
结束时间,yyyy-MM-dd HH:mm:ss。
timeZoneString
时区,默认GMT+8,即“GMT+8”。
actsList
处理动作,默认1和2。 1:拦截 2:监控
policysList
触发策略类型,数组。[protocol:协议合规检测, webShell:后门识别, other:其他防护规则, access:访问控制/限速, rule:Web规则防护]

返回参数

Body 参数

参数名称描述
codeString
0状态码表示请求成功,其他状态码说明请参见《错误码》。
messageString
错误信息或Success。
dataTriggerRule
返回值。
actString
处理动作。 1:拦截 2:监控
ruleNameString
规则名称。
attackTypeString
攻击类型。
attackTypeNameString
攻击类型中文名称。
attackTypeNameEnString
攻击类型英文名称。
ruleIdString
规则ID。
totalCountString
触发次数。

错误码

错误代码(code)描述(message)HTTP状态码语义
22992000ERROR_SYSTEM200系统错误
22992001ERROR_PARAM200参数错误
22992002ERROR_HEADER200请求头参数错误
22992003ERROR_ZONE200时区参数异常,请以GMT开头
22992004ERROR_TIME_ZONE200时区转换异常

示例

JSON
JSON
请求示例
复制代码 复制成功
#!/bin/bash
username="example_username"
# Note that this must be a single quote to avoid the special $ character
apiKey='example_apiKey'
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`

curl -i --url "https://open.chinanetcenter.com/api/waf/report/query-trrigger-rule-list" \
-X "POST" \
-u "$username:$password" \
-H "Date: $date" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
    "domains":["example.xxx.xxx"],
    "startTime":"2021-09-06 00:00:00",
    "endTime":"2021-10-05 00:00:00",
    "timeZone":"GMT+8",
    "acts":[],
    "policys":[]
}'
返回示例
复制代码 复制成功
{
    "code": "0",
    "message": "Success",
    "data": {
        "count": 6,
        "list": [
            {
                "act": "1",
                "attackType": "WAF_FORCE_CRACKING",
                "attackTypeNameEn": "Rate Limiting",
                "ruleName": "cracking",
                "attackTypeName": "Rate Limiting",
                "ruleId": "4000",
                "totalCount": 11651
            },
            {
                "act": "1",
                "attackType": "WAF_SERVER_ERROR_LEAKAGE",
                "attackTypeNameEn": "Server Sensitive Info Leakage",
                "ruleName": "test_guize1",
                "attackTypeName": "Server Sensitive Info Leakage",
                "ruleId": "20347",
                "totalCount": 63
            },
            {
                "act": "2",
                "attackType": "WAF_CUSTOM_RULE",
                "attackTypeNameEn": "Custom Rules",
                "ruleName": "111223",
                "attackTypeName": "Custom Rules",
                "ruleId": "20341",
                "totalCount": 29
            },
            {
                "act": "1",
                "attackType": "WAF_SQLI",
                "attackTypeNameEn": "SQL Injection",
                "ruleName": "",
                "attackTypeName": "SQL Injection",
                "ruleId": "0",
                "totalCount": 26
            },
            {
                "act": "2",
                "attackType": "WAF_SERVER_ERROR_LEAKAGE",
                "attackTypeNameEn": "Server Sensitive Info Leakage",
                "ruleName": "new_test_08251",
                "attackTypeName": "Server Sensitive Info Leakage",
                "ruleId": "20345",
                "totalCount": 2
            },
            {
                "act": "2",
                "attackType": "WAF_SQLI",
                "attackTypeNameEn": "SQL Injection",
                "ruleName": "sql_backslash",
                "attackTypeName": "SQL Injection",
                "ruleId": "5000",
                "totalCount": 2
            }
        ]
    }
}
本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!