文档首页/ 企业主机安全 HSS/ API参考/ API说明/ 安全运营/ 查询指定服务器的安全体检报告
更新时间:2025-09-26 GMT+08:00
分享

查询指定服务器的安全体检报告

功能介绍

查询指定服务器的安全体检报告

调用方法

请参见如何调用API

URI

GET /v5/{project_id}/security-check/host-report/{host_id}

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

参数解释:

项目ID,用于明确项目归属,配置后可通过该ID查询项目下资产。获取方式请参见获取项目ID

约束限制:

不涉及

取值范围:

字符长度1-256位

默认取值:

不涉及

host_id

String

参数解释:

服务器ID

约束限制:

不涉及

取值范围:

字符长度1-64位

默认取值:

不涉及

表2 Query参数

参数

是否必选

参数类型

描述

enterprise_project_id

String

参数解释:

企业项目ID,用于过滤不同企业项目下的资产。获取方式请参见获取企业项目ID

如需查询所有企业项目下的资产请传参“all_granted_eps”。

约束限制:

开通企业项目功能后才需要配置企业项目ID参数。

取值范围:

字符长度1-256位

默认取值:

0,表示默认企业项目(default)。

scan_time

Long

参数解释:

安全体检时间

约束限制:

不涉及

取值范围:

不涉及

默认取值:

不涉及

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释:

用户Token,包含了用户的身份、权限等信息,在调用API接口时,可通过Token进行身份认证。获取方式请参见获取用户Token

约束限制:

不涉及

取值范围:

字符长度1-32768位

默认取值:

不涉及

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

host_result

SecurityCheckHostResultResponseInfo object

参数解释

服务器体检结果信息

取值范围

不涉及

host_status

String

参数解释

服务器运行状态

取值范围

  • ACTIVE:运行中

  • SHUTOFF:关机

  • BUILDING:创建中

  • ERROR:故障

scan_period_start

Long

参数解释

体检周期开始时间

取值范围

不涉及

scan_period_end

Long

参数解释

体检周期结束时间

取值范围

不涉及

risk_rating

Integer

参数解释

风险评分

取值范围

不涉及

severity

String

参数解释

风险级别

取值范围

  • high:高危

  • medium:中危

  • low:低危

  • safe:安全,无风险

risk_num

Integer

参数解释

安全风险数量

取值范围

不涉及

scan_time

Long

参数解释

最新检测时间

取值范围

不涉及

free

Boolean

参数解释:

是否是免费安全体检的报告

取值范围:

  • true:免费安全体检的报告

  • false:非免费安全体检的报告

event_num_info

SecurityCheckRiskNumInfo object

参数解释

入侵风险数量信息

取值范围

不涉及

vul_num_info

SecurityCheckRiskNumInfo object

参数解释

漏洞风险数量信息

取值范围

不涉及

baseline_num_info

SecurityCheckRiskNumInfo object

参数解释

基线风险数量信息

取值范围

不涉及

asset_num_info

SecurityCheckRiskNumInfo object

参数解释

主机资产风险数量信息

取值范围

不涉及

asset_change_num

Integer

参数解释

主机资产变动记录数量

取值范围

不涉及

app_num

Integer

参数解释

软件数量

取值范围

不涉及

port_num

Integer

参数解释

危险端口数量

取值范围

不涉及

event_list

Array of SecurityCheckRiskEventInfo objects

参数解释

入侵事件列表

取值范围

不涉及

vul_list

Array of SecurityCheckVulInfo objects

参数解释

漏洞列表

取值范围

不涉及

security_config_list

Array of SecurityConfigInfo objects

参数解释

配置检测列表

取值范围

不涉及

security_config_item_list

Array of SecurityConfigItemInfo objects

参数解释

配置检查项列表

取值范围

不涉及

pwd_policy_list

Array of SecurityConfigPwdPolicyInfo objects

参数解释

口令复杂度策略列表

取值范围

不涉及

weak_pwd_list

Array of SecurityConfigWeakPwdInfo objects

参数解释

经典弱口令列表

取值范围

不涉及

user_change_list

Array of SecurityConfigUserChangeInfo objects

参数解释

主机账户的历史变动记录

取值范围

不涉及

port_list

Array of SecurityConfigPortInfo objects

参数解释

危险开放端口列表

取值范围

不涉及

app_list

Array of AppResponseInfo objects

参数解释

资产的软件列表

取值范围

不涉及

表5 SecurityCheckHostResultResponseInfo

参数

参数类型

描述

host_info

SecurityCheckHostInfo object

参数解释

服务器信息

取值范围

不涉及

severity

String

参数解释

风险级别

取值范围

  • high:高危

  • medium:中危

  • low:低危

  • safe:安全,无风险

