更新时间:2025-09-08 GMT+08:00

查询病毒扫描结果列表

功能介绍

查询病毒扫描结果列表

调用方法

请参见如何调用API

URI

GET /v5/{project_id}/antivirus/result

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

参数解释:

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

约束限制:

不涉及

取值范围:

字符长度1-256位

默认取值:

不涉及

表2 Query参数

参数

是否必选

参数类型

描述

enterprise_project_id

String

参数解释:

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

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

约束限制:

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

取值范围:

字符长度1-256位

默认取值:

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

offset

Integer

参数解释:

偏移量:指定返回记录的开始位置

约束限制:

不涉及

取值范围:

最小值0,最大值2000000

默认取值:

不涉及

limit

Integer

参数解释:

每页显示个数

约束限制:

不涉及

取值范围:

取值10-200

默认取值:

10

host_name

String

参数解释:

服务器名称

约束限制:

不涉及

取值范围:

字符长度1-256位

默认取值:

不涉及

private_ip

String

参数解释:

服务器私有IP

约束限制:

不涉及

取值范围:

字符长度1-128位

默认取值:

不涉及

public_ip

String

服务器公网IP

handle_status

String

处置状态,包含如下:

  • unhandled:未处理

  • handled:已处理

severity_list

Array of strings

威胁等级,包含如下:

  • Low:低危

  • Medium:中危

  • High:高危

  • Critical:致命

asset_value

String

资产重要性,包含如下3种

  • important :重要资产

  • common :一般资产

  • test :测试资产

malware_name

String

病毒名称

file_path

String

文件路径

file_hash

String

文件hash,当前为sha256

task_name

String

任务名称

manual_isolate

Boolean

是否使用手动隔离按钮

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释:

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

约束限制:

不涉及

取值范围:

字符长度1-32768位

默认取值:

不涉及

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

total_num

Integer

参数解释:

总数

取值范围:

最小值0,最大值2147483647

data_list

Array of AntiVirusResultResponseInfo objects

结果列表详情

表5 AntiVirusResultResponseInfo

参数

参数类型

描述

result_id

String

病毒查杀结果ID

malware_type

String

病毒类型

malware_name

String

病毒名称

severity

String

威胁等级,包含如下:

  • Low:低危

  • Medium:中危

  • High:高危

  • Critical:致命

task_id

String

任务ID

task_name

String

任务名称

file_info

ResultFileResponseInfo object

文件信息

resource_info

ResultResourceResponseInfo object

资源信息

event_type

Integer

事件类型

occur_time

Integer

参数解释

发生时间,毫秒

取值范围

最小值0,最大值9223372036854775807

handle_status

String

参数解释

处理状态

取值范围

  • unhandled:未处理

  • handled:已处理

handle_method

String

处理方式,包含如下:

  • mark_as_handled:手动处理

  • ignore:忽略

  • add_to_alarm_whitelist:加入告警白名单

  • isolate_and_kill:隔离文件

memo

String

备注信息

operate_accept_list

Array of strings

支持的处理操作

operate_detail_list

Array of ResultDetailResponseInfo objects

操作详情信息列表(页面不展示)

isolate_tag

String

自动隔离查杀标识

表6 ResultFileResponseInfo

参数

参数类型

描述

file_path

String

参数解释

文件路径

取值范围

字符长度1-256位

file_hash

String

参数解释

文件哈希

取值范围

字符长度1-256位

file_size

Integer

参数解释:

文件大小

约束限制:

不涉及

取值范围:

最小值0,最大值9223372036854775807

默认取值:

不涉及

file_owner

String

文件属性

file_attr

String

参数解释

文件属性

取值范围

字符长度1-256位

file_ctime

Integer

文件创建时间

file_mtime

Integer

文件更新时间

表7 ResultResourceResponseInfo

参数

参数类型

描述

host_name

String

参数解释:

服务器名称

取值范围:

字符长度1-256位

host_id

String

参数解释

主机ID

