我正在尝试使用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."}computers对象有一个如here所示的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)那是个bug吗?
发布于 2019-02-20 21:14:33
这不是一个bug。在API参考中,展开搜索计算机操作的200响应,以查看计算机字段的说明。您将看到这些描述指出了它们是否可搜索-- displayName就是一个很好的例子。lastIPUsed字段不表示它是可搜索的。
希望这能有所帮助,
-Scott (深度安全内容开发人员)
https://stackoverflow.com/questions/54777366
复制相似问题