华为云用户手册

  • Python 查询告警列表,偏移量为10,查询3条 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 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdksecmaster.v2.region.secmaster_region import SecMasterRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdksecmaster.v2 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.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = SecMasterClient.new_builder() \ .with_credentials(credentials) \ .with_region(SecMasterRegion.value_of("cn-north-4")) \ .build() try: request = ListAlertsRequest() request.body = DataobjectSearch( offset=10, limit=3 ) response = client.list_alerts(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 查询告警列表,偏移量为10,查询3条 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 package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2/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") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := secmaster.NewSecMasterClient( secmaster.SecMasterClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.ListAlertsRequest{} offsetDataobjectSearch:= int32(10) limitDataobjectSearch:= int32(3) request.Body = &model.DataobjectSearch{ Offset: &offsetDataobjectSearch, Limit: &limitDataobjectSearch, } response, err := client.ListAlerts(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • 响应示例 状态码: 200 搜索告警列表返回body体 { "code" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "message" : "Error message", "total" : 41, "limit" : 2, "offset" : 1, "success" : true, "data" : [ { "data_object" : { "version" : "1.0", "environment" : { "vendor_type" : "MyXXX", "domain_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "region_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" }, "datasource" : { "source_type" : 3, "domain_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "region_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" }, "first_observed_time" : "2021-01-30T23:00:00Z+0800", "last_observed_time" : "2021-01-30T23:00:00Z+0800", "create_time" : "2021-01-30T23:00:00Z+0800", "arrive_time" : "2021-01-30T23:00:00Z+0800", "title" : "MyXXX", "description" : "This my XXXX", "source_url" : "http://xxx", "count" : 4, "confidence" : 4, "criticality" : 4, "alert_type" : { }, "network_list" : [ { "direction" : { "IN" : null }, "protocol" : "TCP", "src_ip" : "192.168.0.1", "src_port" : "1", "src_domain" : "xxx", "dest_ip" : "192.168.0.1", "dest_port" : "1", "dest_domain" : "xxx", "src_geo" : { "latitude" : 90, "longitude" : 180 }, "dest_geo" : { "latitude" : 90, "longitude" : 180 } } ], "resource_list" : [ { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "name" : "MyXXX", "type" : "MyXXX", "domain_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "region_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "ep_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "ep_name" : "MyXXX", "tags" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" } ], "remediation" : { "recommendation" : "MyXXX", "url" : "MyXXX" }, "verification_state" : "Unknown – 未知,True_Positive – 确认,False_Positive – 误报。默认填写Unknown", "handle_status" : "Open – 打开,Block – 阻塞,Closed – 关闭。默认填写Open", "sla" : 60000, "update_time" : "2021-01-30T23:00:00Z+0800", "close_time" : "2021-01-30T23:00:00Z+0800", "ipdrr_phase" : "Prepartion|Detection and Analysis|Containm,Eradication& Recovery| Post-Incident-Activity", "simulation" : "false", "actor" : "刘一博", "owner" : "MyXXX", "close_comment" : "误检;已解决;重复;其他", "malware" : { "malware_family" : "family", "malware_class" : "恶意占用内存" }, "system_info" : { }, "process" : [ { "process_name" : "MyXXX", "process_path" : "MyXXX", "process_pid" : 123, "process_uid" : 123, "process_cmdline" : "MyXXX" } ], "user_info" : [ { "user_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "user_name" : "MyXXX" } ], "file_info" : [ { "file_path" : "MyXXX", "file_content" : "MyXXX", "file_new_path" : "MyXXX", "file_hash" : "MyXXX", "file_md5" : "MyXXX", "file_sha256" : "MyXXX", "file_attr" : "MyXXX" } ], "system_alert_table" : { }, "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "workspace_id" : "909494e3-558e-46b6-a9eb-07a8e18ca620" }, "create_time" : "2021-01-30T23:00:00Z+0800", "update_time" : "2021-01-30T23:00:00Z+0800", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "workspace_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "id" : "MyXXX", "version" : 123, "format_version" : 123, "dataclass_ref" : { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "name" : "MyXXX" } } ] }
  • Java 查询告警列表,偏移量为10,查询3条 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.secmaster.v2.region.SecMasterRegion; import com.huaweicloud.sdk.secmaster.v2.*; import com.huaweicloud.sdk.secmaster.v2.model.*; public class ListAlertsSolution { 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"); ICredential auth = new BasicCredentials() .withAk(ak) .withSk(sk); SecMasterClient client = SecMasterClient.newBuilder() .withCredential(auth) .withRegion(SecMasterRegion.valueOf("cn-north-4")) .build(); ListAlertsRequest request = new ListAlertsRequest(); DataobjectSearch body = new DataobjectSearch(); body.withOffset(10); body.withLimit(3); request.withBody(body); try { ListAlertsResponse response = client.listAlerts(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()); } } }
  • 响应参数 状态码: 200 表8 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表9 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:0 最大长度:64 message String 错误信息 最小长度:0 最大长度:1024 total Integer 告警总数 最小值:0 最大值:10000 limit Integer 分页大小 最小值:0 最大值:10000 offset Integer 偏移量 最小值:0 最大值:10000 success Boolean 是否成功 data Array of ListAlertDetail objects 告警列表 数组长度:0 - 10000 表10 ListAlertDetail 参数 参数类型 描述 data_object ListAlertRsp object 告警详情 create_time String Create time 最小长度:0 最大长度:64 update_time String Update time 最小长度:0 最大长度:64 project_id String Id value 最小长度:32 最大长度:64 workspace_id String Id value 最小长度:32 最大长度:64 id String The name, display only 最小长度:0 最大长度:1024 type String The name, display only 最小长度:0 最大长度:1024 version Integer The name, display only 最小值:0 最大值:1024 format_version Integer The name, display only 最小值:0 最大值:1024 dataclass_ref dataclass_ref object dataclass对象 表11 ListAlertRsp 参数 参数类型 描述 version String 版本 最小长度:1 最大长度:64 environment environment object 环境信息 datasource datasource object 数据源信息 first_observed_time String Update time 最小长度:0 最大长度:64 last_observed_time String Update time 最小长度:0 最大长度:64 create_time String Create time 最小长度:0 最大长度:64 arrive_time String Update time 最小长度:0 最大长度:64 title String The name, display only 最小长度:0 最大长度:1024 description String The description, display only 最小长度:0 最大长度:1024 source_url String 事件URL链接 最小长度:1 最大长度:64 count Integer 事件发生次数 最小值:0 最大值:5 confidence Integer 置信度 最小值:0 最大值:5 serverity String 严重性等级 最小长度:1 最大长度:64 criticality Integer 关键性,是指事件涉及的资源的重要性级别。 最小值:0 最大值:5 alert_type Object 事件分类 network_list Array of network_list objects network_list 数组长度:0 - 100 resource_list Array of resource_list objects network_list 数组长度:0 - 100 remediation remediation object 补救措施 verification_state String 验证状态 最小长度:1 最大长度:64 handle_status String 事件处理状态 最小长度:1 最大长度:64 sla String sla 最小长度:0 最大长度:65535 update_time String Create time 最小长度:0 最大长度:64 close_time String Create time 最小长度:0 最大长度:64 chop_phase String 周期/处置阶段编号 最小长度:4 最大长度:64 ipdrr_phase String 周期/处置阶段编号 最小长度:4 最大长度:64 ppdr_phase String 周期/处置阶段编号 最小长度:4 最大长度:64 simulation String 是否为调试事件. 最小长度:0 最大长度:64 actor String 委托人 最小长度:0 最大长度:64 owner String The name, display only 最小长度:0 最大长度:1024 cteator String The name, display only 最小长度:0 最大长度:1024 close_reason String 关闭原因 最小长度:32 最大长度:64 close_comment String 关闭原因 最小长度:0 最大长度:64 malware malware object 恶意软件 system_info Object 系统信息 process Array of process objects 进程信息 数组长度:0 - 100 user_info Array of user_info objects 用户信息 数组长度:0 - 100 file_info Array of file_info objects 文件信息 数组长度:0 - 100 system_alert_table Object 系统信息 id String Id value 最小长度:32 最大长度:64 workspace_id String workspace id 最小长度:32 最大长度:64 表12 environment 参数 参数类型 描述 vendor_type String The name, display only 最小长度:0 最大长度:1024 domain_id String Id value 最小长度:32 最大长度:64 region_id String Id value 最小长度:1 最大长度:64 project_id String Id value 最小长度:32 最大长度:64 表13 datasource 参数 参数类型 描述 source_type Integer current page count 最小值:0 最大值:9999 domain_id String Id value 最小长度:32 最大长度:64 project_id String Id value 最小长度:32 最大长度:64 region_id String Id value 最小长度:1 最大长度:64 表14 network_list 参数 参数类型 描述 direction Object 方向,取值范围:IN | OUT protocol String 协议,参考:IANA registered name 最小长度:1 最大长度:64 src_ip String 源IP地址 最小长度:0 最大长度:64 src_port Integer 源端口,0–65535 最小值:0 最大值:65535 src_domain String 源域名,最大128个字符 最小长度:0 最大长度:128 dest_ip String 目的IP地址 最小长度:0 最大长度:64 dest_port String 目的端口,0–65535 最小长度:0 最大长度:64 dest_domain String 目的域名,最大128个字符 最小长度:0 最大长度:128 src_geo Object 源IP的地理位置信息 dest_geo Object 目的IP的地理位置信息 表15 resource_list 参数 参数类型 描述 id String Id value 最小长度:32 最大长度:64 name String The name, display only 最小长度:0 最大长度:1024 type String The name, display only 最小长度:0 最大长度:1024 domain_id String Id value 最小长度:32 最大长度:64 project_id String Id value 最小长度:32 最大长度:64 region_id String Id value 最小长度:0 最大长度:64 ep_id String Id value 最小长度:0 最大长度:64 ep_name String The name, display only 最小长度:0 最大长度:1024 tags String Id value 最小长度:0 最大长度:64 表16 remediation 参数 参数类型 描述 recommendation String The name, display only 最小长度:0 最大长度:1024 url String The name, display only 最小长度:0 最大长度:1024 表17 malware 参数 参数类型 描述 malware_family String 恶意家族 最小长度:0 最大长度:64 malware_class String 恶意软件分类 最小长度:0 最大长度:64 表18 process 参数 参数类型 描述 process_name String The name, display only 最小长度:0 最大长度:1024 process_path String The name, display only 最小长度:0 最大长度:1024 process_pid Integer Id value 最小值:1 最大值:2147483647 process_uid Integer Id value 最小值:1 最大值:2147483647 process_cmdline String The name, display only 最小长度:0 最大长度:1024 表19 user_info 参数 参数类型 描述 user_id String Id value 最小长度:0 最大长度:64 user_name String The name, display only 最小长度:0 最大长度:1024 表20 file_info 参数 参数类型 描述 file_path String The name, display only 最小长度:0 最大长度:1024 file_content String The name, display only 最小长度:0 最大长度:1024 file_new_path String The name, display only 最小长度:0 最大长度:1024 file_hash String The name, display only 最小长度:0 最大长度:1024 file_md5 String The name, display only 最小长度:0 最大长度:1024 file_sha256 String The name, display only 最小长度:0 最大长度:1024 file_attr String The name, display only 最小长度:0 最大长度:1024 表21 dataclass_ref 参数 参数类型 描述 id String Id value 最小长度:32 最大长度:64 name String The name, display only 最小长度:0 最大长度:1024 状态码: 400 表22 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表23 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:0 最大长度:64 message String 错误描述 最小长度:0 最大长度:1024
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值) 最小长度:0 最大长度:2097152 content-type 是 String 内容类型 缺省值:application/json;charset=UTF-8 最小长度:0 最大长度:64 表3 请求Body参数 参数 是否必选 参数类型 描述 limit 否 Integer 分页大小 最小值:0 最大值:1000 offset 否 Integer 偏移量 最小值:0 最大值:1000 sort_by 否 String 排序字段:create_time | update_time 最小长度:0 最大长度:1000 order 否 String 排序方式:DESC | ASC 最小长度:0 最大长度:1000 枚举值: DESC ASC from_date 否 String 搜索开始时间 最小长度:0 最大长度:64 to_date 否 String 搜索结束时间 最小长度:0 最大长度:64 condition 否 condition object 搜索条件表达式 表4 condition 参数 是否必选 参数类型 描述 conditions 否 Array of conditions objects 表达式列表 数组长度:0 - 999 logics 否 Array of logics objects 表达式逻辑 数组长度:0 - 999 表5 conditions 参数 是否必选 参数类型 描述 name 否 String 表达式名称 最小长度:0 最大长度:64 data 否 Array of data objects 表达式内容 数组长度:0 - 999 表6 data 参数 是否必选 参数类型 描述 filed 否 String 字段 最小长度:0 最大长度:64 expression 否 String 逻辑表达式 最小长度:0 最大长度:64 value 否 String 字段值 最小长度:0 最大长度:64 表7 logics 参数 是否必选 参数类型 描述 name 否 String 表达式名称 最小长度:0 最大长度:64
  • Go 将一条告警转为事件,告警ID为909494e3-558e-46b6-a9eb-07a8e18ca62f,事件ID为909494e3-558e-46b6-a9eb-07a8e18ca621,告警状态为已关闭,是否标记为证据为否。 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 50 51 52 53 54 55 package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2/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") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := secmaster.NewSecMasterClient( secmaster.SecMasterClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.CreateBatchOrderAlertsRequest{} idIncidentType:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" categoryIncidentType:= "DDoS攻击" incidentTypeIncidentType:= "DNS协议攻击" incidentTypeIncidentContent := &model.OrderAlertIncidentContentIncidentType{ Id: &idIncidentType, Category: &categoryIncidentType, IncidentType: &incidentTypeIncidentType, } titleIncidentContent:= "XXX" incidentContentbody := &model.OrderAlertIncidentContent{ Title: &titleIncidentContent, IncidentType: incidentTypeIncidentContent, } var listIdsbody = []string{ "909494e3-558e-46b6-a9eb-07a8e18ca62f", } request.Body = &model.OrderAlert{ IncidentContent: incidentContentbody, Ids: &listIdsbody, } response, err := client.CreateBatchOrderAlerts(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • 响应示例 状态码: 200 告警转事件返回body体 { "code" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "message" : "Error message", "data" : { "error_ids" : [ "909494e3-558e-46b6-a9eb-07a8e18ca62f" ], "success_ids" : [ "909494e3-558e-46b6-a9eb-07a8e18ca62f" ] } }
  • Python 将一条告警转为事件,告警ID为909494e3-558e-46b6-a9eb-07a8e18ca62f,事件ID为909494e3-558e-46b6-a9eb-07a8e18ca621,告警状态为已关闭,是否标记为证据为否。 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 # coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdksecmaster.v2.region.secmaster_region import SecMasterRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdksecmaster.v2 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.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = SecMasterClient.new_builder() \ .with_credentials(credentials) \ .with_region(SecMasterRegion.value_of("cn-north-4")) \ .build() try: request = CreateBatchOrderAlertsRequest() incidentTypeIncidentContent = OrderAlertIncidentContentIncidentType( id="909494e3-558e-46b6-a9eb-07a8e18ca62f", category="DDoS攻击", incident_type="DNS协议攻击" ) incidentContentbody = OrderAlertIncidentContent( title="XXX", incident_type=incidentTypeIncidentContent ) listIdsbody = [ "909494e3-558e-46b6-a9eb-07a8e18ca62f" ] request.body = OrderAlert( incident_content=incidentContentbody, ids=listIdsbody ) response = client.create_batch_order_alerts(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
  • 请求示例 将一条告警转为事件,告警ID为909494e3-558e-46b6-a9eb-07a8e18ca62f,事件ID为909494e3-558e-46b6-a9eb-07a8e18ca621,告警状态为已关闭,是否标记为证据为否。 { "ids" : [ "909494e3-558e-46b6-a9eb-07a8e18ca62f" ], "incident_content" : { "title" : "XXX", "incident_type" : { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "category" : "DDoS攻击", "incident_type" : "DNS协议攻击" } } }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值) 最小长度:0 最大长度:2097152 content-type 是 String 内容类型 缺省值:application/json;charset=UTF-8 最小长度:0 最大长度:64 表3 请求Body参数 参数 是否必选 参数类型 描述 ids 否 Array of strings 转事件的告警id列表 最小长度:0 最大长度:100 数组长度:0 - 999 incident_content 否 incident_content object 事件内容 表4 incident_content 参数 是否必选 参数类型 描述 title 否 String 事件名称 最小长度:0 最大长度:255 incident_type 否 incident_type object 事件类型 表5 incident_type 参数 是否必选 参数类型 描述 id 否 String 事件类型id 最小长度:0 最大长度:255 category 否 String 事件类型父类 最小长度:0 最大长度:255 incident_type 否 String 事件类型子类 最小长度:0 最大长度:255
  • 响应参数 状态码: 200 表6 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表7 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:0 最大长度:64 message String 错误信息 最小长度:0 最大长度:1024 data BatchOperateAlertResult object 批量操作告警返回对象 表8 BatchOperateAlertResult 参数 参数类型 描述 error_ids Array of strings 失败id 最小长度:0 最大长度:100 数组长度:0 - 100 success_ids Array of strings 成功id 最小长度:0 最大长度:100 数组长度:0 - 100 状态码: 400 表9 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表10 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:0 最大长度:64 message String 错误描述 最小长度:0 最大长度:1024
  • Python 更新一个剧本动作,剧本名称为MyXXX,描述为This my XXXX,剧本动作类型为aopworkflow,剧本动作ID为909494e3-558e-46b6-a9eb-07a8e18ca62f,排序顺序为string。 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 # coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdksecmaster.v2.region.secmaster_region import SecMasterRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdksecmaster.v2 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.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = SecMasterClient.new_builder() \ .with_credentials(credentials) \ .with_region(SecMasterRegion.value_of("cn-north-4")) \ .build() try: request = UpdatePlaybookActionRequest() request.body = ModifyActionInfo( sort_order="string", action_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", action_type="aopworkflow", description="This my XXXX", name="MyXXX" ) response = client.update_playbook_action(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 更新一个剧本动作,剧本名称为MyXXX,描述为This my XXXX,剧本动作类型为aopworkflow,剧本动作ID为909494e3-558e-46b6-a9eb-07a8e18ca62f,排序顺序为string。 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 main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2/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") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := secmaster.NewSecMasterClient( secmaster.SecMasterClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.UpdatePlaybookActionRequest{} sortOrderModifyActionInfo:= "string" actionIdModifyActionInfo:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" actionTypeModifyActionInfo:= "aopworkflow" descriptionModifyActionInfo:= "This my XXXX" nameModifyActionInfo:= "MyXXX" request.Body = &model.ModifyActionInfo{ SortOrder: &sortOrderModifyActionInfo, ActionId: &actionIdModifyActionInfo, ActionType: &actionTypeModifyActionInfo, Description: &descriptionModifyActionInfo, Name: &nameModifyActionInfo, } response, err := client.UpdatePlaybookAction(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 最小长度:1 最大长度:2097152 content-type 是 String application/json;charset=UTF-8 缺省值:application/json;charset=UTF-8 最小长度:1 最大长度:64 表3 请求Body参数 参数 是否必选 参数类型 描述 name 否 String 名称 最小长度:0 最大长度:1024 description 否 String 描述 最小长度:0 最大长度:1024 action_type 否 String 类型,默认AOP_WORKFLOW. 最小长度:0 最大长度:64 action_id 否 String 剧本动作ID 最小长度:32 最大长度:64 sort_order 否 String 排序方式 最小长度:0 最大长度:64
  • 响应参数 状态码: 200 表4 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表5 响应Body参数 参数 参数类型 描述 code String Error code 最小长度:1 最大长度:32 message String Error message 最小长度:1 最大长度:32 data ActionInfo object 剧本流程动作信息 表6 ActionInfo 参数 参数类型 描述 id String 剧本流程动作ID 最小长度:32 最大长度:64 name String 流程动作名称 最小长度:0 最大长度:1024 description String 描述 最小长度:0 最大长度:1024 action_type String 流程动作类型 最小长度:0 最大长度:64 action_id String 流程ID 最小长度:32 最大长度:64 playbook_id String 剧本ID 最小长度:0 最大长度:64 playbook_version_id String 剧本版本ID 最小长度:0 最大长度:64 project_id String 项目ID 最小长度:0 最大长度:64 状态码: 400 表7 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表8 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:0 最大长度:64 message String 错误描述 最小长度:0 最大长度:1024
  • 请求示例 更新一个剧本动作,剧本名称为MyXXX,描述为This my XXXX,剧本动作类型为aopworkflow,剧本动作ID为909494e3-558e-46b6-a9eb-07a8e18ca62f,排序顺序为string。 { "name" : "MyXXX", "description" : "This my XXXX", "action_type" : "aopworkflow", "action_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "sort_order" : "string" }
  • 响应示例 状态码: 200 请求成功响应参数 { "code" : 0, "message" : "Error message", "data" : { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "name" : "MyXXX", "description" : "This my XXXX", "action_type" : "Workflow", "action_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "playbook_id" : "string", "playbook_version_id" : "string", "project_id" : "string" } }
  • Java 更新一个剧本动作,剧本名称为MyXXX,描述为This my XXXX,剧本动作类型为aopworkflow,剧本动作ID为909494e3-558e-46b6-a9eb-07a8e18ca62f,排序顺序为string。 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 50 51 52 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.secmaster.v2.region.SecMasterRegion; import com.huaweicloud.sdk.secmaster.v2.*; import com.huaweicloud.sdk.secmaster.v2.model.*; public class UpdatePlaybookActionSolution { 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"); ICredential auth = new BasicCredentials() .withAk(ak) .withSk(sk); SecMasterClient client = SecMasterClient.newBuilder() .withCredential(auth) .withRegion(SecMasterRegion.valueOf("cn-north-4")) .build(); UpdatePlaybookActionRequest request = new UpdatePlaybookActionRequest(); ModifyActionInfo body = new ModifyActionInfo(); body.withSortOrder("string"); body.withActionId("909494e3-558e-46b6-a9eb-07a8e18ca62f"); body.withActionType("aopworkflow"); body.withDescription("This my XXXX"); body.withName("MyXXX"); request.withBody(body); try { UpdatePlaybookActionResponse response = client.updatePlaybookAction(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()); } } }
  • URI PUT /v1/{project_id}/workspaces/{workspace_id}/soc/playbooks/versions/{version_id}/actions/{action_id} 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID 最小长度:32 最大长度:36 workspace_id 是 String 工作空间ID 最小长度:32 最大长度:36 version_id 是 String 剧本版本ID 最小长度:32 最大长度:64 action_id 是 String 剧本动作ID 最小长度:32 最大长度:64
  • Go 更新一条告警,告警名称为MyXXX,URL为http://xxx,发生次数为4次,置信度为4,严重等级为tips。 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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2/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") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := secmaster.NewSecMasterClient( secmaster.SecMasterClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.ChangeAlertRequest{} filePathFileInfo:= "MyXXX" fileContentFileInfo:= "MyXXX" fileNewPathFileInfo:= "MyXXX" fileHashFileInfo:= "MyXXX" fileMd5FileInfo:= "MyXXX" fileSha256FileInfo:= "MyXXX" fileAttrFileInfo:= "MyXXX" var listFileInfoDataObject = []model.AlertFileInfo{ { FilePath: &filePathFileInfo, FileContent: &fileContentFileInfo, FileNewPath: &fileNewPathFileInfo, FileHash: &fileHashFileInfo, FileMd5: &fileMd5FileInfo, FileSha256: &fileSha256FileInfo, FileAttr: &fileAttrFileInfo, }, } userIdUserInfo:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" userNameUserInfo:= "MyXXX" var listUserInfoDataObject = []model.AlertUserInfo{ { UserId: &userIdUserInfo, UserName: &userNameUserInfo, }, } processNameProcess:= "MyXXX" processPathProcess:= "MyXXX" processPidProcess:= int32(123) processUidProcess:= int32(123) processCmdlineProcess:= "MyXXX" var listProcessDataObject = []model.AlertProcess{ { ProcessName: &processNameProcess, ProcessPath: &processPathProcess, ProcessPid: &processPidProcess, ProcessUid: &processUidProcess, ProcessCmdline: &processCmdlineProcess, }, } malwareFamilyMalware:= "family" malwareClassMalware:= "恶意占用内存" malwareDataObject := &model.AlertMalware{ MalwareFamily: &malwareFamilyMalware, MalwareClass: &malwareClassMalware, } recommendationRemediation:= "MyXXX" urlRemediation:= "MyXXX" remediationDataObject := &model.AlertRemediation{ Recommendation: &recommendationRemediation, Url: &urlRemediation, } idResourceList:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" nameResourceList:= "MyXXX" typeResourceList:= "MyXXX" regionIdResourceList:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" domainIdResourceList:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" projectIdResourceList:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" epIdResourceList:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" epNameResourceList:= "MyXXX" tagsResourceList:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" var listResourceListDataObject = []model.AlertResourceList{ { Id: &idResourceList, Name: &nameResourceList, Type: &typeResourceList, RegionId: ®ionIdResourceList, DomainId: &domainIdResourceList, ProjectId: &projectIdResourceList, EpId: &epIdResourceList, EpName: &epNameResourceList, Tags: &tagsResourceList, }, } latitudeDestGeo:= float32(90) longitudeDestGeo:= float32(180) destGeoNetworkList := &model.AlertDestGeo{ Latitude: &latitudeDestGeo, Longitude: &longitudeDestGeo, } latitudeSrcGeo:= float32(90) longitudeSrcGeo:= float32(180) srcGeoNetworkList := &model.AlertSrcGeo{ Latitude: &latitudeSrcGeo, Longitude: &longitudeSrcGeo, } directionNetworkList:= model.GetAlertNetworkListDirectionEnum().{} protocolNetworkList:= "TCP" srcIpNetworkList:= "192.168.0.1" srcPortNetworkList:= int32(1) srcDomainNetworkList:= "xxx" destIpNetworkList:= "192.168.0.1" destPortNetworkList:= "1" destDomainNetworkList:= "xxx" var listNetworkListDataObject = []model.AlertNetworkList{ { Direction: &directionNetworkList, Protocol: &protocolNetworkList, SrcIp: &srcIpNetworkList, SrcPort: &srcPortNetworkList, SrcDomain: &srcDomainNetworkList, SrcGeo: srcGeoNetworkList, DestIp: &destIpNetworkList, DestPort: &destPortNetworkList, DestDomain: &destDomainNetworkList, DestGeo: destGeoNetworkList, }, } sourceTypeDataSource:= int32(3) domainIdDataSource:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" projectIdDataSource:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" regionIdDataSource:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" dataSourceDataObject := &model.AlertDataSource{ SourceType: &sourceTypeDataSource, DomainId: &domainIdDataSource, ProjectId: &projectIdDataSource, RegionId: ®ionIdDataSource, } vendorTypeEnvironment:= "MyXXX" domainIdEnvironment:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" regionIdEnvironment:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" projectIdEnvironment:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" environmentDataObject := &model.AlertEnvironment{ VendorType: &vendorTypeEnvironment, DomainId: &domainIdEnvironment, RegionId: ®ionIdEnvironment, ProjectId: &projectIdEnvironment, } versionDataObject:= "1.0" idDataObject:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" workspaceIdDataObject:= "909494e3-558e-46b6-a9eb-07a8e18ca620" firstObservedTimeDataObject:= "2021-01-30T23:00:00Z+0800" lastObservedTimeDataObject:= "2021-01-30T23:00:00Z+0800" createTimeDataObject:= "2021-01-30T23:00:00Z+0800" arriveTimeDataObject:= "2021-01-30T23:00:00Z+0800" titleDataObject:= "MyXXX" descriptionDataObject:= "This my XXXX" sourceUrlDataObject:= "http://xxx" countDataObject:= int32(4) confidenceDataObject:= int32(4) severityDataObject:= model.GetAlertSeverityEnum().TIPS criticalityDataObject:= int32(4) verificationStateDataObject:= model.GetAlertVerificationStateEnum().UNKNOWN_–_未知,TRUE_POSITIVE_–_确认,FALSE_POSITIVE_–_误报。默认填写UNKNOWN handleStatusDataObject:= model.GetAlertHandleStatusEnum().OPEN_–_打开,BLOCK_–_阻塞,CLOSED_–_关闭。默认填写OPEN slaDataObject:= int32(60000) updateTimeDataObject:= "2021-01-30T23:00:00Z+0800" closeTimeDataObject:= "2021-01-30T23:00:00Z+0800" ipdrrPhaseDataObject:= model.GetAlertIpdrrPhaseEnum().PREPARTION|DETECTION_AND_ANALYSIS|CONTAINM,ERADICATION&_RECOVERY|_POST_INCIDENT_ACTIVITY simulationDataObject:= "false" actorDataObject:= "刘一博" ownerDataObject:= "MyXXX" creatorDataObject:= "MyXXX" closeReasonDataObject:= model.GetAlertCloseReasonEnum().误检;已解决;重复;其他 closeCommentDataObject:= "误检;已解决;重复;其他" var systemInfoDataObject interface{} = make(map[string]string) var systemAlertTableDataObject interface{} = make(map[string]string) dataObjectbody := &model.Alert{ Version: &versionDataObject, Id: &idDataObject, WorkspaceId: &workspaceIdDataObject, Environment: environmentDataObject, DataSource: dataSourceDataObject, FirstObservedTime: &firstObservedTimeDataObject, LastObservedTime: &lastObservedTimeDataObject, CreateTime: &createTimeDataObject, ArriveTime: &arriveTimeDataObject, Title: &titleDataObject, Description: &descriptionDataObject, SourceUrl: &sourceUrlDataObject, Count: &countDataObject, Confidence: &confidenceDataObject, Severity: &severityDataObject, Criticality: &criticalityDataObject, NetworkList: &listNetworkListDataObject, ResourceList: &listResourceListDataObject, Remediation: remediationDataObject, VerificationState: &verificationStateDataObject, HandleStatus: &handleStatusDataObject, Sla: &slaDataObject, UpdateTime: &updateTimeDataObject, CloseTime: &closeTimeDataObject, IpdrrPhase: &ipdrrPhaseDataObject, Simulation: &simulationDataObject, Actor: &actorDataObject, Owner: &ownerDataObject, Creator: &creatorDataObject, CloseReason: &closeReasonDataObject, CloseComment: &closeCommentDataObject, Malware: malwareDataObject, SystemInfo: &systemInfoDataObject, Process: &listProcessDataObject, UserInfo: &listUserInfoDataObject, FileInfo: &listFileInfoDataObject, SystemAlertTable: &systemAlertTableDataObject, } request.Body = &model.ChangeAlertRequestBody{ DataObject: dataObjectbody, } response, err := client.ChangeAlert(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • 响应示例 状态码: 200 更新告警返回body体 { "code" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "message" : "Error message", "data" : { "data_object" : { "version" : "1.0", "environment" : { "vendor_type" : "MyXXX", "domain_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "region_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" }, "data_source" : { "source_type" : 3, "domain_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "region_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" }, "first_observed_time" : "2021-01-30T23:00:00Z+0800", "last_observed_time" : "2021-01-30T23:00:00Z+0800", "create_time" : "2021-01-30T23:00:00Z+0800", "arrive_time" : "2021-01-30T23:00:00Z+0800", "title" : "MyXXX", "description" : "This my XXXX", "source_url" : "http://xxx", "count" : 4, "confidence" : 4, "severity" : "TIPS", "criticality" : 4, "alert_type" : { }, "network_list" : [ { "direction" : { "IN" : null }, "protocol" : "TCP", "src_ip" : "192.168.0.1", "src_port" : "1", "src_domain" : "xxx", "dest_ip" : "192.168.0.1", "dest_port" : "1", "dest_domain" : "xxx", "src_geo" : { "latitude" : 90, "longitude" : 180 }, "dest_geo" : { "latitude" : 90, "longitude" : 180 } } ], "resource_list" : [ { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "name" : "MyXXX", "type" : "MyXXX", "domain_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "region_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "ep_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "ep_name" : "MyXXX", "tags" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" } ], "remediation" : { "recommendation" : "MyXXX", "url" : "MyXXX" }, "verification_state" : "Unknown – 未知,True_Positive – 确认,False_Positive – 误报。默认填写Unknown", "handle_status" : "Open – 打开,Block – 阻塞,Closed – 关闭。默认填写Open", "sla" : 60000, "update_time" : "2021-01-30T23:00:00Z+0800", "close_time" : "2021-01-30T23:00:00Z+0800", "ipdrr_phase" : "Prepartion|Detection and Analysis|Containm,Eradication& Recovery| Post-Incident-Activity", "simulation" : "false", "actor" : "刘一博", "owner" : "MyXXX", "creator" : "MyXXX", "close_reason" : "误检;已解决;重复;其他", "close_comment" : "误检;已解决;重复;其他", "malware" : { "malware_family" : "family", "malware_class" : "恶意占用内存" }, "system_info" : { }, "process" : [ { "process_name" : "MyXXX", "process_path" : "MyXXX", "process_pid" : 123, "process_uid" : 123, "process_cmdline" : "MyXXX" } ], "user_info" : [ { "user_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "user_name" : "MyXXX" } ], "file_info" : [ { "file_path" : "MyXXX", "file_content" : "MyXXX", "file_new_path" : "MyXXX", "file_hash" : "MyXXX", "file_md5" : "MyXXX", "file_sha256" : "MyXXX", "file_attr" : "MyXXX" } ], "system_alert_table" : { }, "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "workspace_id" : "909494e3-558e-46b6-a9eb-07a8e18ca620" }, "create_time" : "2021-01-30T23:00:00Z+0800", "update_time" : "2021-01-30T23:00:00Z+0800", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "workspace_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "id" : "MyXXX", "version" : 11, "format_version" : 11, "dataclass_ref" : { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "name" : "MyXXX" } } }
  • 请求示例 更新一条告警,告警名称为MyXXX,URL为http://xxx,发生次数为4次,置信度为4,严重等级为tips。 { "data_object" : { "version" : "1.0", "environment" : { "vendor_type" : "MyXXX", "domain_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "region_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" }, "data_source" : { "source_type" : 3, "domain_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "region_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" }, "first_observed_time" : "2021-01-30T23:00:00Z+0800", "last_observed_time" : "2021-01-30T23:00:00Z+0800", "create_time" : "2021-01-30T23:00:00Z+0800", "arrive_time" : "2021-01-30T23:00:00Z+0800", "title" : "MyXXX", "description" : "This my XXXX", "source_url" : "http://xxx", "count" : 4, "confidence" : 4, "severity" : "TIPS", "criticality" : 4, "alert_type" : { }, "network_list" : [ { "direction" : { "IN" : null }, "protocol" : "TCP", "src_ip" : "192.168.0.1", "src_port" : "1", "src_domain" : "xxx", "dest_ip" : "192.168.0.1", "dest_port" : "1", "dest_domain" : "xxx", "src_geo" : { "latitude" : 90, "longitude" : 180 }, "dest_geo" : { "latitude" : 90, "longitude" : 180 } } ], "resource_list" : [ { "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "name" : "MyXXX", "type" : "MyXXX", "domain_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "region_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "ep_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "ep_name" : "MyXXX", "tags" : "909494e3-558e-46b6-a9eb-07a8e18ca62f" } ], "remediation" : { "recommendation" : "MyXXX", "url" : "MyXXX" }, "verification_state" : "Unknown – 未知,True_Positive – 确认,False_Positive – 误报。默认填写Unknown", "handle_status" : "Open – 打开,Block – 阻塞,Closed – 关闭。默认填写Open", "sla" : 60000, "update_time" : "2021-01-30T23:00:00Z+0800", "close_time" : "2021-01-30T23:00:00Z+0800", "ipdrr_phase" : "Prepartion|Detection and Analysis|Containm,Eradication& Recovery| Post-Incident-Activity", "simulation" : "false", "actor" : "刘一博", "owner" : "MyXXX", "creator" : "MyXXX", "close_reason" : "误检;已解决;重复;其他", "close_comment" : "误检;已解决;重复;其他", "malware" : { "malware_family" : "family", "malware_class" : "恶意占用内存" }, "system_info" : { }, "process" : [ { "process_name" : "MyXXX", "process_path" : "MyXXX", "process_pid" : 123, "process_uid" : 123, "process_cmdline" : "MyXXX" } ], "user_info" : [ { "user_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "user_name" : "MyXXX" } ], "file_info" : [ { "file_path" : "MyXXX", "file_content" : "MyXXX", "file_new_path" : "MyXXX", "file_hash" : "MyXXX", "file_md5" : "MyXXX", "file_sha256" : "MyXXX", "file_attr" : "MyXXX" } ], "system_alert_table" : { }, "id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "workspace_id" : "909494e3-558e-46b6-a9eb-07a8e18ca620" } }
  • Python 更新一条告警,告警名称为MyXXX,URL为http://xxx,发生次数为4次,置信度为4,严重等级为tips。 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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 # coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdksecmaster.v2.region.secmaster_region import SecMasterRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdksecmaster.v2 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.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = SecMasterClient.new_builder() \ .with_credentials(credentials) \ .with_region(SecMasterRegion.value_of("cn-north-4")) \ .build() try: request = ChangeAlertRequest() listFileInfoDataObject = [ AlertFileInfo( file_path="MyXXX", file_content="MyXXX", file_new_path="MyXXX", file_hash="MyXXX", file_md5="MyXXX", file_sha256="MyXXX", file_attr="MyXXX" ) ] listUserInfoDataObject = [ AlertUserInfo( user_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", user_name="MyXXX" ) ] listProcessDataObject = [ AlertProcess( process_name="MyXXX", process_path="MyXXX", process_pid=123, process_uid=123, process_cmdline="MyXXX" ) ] malwareDataObject = AlertMalware( malware_family="family", malware_class="恶意占用内存" ) remediationDataObject = AlertRemediation( recommendation="MyXXX", url="MyXXX" ) listResourceListDataObject = [ AlertResourceList( id="909494e3-558e-46b6-a9eb-07a8e18ca62f", name="MyXXX", type="MyXXX", region_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", domain_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", project_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", ep_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", ep_name="MyXXX", tags="909494e3-558e-46b6-a9eb-07a8e18ca62f" ) ] destGeoNetworkList = AlertDestGeo( latitude=90, longitude=180 ) srcGeoNetworkList = AlertSrcGeo( latitude=90, longitude=180 ) listNetworkListDataObject = [ AlertNetworkList( direction="{}", protocol="TCP", src_ip="192.168.0.1", src_port=1, src_domain="xxx", src_geo=srcGeoNetworkList, dest_ip="192.168.0.1", dest_port="1", dest_domain="xxx", dest_geo=destGeoNetworkList ) ] dataSourceDataObject = AlertDataSource( source_type=3, domain_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", project_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", region_id="909494e3-558e-46b6-a9eb-07a8e18ca62f" ) environmentDataObject = AlertEnvironment( vendor_type="MyXXX", domain_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", region_id="909494e3-558e-46b6-a9eb-07a8e18ca62f", project_id="909494e3-558e-46b6-a9eb-07a8e18ca62f" ) dataObjectbody = Alert( version="1.0", id="909494e3-558e-46b6-a9eb-07a8e18ca62f", workspace_id="909494e3-558e-46b6-a9eb-07a8e18ca620", environment=environmentDataObject, data_source=dataSourceDataObject, first_observed_time="2021-01-30T23:00:00Z+0800", last_observed_time="2021-01-30T23:00:00Z+0800", create_time="2021-01-30T23:00:00Z+0800", arrive_time="2021-01-30T23:00:00Z+0800", title="MyXXX", description="This my XXXX", source_url="http://xxx", count=4, confidence=4, severity="TIPS", criticality=4, network_list=listNetworkListDataObject, resource_list=listResourceListDataObject, remediation=remediationDataObject, verification_state="Unknown – 未知,True_Positive – 确认,False_Positive – 误报。默认填写Unknown", handle_status="Open – 打开,Block – 阻塞,Closed – 关闭。默认填写Open", sla=60000, update_time="2021-01-30T23:00:00Z+0800", close_time="2021-01-30T23:00:00Z+0800", ipdrr_phase="Prepartion|Detection and Analysis|Containm,Eradication& Recovery| Post-Incident-Activity", simulation="false", actor="刘一博", owner="MyXXX", creator="MyXXX", close_reason="误检;已解决;重复;其他", close_comment="误检;已解决;重复;其他", malware=malwareDataObject, system_info={}, process=listProcessDataObject, user_info=listUserInfoDataObject, file_info=listFileInfoDataObject, system_alert_table={} ) request.body = ChangeAlertRequestBody( data_object=dataObjectbody ) response = client.change_alert(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
  • 响应参数 状态码: 200 表17 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表18 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:0 最大长度:64 message String 错误信息 最小长度:0 最大长度:1024 data AlertDetail object 表19 AlertDetail 参数 参数类型 描述 create_time String 记录时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 data_object Alert object 告警实体信息 dataclass_ref dataclass_ref object 数据类对象 format_version Integer 格式版本 最小值:0 最大值:999 id String 事件唯一标识,UUID格式,最大36个字符 最小长度:0 最大长度:36 project_id String 当前项目的id 最小长度:0 最大长度:64 update_time String 更新时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 version Integer 版本 最小值:0 最大值:999 workspace_id String 当前的工作空间id 最小长度:0 最大长度:36 表20 Alert 参数 参数类型 描述 version String 告警对象的版本,该字段的值必须为华为云SSA服务确定的官方发布版本之一 最小长度:0 最大长度:64 id String 事件唯一标识,UUID格式,最大36个字符 最小长度:0 最大长度:36 domain_id String 数据投递后,被委托用户的domain_id 最小长度:0 最大长度:36 region_id String 数据投递后,被委托用户的region_id 最小长度:0 最大长度:36 workspace_id String 当前的工作空间id 最小长度:0 最大长度:36 labels String 标签,仅展示 最小长度:0 最大长度:1024 environment environment object 告警产生的环境坐标信息 data_source data_source object 首次上报数据源 first_observed_time String 首次发现时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 last_observed_time String 最近发现时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 create_time String 记录时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 arrive_time String 接收时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 title String 告警标题 最小长度:0 最大长度:255 description String 告警描述信息 最小长度:0 最大长度:1024 source_url String 告警URL链接,指向数据源产品中有关当前事件说明的页面 最小长度:0 最大长度:1024 count Integer 事件发生次数 最小值:0 最大值:999 confidence Integer 事件的置信度。置信度的定义旨在说明识别的行为或问题的可能性。 取值范围:0-100,0表示置信度为0%,100表示置信度为100% 最小值:0 最大值:100 severity String 严重性等级,取值范围:Tips | Low | Medium | High | Fatal 说明: 0: Tips – 未发现任何问题。 1: Low – 无需针对问题执行任何操作。 2: Medium – 问题需要处理,但不紧急。 3: High – 问题必须优先处理。 4: Fatal – 问题必须立即处理,以防止产生进一步的损害 最小长度:3 最大长度:6 枚举值: Tips Low Medium High Fatal criticality Integer 关键性,是指事件涉及的资源的重要性级别。 取值范围:0-100,0表示资源不关键,100表示最关键资源 最小值:0 最大值:100 alert_type alert_type object 告警分类,详细定义参考《告警类型定义》 network_list Array of network_list objects 网络信息 数组长度:0 - 999 resource_list Array of resource_list objects 受影响资源 数组长度:0 - 999 remediation remediation object 补救措施 verification_state String 验证状态,标识事件的准确性。可选类型如下: Unknown – 未知 True_Positive – 确认 False_Positive – 误报 默认填写Unknown 最小长度:32 最大长度:64 枚举值: Unknown True_Positive False_Positive handle_status String 事件处理状态,可选类型如下: Open – 打开,默认 Block – 阻塞 Closed – 关闭 默认填写Open 最小长度:4 最大长度:5 枚举值: Open Block Closed sla Integer 约束闭环时间:设置风险接受持续时间。单位:小时 最小值:0 最大值:999 update_time String 更新时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 close_time String 关闭时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 ipdrr_phase String 周期/处置阶段编号 Prepartion|Detection and Analysis|Containm,Eradication& Recovery|Post-Incident-Activity 最小长度:0 最大长度:64 枚举值: Prepartion Detection and Analysis Containm,Eradication& Recovery Post-Incident-Activity simulation String 调试字段 最小长度:0 最大长度:64 actor String 告警调查员 最小长度:0 最大长度:64 owner String 责任人、服务责任人 最小长度:0 最大长度:64 creator String 创建人 最小长度:0 最大长度:64 close_reason String 关闭原因: 误检 - False detection 已解决 - Resolved 重复 - Repeated 其他 - Other 最小长度:0 最大长度:64 枚举值: False detection Resolved Repeated Other close_comment String 关闭评论 最小长度:0 最大长度:1024 malware malware object 恶意软件 system_info Object 系统信息 process Array of process objects 进程信息 数组长度:0 - 999 user_info Array of user_info objects 用户信息 数组长度:0 - 999 file_info Array of file_info objects 文件信息 数组长度:0 - 999 system_alert_table Object 告警管理列表的布局字段 表21 environment 参数 参数类型 描述 vendor_type String 环境供应商:HWCP/HWC/AWS/Azure/GCP 最小长度:0 最大长度:64 domain_id String 租户id 最小长度:0 最大长度:64 region_id String 区域od,全局服务global 最小长度:0 最大长度:64 cross_workspace_id String 数据投递前的源工作空间id,在源空间下值为null,投递后为被委托用户的id 最小长度:0 最大长度:64 project_id String 项目id, 全局服务默认null 最小长度:0 最大长度:64 表22 data_source 参数 参数类型 描述 source_type Integer 数据源类型,取值范围如下: 1 - 华为产品 2 - 第三方产品 3 - 租户私有产品 最小值:1 最大值:3 枚举值: 1 2 3 domain_id String 数据源产品所属账号的id 最小长度:0 最大长度:36 project_id String 数据源产品所属项目的id 最小长度:0 最大长度:64 region_id String 数据源产品所在区域,具体取值范围查看华为云地区和终端节点定义,例如cn-north-1 最小长度:0 最大长度:64 company_name String 数据源产品所属公司的名称 最小长度:0 最大长度:16 product_name String 数据源产品的名称 最小长度:0 最大长度:24 product_feature String 产品功能特性名称,用来指明检测到当前事件的产品的功能特性 最小长度:0 最大长度:24 product_module String 检测模块列表 最小长度:0 最大长度:1024 表23 alert_type 参数 参数类型 描述 category String 类别 最小长度:0 最大长度:1024 alert_type String 告警类型 最小长度:0 最大长度:1024 表24 network_list 参数 参数类型 描述 direction String 方向,取值范围:IN | OUT 最小长度:0 最大长度:3 枚举值: IN OUT protocol String 协议,包含7层和4层的协议 参考:IANA registered name https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml 最小长度:0 最大长度:64 src_ip String 源IP地址 最小长度:0 最大长度:64 src_port Integer 源端口,0–65535 最小值:0 最大值:65535 src_domain String 源域名 最小长度:0 最大长度:128 src_geo src_geo object 源IP的地理位置信息 dest_ip String 目的IP地址 最小长度:32 最大长度:64 dest_port String 目的端口,0–65535 最小长度:0 最大长度:65535 dest_domain String 目的域名 最小长度:0 最大长度:128 dest_geo dest_geo object 目标IP的地理位置信息 表25 src_geo 参数 参数类型 描述 latitude Number 纬度 最小值:0 最大值:90 longitude Number 经度 最小值:0 最大值:180 city_code String 城市编码,Beijing | Shanghai 最小长度:0 最大长度:64 country_code String 国家简码,参考ISO 3166-1 alpha-2,例如:CN | US | DE | IT | SG 最小长度:0 最大长度:64 表26 dest_geo 参数 参数类型 描述 latitude Number 纬度 最小值:0 最大值:90 longitude Number 经度 最小值:0 最大值:180 city_code String 城市编码,Beijing | Shanghai 最小长度:0 最大长度:64 country_code String 国家简码,参考ISO 3166-1 alpha-2,例如:CN | US | DE | IT | SG 最小长度:0 最大长度:64 表27 resource_list 参数 参数类型 描述 id String 云服务资源id 最小长度:0 最大长度:36 name String 资源名称 最小长度:0 最大长度:255 type String 资源类型;引用华为云RMS type字段 最小长度:0 最大长度:64 provider String 云服务名称;引用华为云RMS provider字段 最小长度:0 最大长度:64 region_id String 区域;按照华为云regionId填写,如cn-north-1等 最小长度:0 最大长度:36 domain_id String 资源所属账号ID,UUID格式 最小长度:0 最大长度:36 project_id String 资源所属项目ID,UUID格式 最小长度:0 最大长度:36 ep_id String 企业项目id 最小长度:0 最大长度:128 ep_name String 企业项目名称 最小长度:0 最大长度:128 tags String 资源标签 1、最多50个key/values对 2、values:最大255字符,取值范围:字母数字,空格,+, -, =, ., _, :, /,@ 最小长度:0 最大长度:2048 表28 remediation 参数 参数类型 描述 recommendation String 推荐处理方法 最小长度:0 最大长度:128 url String 链接,指向该事件的一般修复信息。该URL必须可以从公网访问,不需要提供凭证 最小长度:0 最大长度:2048 表29 malware 参数 参数类型 描述 malware_family String 恶意家族 最小长度:0 最大长度:64 malware_class String 恶意软件分类 最小长度:0 最大长度:64 表30 process 参数 参数类型 描述 process_name String 进程名 最小长度:0 最大长度:64 process_path String 进程执行文件路径 最小长度:0 最大长度:512 process_pid Integer 进程id 最小值:0 最大值:65535 process_uid Integer 进程用户id 最小值:0 最大值:655350 process_cmdline String 进程命令行 最小长度:0 最大长度:128 process_parent_name String 父进程名称 最小长度:0 最大长度:64 process_parent_path String 父进程执行文件路径 最小长度:0 最大长度:512 process_parent_pid Integer 父进程id 最小值:0 最大值:65535 process_parent_uid Integer 父进程用户id 最小值:0 最大值:655350 process_parent_cmdline String 父进程命令行 最小长度:0 最大长度:128 process_child_name String 子进程名称 最小长度:0 最大长度:64 process_child_path String 子进程执行文件路径 最小长度:0 最大长度:512 process_child_pid Integer 子进程id 最小值:0 最大值:65535 process_child_uid Integer 子进程用户id 最小值:0 最大值:655350 process_child_cmdline String 子进程命令行 最小长度:0 最大长度:128 process_launche_time String 进程启动时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 process_terminate_time String 进程结束时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 表31 user_info 参数 参数类型 描述 user_id String 用户uid 最小长度:0 最大长度:36 user_name String 用户名称 最小长度:32 最大长度:64 表32 file_info 参数 参数类型 描述 file_path String 文件路径/名称 最小长度:0 最大长度:128 file_content String 文件内容 最小长度:0 最大长度:1024 file_new_path String 文件新路径/名称 最小长度:32 最大长度:64 file_hash String 文件hash 最小长度:0 最大长度:128 file_md5 String 文件md5 最小长度:0 最大长度:128 file_sha256 String 文件sha256 最小长度:0 最大长度:128 file_attr String 文件属性 最小长度:0 最大长度:1024 表33 dataclass_ref 参数 参数类型 描述 id String 数据类唯一标识,UUID格式,最大36个字符 最小长度:0 最大长度:36 name String 数据类名称 最小长度:0 最大长度:36 状态码: 400 表34 响应Header参数 参数 参数类型 描述 X-request-id String 请求ID,格式为:request_uuid-timestamp-hostname 表35 响应Body参数 参数 参数类型 描述 code String 错误码 最小长度:0 最大长度:64 message String 错误描述 最小长度:0 最大长度:1024
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值) 最小长度:0 最大长度:2097152 content-type 是 String 内容类型 缺省值:application/json;charset=UTF-8 最小长度:0 最大长度:64 表3 请求Body参数 参数 是否必选 参数类型 描述 batch_ids 否 Array of strings 更新告警的ID列表 最小长度:0 最大长度:100 数组长度:0 - 999 data_object 否 Alert object 告警实体信息 表4 Alert 参数 是否必选 参数类型 描述 version 否 String 告警对象的版本,该字段的值必须为华为云SSA服务确定的官方发布版本之一 最小长度:0 最大长度:64 id 否 String 事件唯一标识,UUID格式,最大36个字符 最小长度:0 最大长度:36 domain_id 否 String 数据投递后,被委托用户的domain_id 最小长度:0 最大长度:36 region_id 否 String 数据投递后,被委托用户的region_id 最小长度:0 最大长度:36 workspace_id 否 String 当前的工作空间id 最小长度:0 最大长度:36 labels 否 String 标签,仅展示 最小长度:0 最大长度:1024 environment 否 environment object 告警产生的环境坐标信息 data_source 否 data_source object 首次上报数据源 first_observed_time 否 String 首次发现时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 last_observed_time 否 String 最近发现时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 create_time 否 String 记录时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 arrive_time 否 String 接收时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 title 否 String 告警标题 最小长度:0 最大长度:255 description 否 String 告警描述信息 最小长度:0 最大长度:1024 source_url 否 String 告警URL链接,指向数据源产品中有关当前事件说明的页面 最小长度:0 最大长度:1024 count 否 Integer 事件发生次数 最小值:0 最大值:999 confidence 否 Integer 事件的置信度。置信度的定义旨在说明识别的行为或问题的可能性。 取值范围:0-100,0表示置信度为0%,100表示置信度为100% 最小值:0 最大值:100 severity 否 String 严重性等级,取值范围:Tips | Low | Medium | High | Fatal 说明: 0: Tips – 未发现任何问题。 1: Low – 无需针对问题执行任何操作。 2: Medium – 问题需要处理,但不紧急。 3: High – 问题必须优先处理。 4: Fatal – 问题必须立即处理,以防止产生进一步的损害 最小长度:3 最大长度:6 枚举值: Tips Low Medium High Fatal criticality 否 Integer 关键性,是指事件涉及的资源的重要性级别。 取值范围:0-100,0表示资源不关键,100表示最关键资源 最小值:0 最大值:100 alert_type 否 alert_type object 告警分类,详细定义参考《告警类型定义》 network_list 否 Array of network_list objects 网络信息 数组长度:0 - 999 resource_list 否 Array of resource_list objects 受影响资源 数组长度:0 - 999 remediation 否 remediation object 补救措施 verification_state 否 String 验证状态,标识事件的准确性。可选类型如下: Unknown – 未知 True_Positive – 确认 False_Positive – 误报 默认填写Unknown 最小长度:32 最大长度:64 枚举值: Unknown True_Positive False_Positive handle_status 否 String 事件处理状态,可选类型如下: Open – 打开,默认 Block – 阻塞 Closed – 关闭 默认填写Open 最小长度:4 最大长度:5 枚举值: Open Block Closed sla 否 Integer 约束闭环时间:设置风险接受持续时间。单位:小时 最小值:0 最大值:999 update_time 否 String 更新时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 close_time 否 String 关闭时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 ipdrr_phase 否 String 周期/处置阶段编号 Prepartion|Detection and Analysis|Containm,Eradication& Recovery|Post-Incident-Activity 最小长度:0 最大长度:64 枚举值: Prepartion Detection and Analysis Containm,Eradication& Recovery Post-Incident-Activity simulation 否 String 调试字段 最小长度:0 最大长度:64 actor 否 String 告警调查员 最小长度:0 最大长度:64 owner 否 String 责任人、服务责任人 最小长度:0 最大长度:64 creator 否 String 创建人 最小长度:0 最大长度:64 close_reason 否 String 关闭原因: 误检 - False detection 已解决 - Resolved 重复 - Repeated 其他 - Other 最小长度:0 最大长度:64 枚举值: False detection Resolved Repeated Other close_comment 否 String 关闭评论 最小长度:0 最大长度:1024 malware 否 malware object 恶意软件 system_info 否 Object 系统信息 process 否 Array of process objects 进程信息 数组长度:0 - 999 user_info 否 Array of user_info objects 用户信息 数组长度:0 - 999 file_info 否 Array of file_info objects 文件信息 数组长度:0 - 999 system_alert_table 否 Object 告警管理列表的布局字段 表5 environment 参数 是否必选 参数类型 描述 vendor_type 否 String 环境供应商:HWCP/HWC/AWS/Azure/GCP 最小长度:0 最大长度:64 domain_id 否 String 租户id 最小长度:0 最大长度:64 region_id 否 String 区域od,全局服务global 最小长度:0 最大长度:64 cross_workspace_id 否 String 数据投递前的源工作空间id,在源空间下值为null,投递后为被委托用户的id 最小长度:0 最大长度:64 project_id 否 String 项目id, 全局服务默认null 最小长度:0 最大长度:64 表6 data_source 参数 是否必选 参数类型 描述 source_type 否 Integer 数据源类型,取值范围如下: 1 - 华为产品 2 - 第三方产品 3 - 租户私有产品 最小值:1 最大值:3 枚举值: 1 2 3 domain_id 否 String 数据源产品所属账号的id 最小长度:0 最大长度:36 project_id 否 String 数据源产品所属项目的id 最小长度:0 最大长度:64 region_id 否 String 数据源产品所在区域,具体取值范围查看华为云地区和终端节点定义,例如cn-north-1 最小长度:0 最大长度:64 company_name 否 String 数据源产品所属公司的名称 最小长度:0 最大长度:16 product_name 否 String 数据源产品的名称 最小长度:0 最大长度:24 product_feature 否 String 产品功能特性名称,用来指明检测到当前事件的产品的功能特性 最小长度:0 最大长度:24 product_module 否 String 检测模块列表 最小长度:0 最大长度:1024 表7 alert_type 参数 是否必选 参数类型 描述 category 否 String 类别 最小长度:0 最大长度:1024 alert_type 否 String 告警类型 最小长度:0 最大长度:1024 表8 network_list 参数 是否必选 参数类型 描述 direction 否 String 方向,取值范围:IN | OUT 最小长度:0 最大长度:3 枚举值: IN OUT protocol 否 String 协议,包含7层和4层的协议 参考:IANA registered name https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml 最小长度:0 最大长度:64 src_ip 否 String 源IP地址 最小长度:0 最大长度:64 src_port 否 Integer 源端口,0–65535 最小值:0 最大值:65535 src_domain 否 String 源域名 最小长度:0 最大长度:128 src_geo 否 src_geo object 源IP的地理位置信息 dest_ip 否 String 目的IP地址 最小长度:32 最大长度:64 dest_port 否 String 目的端口,0–65535 最小长度:0 最大长度:65535 dest_domain 否 String 目的域名 最小长度:0 最大长度:128 dest_geo 否 dest_geo object 目标IP的地理位置信息 表9 src_geo 参数 是否必选 参数类型 描述 latitude 否 Number 纬度 最小值:0 最大值:90 longitude 否 Number 经度 最小值:0 最大值:180 city_code 否 String 城市编码,Beijing | Shanghai 最小长度:0 最大长度:64 country_code 否 String 国家简码,参考ISO 3166-1 alpha-2,例如:CN | US | DE | IT | SG 最小长度:0 最大长度:64 表10 dest_geo 参数 是否必选 参数类型 描述 latitude 否 Number 纬度 最小值:0 最大值:90 longitude 否 Number 经度 最小值:0 最大值:180 city_code 否 String 城市编码,Beijing | Shanghai 最小长度:0 最大长度:64 country_code 否 String 国家简码,参考ISO 3166-1 alpha-2,例如:CN | US | DE | IT | SG 最小长度:0 最大长度:64 表11 resource_list 参数 是否必选 参数类型 描述 id 否 String 云服务资源id 最小长度:0 最大长度:36 name 否 String 资源名称 最小长度:0 最大长度:255 type 否 String 资源类型;引用华为云RMS type字段 最小长度:0 最大长度:64 provider 否 String 云服务名称;引用华为云RMS provider字段 最小长度:0 最大长度:64 region_id 否 String 区域;按照华为云regionId填写,如cn-north-1等 最小长度:0 最大长度:36 domain_id 否 String 资源所属账号ID,UUID格式 最小长度:0 最大长度:36 project_id 否 String 资源所属项目ID,UUID格式 最小长度:0 最大长度:36 ep_id 否 String 企业项目id 最小长度:0 最大长度:128 ep_name 否 String 企业项目名称 最小长度:0 最大长度:128 tags 否 String 资源标签 1、最多50个key/values对 2、values:最大255字符,取值范围:字母数字,空格,+, -, =, ., _, :, /,@ 最小长度:0 最大长度:2048 表12 remediation 参数 是否必选 参数类型 描述 recommendation 否 String 推荐处理方法 最小长度:0 最大长度:128 url 否 String 链接,指向该事件的一般修复信息。该URL必须可以从公网访问,不需要提供凭证 最小长度:0 最大长度:2048 表13 malware 参数 是否必选 参数类型 描述 malware_family 否 String 恶意家族 最小长度:0 最大长度:64 malware_class 否 String 恶意软件分类 最小长度:0 最大长度:64 表14 process 参数 是否必选 参数类型 描述 process_name 否 String 进程名 最小长度:0 最大长度:64 process_path 否 String 进程执行文件路径 最小长度:0 最大长度:512 process_pid 否 Integer 进程id 最小值:0 最大值:65535 process_uid 否 Integer 进程用户id 最小值:0 最大值:655350 process_cmdline 否 String 进程命令行 最小长度:0 最大长度:128 process_parent_name 否 String 父进程名称 最小长度:0 最大长度:64 process_parent_path 否 String 父进程执行文件路径 最小长度:0 最大长度:512 process_parent_pid 否 Integer 父进程id 最小值:0 最大值:65535 process_parent_uid 否 Integer 父进程用户id 最小值:0 最大值:655350 process_parent_cmdline 否 String 父进程命令行 最小长度:0 最大长度:128 process_child_name 否 String 子进程名称 最小长度:0 最大长度:64 process_child_path 否 String 子进程执行文件路径 最小长度:0 最大长度:512 process_child_pid 否 Integer 子进程id 最小值:0 最大值:65535 process_child_uid 否 Integer 子进程用户id 最小值:0 最大值:655350 process_child_cmdline 否 String 子进程命令行 最小长度:0 最大长度:128 process_launche_time 否 String 进程启动时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 process_terminate_time 否 String 进程结束时间,格式ISO8601:YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息为事件发生时区,无法解析时区的时间,默认时区填东八区 最小长度:0 最大长度:30 表15 user_info 参数 是否必选 参数类型 描述 user_id 否 String 用户uid 最小长度:0 最大长度:36 user_name 否 String 用户名称 最小长度:32 最大长度:64 表16 file_info 参数 是否必选 参数类型 描述 file_path 否 String 文件路径/名称 最小长度:0 最大长度:128 file_content 否 String 文件内容 最小长度:0 最大长度:1024 file_new_path 否 String 文件新路径/名称 最小长度:32 最大长度:64 file_hash 否 String 文件hash 最小长度:0 最大长度:128 file_md5 否 String 文件md5 最小长度:0 最大长度:128 file_sha256 否 String 文件sha256 最小长度:0 最大长度:128 file_attr 否 String 文件属性 最小长度:0 最大长度:1024
  • URI PUT /v1/{project_id}/workspaces/{workspace_id}/soc/alerts/{alert_id} 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目id 最小长度:32 最大长度:36 workspace_id 是 String 工作空间id 最小长度:32 最大长度:36 alert_id 是 String 告警ID 最小长度:32 最大长度:36
  • Go 更新一条指标,指标触发标志为否,值为ip。 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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2/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") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := secmaster.NewSecMasterClient( secmaster.SecMasterClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.UpdateIndicatorRequest{} sourceTypeDataSource:= int32(1) domainIdDataSource:= "ac7438b990ef4a37b741004eb45e8bf4" projectIdDataSource:= "5b8bb3c888db498f9eeaf1023f7ba597" regionIdDataSource:= "cn-xxx-7" dataSourceDataObject := &model.IndicatorDataObjectDetailDataSource{ SourceType: &sourceTypeDataSource, DomainId: &domainIdDataSource, ProjectId: &projectIdDataSource, RegionId: ®ionIdDataSource, } indicatorTypeIndicatorType:= "ipv6" idIndicatorType:= "ac794b2dfab9fe8c0676587301a636d3" categoryIndicatorType:= "ipv6" layoutIdIndicatorType:= "4e2d7f64-a66d-3236-a8c1-704636ced9a7" indicatorTypeDataObject := &model.IndicatorDataObjectDetailIndicatorType{ IndicatorType: &indicatorTypeIndicatorType, Id: &idIndicatorType, Category: &categoryIndicatorType, LayoutId: &layoutIdIndicatorType, } valueDataObject:= "ip" firstReportTimeDataObject:= "2023-07-04T16:47:01Z+0800" granularMarkingDataObject:= int32(1) projectIdDataObject:= "909494e3-558e-46b6-a9eb-07a8e18ca62f" statusDataObject:= "Open" workspaceIdDataObject:= "909494e3-558e-46b6-a9eb-07a8e18ca620" dataObjectbody := &model.IndicatorDataObjectDetail{ IndicatorType: indicatorTypeDataObject, Value: &valueDataObject, DataSource: dataSourceDataObject, FirstReportTime: &firstReportTimeDataObject, GranularMarking: &granularMarkingDataObject, ProjectId: &projectIdDataObject, Status: &statusDataObject, WorkspaceId: &workspaceIdDataObject, } request.Body = &model.UpdateIndicatorRequestBody{ DataObject: dataObjectbody, } response, err := client.UpdateIndicator(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • Java 更新一条指标,指标触发标志为否,值为ip。 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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 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.secmaster.v2.region.SecMasterRegion; import com.huaweicloud.sdk.secmaster.v2.*; import com.huaweicloud.sdk.secmaster.v2.model.*; public class UpdateIndicatorSolution { 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"); ICredential auth = new BasicCredentials() .withAk(ak) .withSk(sk); SecMasterClient client = SecMasterClient.newBuilder() .withCredential(auth) .withRegion(SecMasterRegion.valueOf("cn-north-4")) .build(); UpdateIndicatorRequest request = new UpdateIndicatorRequest(); UpdateIndicatorRequestBody body = new UpdateIndicatorRequestBody(); IndicatorDataObjectDetailDataSource dataSourceDataObject = new IndicatorDataObjectDetailDataSource(); dataSourceDataObject.withSourceType(1) .withDomainId("ac7438b990ef4a37b741004eb45e8bf4") .withProjectId("5b8bb3c888db498f9eeaf1023f7ba597") .withRegionId("cn-xxx-7"); IndicatorDataObjectDetailIndicatorType indicatorTypeDataObject = new IndicatorDataObjectDetailIndicatorType(); indicatorTypeDataObject.withIndicatorType("ipv6") .withId("ac794b2dfab9fe8c0676587301a636d3") .withCategory("ipv6") .withLayoutId("4e2d7f64-a66d-3236-a8c1-704636ced9a7"); IndicatorDataObjectDetail dataObjectbody = new IndicatorDataObjectDetail(); dataObjectbody.withIndicatorType(indicatorTypeDataObject) .withValue("ip") .withDataSource(dataSourceDataObject) .withFirstReportTime("2023-07-04T16:47:01Z+0800") .withGranularMarking(1) .withProjectId("909494e3-558e-46b6-a9eb-07a8e18ca62f") .withStatus("Open") .withWorkspaceId("909494e3-558e-46b6-a9eb-07a8e18ca620"); body.withDataObject(dataObjectbody); request.withBody(body); try { UpdateIndicatorResponse response = client.updateIndicator(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()); } } }
  • 请求示例 更新一条指标,指标触发标志为否,值为ip。 { "data_object" : { "indicator_type" : { "layout_id" : "4e2d7f64-a66d-3236-a8c1-704636ced9a7", "indicator_type" : "ipv6", "id" : "ac794b2dfab9fe8c0676587301a636d3", "category" : "ipv6" }, "value" : "ip", "data_source" : { "domain_id" : "ac7438b990ef4a37b741004eb45e8bf4", "project_id" : "5b8bb3c888db498f9eeaf1023f7ba597", "region_id" : "cn-xxx-7", "source_type" : 1 }, "workspace_id" : "909494e3-558e-46b6-a9eb-07a8e18ca620", "project_id" : "909494e3-558e-46b6-a9eb-07a8e18ca62f", "granular_marking" : 1, "first_report_time" : "2023-07-04T16:47:01Z+0800", "status" : "Open" } }
共100000条