2

I'm trying to search computers using the IP as search criteria but the console responds as not searchable field:

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."}

The computers object has a lastIPUsed field as shown here

Full method:

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)

Is that a bug?

Victor Ide
  • 41
  • 6

1 Answers1

1

It is not a bug. In the API reference, expand the 200 response of the Search Computers operation to see the descriptions of the Computer fields. You'll see that the descriptions indicate whether they are searchable -- displayName as a good example. The lastIPUsed field does not indicate that it is searchable.

Hope that helps,

-Scott (content developer for Deep Security)

ScottBro
  • 309
  • 1
  • 12