EDR 威胁响应 API

Kaspersky Endpoint Security 12.9 for Windows 引入了对 EDR 威胁响应操作的支持 (EDR responses),使用 Kaspersky Security Center OpenAPI。也就是说,您可以使用 Python 调用 OpenAPI 方法自动化 EDR 威胁响应。当与 SIEM 解决方案集成时,您可以调用这些方法。Kaspersky Unified Monitoring and Analysis Platform,卡巴斯基 SIEM 解决方案从 3.4.1 版本开始支持 EDR 威胁响应 OpenAPI。有关示例脚本,请参阅 KUMA 文档。

要执行 EDR 威胁响应操作,您需要创建一个请求并使用 KSC Open API (AddIncident)发送它。处理请求后,将在 Kaspersky Security Center 控制台中创建一个特殊任务。

要在响应 EDR 威胁时创建任务,您必须在管理服务器和 Kaspersky Security Center Web Console 之间建立后台连接。后台连接服务在 Kaspersky Security Center Windows 14.2 或更高版本以及 Kaspersky Security Center Linux 15.2 中可用。不支持其他控制台,包括 Kaspersky Detection and Response 解决方案的控制台。

对于 EDR 威胁响应,您需要指定基本请求参数,例如以 JSON 格式:

要配置 EDR 威胁响应,您需要在“"KLINCDT_BODY": json.dumps(data)”参数中以 JSON 格式指定任务设置。因此,应用程序在 Kaspersky Security Center 控制台中创建“[Response][KUMA] <task type> - <Date> <Time> - <ID>”。

连接到 Kaspersky Security Center OpenAPI

作为 EDR 威胁响应的一部分,应用程序在 Kaspersky Security Center 控制台中创建特殊任务。创建这些任务需要在计算机和 Kaspersky Security Center 之间建立连接。为此,必须在请求中指定 Kaspersky Security Center 连接参数。

Kaspersky Security Center 连接参数

参数

类型

描述

kscHost

string

Kaspersky Security Center 管理服务器地址。必需参数。

kscPort

int

管理服务器连接端口。必需参数。

kscCert

string

用于连接到 Kaspersky Security Center 管理服务器的证书文件的路径。默认情况下,该参数设置为“False”。

kscUser

string

用户账户名称。必需参数。

kscPassword

string

用户账户密码。必需参数。

示例

# KSC connection info

# reads Environment variables by default, change with corresponding values

# KSC host, string, required

kscHost = "kscHost"

# KSC port, required, default is "13299"

kscPort = "13299"

# KSC certificate file path, default is False

kscCert = False

# KSC user, string, required

kscUser = "kscUser"

# KSC password, string, required

kscPassword = "kscPassword"

server_url = 'https://' + kscHost + ':' + str(kscPort)

    server = KlAkAdmServer.Create(

        server_url, kscUser, kscPassword, verify=kscCert)

    params = validate(args)

    data = {"targetHost": <MyHost>,

            "task": task,

            "params": params,

            "responseEventIncident": True,

            "responseEventIncidentArea":"Kuma"}

    oHostGroup = KlAkHostGroup(server)

    incdnt = oHostGroup.AddIncident({"KLINCDT_SEVERITY": 2,

                                     "KLINCDT_ADDED": paramDateTime(datetime.datetime.now()),

                                     "KLINCDT_BODY": json.dumps(data),

                                     "KLHST_WKS_HOSTNAME":  args.targetHost}).RetVal()

    oHostGroup.UpdateIncident(incdnt, {"KLINCDT_IS_HANDLED": False,

                                       "KLHST_WKS_HOSTNAME":  args.targetHost})

用户账户数据不受保护,因此您需要指定一个单独的用户来执行这些操作。

获取文件getFile

获取文件 任务设置

参数

类型

描述

md5hash

string

您想要获取的文件的 MD5 哈希值。

sha256hash

string

您想要获取的文件的 SHA256 哈希值。

path

string

您想要获取的文件的路径。

示例

type getFile = {

task: 'getFile';

targetHost: string;

params: {

// an empty string or a valid md5 hash of the file

md5hash: string;

// an empty string or a valid sha256 hash of the file

sha256hash: string;

// the path to the file

path: string;

};

responseEventIncidentArea: string;

};

删除文件deleteFile

删除文件 任务设置

参数

类型

描述

md5hash

string

您要删除的文件的 MD5 哈希值。

sha256hash

string

您要删除的文件的 SHA256 哈希值。

path

string

您要删除的文件的路径。

searchInSubfolders?

boolean

在子文件夹中搜索要删除的文件。

示例

type deleteFile = {

task: 'deleteFile';

targetHost: string;

params: {

// an empty string or a valid md5 hash of the file

md5hash: string;

// an empty string or a valid sha256 hash of the file

sha256hash: string;

// the path to the file

path: string;

// recursive search for a file (subfolder), optional

searchInSubfolders?: boolean;

};

responseEventIncidentArea: string;

};

