漏洞管理-主机视图-主机列表-导出报告
功能介绍
在主机视图中导出漏洞报告详细报告pdf格式
调用方法
请参见如何调用API。
URI
POST /v5/{project_id}/vulnerability/report/data
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
参数解释: 项目ID,用于明确项目归属,配置后可通过该ID查询项目下资产。获取方式请参见获取项目ID。 约束限制: 不涉及 取值范围: 字符长度1-256位 默认取值: 不涉及 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
enterprise_project_id |
否 |
String |
参数解释: 企业项目ID,用于过滤不同企业项目下的资产。获取方式请参见获取企业项目ID。 如需查询所有企业项目下的资产请传参“all_granted_eps”。 约束限制: 开通企业项目功能后才需要配置企业项目ID参数。 取值范围: 字符长度1-256位 默认取值: 0,表示默认企业项目(default)。 |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
String |
参数解释: 用户Token,包含了用户的身份、权限等信息,在调用API接口时,可通过Token进行身份认证。获取方式请参见获取用户Token。 约束限制: 不涉及 取值范围: 字符长度1-32768位 默认取值: 不涉及 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
asset_value |
否 |
String |
参数解释: 资产重要性 约束限制: 不涉及 取值范围:
默认取值: 不涉及 |
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 |
参数解释: 漏洞风险等级 约束限制: 不涉及 取值范围:
默认取值: 不涉及 |
handle_status |
是 |
String |
参数解释: 处置状态 约束限制: 不涉及 取值范围:
默认取值: 不涉及 |
status |
否 |
String |
参数解释: 主机的漏洞状态 约束限制: 不涉及 取值范围:
默认取值: 不涉及 |
响应参数
状态码:200
参数 |
参数类型 |
描述 |
---|---|---|
sumary |
sumary 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 |
参数 |
参数类型 |
描述 |
---|---|---|
vul_num_repair_necessity |
Integer |
参数解释: 紧急修复漏洞数量 取值范围: 最小值0,最大值1000000 |
vul_num_unfixed |
Integer |
参数解释: 未完成修复的漏洞数量 取值范围: 最小值0,最大值1000000 |
vul_num_linux |
Integer |
参数解释: linxu漏洞数量 取值范围: 最小值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 |
参数 |
参数类型 |
描述 |
---|---|---|
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 |
参数解释: 漏洞风险等级 取值范围:
|
vul_total_num |
Integer |
参数解释: 漏洞数 取值范围: 最小值0,最大值10000000 |
host_id |
String |
参数解释: 主机ID 取值范围: 字符长度1-128位 |
参数 |
参数类型 |
描述 |
---|---|---|
vul_name |
String |
参数解释: 漏洞名称 取值范围: 字符长度0-256位 |
scan_time |
Long |
参数解释: 最近扫描时间 取值范围: 最小值0,最大值9223372036854775807 |
type |
String |
参数解释: 漏洞类型 取值范围:
|
cve_list |
Array of cve_list objects |
CVE列表 |
repair_priority |
String |
参数解释: 修复优先级 取值范围:
|
host_num |
Integer |
参数解释: 影响主机数量 取值范围: 最小值0,最大值20000 |
host_id_list |
Array of strings |
参数解释: 主机ID列表(数组长度跟host_num对不上时,主机数量以host_num为准) 取值范围: 最小值0,最大值20000 |
请求示例
""
响应示例
状态码:200
请求已成功
{ "sumary" : [ { "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, "vul_num_urgent" : 0, "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", "agent_id" : "aba3b0eedecb5335aaa2804334783e556cf3811fb81b164abbf2dfe754563468", "host_name" : "00693117", "group_id" : "6f41a5fd-d435-4102-9a8b-73a9abc49418", "group_name" : "xxxxxxxxxx", "asset_value" : "important", "private_ip" : "192.168.0.246", "public_ip" : "", "severity_level" : "High", "vul_total_num" : 1 } ], "vulnerabilities" : [ { "type" : "linux_vul", "vul_name" : "HCE2-SA-2025-0089 An update for expat is now available for HCE 2.0", "vul_id\"" : "HCE2-SA-2025-0089", "repair_priority\"" : "High", "host_num" : 1, "scan_time" : 1755139626431, "host_id_list" : [ "cf2f2f7d-48be-45a0-ad6f-5a89e62c4677" ], "cve_list\"" : [ { "cve_id" : "CVE-2024-50602" } ], "repair_priority_list\"" : [ { "repair_priority" : "Critical", "host_num" : 0 }, { "repair_priority" : "High", "host_num" : 1 }, { "repair_priority" : "Medium", "host_num" : 0 }, { "repair_priority" : "Low", "host_num" : 0 } ] } ], "report_create_time" : 1755570076030, "vulnerability_total_count" : 1 }
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 49 |
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 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(); 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()); } } } |
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 |
# 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( ) 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) |
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 |
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.ShowVulReportDataRequest{} request.Body = &model.VulReportRequestBody{ } response, err := client.ShowVulReportData(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
状态码 |
描述 |
---|---|
200 |
请求已成功 |
错误码
请参见错误码。