|
KSC Open API
Kaspersky Security Center API description
|
Initiate action under the specified file from specified network list.
See also Python code with use of KlAkOAPI Python package below:
def AddTaskForAllEntries(strListName, strTaskName, server):
oSrvView = KlAkOAPI.SrvView.KlAkSrvView(server)
wstrIteratorId = oSrvView.ResetIterator(strListName, "", ["nId", "strHostName", "ObjName", "szDescription"], [], {}, lifetimeSec = 60 * 60 * 3).OutPar('wstrIteratorId') iRecordCount = oSrvView.GetRecordCount(wstrIteratorId).RetVal()
iStep = 200
iStart = 0
while iStart < iRecordCount:
pRecords = oSrvView.GetRecordRange(wstrIteratorId, iStart, iStart + iStep).OutPar('pRecords')
for oObj in pRecords['KLCSP_ITERATOR_ARRAY']:
nId = oObj["nId"]
strHostName = oObj["strHostName"]
strObjName = oObj["ObjName"]
if "szDescription" in oObj:
strDescr = oObj["szDescription"]
# work with other fields... KlAkOAPI.QBTNetworkListApi.KlAkQBTNetworkListApi(server).AddListItemTask(strListName, oObj["nId"], strTaskName, {})
iStart += iStep + 1oSrvView.ReleaseIterator(wstrIteratorId) def main():
server = KlAkOAPI.AdmServer.KlAkAdmServer.Create("https://ksc.example.com:13299", "username", "password", verify = False) # create scan task for each entry of Quarantine collection
AddTaskForAllEntries("Quarantine", "ScanQuarantine", server) # restore all entries of Backup collection
AddTaskForAllEntries("Backup", "RestoreObj", server) # scan and disinfect all entries of TIF collection
AddTaskForAllEntries("TIF", "ScanQuarantine", server)
|