移动文件到隔离区quarantineFile

移动文件到隔离区 任务设置

参数

类型

描述

md5hash

string

您要隔离的文件的 MD5 哈希值。

sha256hash

string

您要隔离的文件的 SHA256 哈希值。

path

string

您想要隔离的文件的路径。

示例

type quarantineFile = {

task: 'quarantineFile';

targetHost: string;

params: {

// an empty string or a valid md5 hash of the file

md5hash: string;

// an empty string or a valid sha256 hash of the file

sha256hash: string;

// the path to the file

path: string;

};

responseEventIncidentArea: string;

};

IOC 扫描iocScan

IOC 扫描 任务设置

参数

类型

描述

ioc

string

您要用于扫描的带有 IOC 文件的 ZIP 存档的路径。

isolateHost

boolean

当检测到入侵指标时将计算机与网络隔离,以防止威胁蔓延。

scanCriticalAreas

boolean

当检测到入侵指标时运行“关键区域扫描”任务。

quarantineObject

boolean

当检测到入侵指标时删除恶意对象。删除对象之前,Kaspersky Endpoint Security 创建备份副本,以便日后对其进行恢复。Kaspersky Endpoint Security 移动备份副本到隔离区。

示例

type iocScan = {

task: 'iocScan';

targetHost: string;

params: {

// the path to the zip archive with ioc files in base64 encoding

ioc: string;

// isolation of the computer from the network

isolateHost: boolean;

// critical areas scan

scanCriticalAreas: boolean;

// quarantine the file

quarantineObject: boolean;

};

responseEventIncidentArea: string;

};

启动进程startProcess

启动进程 任务设置

参数

类型

描述

executablePath

string

用于启动进程的可执行文件的路径。

arguments?

string

用于启动进程的附加命令行参数。

workingFolder?

string

进程工作文件夹的路径。

示例

type startProcess = {

task: 'startProcess';

targetHost: string;

params: {

// the path to the file

executablePath: string;

// command line arguments, optional

arguments?: string;

// a working folder, optional

workingFolder?: string;

};

responseEventIncidentArea: string;

};

终止进程terminateProcess

终止进程 任务设置

参数

类型

描述

md5hash

string

您想要终止其进程的文件的 MD5 哈希值。

sha256hash

string

您想要终止其进程的文件的 SHA256 哈希值。

path

string

您要删除的文件的路径。

caseSensitive

boolean

搜索文件时区分大小写。

示例

type terminateProcess = {

task: 'terminateProcess';

targetHost: string;

params: {

// an empty string or a valid md5 hash of the file

md5hash: string;

// an empty string or a valid sha256 hash of the file

sha256hash: string;

// the path to the file

path: string;

// case sensitive of the file name

caseSensitive: boolean;

};

responseEventIncidentArea: string;

};

计算机网络隔离 – isolateHost

计算机网络隔离设置

参数

类型

描述

action

string

您想要获取的文件的 MD5 哈希值。

示例

type isolateHost = {

task: 'isolateHost';

targetHost: string;

params: {

// 0 - turning off network isolation, 1 - turning on network isolation

action: number;

};

responseEventIncidentArea: string;

};

执行防护 – preventExecution

执行防护设置

参数

类型

描述

hash

string

您想要阻止运行的文件的 MD5 哈希值。

path

string

您想要阻止运行的文件的路径。

caseSensitive

boolean

搜索文件时区分大小写。

示例

type preventExecution = {

task: 'preventExecution';

targetHost: string;

params: {

// a valid md5 hash of the file

hash: string;

// the path to the file

path: string;

// case sensitive of the file name

caseSensitive: boolean;

};

responseEventIncidentArea: string;

};

恶意软件扫描onDemandScan

恶意软件扫描 任务设置

参数

类型

描述

path

string

自定义扫描的文件和文件夹的空格分隔列表。

recursive

boolean

递归扫描模式。

type

number

扫描范围。

ScanObjectType = Enum("ScanObjectType",

[

("SystemMemory", 14),

("StartupObjectsAndRunningProcesses", 15),

("DiskBootSectors", 16),

("SystemBackupStorage", 17),

("Email", 18),

("Folder", 22),

("AllRemovableDrives", 23),

("AllNetworkDrives", 24),

("AllFixedDrives", 25)])

示例

type onDemandScan = {

task: 'onDemandScan';

targetHost: string;

// please note, this is an array

// array of scan object

params: [{

// enabling the scan object

enabled: boolean;

// an empty string or the path to the folder to scan

path: string;

// recursive scan mode

recursive: boolean;

// ID scan object

type: number;

}];

responseEventIncidentArea: string;

};

页面顶部