Kaspersky Industrial CyberSecurity for Networks API Developer's Guide

Getting dictionary values

This section explains how to obtain dictionary values used by Kaspersky Industrial CyberSecurity for Networks.

Overview

Kaspersky Industrial CyberSecurity for Networks uses several dictionaries, including a dictionary of rule names, a dictionary of monitoring point names, and a dictionary of protocol names. All dictionary types are defined in the DictionaryType enumeration.

You can get values from the dictionaries by using the DictionaryProvider service methods. The service, messages, and enumerations are defined in the dictionary_provider_service.proto file.

The DictionaryProvider service has the following method for getting dictionary values:

  • GetDictionary

    Returns values from the specified dictionary.

Getting dictionary values (example)

In the following example, a stub requests 100 values from the dictionary containing the rule names. You must specify the maximum count in the request.

configStub = configuration_provider_service_pb2_grpc.ConfigurationProviderStub(channel)

 

#rpc GetDictionary(DictionaryRequest) returns(stream google.protobuf.StringValue);

 

request = dictionary_provider_service_pb2.DictionaryRequest(

type=dictionary_provider_service_pb2.Rules,

maxCount=100)

 

response = dictStub.GetDictionary(request)

for element in response:

print(element.value)

Getting specific dictionary values (example)

In the following example, a stub requests 10 values from the dictionary with the protocol names. The valuePrefix parameter specifies that only protocol names starting with "M300" must be returned.

configStub = configuration_provider_service_pb2_grpc.ConfigurationProviderStub(channel)

 

#rpc GetDictionary(DictionaryRequest) returns(stream google.protobuf.StringValue);

 

request = dictionary_provider_service_pb2.DictionaryRequest(

type=dictionary_provider_service_pb2.Protocols,

valuePrefix="M",

maxCount=10)

 

response = dictStub.GetDictionary(request)

 

for element in response:

print(element.value)