取值范围

字符长度1-64位

agent_id

String

参数解释:

Agent ID

约束限制:

不涉及

取值范围:

字符长度1-64位

默认取值:

不涉及

private_ip

String

参数解释

服务器私有IP

取值范围

字符长度1-128位

public_ip

String

参数解释

弹性公网IP地址

取值范围

字符长度1-256位

os_type

String

参数解释

操作系统类型

取值范围

  • Linux:Linux。

  • Windows:Windows。

host_status

String

服务器状态,包含如下4种。

  • ACTIVE :运行中。

  • SHUTOFF :关机。

  • BUILDING :创建中。

  • ERROR :故障。

agent_status

String

Agent状态,包含如下5种。

  • installed :已安装。

  • not_installed :未安装。

  • online :在线。

  • offline :离线。

  • install_failed :安装失败。

  • installing :安装中。

protect_status

String

防护状态,包含如下2种。

  • closed :未防护。

  • opened :防护中。

asset_value

String

资产重要性,包含如下3种

  • important :重要资产

  • common :一般资产

  • test :测试资产

os_name

String

操作系统名称

os_version

String

操作系统版本

表8 ResultDetailResponseInfo

参数

参数类型

描述

keyword

String

告警事件关键字,仅用于告警白名单

hash

String

告警事件hash,仅用于告警白名单

请求示例

响应示例

状态码:200

病毒查杀结果列表

{
  "total_num" : 3849,
  "data_list" : [ {
    "result_id" : "f989**25-b3a4-4d88-b05a-cc***cd1205",
    "malware_type" : "木马",
    "malware_name" : "Linux.Trojan.Ircbot",
    "severity" : "High",
    "task_id" : "cc****7a-bf3c-4b6a-9f77-32857****5504",
    "task_name" : "自定义查杀-20250121211946",
    "file_info" : {
      "file_path" : "/root/Malware_Samples/IRC-Robot/a87b13391818*****5466b66363ea4d*******f2d3e30448d6930ab722b5",
      "file_hash" : "a87****80203c5466b66363ea4d5****5400f2d3e30448d6930ab722b5",
      "file_size" : 5028448,
      "file_owner" : "root",
      "file_attr" : "-rw-r--r--",
      "file_ctime" : 1737030295,
      "file_mtime" : 1700805582
    },
    "resource_info" : {
      "host_name" : "h00657476-linux-不要动不要删",
      "host_id" : "b4****be-4c28-4bf3-8070-fde***c6689",
      "agent_id" : "50a1154572*****f934415cdd6817af90a905c5****951a2265003df8e9",
      "private_ip" : "192.168.0.**",
      "public_ip" : "100.93.10.***",
      "os_type" : "Linux",
      "host_status" : "ACTIVE",
      "agent_status" : "online",
      "protect_status" : "opened",
      "asset_value" : "common",
      "os_name" : "HCE OS",
      "os_version" : "2.0"
    },
    "event_type" : 1004,
    "occur_time" : 1737465650731,
    "handle_status" : "unhandled",
    "operate_accept_list" : [ "mark_as_handled", "ignore", "add_to_alarm_whitelist", "manual_isolate_and_kill" ],
    "operate_detail_list" : [ {
      "keyword" : "a87b1339181880203c5******95400f2d3e30448d6930ab722b5",
      "hash" : "a87b1339181880203c5466b66363ea4d54*****d3e30448d6930ab722b5"
    } ]
  } ]
}

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
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 ListAntiVirusResultSolution {

    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();
        ListAntiVirusResultRequest request = new ListAntiVirusResultRequest();
        try {
            ListAntiVirusResultResponse response = client.listAntiVirusResult(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
# 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 = ListAntiVirusResultRequest()
        response = client.list_anti_virus_result(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
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.ListAntiVirusResultRequest{}
	response, err := client.ListAntiVirusResult(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

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

状态码

状态码

描述

200

病毒查杀结果列表

错误码

请参见错误码