
# 漏洞管理-主机视图-主机列表-导出报告 - ShowVulReportData
#### 功能介绍
在主机视图中导出漏洞报告详细报告pdf格式。
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-hss2.0/hss_02_0007.html)。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-hss2.0/hss_02_0022.html)。
- 如果使用身份策略授权，当前API调用无需身份策略权限。
 
#### URI
POST /v5/{project_id}/vulnerability/report/data
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                         |
|:---|:---|:---|:---|
| project_id | 是    | String | **参数解释**: 项目ID，用于明确项目归属，配置后可通过该ID查询项目下资产。获取方式请参见[获取项目ID](https://support.huaweicloud.com/api-hss2.0/hss_02_0024.html)。 **约束限制**: 不涉及 **取值范围**: 字符长度1-256位 **默认取值**: 不涉及 |
   
表2Query参数 
| 参数                    | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
|:---|:---|:---|:---|
| enterprise_project_id | 否    | String | **参数解释**: 企业项目ID，用于过滤不同企业项目下的资产。获取方式请参见[获取企业项目ID](https://support.huaweicloud.com/api-hss2.0/hss_02_0027.html)。 如需查询所有企业项目下的资产请传参"all_granted_eps"。 **约束限制**: 开通企业项目功能后才需要配置企业项目ID参数。 **取值范围**: 字符长度1-256位 **默认取值**: 0，表示默认企业项目（default）。 |
   
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | **参数解释**: 用户Token，包含了用户的身份、权限等信息，在调用API接口时，可通过Token进行身份认证。获取方式请参见[获取用户Token](https://support.huaweicloud.com/api-hss2.0/hss_02_0009.html)。 **约束限制**: 不涉及 **取值范围**: 字符长度1-32768位 **默认取值**: 不涉及 |
   
表4请求Body参数 
| 参数             | 是否必选 | 参数类型             | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
|:---|:---|:---|:---|
| asset_value    | 否    | String           | **参数解释**: 资产重要性 **约束限制**: 不涉及 **取值范围**: - important：重要资产。   - common：一般资产。   - test：测试资产。    **默认取值**: 不涉及                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| group_name     | 否    | String           | **参数解释**： 服务器组名称 **约束限制**： 不涉及 **取值范围**： 字符长度1-64位 **默认取值**： 不涉及                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| host_ids       | 否    | Array of strings | **参数解释**： 服务器ID列表 **约束限制**： 不涉及 **取值范围**： 0-100个items **默认取值**： 不涉及                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| host_name      | 否    | String           | **参数解释**： 主机名称 **约束限制**： 不涉及 **取值范围**： 字符长度1-64位 **默认取值**： 不涉及                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| host_ip        | 否    | String           | **参数解释**： 主机ip **约束限制**： 不涉及 **取值范围**： 字符长度0-128位 **默认取值**： 不涉及                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| severity_level | 否    | String           | **参数解释**: 漏洞风险等级 **约束限制**: 不涉及 **取值范围**: - High：高。   - Medium：中等。   - Low：低。   - Security：安全。    **默认取值**: 不涉及                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| handle_status  | 是    | String           | **参数解释**: 处置状态 **约束限制**: 不涉及 **取值范围**: - unhandled：未处理。   - handled：已处理。    **默认取值**: 不涉及                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| status         | 否    | String           | **参数解释**: 主机的漏洞状态 **约束限制**: 不涉及 **取值范围**: - vul_status_unfix：未处理。   - vul_status_ignored：已忽略。   - vul_status_verified：验证中。   - vul_status_fixing：修复中。   - vul_status_fixed：已修复。   - vul_status_reboot：修复待重启。   - vul_status_failed：修复失败。   - vul_status_fix_after_reboot：请重启主机再次修复。    **默认取值**: 不涉及 |
   
#### 响应参数
**状态码：200**
表5响应Body参数 
| 参数                        | 参数类型                                                                             | 描述                                                                                                                                                                    |
|:---|:---|:---|
| sumary                    | [sumary] object                             | 统计信息（该字段已废弃）                                                                                                                                                          |
| summary                   | [summary] object                           | 统计信息                                                                                                                                                                  |
| hosts                     | Array of [hosts] objects                     | 主机列表                                                                                                                                                                  |
| vulnerabilities           | Array of [vulnerabilities] objects | 漏洞列表                                                                                                                                                                  |
| report_create_time        | Long                                                                             | **参数解释**： 报告生成时间 **取值范围**： 最小值0，最大值9223372036854775807 |
| vulnerability_total_count | Integer                                                                          | **参数解释**： 漏洞总数量 **取值范围**： 最小值0，最大值10000000             |
| host_total_count          | Integer                                                                          | **参数解释**： 主机总数量 **取值范围**： 最小值0，最大值20000                |
   
 表6sumary 
| 参数                       | 参数类型    | 描述                                                                                                                                                          |
|:---|:---|:---|
| vul_num_repair_necessity | Integer | **参数解释**: 紧急修复漏洞数量 **取值范围**: 最小值0，最大值1000000 |
   
 表7summary 
| 参数                         | 参数类型    | 描述                                                                                                                                                              |
|:---|:---|:---|
| vul_num_repair_necessity   | Integer | **参数解释**: 紧急修复漏洞数量 **取值范围**: 最小值0，最大值1000000     |
| vul_num_unfixed            | Integer | **参数解释**: 未完成修复的漏洞数量 **取值范围**: 最小值0，最大值1000000   |
| vul_num_linux              | Integer | **参数解释**: linux漏洞数量 **取值范围**: 最小值0，最大值1000000    |
| vul_num_windows            | Integer | **参数解释**: windows的漏洞数量 **取值范围**: 最小值0，最大值1000000 |
| vul_num_web_cms            | Integer | **参数解释**: web-cms的漏洞数量 **取值范围**: 最小值0，最大值1000000 |
| vul_num_app                | Integer | **参数解释**: 应用漏洞 **取值范围**: 最小值0，最大值1000000         |
| host_num_risk              | Integer | **参数解释**: 有风险的主机数量 **取值范围**: 最小值0，最大值1000000     |
| host_num_high_risk         | Integer | **参数解释**: 有高危风险的主机数量 **取值范围**: 最小值0，最大值1000000   |
| host_num_medium_risk       | Integer | **参数解释**: 有中危风险的主机数量 **取值范围**: 最小值0，最大值1000000   |
| host_num_low_risk          | Integer | **参数解释**: 有低危风险的主机数量 **取值范围**: 最小值0，最大值1000000   |
| affect_asset_num_important | Integer | **参数解释**: 受影响的重要资产数量 **取值范围**: 最小值0，最大值1000000   |
| affect_asset_num_common    | Integer | **参数解释**: 受影响的一般资产数量 **取值范围**: 最小值0，最大值1000000   |
| affect_asset_num_test      | Integer | **参数解释**: 受影响的测试资产数量 **取值范围**: 最小值0，最大值1000000   |
   
 表8hosts 
| 参数             | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
|:---|:---|:---|
| host_name      | String  | **参数解释**： 主机名称 **取值范围**： 字符长度1-256位                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| public_ip      | String  | **参数解释**： 服务器公网ip **取值范围**： 字符长度1-64位                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| private_ip     | String  | **参数解释**： 服务器私网ip **取值范围**： 字符长度0-128位                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| scan_time      | Long    | **参数解释**： 最近扫描时间 **取值范围**： 最小值0，最大值9223372036854775807                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| severity_level | String  | **参数解释**： 漏洞风险等级 **取值范围**： - Critical：紧急。   - High：高危。   - Medium：中危。   - Low：低危。    |
| vul_total_num  | Integer | **参数解释**： 漏洞数 **取值范围**： 最小值0，最大值10000000                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| host_id        | String  | **参数解释**： 主机ID **取值范围**： 字符长度1-128位                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
   
 表9vulnerabilities 
| 参数              | 参数类型                                                               | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
|:---|:---|:---|
| vul_name        | String                                                             | **参数解释**： 漏洞名称 **取值范围**： 字符长度0-256位                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| scan_time       | Long                                                               | **参数解释**： 最近扫描时间 **取值范围**： 最小值0，最大值9223372036854775807                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| type            | String                                                             | **参数解释**： 漏洞类型 **取值范围**： - linux_vul：linux漏洞。   - windows_vul：windows漏洞。   - web_cms：Web-CMS漏洞。   - app_vul：应用漏洞。    |
| cve_list        | Array of [cve_list] objects | CVE列表                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| repair_priority | String                                                             | **参数解释**： 修复优先级 **取值范围**： - Critical：紧急。   - High：高。   - Medium：中。   - Low：低。                                        |
| host_num        | Integer                                                            | **参数解释**： 影响主机数量 **取值范围**： 最小值0，最大值20000                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| host_id_list    | Array of strings                                                   | **参数解释**: 主机ID列表(数组长度跟host_num对不上时，主机数量以host_num为准) **取值范围**: 最小值0，最大值20000                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
   
 表10cve_list 
| 参数     | 参数类型   | 描述                                                                                                                                                   |
|:---|:---|:---|
| cve_id | String | **参数解释**： CVE ID **取值范围**： 字符长度1-32位  |
| cvss   | Float  | **参数解释**： CVSS分值 **取值范围**： 最小值0，最大值10 |
   
#### 请求示例
导出project_id为2b31ed520xxxxxxebedb6e57xxxxxxxx的未处置漏洞的报告
```
POST https://{endpoint}/v5/2b31ed520xxxxxxebedb6e57xxxxxxxx/vulnerability/report/data?enterprise_project_id=all_granted_eps
{
  "handle_status" : "unhandled",
  "host_ids" : [ ]
}
```
#### 响应示例
**状态码：200**
请求已成功
```
{
  "summary" : {
    "vul_num_repair_necessity" : 0,
    "vul_num_unfixed" : 1,
    "vul_num_linux" : 1,
    "vul_num_windows" : 0,
    "vul_num_web_cms" : 0,
    "vul_num_app" : 1,
    "host_num_risk" : 1,
    "host_num_high_risk" : 1,
    "host_num_medium_risk" : 1,
    "host_num_low_risk" : 1,
    "affect_asset_num_important" : 1,
    "affect_asset_num_common" : 0,
    "affect_asset_num_test" : 0
  },
  "hosts" : [ {
    "host_id" : "cf2f2f7d-48be-45a0-ad6f-5a89e62c4677",
    "host_name" : "00693117",
    "private_ip" : "192.168.0.246",
    "public_ip" : "192.168.0.246",
    "severity_level" : "High",
    "vul_total_num" : 1,
    "scan_time" : 253
  } ],
  "vulnerabilities" : [ {
    "type" : "linux_vul",
    "vul_name" : "HCE2-SA-2025-0089 An update for expat is now available for HCE 2.0",
    "repair_priority" : "High",
    "host_num" : 1,
    "scan_time" : 1755139626431,
    "host_id_list" : [ "cf2f2f7d-48be-45a0-ad6f-5a89e62c4677" ],
    "cve_list" : [ {
      "cve_id" : "CVE-2024-50602",
      "cvss" : 5
    } ]
  } ],
  "report_create_time" : 1755570076030,
  "vulnerability_total_count" : 1,
  "host_total_count" : 23
}
```
#### SDK代码示例
SDK代码示例如下。
- [Java]
  导出project_id为2b31ed520xxxxxxebedb6e57xxxxxxxx的未处置漏洞的报告
  ```
  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.*;
  import java.util.List;
  import java.util.ArrayList;
  public class ShowVulReportDataSolution {
      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();
          ShowVulReportDataRequest request = new ShowVulReportDataRequest();
          VulReportRequestBody body = new VulReportRequestBody();
          body.withHandleStatus("unhandled");
          request.withBody(body);
          try {
              ShowVulReportDataResponse response = client.showVulReportData(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());
          }
      }
  }
  ```
- [Python]
  导出project_id为2b31ed520xxxxxxebedb6e57xxxxxxxx的未处置漏洞的报告
  ```
  # 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 = ShowVulReportDataRequest()
          request.body = VulReportRequestBody(
              handle_status="unhandled"
          )
          response = client.show_vul_report_data(request)
          print(response)
      except exceptions.ClientRequestException as e:
          print(e.status_code)
          print(e.request_id)
          print(e.error_code)
          print(e.error_msg)
  ```
- [Go]
  导出project_id为2b31ed520xxxxxxebedb6e57xxxxxxxx的未处置漏洞的报告
  ```
  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, err := basic.NewCredentialsBuilder().
          WithAk(ak).
          WithSk(sk).
          WithProjectId(projectId).
          SafeBuild()
      if err != nil {
          fmt.Println(err)
          return
      }
      hcClient, err := hss.HssClientBuilder().
           WithRegion(region.ValueOf("<YOUR REGION>")).
           WithCredential(auth).
           SafeBuild()
      if err != nil {
          fmt.Println(err)
          return
      }
      client := hss.NewHssClient(hcClient)
      request := &model.ShowVulReportDataRequest{}
  request.Body = &model.VulReportRequestBody{
  HandleStatus: "unhandled",
  }
  response, err := client.ShowVulReportData(request)
  if err == nil {
          fmt.Printf("%+v\n", response)
      } else {
          fmt.Println(err)
      }
  }
  ```
- [更多]
  更多编程语言的SDK代码示例，请参见[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/HSS/sdk?api=ShowVulReportData&version=v5)的代码示例页签，可生成自动对应的SDK代码示例。
#### 状态码
| 状态码 | 描述    |
|:---|:---|
| 200 | 请求已成功 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-hss2.0/ErrorCode.html)。