risk_rating

Integer

参数解释

风险评分

取值范围

不涉及

risk_num

Integer

参数解释

风险数量

取值范围

不涉及

scan_time

Long

参数解释

最新检测时间

取值范围

不涉及

表6 SecurityCheckHostInfo

参数

参数类型

描述

host_name

String

参数解释

服务器名称

取值范围

不涉及

host_id

String

参数解释

服务器ID

取值范围

不涉及

private_ip

String

参数解释

私有IP地址

取值范围

不涉及

public_ip

String

参数解释

公网IP地址

取值范围

不涉及

os_type

String

参数解释

系统类型

取值范围

不涉及

表7 SecurityCheckRiskNumInfo

参数

参数类型

描述

total_risk_num

Long

参数解释

风险总数

取值范围

不涉及

compare_status

String

参数解释

与上一周期比较的状态

取值范围

  • lower:降低

  • increase:增加

  • equals:持平

compare_num

Integer

参数解释

与上一周期相差的数量的绝对值

取值范围

不涉及

high_risk_num

Integer

参数解释

高危风险数量

取值范围

不涉及

表8 SecurityCheckRiskEventInfo

参数

参数类型

描述

severity

String

参数解释

风险级别

取值范围

  • high:高危

  • medium:中危

  • low:低危

  • safe:安全,无风险

event_name

String

参数解释

告警事件名称

取值范围

不涉及

event_class_id

String

参数解释

告警事件class,用于前台生成事件名称

取值范围

不涉及

attack_flag

String

参数解释

攻击标识

取值范围

不涉及

attack_time

Long

参数解释

攻击时间

取值范围

不涉及

status

String

参数解释

处理状态

取值范围

  • unhandled:未处理

  • handled:已处理

表9 SecurityCheckVulInfo

参数

参数类型

描述

vul_name

String

参数解释

漏洞名称

取值范围

不涉及

vul_id

String

参数解释

漏洞ID

取值范围

不涉及

repair_necessity

String

参数解释

修复紧急度

取值范围

不涉及

scan_time

Long

参数解释

最近扫描时间

取值范围

不涉及

type

String

参数解释

漏洞类型

取值范围

不涉及

repair_cmd

String

参数解释

修复命令行

取值范围

不涉及

severity_level

String

参数解释:

漏洞风险级别

取值范围:

  • Critical:漏洞cvss评分大于等于9;对应控制台页面的高危

  • High:漏洞cvss评分大于等于7,小于9;对应控制台页面的中危

  • Medium:漏洞cvss评分大于等于4,小于7;对应控制台页面的中危

  • Low:漏洞cvss评分小于4;对应控制台页面的低危

表10 SecurityConfigInfo

参数

参数类型

描述

severity

String

参数解释

风险级别

取值范围

  • high:高危

  • medium:中危

  • low:低危

  • safe:安全,无风险

check_name

String

参数解释

基线名称

取值范围

不涉及

check_rule_num

Integer

参数解释

检查项数量

取值范围

不涉及

failed_rule_num

Integer

参数解释

风险项数量

取值范围

不涉及

scan_time

Long

参数解释

最新检测时间

取值范围

不涉及

check_type_desc

String

参数解释

基线描述信息

取值范围

不涉及

表11 SecurityConfigItemInfo

参数

参数类型

描述

check_name

String

参数解释

基线名称

取值范围

不涉及

check_item_rule

String

参数解释

检查项规则

取值范围

不涉及

scan_result

String

参数解释

检测结果

取值范围

  • pass:通过

  • failed:未通过

表12 SecurityConfigPwdPolicyInfo

参数

参数类型

描述

min_length

Boolean

参数解释

口令最小长度策略是否满足要求

取值范围

  • true:满足要求

  • false:不满足要求

uppercase_letter

Boolean

参数解释

大写字母策略是否满足要求

取值范围

  • true:满足要求

  • false:不满足要求

lowercase_letter

Boolean

参数解释

小写字母策略是否满足要求

取值范围

  • true:满足要求

  • false:不满足要求

number

Boolean

参数解释

数字策略是否满足要求

取值范围

  • true:满足要求

  • false:不满足要求不涉及

special_character

Boolean

参数解释

特殊字符策略是否满足要求

取值范围

  • true:满足要求

  • false:不满足要求

suggestion

String

参数解释

修改建议

取值范围

不涉及

表13 SecurityConfigWeakPwdInfo

参数

参数类型

描述

user_name

String

参数解释

弱口令账号名称

取值范围

不涉及

service_type

String

参数解释

账号类型

取值范围

不涉及

duration

Integer

参数解释

弱口令使用时长,单位天

