首页 > 解决方案 > 搜索字段 lastIPUsed 不可搜索

问题描述

我正在尝试使用 IP 作为搜索条件来搜索计算机,但控制台响应为不可搜索字段:

Exception: (400)                                                                                                                                                                        
Reason:
HTTP response headers: HTTPHeaderDict({'X-Frame-Options': 'SAMEORIGIN', 'X-XSS-Protection': '1;mode=block', 'Cache-Control': 'no-cache,no-store', 'Pragma': 'no-cache', 'X-DSM-Version': 'Deep Security/11.2.225', 'Content-Type': 'application/json', 'Content-Length': '73', 'Date': 'Wed, 20 Feb 2019 00:51:37 GMT', 'Connection': 'close'})
HTTP response body: {"message":"Invalid SearchFilter: lastUsedIP is not a searchable field."}

计算机对象有一个 lastIPUsed 字段,如下所示

完整方法:

def search_computer_by_ip(configuration, host_ip):

    host_ip_criteria = deepsecurity.SearchCriteria()
    host_ip_criteria.field_name = "lastIPUsed"
    host_ip_criteria.string_test = "equal"
    host_ip_criteria.string_value = host_ip

    search_filter_host_ip = deepsecurity.SearchFilter(None, host_ip_criteria)

    try:
        api_response = deepsecurity.ComputersApi(deepsecurity.ApiClient(configuration))
        return api_response.search_computers(api_version, search_filter=search_filter_host_ip)
    except ApiException as e:
        print("Exception: %s\n" % e)

那是一个错误吗?

标签: deepsecurity

解决方案


这不是一个错误。在 API 参考中,展开 Search Computers 操作的 200 响应以查看 Computer 字段的描述。您会看到描述表明它们是否可搜索—— displayName 就是一个很好的例子。lastIPUsed 字段并不表示它是可搜索的。

希望有帮助,

-Scott(Deep Security 的内容开发人员)


推荐阅读