CounterTack
CounterTack empowers endpoint security teams to assure endpoint protection for Identifying Cyber Threats. Integrating a predictive endpoint protection platform.
Endpoint · CounterTack
Details
| ID | CounterTack |
|---|---|
| Provider | SparkCognition |
| Category | Endpoint |
| From Version | 5.0.0 |
| Docker Image | demisto/python3:3.12.13.10116658 |
| Supported Modules | Agentix XSIAM |
README
CounterTack empowers endpoint security teams to assure endpoint protection for Identifying Cyber Threats. Integrating a predictive endpoint protection platform
Configure CounterTack in Cortex
| Parameter | Required |
|---|---|
| Server URL (e.g. https://democloud.countertack.com) | True |
| User Name | True |
| Password | True |
| Use system proxy settings | False |
| Trust any certificate (not secure) | False |
| Fetch incidents | False |
| Incident type | False |
| First fetch timestamp (<number> <time unit>, e.g., 12 hours, 7 days, 3 months, 1 year) | False |
| Fetch notifications incidents | False |
| Fetch behviors incidents | False |
Commands
You can execute these commands from the CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.
countertack-get-endpoints
Returns information for endpoints.
Base Command
countertack-get-endpoints
Input
There are no input arguments for this command.
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.Endpoint.IsQuarantined | boolean | Is the endpoint currently quarantined |
| CounterTack.Endpoint.MaxImpact | number | Impact of the highest scoring behavior |
| CounterTack.Endpoint.Memory | number | The RAM of the endpoint (in megabytes). |
| CounterTack.Endpoint.DriverVersion | string | Endpoint sensor version |
| CounterTack.Endpoint.ProfileVersion | string | Version of the current profile used for collection |
| CounterTack.Endpoint.BehaviorCount | number | Number of behaviors detected |
| CounterTack.Endpoint.CurrentProfile | string | Currently active analysis profile |
| CounterTack.Endpoint.Domain | string | DNS suffix for the endpoint |
| CounterTack.Endpoint.NumCpus | number | Number of CPUs |
| CounterTack.Endpoint.Macs | string | MAC addresses associated with the endpoint |
| CounterTack.Endpoint.WinRdpPort | number | RDP port used by the endpoint |
| CounterTack.Endpoint.Ip | string | IP address used to connect to the analysis cluster |
| CounterTack.Endpoint.ClusterHosts | string | The list of hosts that the endpoint tries to connect through (in order). |
| CounterTack.Endpoint.Vendor | string | OS vendor |
| CounterTack.Endpoint.SensorMode | string | Specifies the sensor mode of the driver |
| CounterTack.Endpoint.Identifier | string | OS identifier |
| CounterTack.Endpoint.CurrentResponsePolicy | string | Currently active response policy |
| CounterTack.Endpoint.Tenant | string | Tenant ID set at the time of KM installation |
| CounterTack.Endpoint.Name | string | Product name of the endpoint OS |
| CounterTack.Endpoint.ImpactLevel | string | Threat level of the endpoint.(LOW, MEDIUM, HIGH, CRITICAL) |
| CounterTack.Endpoint.Ips | string | IP addresses associated with the endpoint |
| CounterTack.Endpoint.ClusterConnectionRoute | string | List of hosts the endpoint is currently connected through |
| CounterTack.Endpoint.LastActive | date | Time of last event captured on the endpoint |
| CounterTack.Endpoint.TimeStarted | date | Time kernel module collection last engaged |
| CounterTack.Endpoint.Mac | string | The endpoint MAC address |
| CounterTack.Endpoint.EventStartTime | date | The time that the event was captured |
| CounterTack.Endpoint.CpuType | string | Bit length of the CPU architecture. |
| CounterTack.Endpoint.Status | string | Collection status of the endpoint (ON, PAUSE, OFF, INIT) |
| CounterTack.Endpoint.OsType | number | The OS type. |
| CounterTack.Endpoint.Version | string | OS version |
| CounterTack.Endpoint.Tags | string | List of user assigned tags |
| CounterTack.Endpoint.Threat | string | Threat level associated with the endpoint |
| CounterTack.Endpoint.Id | string | Endpoints ID |
| CounterTack.Endpoint.ProductName | string | Product name of the endpoint OS |
| Endpoint.Memory | number | Endpoint RAM (megabytes) |
| Endpoint.Processors | number | Number of CPUs |
| Endpoint.Domain | string | DNS suffix for the endpoint |
| Endpoint.OS | string | Product name of the endpoint OS |
| Endpoint.MACAddress | string | The MAC address of the endpoint. |
| Endpoint.Model | string | The analysis profile that is currently active. |
| Endpoint.IPAddress | string | The IP addresses that are associated with the endpoint. |
| Endpoint.OSVersion | string | The endpoint sensor version. |
| Endpoint.ID | string | The ID of the Endpoints. |
countertack-get-behaviors
Returns information for all behaviors.
Base Command
countertack-get-behaviors
Input
There are no input arguments for this command.
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.Behavior.MaxImpact | number | The impact of the highest scoring event (0-100) |
| CounterTack.Behavior.EndpointId | string | The ID of the endpoint, based on the UUID of the last installed endpoint sensor |
| CounterTack.Behavior.Tenant | string | The tenant of the behavior. |
| CounterTack.Behavior.EventCount | number | The number of events detected. |
| CounterTack.Behavior.Name | string | The name of the condition that triggered the behavior. |
| CounterTack.Behavior.ImpactLevel | string | The threat level of the behavior (LOW, MEDIUM, HIGH, CRITICAL). |
| CounterTack.Behavior.LastActive | date | The time that the behavior was last active. |
| CounterTack.Behavior.FirstEventId | date | The ID of the first event. |
| CounterTack.Behavior.TimeStamp | date | The start time for the behavior. |
| CounterTack.Behavior.Type | string | The type of behavior (CLASSIFICATION, TRACE) |
| CounterTack.Behavior.Id | string | The ID of the behaviors. |
| CounterTack.Behavior.LastReported | date | The time that the behavior was last seen. |
countertack-get-endpoint
Get information on specific endpoint
Base Command
countertack-get-endpoint
Input
| Argument Name | Description | Required |
|---|---|---|
| endpoint_id | The ID of the endpoint. To get the “endpoint_id”, run the get-endpoints command. |
Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.Endpoint.MaxImpact | number | The impact of the highest scoring behavior. |
| CounterTack.Endpoint.Memory | number | The RAM of the endpoint (in megabytes) |
| CounterTack.Endpoint.DriverVersion | string | The sensor version of the endpoint. |
| CounterTack.Endpoint.ProfileVersion | string | The version of the current profile used for collection. |
| CounterTack.Endpoint.BehaviorCount | number | The number of behaviors that were detected. |
| CounterTack.Endpoint.CurrentProfile | string | The analysis profile that is currently active. |
| CounterTack.Endpoint.Domain | string | DNS suffix for the endpoint. |
| CounterTack.Endpoint.NumCpus | number | The number of CPUs for the endpoint. |
| CounterTack.Endpoint.WinRdpPort | number | The RDP port used by the endpoint. |
| CounterTack.Endpoint.Macs | string | The MAC addresses associated with the endpoint. |
| CounterTack.Endpoint.Ip | string | The IP address used to connect to the analysis cluster. |
| CounterTack.Endpoint.ClusterHosts | string | The list of hosts that the endpoint tries to connect through (in order). |
| CounterTack.Endpoint.Vendor | string | The OS vendor. |
| CounterTack.Endpoint.SensorMode | string | The sensor mode of the driver. |
| CounterTack.Endpoint.Identifier | string | The identifier of the OS. |
| CounterTack.Endpoint.Tenant | string | The tenant ID that was set at the time of KM installation. |
| CounterTack.Endpoint.Name | string | The machine name of the endpoint. |
| CounterTack.Endpoint.ImpactLevel | string | The threat level of the endpoint. |
| CounterTack.Endpoint.Ips | string | The IP addresses associated with the endpoint. |
| CounterTack.Endpoint.ClusterConnectionRoute | string | The list of hosts that the endpoint is currently connected through. |
| CounterTack.Endpoint.LastActive | date | The time of the last event that was captured on the endpoint. |
| CounterTack.Endpoint.TimeStarted | date | The first time that the endpoint started to work. |
| CounterTack.Endpoint.Mac | string | The MAC address of the endpoint. |
| CounterTack.Endpoint.EventStartTime | date | The time that the event was captured. |
| CounterTack.Endpoint.CpuType | number | The bit length of the CPU architecture. |
| CounterTack.Endpoint.Status | string | The collection status of the endpoint (ON, PAUSE, OFF, INIT). |
| CounterTack.Endpoint.OsType | number | The OS type. |
| CounterTack.Endpoint.Version | string | The version of the endpoint. |
| CounterTack.Endpoint.Threat | string | The threat level associated with the endpoint. |
| CounterTack.Endpoint.Id | string | The ID of the endpoint. |
| CounterTack.Endpoint.ProductName | string | The product name of the endpoint OS. |
| CounterTack.Endpoint.Tags | string | The list of user assigned tags. |
| CounterTack.Endpoint.IsQuarantined | boolean | Whether the endpoint is currently quarantined. |
| Endpoint.Memory | number | The RAM of the endpoint (in megabytes). |
| Endpoint.Processors | number | The number of CPUs. |
| Endpoint.Domain | string | The DNS suffix for the endpoint. |
| Endpoint.OS | string | The product name of the endpoint OS. |
| Endpoint.MACAddress | string | The MAC address of the endpoint. |
| Endpoint.Model | string | The analysis profile that is currently active. |
| Endpoint.IPAddress | string | The IP addresses associated with the endpoint. |
| Endpoint.OSVersion | string | The version of the endpoint sensor. |
countertack-get-behavior
Gets information of a given behavior.
Base Command
countertack-get-behavior
Input
| Argument Name | Description | Required |
|---|---|---|
| behavior_id | The ID of the behavior. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.Behavior.MaxImpact | number | The maximum impact of the behavior. |
| CounterTack.Behavior.EndpointId | string | The ID of the endpoint. |
| CounterTack.Behavior.Tenant | string | The tenant of the behavior. |
| CounterTack.Behavior.EventCount | number | The event count of the behavior. |
| CounterTack.Behavior.ReportedOn | date | The time that the behavior was first seen. |
| CounterTack.Behavior.Name | string | The name of the behavior. |
| CounterTack.Behavior.ImpactLevel | string | The impact level of the behavior. |
| CounterTack.Behavior.LastActive | date | The last time that the behavior was active. |
| CounterTack.Behavior.TimeStamp | date | The time stamp of the behavior. |
| CounterTack.Behavior.FirstEventId | string | The ID of the first event. |
| CounterTack.Behavior.Type | string | The type of behavior. |
| CounterTack.Behavior.Id | string | The ID of the behavior. |
| CounterTack.Behavior.LastReported | date | The time that the behavior was last seen. |
countertack-get-endpoint-tags
Gets the tags of a given endpoint.
Base Command
countertack-get-endpoint-tags
Input
| Argument Name | Description | Required |
|---|---|---|
| endpoint_id | The ID of the endpoint to get tags for. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.Endpoint.Tags | string | The list of user assigned tags. |
| CounterTack.Endpoint.EndpointId | string | The ID of the endpoints. |
countertack-add-tags
Adds tags to a given endpoint.
Base Command
countertack-add-tags
Input
| Argument Name | Description | Required |
|---|---|---|
| endpoint_id | The ID of the endpoint. To get the “endpoint_id”, run the get-endpoints command. |
Required |
| tags | A CSV list of tags you want to add to the endpoint, for example, “test1,test2”. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.Endpoint.EndpointId | string | The ID of the endpoint. |
| CounterTack.Endpoint.Tags | string | The tags that were added to the endpoint. |
countertack-delete-tags
Deletes the supplied tags from a given endpoint.
Base Command
countertack-delete-tags
Input
| Argument Name | Description | Required |
|---|---|---|
| tags | The tags to be deleted from specified endpoint. To delete more then one, separate the tags with a comma. (e.g test1,test2). | Required |
| endpoint_id | The endpoint ID. Get the ID from the “get-endpoints” command. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.Endpoint.Id | string | The ID of the endpoint |
| CounterTack.Endpoint.Tags | string | The tags of the specified endpoint |
countertack-add-behavior-tags
Adds tags to a given behavior.
Base Command
countertack-add-behavior-tags
Input
| Argument Name | Description | Required |
|---|---|---|
| behaviour_id | The ID of the behavior. | Required |
| tags | A CSV list of tags to add to the behavior, for example, “test1,test2”. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.Behavior.Id | string | The ID of the behavior. |
| CounterTack.Behavior.Tags | string | The tags of the behavior. |
countertack-delete-behavior-tags
Deletes the supplied tags from a given behavior.
Base Command
countertack-delete-behavior-tags
Input
| Argument Name | Description | Required |
|---|---|---|
| behaviour_id | The behavior ID. | Required |
| tags | Tags to delete from a behavior. To delete more then one, separate the tags with a comma. (e.g test1,test2). | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.Behavior.Id | string | The ID of the behavior. |
| CounterTack.Behavior.Tags | Unknown | The tags of the behavior. |
countertack-endpoint-quarantine
Quarantines a given endpoint.
Base Command
countertack-endpoint-quarantine
Input
| Argument Name | Description | Required |
|---|---|---|
| endpoint_id | The ID of the endpoint to quarantine. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.Endpoint.Id | string | The ID of the endpoint. |
| CounterTack.Endpoint.IsQuarantine | boolean | Is the endpoint currently quarantined. |
countertack-disable-quarantine
Removes a given endpoint from quarantine.
Base Command
countertack-disable-quarantine
Input
| Argument Name | Description | Required |
|---|---|---|
| endpoint_id | The ID of the endpoint to remove from quarantine. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.Endpoint.Id | string | The ID of the endpoint that was removed from quarantine. |
| CounterTack.Endpoint.IsQuarantine | string | Is the endpoint is currently quarantined. |
countertack-extract-file
Extracts a file from given endpoint.
Base Command
countertack-extract-file
Input
| Argument Name | Description | Required |
|---|---|---|
| endpoint_id | The ID of the endpoint to extract a file from. | Required |
| file_path | The path of the file to extract, for example, “C:\test1.txt”. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.File.CommandArg.contents | boolean | The contents of the extracted file. |
| CounterTack.File.CommandArg.extracted_ids | string | The IDs of the extracted file. |
| CounterTack.File.CommandArg.md5 | boolean | The MD5 hash of the extracted file. |
| CounterTack.File.CommandArg.paths | string | The path of the extracted file. |
| CounterTack.File.CommandArg.sha256 | boolean | The SHA-256 has of teh extracted file. |
| CounterTack.File.CommandArg.ssdeep | boolean | The ssdeep hash of the extracted file. |
| CounterTack.File.CommandArg | Unknown | The command arguments. |
| CounterTack.File.CommandName | string | The name of the command that is sent. |
| CounterTack.File.Username | string | The username of the user that requested the command. |
| CounterTack.File.TargetType | string | The type of resource or collection this command is being sent to. |
| CounterTack.File.Status | string | The status of the command (initial, pending, complete, error). |
| CounterTack.File.RequestTime | date | The time at which the client requested the command. |
| CounterTack.File.Id | string | The ID of the commands. |
| CounterTack.File.EndpointIds | string | The ID of the source this command is being sent to. |
countertack-delete-file
Deletes a file from the given endpoint.
Base Command
countertack-delete-file
Input
| Argument Name | Description | Required |
|---|---|---|
| endpoint_id | The ID of the endpoint to delete a file from. | Required |
| file_path | The path of the file to delete. | Required |
Context Output
There is no context output for this command.
countertack-get-all-files
Gets all extracted files for all endpoints.
Base Command
countertack-get-all-files
Input
There are no input arguments for this command.
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.File.Size | number | The size of the extracted file (in bytes). |
| CounterTack.File.EndpointId | string | The ID of the endpoint that contains the extracted file. |
| CounterTack.File.ExtractionTime | date | The time that the file was extracted. |
| CounterTack.File.Path | string | The full file system path of the extracted file, including the filename, as seen on the endpoint. |
| CounterTack.File.Sha256 | string | The SHA-256 digest of the file contents. |
| CounterTack.File.Tenant | string | The tenant ID for the endpoint. |
| CounterTack.File.User | string | The name of the user requesting the file. |
| CounterTack.File.Ssdeep | string | The ssdeep digest of the file contents. |
| CounterTack.File.EndpointIp | string | The IP address of the endpoint with the extracted file. |
| CounterTack.File.AvCoverage | number | The percentage of AV engines that determined that the hash is malicious. |
| CounterTack.File.Status | string | The status of the contents. |
| CounterTack.File.VtStatus | string | The Virus Total report status. |
| CounterTack.File.EndpointName | string | The name of the endpoint with the extracted file. |
| CounterTack.File.Id | string | The file ID of the extracted file. |
| CounterTack.File.Md5 | string | The MD5 digest of the file contents. |
| CounterTack.File.VtReportLocation | string | The VirusTotal report location path. |
| File.MD5 | string | The MD5 digest of the file contents. |
| File.Path | string | The full file system path of the extracted file, including the filename, as seen on the endpoint. |
| File.SHA256 | string | The SHA-256 digest of the file contents. |
| File.SSDeep | string | The ssdeep digest of the file contents. |
| File.Size | number | The size of the extracted file (in bytes). |
countertack-get-endpoint-files
Returns all extracted files from a given endpoint.
Base Command
countertack-get-endpoint-files
Input
| Argument Name | Description | Required |
|---|---|---|
| endpoint_id | The ID of the endpoint. To get the endpoint_id, run the get-endpoints command. |
Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.File.Id | string | The file ID of the extracted file. |
| CounterTack.File.Status | string | The status of the contents. |
| CounterTack.File.EndpointId | string | The ID of the endpoint with the extracted file. |
| CounterTack.File.ExtractionTime | date | The time that the file was extracted. |
| CounterTack.File.Tenant | string | The tenant ID for the endpoint. |
| CounterTack.File.User | string | The name of the user requesting the file. |
| CounterTack.File.Path | string | The full file system path of the extracted file, including the filename, as seen on the endpoint. |
| CounterTack.File.Sha256 | string | The SHA-256 digest of the file contents. |
| CounterTack.File.Ssdeep | string | The ssdeep digest of the file contents. |
| CounterTack.File.EndpointIp | string | The IP address of the endpoint with the extracted file. |
| CounterTack.File.VtStatus | string | The VirusTotal report status. |
| CounterTack.File.VtReportLocation | string | The location path of the VirusTotal report. |
| CounterTack.File.Size | number | The size of the extracted file (in bytes). |
| CounterTack.File.EndpointName | string | The name of the endpoint with the extracted file. |
| CounterTack.File.Md5 | string | The MD5 digest of the file contents. |
| File.MD5 | string | The MD5 digest of the file contents. |
| File.Path | string | The full file system path of the extracted file, including the filename, as seen on the endpoint. |
| File.SHA256 | string | The SHA-256 digest of the file contents. |
| File.SSDeep | string | The ssdeep digest of the file contents. |
| File.Size | number | The size of the extracted file (bytes). |
countertack-get-file-information
Gets the information of a given file.
Base Command
countertack-get-file-information
Input
| Argument Name | Description | Required |
|---|---|---|
| file_id | The ID of the requested file. To get the “file_id”m run the get-all-files command. |
Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.File.Size | number | The size of the extracted file (in bytes). |
| CounterTack.File.EndpointId | string | The ID of the endpoint with the extracted file. |
| CounterTack.File.ExtractionTime | date | The time that the file was extracted. |
| CounterTack.File.Path | string | Full file system path of the extracted file, including the filename, as seen on the endpoint. |
| CounterTack.File.Sha256 | string | The SHA-256 digest of the file contents. |
| CounterTack.File.Tenant | string | The tenant ID for the endpoint. |
| CounterTack.File.User | string | The name of the user requesting the file. |
| CounterTack.File.Ssdeep | string | The ssdeep digest of the file contents. |
| CounterTack.File.EndpointIp | string | The IP address of the endpoint with the extracted file. |
| CounterTack.File.AvCoverage | number | The percentage of AV engines that determined that the hash is malicious. |
| CounterTack.File.Status | string | The status of the contents. |
| CounterTack.File.VtStatus | string | The status of the VirusTotal report. |
| CounterTack.File.EndpointName | string | The name of the endpoint with the extracted file. |
| CounterTack.File.Id | string | The ID of the extracted file. |
| CounterTack.File.Md5 | string | The MD5 digest of the file contents. |
| CounterTack.File.VtReportLocation | string | The location path of the VirusTotal report. |
| File.MD5 | string | The MD5 digest of the file contents. |
| File.Path | string | The full file system path of the extracted file, including the filename, as seen on the endpoint. |
| File.SHA256 | string | The SHA-256 digest of the file contents. |
| File.SSDeep | string | The ssdeep digest of the file contents. |
| File.Size | number | The size of the extracted file (in bytes). |
countertack-download-file
Downloads an extracted file in ZIP format. The password to unlock the ZIP file is sentinel.
Base Command
countertack-download-file
Input
| Argument Name | Description | Required |
|---|---|---|
| file_id | The ID of the extracted file. To get the “file_id”, run the get-all-files command. |
Required |
Context Output
| Path | Type | Description |
|---|---|---|
| File.Size | number | The size of the extracted file (in bytes). |
| File.SHA1 | string | The SHA-1 digest of the file contents. |
| File.SHA256 | string | The SHA-256 digest of the file contents. |
| File.Name | string | The name of the file. |
| File.SSDeep | string | The ssdeep digest of the file contents. |
| File.EntryID | string | The EntryID of the file. |
| File.Info | string | The file information. |
| File.Type | string | The file type. |
| File.MD5 | string | The MD5 digest of the file contents. |
| File.Extension | string | The extension of the file (.zip). |
countertack-search-events
Searches for events, using CQL expression.
Base Command
countertack-search-events
Input
| Argument Name | Description | Required |
|---|---|---|
| expression | The CQL expression to be used for the search, for example, “events.event_type=basic”. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.Event.SourceProcessTimeStarted | date | The start time for the source process. |
| CounterTack.Event.SourceThreadProcessPid | number | The process PID of the source thread. |
| CounterTack.Event.IsTaintTransfer | boolean | Is the event a malignant transfer. |
| CounterTack.Event.IsBasic | boolean | Is the event a basic event. |
| CounterTack.Event.SourceThreadTimeFinished | date | The exit time of the source thread. |
| CounterTack.Event.SourceThreadTid | number | The TID of the source thread. |
| CounterTack.Event.Tenant | string | The tenant of the event. |
| CounterTack.Event.SourceThreadProcessTimeStarted | date | The start time of the parent process for the source thread. |
| CounterTack.Event.TargetType | string | The system object type that was target of the event (PROCESS, THREAD, REGISTRY, DRIVER, TCPIP,FILE, MUTEX, MEMORY_REGION). |
| CounterTack.Event.ConditionNames | Unknown | The names of the condition triggered by the event. |
| CounterTack.Event.IsOrigin | boolean | Is the event an origin for a trace. |
| CounterTack.Event.endpoint_id | string | The endpoint ID, based on the UUID of the last installed endpoint sensor. |
| CounterTack.Event.TargetFilePath | string | The path of the target file. |
| CounterTack.Events.SourceThreadProcessBackingFilePath | string | The backing file of the source thread. |
| CounterTack.Event.EventType | string | The type of event. |
| CounterTack.Event.IsKey | boolean | Is the event a key event in a trace. |
| CounterTack.Event.SourceType | string | The system object that was the source of the event. |
| CounterTack.Event.SourceThreadProcessName | string | The name of the parent process for the source thread. |
| CounterTack.Event.SourceThreadProcessUser | string | The user associated with the process of the thread. |
| CounterTack.Event.TimeStamp | date | The time that the event was collected. |
| CounterTack.Event.Action | string | The system interaction that characterizes the event. |
| CounterTack.Event.IsTainted | boolean | Are the objects in the event tainted. |
| CounterTack.Event.SourceThreadProcessParentPid | number | The parent PID of the source thread process. |
| CounterTack.Event.SourceProcessPid | number | The PID of the source process. |
| CounterTack.Event.SourceThreadStartAddress | number | The start address of the thread. |
| CounterTack.Event.SourceProcessSid | number | The user SIDs associated with the process. |
| CounterTack.Event.Id | string | The ID of the event. |
| CounterTack.Event.ConditionIds | Unknown | The IDs of the condition triggered by the event. |
| CounterTack.Event.SourceProcessName | string | The name of the process that was the source of the event. |
| CounterTack.Event.SourceProcessUser | string | The user associated with the process |
countertack-kill-process
Terminates all instances of the process identified in the command. Processes can be identified by the PID or process name.
Base Command
countertack-kill-process
Input
| Argument Name | Description | Required |
|---|---|---|
| endpoint_id | The ID of the endpoint. To get the “endpoint_id”, run the get-endpoints command. |
Required |
| process_id | The process PID. To get the “process_id”, run the search-events command. |
Optional |
| process_name | The name of the process. To get the “process_name”, run the search-events command. |
Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.Endpoint.EndpointIds | string | The ID of the source this command is being sent to. |
| CounterTack.Endpoint.TargetType | string | The type of resource or collection this command is being sent to. |
| CounterTack.Endpoint.CommandArg.name | string | The name of the process that was terminated. |
| CounterTack.Endpoint.CommandArg.pid | number | The PID of the process that was terminated. |
| CounterTack.Endpoint.CommandArg | string | The command arguments. |
| CounterTack.Endpoint.Status | string | The status of the command (initial, pending, complete, error). |
| CounterTack.Endpoint.CommandName | string | The name of the command that is sent. |
| CounterTack.Endpoint.Username | string | The username of the user that requested the command. |
| CounterTack.Endpoint.Id | string | The ID of the commands. |
| CounterTack.Endpoint.RequestTime | date | The time at which the client requested the command. |
countertack-search-hashes
Searches for hashes using CQL expressions (Contextual Query Language) to represent queries.
Base Command
countertack-search-hashes
Input
| Argument Name | Description | Required |
|---|---|---|
| expression | The CQL expression to be used for the search (e.g hashes.type = md5). | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.Hash.AvCoverage | number | The percentage of AV engines that determined that the hash is malicious. |
| CounterTack.Hash.Id | string | The ID of the hashes. |
| CounterTack.Hash.Impact | number | The impact score for the event in the hash (1-100). |
| CounterTack.Hash.Type | string | The type of hash (sha256, md5, or ssdeep). |
| CounterTack.Hash.VtReportLocation | string | The report location for VirusTotal report. |
| File.MD5 | string | The MD5 of the file |
| File.SHA256 | string | The SHA-256 of the file. |
| File.SSDeep | string | The ssdeep of the file. |
countertack-search-endpoints
Request for endpoints search using CQL expression (Contextual Query Language) to represent queries.
Base Command
countertack-search-endpoints
Input
| Argument Name | Description | Required |
|---|---|---|
| expression | The CQL expression to be used for the search. (e.g endpoints.status=on). | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.Endpoint.Memory | Number | The RAM of the endpoint (in megabytes). |
| CounterTack.Endpoint.CpuType | Number | Bit length of the CPU architecture. |
| CounterTack.Endpoint.WinRdpPort | Number | RDP port used by the endpoint |
| CounterTack.Endpoint.Macs | String | MAC addresses associated with the endpoint |
| CounterTack.Endpoint.Ip | String | IP address used to connect to the analysis cluster |
| CounterTack.Endpoint.Vendor | String | OS vendor |
| CounterTack.Endpoint.Identifier | String | OS identifier |
| CounterTack.Endpoint.Tenant | String | Tenant ID set at the time of KM installation |
| CounterTack.Endpoint.MaxImpact | Number | Impact of the highest scoring behavior |
| CounterTack.Endpoint.Name | String | Product name of the endpoint OS |
| CounterTack.Endpoint.Ips | String | IP addresses associated with the endpoint |
| CounterTack.Endpoint.CurrentResponsePolicy | String | Currently active response policy |
| CounterTack.Endpoint.ProfileVersion | String | Version of the current profile used for collection |
| CounterTack.Endpoint.CurrentProfile | String | Currently active analysis profile |
| CounterTack.Endpoint.DriverVersion | String | Endpoint sensor version |
| CounterTack.Endpoint.NumCpus | Number | Number of CPUs |
| CounterTack.Endpoint.ClusterConnectionRoute | String | List of hosts the endpoint is currently connected through |
| CounterTack.Endpoint.ClusterHosts | String | The list of hosts that the endpoint tries to connect through (in order). |
| CounterTack.Endpoint.Status | String | Collection status of the endpoint (ON, PAUSE, OFF, INIT) |
| CounterTack.Endpoint.TimeStarted | Date | Time kernel module collection last engaged |
| CounterTack.Endpoint.EventStartTime | Date | The time that the event was captured |
| CounterTack.Endpoint.Version | String | OS version |
| CounterTack.Endpoint.Threat | String | Threat level associated with the endpoint |
| CounterTack.Endpoint.ProductName | String | Product name of the endpoint OS |
| CounterTack.Endpoint.Id | String | Endpoints ID |
| CounterTack.Endpoint.LastActive | Date | Time of last event captured on the endpoint |
| CounterTack.Endpoint.SensorMode | String | Specifies the sensor mode of the driver |
| CounterTack.Endpoint.BehaviorCount | Number | Number of behaviors detected |
| CounterTack.Endpoint.ImpactLevel | String | Threat level of the endpoint.(LOW, MEDIUM, HIGH, CRITICAL) |
| CounterTack.Endpoint.OsType | Number | The OS type. |
| Endpoint.Memory | Number | Endpoint RAM (megabytes) |
| Endpoint.Processors | Number | Number of CPUs |
| Endpoint.Domain | String | DNS suffix for the endpoint |
| Endpoint.OS | String | Product name of the endpoint OS |
| Endpoint.MACAddress | String | The MAC address of the endpoint. |
| Endpoint.Model | String | The analysis profile that is currently active. |
| Endpoint.IPAddress | String | The IP addresses that are associated with the endpoint. |
| Endpoint.OSVersion | String | The endpoint sensor version. |
| Endpoint.Id | String | The ID of the Endpoints. |
countertack-search-behaviors
Request for behaviors search using CQL expression (Contextual Query Language) to represent queries.
Base Command
countertack-search-behaviors
Input
| Argument Name | Description | Required |
|---|---|---|
| expression | The CQL expression to be used for the search(e.g behaviors.event_count<60). | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CounterTack.Behavior.FirstEventId | String | The ID of the first event. |
| CounterTack.Behavior.LastReported | Date | The time that the behavior was last seen. |
| CounterTack.Behavior.Tenant | String | The tenant of the behavior. |
| CounterTack.Behavior.MaxImpact | Number | The impact of the highest scoring event (0-100) |
| CounterTack.Behavior.Name | String | The name of the condition that triggered the behavior. |
| CounterTack.Behavior.EndpointId | String | The ID of the endpoint, based on the UUID of the last installed endpoint sensor |
| CounterTack.Behavior.ReportedOn | Date | The time that the behavior was first seen. |
| CounterTack.Behavior.EventCount | Number | The number of events detected. |
| CounterTack.Behavior.TimeStamp | Date | The start time for the behavior. |
| CounterTack.Behavior.Type | String | The type of behavior (CLASSIFICATION, TRACE) |
| CounterTack.Behavior.Id | String | The ID of the behaviors. |
| CounterTack.Behavior.LastActive | Date | The time that the behavior was last active. |
| CounterTack.Behavior.ImpactLevel | String | The threat level of the behavior (LOW, MEDIUM, HIGH, CRITICAL). |
Configuration parameters
server— Server URL (e.g. https://democloud.countertack.com) (required)credentials— User Name (required)proxy— Use system proxy settingsunsecure— Trust any certificate (not secure)isFetch— Fetch incidentsincidentType— Incident typeincidentFetchInterval— Incidents Fetch Intervalfetch_time— First fetch timestamp (<number> <time unit>, e.g., 12 hours, 7 days, 3 months, 1 year)fetch_notifications— Fetch notifications incidentsfetch_behviors— Fetch behviors incidents
Commands (22)
-
countertack-add-behavior-tagsAdds tags to a given behavior.
-
countertack-add-tagsAdds tags to a given endpoint.
-
countertack-delete-behavior-tagsDeletes the supplied tags from a given behavior.
-
countertack-delete-fileDeletes a file from the given endpoint.
-
countertack-delete-tagsDeletes the supplied tags from a given endpoint.
-
countertack-disable-quarantineRemoves a given endpoint from quarantine.
-
countertack-download-fileDownloads an extracted file in ZIP format. The password to unlock the ZIP file is `sentinel`.
-
countertack-endpoint-quarantineQuarantines a given endpoint.
-
countertack-extract-fileExtracts a file from given endpoint.
-
countertack-get-all-filesGets all extracted files for all endpoints.
-
countertack-get-behaviorGets information of a given behavior.
-
countertack-get-behaviorsReturns information for all behaviors.
-
countertack-get-endpointGet information on specific endpoint
-
countertack-get-endpoint-filesReturns all extracted files from a given endpoint.
-
countertack-get-endpoint-tagsGets the tags of a given endpoint.
-
countertack-get-endpointsReturns information for endpoints.
-
countertack-get-file-informationGets the information of a given file.
-
countertack-kill-processTerminates all instances of the process identified in the command. Processes can be identified by the PID or process name.
-
countertack-search-behaviorsRequest for behaviors search using CQL expression (Contextual Query Language) to represent queries.
-
countertack-search-endpointsRequest for endpoints search using CQL expression (Contextual Query Language) to represent queries.
-
countertack-search-eventsSearches for events, using CQL expression.
-
countertack-search-hashesSearches for hashes using CQL expressions (Contextual Query Language) to represent queries.
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * """ IMPORTS """ import json import os.path import requests import urllib3 # Disable insecure warnings urllib3.disable_warnings() # remove proxy if not set to true in params if not demisto.params().get("proxy"): # Remove proxy environment variables if they exist for proxy_var in ["HTTP_PROXY", "HTTPS_PROXY", "http_proxy", "https_proxy"]: os.environ.pop(proxy_var, None) """ GLOBALS/PARAMS """ USERNAME = demisto.params().get("credentials").get("identifier") PASSWORD = demisto.params().get("credentials").get("password") SERVER_URL = ( demisto.params().get("server")[:-1] if demisto.params().get("server").endswith("/") else demisto.params().get("server") ) FETCH_TIME = demisto.params().get("fetch_time", "3 days").strip() FETCH_NOTIFICATIONS = demisto.params().get("fetch_notifications") FETCH_BEHAVIORS = demisto.params().get("fetch_behviors") # Should we use SSL USE_SSL = not demisto.params().get("unsecure", False) # Service base URL BASE_PATH = f"{SERVER_URL}/api/v2/" # Headers to be sent in requests DEFAULT_HEADERS = {"Content-Type": "application/json"} def http_request(method, suffix_url, headers=DEFAULT_HEADERS, body=None): """ returns the http request """ url = BASE_PATH + suffix_url response = requests.request(method, url, auth=(USERNAME, PASSWORD), headers=headers, verify=USE_SSL, data=body) # handle request failure if response.status_code not in {200}: message = parse_error_response(response) return_error(f"Error in API call to CounterTack with status code {response.status_code}\n{message}") try: response = response.json() except Exception: return_error(response.content) return response def parse_error_response(response): try: res = response.json() msg = res.get("message") if res.get("details") is not None and res.get("details")[0].get("message") is not None: msg = msg + "\n" + json.dumps(res.get("details")[0]) except Exception: return response.text return msg """ ENDPOINTS """ def get_endpoints_request(): """ This request returns a collection of endpoints. """ suffix_url = "endpoints" response = http_request("GET", suffix_url) return response def get_endpoints(): """ Returns the information on existing endpoints """ data = [] endpoint_standards = [] endpoints = get_endpoints_request() for endpoint in endpoints: data.append( { "Id": endpoint.get("id"), "Name": endpoint.get("name"), "OS": endpoint.get("product_name"), "IP": endpoint.get("ips"), "Status": endpoint.get("status"), "Threat": endpoint.get("threat"), } ) endpoint_standards.append( { "Id": endpoint.get("id"), "IPAddress": endpoint.get("ips"), "Domain": endpoint.get("domain"), "MACAddress": endpoint.get("mac"), "OS": endpoint.get("product_name"), "OSVersion": endpoint.get("driver_version"), "Model": endpoint.get("current_profile"), "Memory": endpoint.get("memory"), "Processors": endpoint.get("num_cpus"), } ) context = { "CounterTack.Endpoint(val.Id && val.Id === obj.Id)": createContext(endpoints, keyTransform=underscoreToCamelCase), "Endpoint": endpoint_standards, } headers = ["OS", "Name", "Threat", "Status", "Id", "IP"] entry = { "Type": entryTypes["note"], "Contents": endpoints, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("CounterTack Endpoints", data, headers, removeNull=True), "EntryContext": context, } demisto.results(entry) def get_endpoint_request(endpoint_id): """ Request for a specific endpoint """ suffix_url = "endpoints/" + endpoint_id response = http_request("GET", suffix_url) return response def get_endpoint(): """ Get the information for the requested endpoint demisto parameter: (string) endpoint_id The unique ID of the endpoint returns: The information about the specified endpoint """ endpoint_id = demisto.args().get("endpoint_id") response = get_endpoint_request(endpoint_id) content = { "OS": response.get("product_name"), "Domain": response.get("domain"), "IP": response.get("ip"), "Threat": response.get("threat"), "MaxImpact": response.get("max_impact"), "TenantID": response.get("tenant"), "IsQuarantined": response.get("is_quarantined"), "Profile": response.get("current_profile"), "Cluster_hosts": response.get("cluster_hosts"), "Status": response.get("status"), "Tags": response.get("tags"), } endpoint_standards = { "Id": response.get("id"), "IPAddress": response.get("ips"), "Domain": response.get("domain"), "MACAddress": response.get("mac"), "OS": response.get("product_name"), "OSVersion": response.get("driver_version"), "Model": response.get("current_profile"), "Memory": response.get("memory"), "Processors": response.get("num_cpus"), } context = { "CounterTack.Endpoint(val.Id && val.Id === obj.Id)": createContext(response, keyTransform=underscoreToCamelCase), "Endpoint": endpoint_standards, } headers = [ "OS", "Domain", "IP", "Threat", "MaxImpact", "TenantID", "IsQuarantined", "Profile", "Tags", "Cluster_Hosts", "Status", ] entry = { "Type": entryTypes["note"], "Contents": response, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("CounterTack Endpoint information:", content, headers, removeNull=True), "EntryContext": context, } demisto.results(entry) """ ENDPOINTS TAGS """ def endpoint_tags_request(endpoint_id): """ This request retrieves tags from specified endpoint """ suffix_url = "endpoints/" + endpoint_id + "/tags" response = http_request("GET", suffix_url) return response def get_endpoint_tags(): """ Get the tags for the specified endpoint demisto parameter: (string) endpoint_id The unique ID of the endpoint """ endpoint_id = demisto.args().get("endpoint_id") response = endpoint_tags_request(endpoint_id) response = {"tags": response} tags_context = {"Id": endpoint_id, "tags": response} context = { "CounterTack.Endpoint(val.Id && val.Id === obj.Id)": createContext(tags_context, keyTransform=underscoreToCamelCase) } entry = { "Type": entryTypes["note"], "Contents": response, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("CounterTack tags for the specified endpoint:", response, removeNull=True), "EntryContext": context, } demisto.results(entry) def add_tags_request(endpoint_id, body): """ The request adds tags to specified endpoint The request gets the endpoint ID and the tags the user wants to add. """ suffix_url = "endpoints/" + endpoint_id + "/tags" response = http_request("POST", suffix_url, body=json.dumps(body)) return response def add_tags(): """ The command add tags for the specified endpoint. demisto parameter: (string) endpoint_id The unique ID of the endpoint demisto parameter: (array) body The tags to add to the endpoint """ endpoint_id = demisto.args().get("endpoint_id") body = argToList(demisto.args().get("tags")) response = add_tags_request(endpoint_id, body) response = endpoint_tags_request(endpoint_id) response = {"tags": response, "Id": endpoint_id} context = {"CounterTack.Endpoint(val.Id && val.Id === obj.Id)": createContext(response, keyTransform=underscoreToCamelCase)} entry = { "Type": entryTypes["note"], "Contents": response, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("Endpoint tags were added successfully", response), "EntryContext": context, } demisto.results(entry) def delete_tags_request(endpoint_id, body): """ This request deletes specific tags from specified endpoint. demisto parameter: (string) endpoint_id The unique ID of the endpoint demisto parameter: (array) body The tags to delete from the endpoint """ suffix_url = "endpoints/" + endpoint_id + "/tags" response = http_request("DELETE", suffix_url, body=json.dumps(body)) return response def delete_tags(): """ The command deletes tags for the specified endpoint. demisto parameter: (string) endpoint_id The unique ID of the endpoint demisto parameter: (array) body The tags to delete from the endpoint """ endpoint_id = demisto.args().get("endpoint_id") body = argToList(demisto.args().get("tags")) response = delete_tags_request(endpoint_id, body) response = endpoint_tags_request(endpoint_id) response = {"tags": response, "Id": endpoint_id} context = {"CounterTack.Endpoint(val.Id && val.Id === obj.Id)": createContext(response, keyTransform=underscoreToCamelCase)} entry = { "Type": entryTypes["note"], "Contents": response, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("Endpoint tags were deleted successfully", response), "EntryContext": context, } demisto.results(entry) """ ENDPOINTS COMMANDS """ def endpoint_quarantine_request(endpoint_id, body): """ Request to quarantine a specified endpoint demisto parameter: (string) endpoint_id The unique ID of the endpoint demisto parameter: (string) type The type of the command: quarantine """ suffix_url = "endpoints/" + endpoint_id + "/commands" response = http_request("POST", suffix_url, body=json.dumps(body)) return response def endpoint_quarantine(): """ Prevents an endpoint(s) from any network communication, but maintains a connection to the Sentinel Cluster and addresses defined in the Global Whitelist. demisto parameter: (string) endpoint_id The unique ID of the endpoint demisto parameter: (string) type The type of the command: quarantine """ endpoint_id = demisto.args().get("endpoint_id") body = {"type": "quarantine"} response = endpoint_quarantine_request(endpoint_id, body) quarantine_response = get_endpoint_request(endpoint_id) quarantine_context = {"Id": endpoint_id, "is_quarantine": quarantine_response.get("is_quarantined")} context = { "CounterTack.Endpoint(val.Id && val.Id === obj.Id)": createContext(quarantine_context, keyTransform=underscoreToCamelCase) } data = { "Id": response.get("id"), "user name": response.get("username"), "request time": response.get("request_time"), "endpoint ID": response.get("endpoint_ids"), "command name": response.get("command_name"), "status": response.get("status"), } entry = { "Type": entryTypes["note"], "Contents": quarantine_context, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("The command has been applied successfully:", data, removeNull=True), "EntryContext": context, } demisto.results(entry) def disable_quarantine(): """ Allows a previously quarantined endpoint to communicate with the network. demisto parameter: (string) endpoint_id The unique ID of the endpoint demisto parameter: (string) type The type of the command: lift_quarantine """ endpoint_id = demisto.args().get("endpoint_id") body = {"type": "lift_quarantine"} response = endpoint_quarantine_request(endpoint_id, body) quarantine_response = get_endpoint_request(endpoint_id) quarantine_context = {"Id": endpoint_id, "is_quarantine": quarantine_response.get("is_quarantined")} data = { "Id": response.get("id"), "user name": response.get("username"), "request time": response.get("request_time"), "endpoint ID": response.get("endpoint_ids"), "command name": response.get("command_name"), "status": response.get("status"), } context = { "CounterTack.Endpoint(val.Id && val.Id === obj.Id)": createContext(quarantine_context, keyTransform=underscoreToCamelCase) } entry = { "Type": entryTypes["note"], "Contents": quarantine_context, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("The command has been applied successfully:", data, removeNull=True), "EntryContext": context, } demisto.results(entry) def file_extract_request(endpoint_id, body): """ Request for extracting file from specified endpoint """ suffix_url = "endpoints/" + endpoint_id + "/commands" response = http_request("POST", suffix_url, body=json.dumps(body)) return response def extract_file(): """ Enables an API consumer to extract the file in addition to some file metadata. demisto parameter: (string) endpoint_id The unique ID of the endpoint demisto parameter: (string) body The type of the command: extract file and the file path """ endpoint_id = demisto.args().get("endpoint_id") paths = argToList(demisto.args().get("file_path")) body = {"type": "extract_files", "paths": paths} response = file_extract_request(endpoint_id, body) data = { "Id": response.get("id"), "User Name": response.get("username"), "Request Time": response.get("request_time"), "Endpoint ID": response.get("endpoint_ids"), "Command Name": response.get("command_name"), "Command Arguments": response.get("command_arg"), "Status": response.get("status"), } context = {"CounterTack.File(val.Id && val.Id === obj.Id)": createContext(response, keyTransform=underscoreToCamelCase)} headers = ["Id", "User Name", "Request Time", "Endpoint ID", "Command Name", "Command Arguments", "Status"] entry = { "Type": entryTypes["note"], "Contents": response, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("The file has been extracted successfully:", data, headers, removeNull=True), "EntryContext": context, } demisto.results(entry) def delete_file_request(endpoint_id, body): """ Deletes a file from the specified endpoint """ suffix_url = "endpoints/" + endpoint_id + "/commands" response = http_request("POST", suffix_url, body=json.dumps(body)) return response def delete_file(): """ Deletes a file from the specified endpoint demisto parameter: (string) endpoint_id The unique ID of the endpoint demisto parameter: (string) body The type of the command: delete_file and the file path """ endpoint_id = demisto.args().get("endpoint_id") path = demisto.args().get("file_path") body = {"type": "delete_file", "path": path} delete_file_request(endpoint_id, body) demisto.results("The file has been deleted successfully") def kill_process_request(endpoint_id, body): """ Reqquest to terminates all instances of the process identified in the command. """ suffix_url = "endpoints/" + endpoint_id + "/commands" response = http_request("POST", suffix_url, body=json.dumps(body)) return response def kill_process(): """ Terminates all instances of the process identified in the command. Processes can be identified by the PID or process name. demisto parameter: (string) endpoint_id The unique ID of the endpoint demisto parameter: (string) process_id The ID of the process to terminate demisto parameter: (string) process_name The name of the process to terminate """ endpoint_id = demisto.args().get("endpoint_id") pid = demisto.args().get("process_id") name = demisto.args().get("process_name") if not pid and not name: return_error("Please provide either process_id or process_name") body = {"type": "kill_process", "pid": pid, "name": name} response = kill_process_request(endpoint_id, body) data = { "Id": response.get("id"), "User Name": response.get("username"), "Request Time": response.get("request_time"), "Endpoint ID": response.get("endpoint_ids"), "Command Name": response.get("command_name"), "Status": response.get("status"), } context = { "CounterTack.Endpoint(val.Id && val.Id === obj.Id)": createContext( response, keyTransform=underscoreToCamelCase, removeNull=True ) } entry = { "Type": entryTypes["note"], "Contents": response, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("The process has been terminated", data, removeNull=True), "EntryContext": context, } demisto.results(entry) """ ENDPOINT FILES """ def file_request(): """ This request retrieves all extracted files for all endpoints on the cluster """ suffix_url = "endpoints/files" response = http_request("GET", suffix_url) return response def get_all_files(): data = [] files_standards = [] files = file_request() for file in files: data.append( { "Id": file.get("id"), "user": file.get("user"), "endpoint_id": file.get("endpoint_id"), "path": file.get("path"), "extraction_time": file.get("extraction_time"), "Status": file.get("status"), } ) files_standards.append( { "Size": file.get("size"), "MD5": file.get("md5"), "SHA256": file.get("sha256"), "SSDeep": file.get("ssdeep"), "Path": file.get("path"), } ) context = { "CounterTack.File(val.Id && val.Id === obj.Id)": createContext(files, keyTransform=underscoreToCamelCase), outputPaths["file"]: files_standards, } headers = ["Status", "Id", "path", "endpoint_id", "extraction_time", "user"] entry = { "Type": entryTypes["note"], "Contents": files, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("CounterTack Endpoints Files", data, headers, removeNull=True), "EntryContext": context, } demisto.results(entry) def endpoint_files_request(endpoint_id): """ This request returns all extracted files from specified endpoint """ suffix_url = "endpoints/" + endpoint_id + "/files" response = http_request("GET", suffix_url) return response def get_endpoint_files(): """ Returns extracted files from specific endpoint demisto parameter: (string) endpoint_id The unique ID of the endpoint """ endpoint_id = demisto.args().get("endpoint_id") data = [] files_standards = [] files = endpoint_files_request(endpoint_id) for file in files: data.append( { "Id": file.get("id"), "User": file.get("user"), "EndpointId": file.get("endpoint_id"), "Path": file.get("path"), "ExtractionTime": file.get("extraction_time"), "Status": file.get("status"), } ) files_standards.append( { "Size": file.get("size"), "MD5": file.get("md5"), "SHA256": file.get("sha256"), "SSDeep": file.get("ssdeep"), "Path": file.get("path"), } ) context = { "CounterTack.File(val.Id && val.Id === obj.Id)": createContext(files, keyTransform=underscoreToCamelCase), outputPaths["file"]: files_standards, } headers = ["Status", "Id", "path", "endpoint_id", "extraction_time", "user"] entry = { "Type": entryTypes["note"], "Contents": data, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("The extracted files from the endpoint:", data, headers, removeNull=True), "EntryContext": context, } demisto.results(entry) def file_information_request(file_id): """ request specific file information """ suffix_url = "endpoints/files/" + file_id response = http_request("GET", suffix_url) return response def get_file_information(): """ Get the information of a specific file demisto parameter: (string) file_id The unique ID of the extracted file """ context = {} files_standards = [] file_id = demisto.args().get("file_id") response = file_information_request(file_id) data = { "endpoint_name": response.get("endpoint_name"), "path": response.get("path"), "size": response.get("size"), "extraction_time": response.get("extraction_time"), "status": response.get("status"), } files_standards.append( { "Size": response.get("size"), "MD5": response.get("md5"), "SHA256": response.get("sha256"), "SSDeep": response.get("ssdeep"), "Path": response.get("path"), } ) context["CounterTack.File(val.Id && val.Id === obj.Id)"] = createContext(response, keyTransform=underscoreToCamelCase) context[outputPaths["file"]] = files_standards headers = ["endpoint_name", "path", "size", "status", "extraction_time"] entry = { "Type": entryTypes["note"], "Contents": response, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("CounterTack File Information:", data, headers, removeNull=True), "EntryContext": context, } demisto.results(entry) def download_file_request(file_id): # This request downloads an extracted file. suffix_url = "downloads/extractedfiles/" + file_id response = http_request("GET", suffix_url) return response def download_file(): """ Download an extracted file in a ZIP format. demisto parameter: (string) file_id The unique ID of the extracted file """ file_id = demisto.args().get("file_id") response = download_file_request(file_id) demisto.results(fileResult(file_id + ".zip", response.content)) """ BEHAVIORS """ def get_behaviors_request(): """ This request retrieves information on a collection of behaviors. """ suffix_url = "behaviors" response = http_request("GET", suffix_url) return response def get_behaviors(): """ retrieve information on a collection of behaviors. """ data = [] behaviors = get_behaviors_request() for behavior in behaviors: data.append( { "Id": behavior.get("id"), "Name": behavior.get("name"), "Type": behavior.get("type"), "ImpactLevel": behavior.get("impact_level"), "lastReported": behavior.get("last_reported"), "EndpointId": behavior.get("endpoint_id"), } ) context = {"CounterTack.Behavior(val.Id && val.Id === obj.Id)": createContext(behaviors, keyTransform=underscoreToCamelCase)} headers = ["Name", "Id", "Type", "ImpactLevel", "EndpointId", "lastReported"] entry = { "Type": entryTypes["note"], "Contents": behaviors, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("CounterTack Endpoints Behaviors", data, headers, removeNull=True), "EntryContext": context, } demisto.results(entry) def get_behavior_request(behavior_id): """ Request for getting specified behvior """ suffix_url = "behaviors/" + behavior_id response = http_request("GET", suffix_url) return response def get_behavior(): """ Get behavior information demisto parameter: behavior_id(string) The unique ID of the behvior """ behavior_id = demisto.args().get("behavior_id") response = get_behavior_request(behavior_id) data = { "Id": response.get("id"), "Name": response.get("name"), "ImpactLevel": response.get("impact_level"), "LastActive": response.get("last_active"), "EventCount": response.get("event_count"), "MaxImpact": response.get("max_impact"), "EndpointId": response.get("endpoint_id"), "Type": response.get("type"), } context = {"CounterTack.Behavior(val.Id && val.Id === obj.Id)": createContext(response, keyTransform=underscoreToCamelCase)} headers = ["Name", "Id", "ImpactLevel", "MaxImpact", "EventCount", "Type", "EndpointId", "LastActive"] entry = { "Type": entryTypes["note"], "Contents": response, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("CounterTack Behavior information", data, headers, removeNull=True), "EntryContext": context, } demisto.results(entry) """ BEHAVIORS TAGS """ def behaviour_add_tags_request(behaviour_id, body): """ The request adds tags to specified behaviour """ suffix_url = "behaviors/" + behaviour_id + "/tags" response = http_request("POST", suffix_url, body=json.dumps(body)) return response def add_behavior_tags(): """ Add specific tags to specified behavior demisto parameter: (string) behavior_id The unique ID of the behavior demisto parameter: (Array) Body. The tags to add to the behavior. seperate the tags with comma """ behaviour_id = demisto.args().get("behaviour_id") body = argToList(demisto.args().get("tags")) response = behaviour_add_tags_request(behaviour_id, body) behavior_tags = get_behavior_request(behaviour_id) response = {"tags": behavior_tags.get("tags"), "Id": behaviour_id} context = {"CounterTack.Behavior(val.Id && val.Id === obj.Id)": createContext(response, keyTransform=underscoreToCamelCase)} entry = { "Type": entryTypes["note"], "Contents": response, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("Behavior tags were added successfully", response), "EntryContext": context, } demisto.results(entry) def delete_tags_behavior_request(behaviour_id, body): suffix_url = "behaviors/" + behaviour_id + "/tags" response = http_request("DELETE", suffix_url, body=json.dumps(body)) return response def delete_behavior_tags(): """ Delete specific tags from behavior demisto parameter: (string) behavior_id The unique ID of the behavior demisto parameter: (Array) Body. The tags to delete from the behavior. seperate the tags with comma """ behaviour_id = demisto.args().get("behaviour_id") body = argToList(demisto.args().get("tags")) response = delete_tags_behavior_request(behaviour_id, body) response = get_behavior_request(behaviour_id) response = {"tags": response.get("tags"), "Id": behaviour_id} context = {"CounterTack.Behavior(val.Id && val.Id === obj.Id)": createContext(response, keyTransform=underscoreToCamelCase)} entry = { "Type": entryTypes["note"], "Contents": response, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("Endpoint tags were deleted successfully", response, removeNull=True), "EntryContext": context, } demisto.results(entry) """ SEARCH """ def search_endpoints_request(exp): """ Request for endpoints search using CQL expression """ suffix_url = "search/endpoints" + exp response = http_request("GET", suffix_url) return response def search_behaviors_request(exp): """ Request for endpoints search using CQL expression """ suffix_url = "search/behaviors" + exp response = http_request("GET", suffix_url) return response def search_events_request(exp): """ Request for events search using CQL expression """ suffix_url = "search/events" + exp response = http_request("GET", suffix_url) return response def search_events(): """ Request for events search using CQL expression demisto parameter: (dict) expression The CQL expression to be used for the search """ data = [] expression = demisto.args().get("expression") exp = "?expression=" + expression events = search_events_request(exp) if events.get("results"): results = events.get("results") results_lst = [] for i in range(len(results)): results_lst.append({k.replace("events.", ""): v for k, v in results[i].items()}) events["results"] = results_lst for event in events.get("results"): data.append( { "Id": event.get("id"), "Events Action": event.get("action"), "Events Impact": event.get("impact"), "Events EndpointID": event.get("endpoint_id"), "Event Type": event.get("event_type"), "Collected time": event.get("time_stamp"), "Source process PID": event.get("source_process_pid"), "Source process name": event.get("source_process_name"), } ) context = { "CounterTack.Event(val.Id && val.Id === obj.Id)": createContext( results_lst, keyTransform=underscoreToCamelCase, removeNull=True ) } headers = [ "ID", "Event Type", "Events Action", "Events EndpointID", "Events Impact", "Collected time", "Source process PID", "Source process name", ] entry = { "Type": entryTypes["note"], "Contents": results_lst, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("Results of the events search", data, headers, removeNull=True), "EntryContext": context, } demisto.results(entry) else: demisto.results("No results found") def search_endpoints(): """ Request for endpoints search using CQL expression demisto parameter: (dict) expression The CQL expression to be used for the search """ data = [] endpoint_standards = [] expression = demisto.args().get("expression") exp = "?expression=" + expression endpoints = search_endpoints_request(exp) if endpoints.get("results"): results = endpoints.get("results") results_lst = [] for i in range(len(results)): results_lst.append({k.replace("endpoints.", ""): v for k, v in results[i].items()}) endpoints["results"] = results_lst for endpoint in endpoints.get("results"): data.append( { "Id": endpoint.get("id"), "Name": endpoint.get("name"), "OS": endpoint.get("product_name"), "IP": endpoint.get("ips"), "Status": endpoint.get("status"), "Threat": endpoint.get("threat"), } ) endpoint_standards.append( { "Id": endpoint.get("id"), "IPAddress": endpoint.get("ips"), "Domain": endpoint.get("domain"), "MACAddress": endpoint.get("mac"), "OS": endpoint.get("product_name"), "OSVersion": endpoint.get("driver_version"), "Model": endpoint.get("current_profile"), "Memory": endpoint.get("memory"), "Processors": endpoint.get("num_cpus"), } ) context = { "CounterTack.Endpoint(val.Id && val.Id === obj.Id)": createContext( results_lst, keyTransform=underscoreToCamelCase, removeNull=True ), "Endpoint": endpoint_standards, } headers = ["Status", "Name", "Id", "OS", "Events Impact", "Threat", "IP"] entry = { "Type": entryTypes["note"], "Contents": results_lst, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("Results of the endpoints search", data, headers, removeNull=True), "EntryContext": context, } demisto.results(entry) else: demisto.results("No results found") def search_behaviors(): """ Request for behaviors search using CQL expression demisto parameter: (dict) expression The CQL expression to be used for the search """ data = [] expression = demisto.args().get("expression") exp = "?expression=" + expression behaviors = search_behaviors_request(exp) if behaviors.get("results"): results = behaviors.get("results") results_lst = [] for i in range(len(results)): results_lst.append({k.replace("behaviors.", ""): v for k, v in results[i].items()}) behaviors["results"] = results_lst for behavior in behaviors.get("results"): data.append( { "Id": behavior.get("id"), "Name": behavior.get("name"), "Type": behavior.get("type"), "Impact_Level": behavior.get("impact_level"), "lastReported": behavior.get("last_reported"), "EndpointID": behavior.get("endpoint_id"), } ) context = { "CounterTack.Behavior(val.Id && val.Id === obj.Id)": createContext( results_lst, keyTransform=underscoreToCamelCase, removeNull=True ) } headers = ["Name", "Type", "Impact_Level", "Id", "EndpointID", "lastReported"] entry = { "Type": entryTypes["note"], "Contents": results_lst, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("Results of the behaviors search", data, headers, removeNull=True), "EntryContext": context, } demisto.results(entry) else: demisto.results("No results found") def hashes_search_request(exp): """ Request for Hashed search using CQL expression """ suffix_url = "search/hashes" + exp response = http_request("GET", suffix_url) return response def search_hashes(): """ Request for hashes search using CQL expression demisto parameter: (dict) expression The CQL expression to be used for the search """ data = [] file_standards = [] expression = demisto.args().get("expression") exp = "?expression=" + expression hashes = hashes_search_request(exp) if hashes.get("results"): results = hashes.get("results") results_lst = [] for i in range(len(results)): results_lst.append({k.replace("hashes.", ""): v for k, v in results[i].items()}) hashes["results"] = results_lst for hash_type in hashes.get("results"): file_hash_type = hash_type.get("type", "").upper() if file_hash_type == "SSDEEP": file_hash_type = "SSDeep" hash_id = hash_type.get("id") data.append( { file_hash_type: hash_id, "Type": file_hash_type, "Impact": hash_type.get("impact"), "VT report location": hash_type.get("vt_report_location"), "AV Coverage": hash_type.get("av_coverage"), } ) if file_hash_type: file_standards.append({file_hash_type: hash_id}) context = { "CounterTack.Hash(val.hash_id && val.hash_id === obj.hash_id)": createContext(data), outputPaths["file"]: file_standards, } entry = { "Type": entryTypes["note"], "Contents": results_lst, "ContentsFormat": formats["json"], "ReadableContentsFormat": formats["markdown"], "HumanReadable": tableToMarkdown("Results of the hashes search:", data, removeNull=True), "EntryContext": context, } demisto.results(entry) else: demisto.results("No results found") """ FETCH INCIDENTS """ def search_notifications_request(params=""): """ Request for notifications search using CQL expression """ suffix_url = "search/notifications?expression=" + params response = http_request("GET", suffix_url) return response def fetch_behaviors_request(params=""): """ Request for behaviors search using CQL expression """ suffix_url = "search/behaviors?expression=" + params response = http_request("GET", suffix_url) return response def fetch_incidents(): incidents = [] last_run = demisto.getLastRun() if last_run and last_run["time_stamp"]: last_update_time = last_run["time_stamp"] else: # In first run last_update_time, _ = parse_date_range(FETCH_TIME, date_format="%Y-%m-%dT%H:%M:%S.%f"[:-3]) max_timestamp = last_update_time if FETCH_BEHAVIORS: params = "behaviors.time_stamp>" + last_update_time behaviors = fetch_behaviors_request(params) for behavior in behaviors.get("results"): incident = behavior_to_incident(behavior) # 0 corresponds to never triggered time_stamp = behavior.get("behaviors.time_stamp")[:-5] # comapre time_stamp if time_stamp > max_timestamp: max_timestamp = time_stamp incidents.append(incident) if FETCH_NOTIFICATIONS: params = "notifications.time_stamp>" + last_update_time notifications = search_notifications_request(params) for notification in notifications.get("results"): incident = notifications_to_incidents(notification) time_stamp = notification.get("notifications.time_stamp")[:-5] if time_stamp > max_timestamp: max_timestamp = time_stamp incidents.append(incident) demisto.setLastRun({"time_stamp": max_timestamp}) demisto.incidents(incidents) def behavior_to_incident(behavior): incident = {} incident["name"] = "CounterTack Behavior - " + behavior.get("behaviors.name") incident["rawJSON"] = json.dumps(behavior) return incident def notifications_to_incidents(notification): incident = {} incident["name"] = "CounterTack Notification - " + notification.get("notifications.message") incident["rawJSON"] = json.dumps(notification) return incident """ EXECUTION """ command = demisto.command() LOG(f'Running command "{command}"') try: if command == "test-module": get_endpoints_request() demisto.results("ok") elif command == "fetch-incidents": fetch_incidents() elif command == "countertack-get-endpoints": get_endpoints() elif command == "countertack-get-endpoint": get_endpoint() elif command == "countertack-get-endpoint-tags": get_endpoint_tags() elif command == "countertack-add-tags": add_tags() elif command == "countertack-delete-tags": delete_tags() elif command == "countertack-endpoint-quarantine": endpoint_quarantine() elif command == "countertack-disable-quarantine": disable_quarantine() elif command == "countertack-extract-file": extract_file() elif command == "countertack-delete-file": delete_file() elif command == "countertack-get-all-files": get_all_files() elif command == "countertack-get-endpoint-files": get_endpoint_files() elif command == "countertack-get-file-information": get_file_information() elif command == "countertack-download-file": download_file() elif command == "countertack-get-behaviors": get_behaviors() elif command == "countertack-get-behavior": get_behavior() elif command == "countertack-add-behavior-tags": add_behavior_tags() elif command == "countertack-delete-behavior-tags": delete_behavior_tags() elif command == "countertack-search-events": search_events() elif command == "countertack-search-hashes": search_hashes() elif command == "countertack-search-endpoints": search_endpoints() elif command == "countertack-search-behaviors": search_behaviors() elif command == "countertack-kill-process": kill_process() except Exception as e: return_error(e) LOG(e)