KSC Open API
13.1
Kaspersky Security Center API description
|
Receives a tree of subgroups in the administration group.
See also how to use the KlAkOAPI Python package: def EnumerateGroups(oGroups, nLevel): for oGroup in oGroups: nId = oGroup['id'] strName = oGroup['name'] # form indention for logging strIndention = ' ' + ' ' * nLevel + '+-' # log the found administration group print(strIndention, 'Subgroup:', strName, ', id:', nId) if 'groups' in oGroup: groups = oGroup['groups'] EnumerateGroups(groups, nLevel + 1) def main(): # server details server = KlAkOAPI.AdmServer.KlAkAdmServer.Create("https://ksc.example.com:13299", "username", "password", verify = False) oHostGroup = KlAkOAPI.HostGroup.KlAkHostGroup(server) # get ID of the root group ('Managed devices' group) nRootGroupID = oHostGroup.GroupIdGroups().RetVal() # enumerate subgroups of the root group oSubgroups = oHostGroup.GetSubgroups(nRootGroupID, 0).RetVal() EnumerateGroups(oSubgroups, 0)
|