我正在尝试使用 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)
那是一个错误吗?