取值范围

不涉及

表14 SecurityConfigUserChangeInfo

参数

参数类型

描述

change_type

String

参数解释

主机账户历史变动类型

取值范围

  • add:添加

  • delete:删除

  • modify:修改

login_permission

Boolean

参数解释

是否有登录权限

取值范围

  • true:有登录权限

  • false:无登录权限

root_permission

Boolean

参数解释

是否有root权限

取值范围

  • true:有root权限

  • false:无root权限

user_group_name

String

参数解释

用户组

取值范围

不涉及

user_home_dir

String

参数解释

用户目录

取值范围

不涉及

shell

String

参数解释

用户启动shell

取值范围

不涉及

user_name

String

参数解释

用户名

取值范围

不涉及

scan_time

Long

参数解释

最新扫描时间,采用时间戳,默认毫秒

取值范围

不涉及

表15 SecurityConfigPortInfo

参数

参数类型

描述

port

Integer

参数解释

端口号

取值范围

0-65535

type

String

参数解释

类型

取值范围

不涉及

status

String

参数解释

端口危险程度

取值范围

  • normal:正常端口

  • danger:危险端口

  • unknow:未知端口

port_status

Integer

参数解释

端口状态

取值范围

  • 0:未处理

  • 1:已忽略

  • 2:无需处理

port_desc

String

参数解释

端口描述

取值范围

不涉及

表16 AppResponseInfo

参数

参数类型

描述

agent_id

String

参数解释

agent ID

取值范围

不涉及

host_id

String

参数解释

服务器 ID

取值范围

不涉及

host_name

String

参数解释

服务器名称

取值范围

不涉及

host_ip

String

参数解释

服务器 IP

取值范围

不涉及

app_name

String

参数解释

软件名称

取值范围

不涉及

version

String

参数解释

软件版本

取值范围

不涉及

install_dir

String

参数解释

软件安装路径

取值范围

不涉及

container_id

String

参数解释

容器 ID

取值范围

不涉及

container_name

String

参数解释

容器名称

取值范围

不涉及

recent_scan_time

Long

参数解释

最近扫描时间

取值范围

不涉及

update_time

Long

参数解释

更新时间

取值范围

不涉及

请求示例

响应示例

状态码:200

请求已成功

{
  "host_result" : {
    "host_info" : {
      "host_name" : "hostName",
      "host_id" : "00433ab9-bfb4-44a5-a755-0c1b",
      "private_ip" : "1.1.1.1",
      "public_ip" : "1.1.1.1",
      "os_type" : "linux"
    },
    "severity" : "high",
    "risk_rating" : 10,
    "risk_num" : 10,
    "scan_time" : 1745051197000
  },
  "host_status" : "ACTIVE",
  "scan_period_start" : 1745051197000,
  "scan_period_end" : 1745051197000,
  "risk_rating" : 10,
  "severity" : "high",
  "risk_num" : 10,
  "scan_time" : 1745051197000,
  "event_num_info" : { },
  "vul_num_info" : {
    "total_risk_num" : 20,
    "compare_status" : "equals",
    "compare_num" : 10,
    "high_risk_num" : 10
  },
  "baseline_num_info" : { },
  "asset_num_info" : { },
  "asset_change_num" : 10,
  "port_num" : 10,
  "event_list" : [ ],
  "vul_list" : [ ],
  "security_config_list" : [ ],
  "security_config_item_list" : [ ],
  "pwd_policy_list" : [ ],
  "weak_pwd_list" : [ ],
  "user_change_list" : [ ],
  "port_list" : [ ]
}

SDK代码示例

SDK代码示例如下。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.hss.v5.region.HssRegion;
import com.huaweicloud.sdk.hss.v5.*;
import com.huaweicloud.sdk.hss.v5.model.*;


public class ShowSecurityCheckHostReportSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        HssClient client = HssClient.newBuilder()
                .withCredential(auth)
                .withRegion(HssRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowSecurityCheckHostReportRequest request = new ShowSecurityCheckHostReportRequest();
        request.withHostId("{host_id}");
        try {
            ShowSecurityCheckHostReportResponse response = client.showSecurityCheckHostReport(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkhss.v5.region.hss_region import HssRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkhss.v5 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = HssClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(HssRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ShowSecurityCheckHostReportRequest()
        request.host_id = "{host_id}"
        response = client.show_security_check_host_report(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    hss "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/hss/v5"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/hss/v5/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/hss/v5/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := hss.NewHssClient(
        hss.HssClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ShowSecurityCheckHostReportRequest{}
	request.HostId = "{host_id}"
	response, err := client.ShowSecurityCheckHostReport(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

请求已成功

错误码

请参见错误码

相关文档