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

查询开放端口统计信息

功能介绍

查询开放端口列表,支持通过传入端口或协议类型查询服务器数

URI

GET /v5/{project_id}/asset/port/statistics

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目id

表2 Query参数

参数

是否必选

参数类型

描述

port

Integer

端口号,精确匹配

port_string

String

端口字符串,用来进行模糊匹配

type

String

端口类型

enterprise_project_id

String

企业项目

sort_key

String

排序的key值,目前支持按照端口号port排序

sort_dir

String

升序还是降序,默认升序,asc

limit

Integer

默认10

offset

Integer

默认是0

category

String

类别,默认为host,包含如下:

  • host:主机

  • container:容器

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

x-auth-token

String

iam token

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

total_num

Integer

开放端口总数

data_list

Array of PortStatisticResponseInfo objects

开放端口统计信息列表

表5 PortStatisticResponseInfo

参数

参数类型

描述

port

Integer

端口号

type

String

类型

num

Integer

端口数量

status

String

危险类型:danger/unknown

请求示例

默认查询前10条端口为123,类别为主机的开放端口列表

GET https://{endpoint}/v5/{project_id}/asset/port/statistics?port=123&category=host

响应示例

状态码:200

返回端口信息,端口号、类型、数量、危险状态

{
  "total_num" : 1,
  "data_list" : [ {
    "num" : 4,
    "port" : 123,
    "type" : "UDP",
    "status" : "danger"
  } ]
}

状态码

状态码

描述

200

返回端口信息,端口号、类型、数量、危险状态

错误码

请参见错误码