CheckPointHarmonyEndpoint

Checkpoint Harmony Endpoint provides a complete endpoint security solution built to protect organizations and the remote workforce from today's complex threat landscape.

Endpoint · Check Point Harmony Endpoint

Details

IDCheckPointHarmonyEndpoint
ProviderCheckPoint Software Technologies
CategoryEndpoint
From Version6.10.0
Docker Imagedemisto/python3:3.12.13.10116658
Supported ModulesAgentix XSIAM

README

Checkpoint Harmony Endpoint provides a complete endpoint security solution built to protect organizations and the remote workforce from today’s complex threat landscape.
This integration was integrated and tested with version 1 of CheckPointHarmonyEndpoint.

Configure Check Point Harmony Endpoint in Cortex

Parameter Required
Base URL True
Client ID True
Secret Key True
Trust any certificate (not secure) False
Use system proxy settings 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.

harmony-ep-job-status-get


Retrieves the status and result (if any) of a given asynchronous operation. A job is a way to monitor the progress of an asynchronous operation while avoiding issues that may manifest during long synchronous waits.

Base Command

harmony-ep-job-status-get

Input

Argument Name Description Required
job_id The ID of the operation to query the status of. Job ID will returned from most of the commands in this integration. It can be found in the context path. Required

Context Output

Path Type Description
HarmonyEP.Job.data String The job data.
HarmonyEP.Job.status String The job status.

Command example


#### Context Example

```json
{
    "HarmonyEP": {
        "Job": {
            "data": {
                "data": [
                    {
                        "machine": {
                            "id": "1",
                            "name": "DESKTOP-1"
                        },
                        "operation": {
                            "response": null,
                            "status": "DA_NOT_INSTALLED"
                        }
                    },
                    {
                        "machine": {
                            "id": "2",
                            "name": "DESKTOP-2"
                        },
                        "operation": {
                            "response": null,
                            "status": "DA_NOT_INSTALLED"
                        }
                    }
                ],
                "metadata": {
                    "count": 2,
                    "from": 0,
                    "to": 100
                }
            },
            "status": "DONE",
            "statusCode": 200,
            "statusType": 2
        }
    }
}

Human Readable Output

Results

data status statusCode statusType
data: {‘machine’: {‘id’: ‘1’, ‘name’: ‘DESKTOP-1’}, ‘operation’: {‘response’: None, ‘status’: ‘DA_NOT_INSTALLED’}},
{‘machine’: {‘id’: ‘2’, ‘name’: ‘DESKTOP-2’}, ‘operation’: {‘response’: None, ‘status’: ‘DA_NOT_INSTALLED’}}
metadata: {“from”: 0, “to”: 100, “count”: 2}
DONE 200 2

harmony-ep-ioc-list


Gets a list of all Indicators of Compromise. Use the filter parameters to fetch specific IOCs.

Base Command

harmony-ep-ioc-list

Input

Argument Name Description Required
filter The indicator value or comment to search for. The filter is case-insensitive. For example, filter ‘efg will match IoCs ‘abcdEFG’, ‘efGGG’, and ‘yEfG’. Optional
field The Indicator of Compromise field to search by. Possible values are: iocValue, iocComment. Default is iocValue. Optional
sort_direction The way to sort the results. Possible values are: ASC, DESC. Default is DESC. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional

Context Output

Path Type Description
HarmonyEP.IOC.comment String The IOC comment.
HarmonyEP.IOC.modifiedOn Number The time the IOC was modified.
HarmonyEP.IOC.value String The IOC value.
HarmonyEP.IOC.type String The IOC type.
HarmonyEP.IOC.id String The IOC ID.

Command example


#### Context Example

```json
{
    "HarmonyEP": {
        "IOC": [
            {
                "comment": "test",
                "id": "3",
                "modifiedOn": "2024-04-03T09:15:04.182Z",
                "type": "Domain",
                "value": "test2.com"
            },
            {
                "comment": "comment",
                "id": "4",
                "modifiedOn": "2024-05-20T13:14:28.290Z",
                "type": "Domain",
                "value": "test1.com"
            }
        ]
    }
}

Human Readable Output

IOC List

Showing page 1.
Current page size: 50.

Id Type Value Comment Modifiedon
3 Domain test2.com test 2024-04-03T09:15:04.182Z
4 Domain test1.com comment 2024-05-20T13:14:28.290Z

harmony-ep-ioc-update


Updates the given Indicators of Compromise with the given parameters.

Base Command

harmony-ep-ioc-update

Input

Argument Name Description Required
ioc_id The ID of the IOC to update. Use harmony-ep-ioc-list command to get all IOC IDs. Required
comment The IOC comment to update. Required
value The IOC value to update. Required
type The IOC type to update. Possible values are: Domain, IP, URL, MD5, SHA1. Required

Context Output

Path Type Description
HarmonyEP.IOC.comment String The IOC comment.
HarmonyEP.IOC.modifiedOn Number The time the IOC was modified.
HarmonyEP.IOC.value String The IOC value.
HarmonyEP.IOC.type String The IOC type.
HarmonyEP.IOC.id String The IOC ID.

Command example

!harmony-ep-ioc-update ioc_id=8 comment=test value=8.8.8.8 type=IP

Context Example

{
    "HarmonyEP": {
        "IOC": {
            "comment": "test",
            "id": "8",
            "modifiedOn": "2024-06-24T06:44:49.214Z",
            "type": "IP",
            "value": "8.8.8.8"
        }
    }
}

Human Readable Output

IOC 8 was updated successfully

Id Type Value Comment Modifiedon
8 IP 8.8.8.8 test 2024-06-24T06:44:49.214Z

harmony-ep-ioc-create


Creates new Indicators of Compromise using the given parameters.

Base Command

harmony-ep-ioc-create

Input

Argument Name Description Required
comment The IOC comment. Required
value The IOC value. For example, 8.8.8.8 for IP or example.com for Domain. Required
type The IOC type. Possible values are: Domain, IP, URL, MD5, SHA1. Required

Context Output

There is no context output for this command.

Command example

!harmony-ep-ioc-create comment=test value=1.1.1.2 type=IP

Human Readable Output

IOC was created successfully.

harmony-ep-ioc-delete


Deletes the given Indicators of Compromise by their ID.

Base Command

harmony-ep-ioc-delete

Input

Argument Name Description Required
ids A A comma-separated list of list of IOC IDs to delete. Use harmony-ep-ioc-list command to get all IOC IDs. Optional
delete_all Whether to delete all IOCs. This action permanently deletes all Indicators of Compromise and cannot be undone. Possible values are: true, false. Default is false. Optional

Context Output

There is no context output for this command.

Command example

!harmony-ep-ioc-delete ids=7

Human Readable Output

IOCs 7 was deleted successfully.

harmony-ep-policy-rule-assignments-get


Gets all entities directly assigned to the given rule.

Base Command

harmony-ep-policy-rule-assignments-get

Input

Argument Name Description Required
rule_id The ID of the rule to get the assignments. Use harmony-ep-rule-metadata-list command to get all rule IDs. Required

Context Output

Path Type Description
HarmonyEP.Rule.Assignments.type String The rule assignment type.
HarmonyEP.Rule.Assignments.name String The rule assignment name.
HarmonyEP.Rule.Assignments.id String The rule assignment ID.

Command example

!harmony-ep-policy-rule-assignments-get rule_id=1a2b

Context Example

{
    "HarmonyEP": {
        "Rule": {
            "assignments": [
                {
                    "id": "456",
                    "name": "ChromeOsLaptops",
                    "type": "VIRTUAL_GROUP"
                }
            ],
            "id": "1a2b"
        }
    }
}

Human Readable Output

Rule 1a2b assignments

Id Name Type
456 ChromeOsLaptops VIRTUAL_GROUP

harmony-ep-policy-rule-assignments-add


Assigns the specified entities to the given rule. Specified IDs that are already assigned to the rule are ignored.

Base Command

harmony-ep-policy-rule-assignments-add

Input

Argument Name Description Required
rule_id The ID of the rule to add assignments to. Use harmony-ep-rule-metadata-list command to get all rule IDs. Required
entities_ids The entity IDs to assign. Required

Context Output

There is no context output for this command.

Command example

!harmony-ep-policy-rule-assignments-add rule_id=1a2b entities_ids=000

Human Readable Output

Entities [‘000’] were assigned to rule 1a2b successfully.

harmony-ep-policy-rule-assignments-remove


Removes the specified entities from the given rule’s assignments. Specified IDs that are not assigned to the rule are ignored.

Base Command

harmony-ep-policy-rule-assignments-remove

Input

Argument Name Description Required
rule_id The ID of the rule to remove assignments from. Use harmony-ep-rule-metadata-list command to get all rule IDs. Required
entities_ids The entity IDs to remove. Required

Context Output

There is no context output for this command.

Command example

!harmony-ep-policy-rule-assignments-remove rule_id=1a2b entities_ids=000

Human Readable Output

Entities [‘000’] were removed from rule 1a2b successfully.

harmony-ep-policy-rule-install


Installs all policies.

Base Command

harmony-ep-policy-rule-install

Input

Argument Name Description Required
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.PolicyRuleInstall.job_id String The job ID of the policy installation.

Command example

!harmony-ep-policy-rule-install job_id=976

Context Example

{
    "HarmonyEP": {
        "PolicyRuleInstall": {
            "job_id": "976"
        }
    }
}

Human Readable Output

Policy was installed successfully

Job ID: 976
No entries.

harmony-ep-policy-rule-modifications-get


Gets information on modifications to a given rule. (Modifications are the additions or removal of assignments on a rule since it was last installed).

Base Command

harmony-ep-policy-rule-modifications-get

Input

Argument Name Description Required
rule_id The ID of the rule to get the modifications of. Use harmony-ep-rule-metadata-list command to get all rule IDs. Required
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.Rule.job_id String The job ID of the remediation operation.
HarmonyEP.Rule.order Number Rule order.
HarmonyEP.Rule.isDefaultRule Boolean Whether or not the rule is the default.
HarmonyEP.Rule.family String A family in the rule-base (legacy and unified).
HarmonyEP.Rule.connectionState String Rule connection state.
HarmonyEP.Rule.comment String Rule comment.
HarmonyEP.Rule.assignments.type String Rule assignments type.
HarmonyEP.Rule.assignments.name String Rule assignments name.
HarmonyEP.Rule.assignments.id String Rule assignments ID.
HarmonyEP.Rule.name String Rule name.
HarmonyEP.Rule.id String Rule ID.
HarmonyEP.Rule.orientation String Rule policy orientation.

Command example

!harmony-ep-policy-rule-modifications-get rule_id=1a2b job_id=999

Context Example

{
    "HarmonyEP": {
        "Rule": {
            "connectionState": "CONNECTED",
            "family": "Access",
            "id": "1a2b",
            "job_id": "999",
            "lastModifiedBy": "talg",
            "lastModifiedOn": {
                "iso-8601": "2024-06-24T09:04:43.000Z",
                "posix": 1719219883000
            },
            "modified": {
                "assignments": {
                    "modified": false
                },
                "order": {
                    "modified": false
                },
                "settings": {
                    "modified": true
                }
            },
            "name": "New Rule 1"
        }
    }
}

Human Readable Output

Rule 1a2b modification

Job ID: 999

Id Name Family Connectionstate Lastmodifiedby Job Id
1a2b New Rule 1 Access CONNECTED talg 999

harmony-ep-policy-rule-metadata-list


Gets the metadata of all rules or the given rule’s metadata. (Metadata refers to all information relating to the rule except it’s actual settings).

Base Command

harmony-ep-policy-rule-metadata-list

Input

Argument Name Description Required
rule_id The ID of the rule to get the metadata. Optional
rule_family An optional ‘Rule Family’ filter. Used to filter the results to only the selected rule family (e.g., only ‘Threat Prevention’). Possible values are: General Settings, Threat Prevention, Data Protection, OneCheck, Deployment, Remote Access VPN, Capsule Docs, Access, Agent Settings. Optional
connection_state An optional ‘Connection State’ filter. Used to filter the results to only the selected Connection State (e.g., only rules pertaining to policies for connected clients). Possible values are: CONNECTED, DISCONNECTED, RESTRICTED. Optional
limit The maximum number of IP lists to return. Default is 50. Optional
all_results Whether to return all of the results or not. Possible values are: true, false. Default is false. Optional

Context Output

Path Type Description
HarmonyEP.Rule.order Number Rule order.
HarmonyEP.Rule.isDefaultRule Boolean Whether or not the rule is the default.
HarmonyEP.Rule.family String A family in the rule-base (legacy and unified).
HarmonyEP.Rule.connectionState String Rule connection state.
HarmonyEP.Rule.comment String Rule comment.
HarmonyEP.Rule.assignments.type String Rule assignments type.
HarmonyEP.Rule.assignments.name String Rule assignments name.
HarmonyEP.Rule.assignments.id String Rule assignments ID.
HarmonyEP.Rule.name String Rule name.
HarmonyEP.Rule.id String Rule ID.
HarmonyEP.Rule.orientation String Rule policy orientation.

Command example

!harmony-ep-policy-rule-metadata-list rule_id=1a2b

Context Example

{
    "HarmonyEP": {
        "Rule": {
            "assignments": [
                {
                    "id": "000",
                    "name": "Entire Organization",
                    "type": "ORGANIZATION_ROOT"
                },
                {
                    "id": "456",
                    "name": "ChromeOsLaptops",
                    "type": "VIRTUAL_GROUP"
                }
            ],
            "comment": "",
            "connectionState": "CONNECTED",
            "family": "Threat Prevention",
            "id": "1a2b",
            "isDefaultRule": true,
            "name": "TalTest",
            "order": 2,
            "orientation": "DEVICE"
        }
    }
}

Human Readable Output

Rule 1a2b metadata

Id Name Family Comment Orientation Connectionstate Assignments
1a2b TalTest Threat Prevention   DEVICE CONNECTED {‘id’: ‘000’, ‘name’: ‘Entire Organization’, ‘type’: ‘ORGANIZATION_ROOT’},
{‘id’: ‘456’, ‘name’: ‘ChromeOsLaptops’, ‘type’: ‘VIRTUAL_GROUP’}

harmony-ep-push-operation-status-list


Gets the current statuses of all remediation operations or if a specific ID is specified, retrieve the current status of the given remediation operation.

Base Command

harmony-ep-push-operation-status-list

Input

Argument Name Description Required
remediation_operation_id Remediation operations ID. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.PushOperation.adminName String The name of the administrator who initiated the operation.
HarmonyEP.PushOperation.aborted Boolean Indicated whether the operation was aborted by an administrator.
HarmonyEP.PushOperation.remainingTimeoutSeconds Number The amount of time, in seconds, the operation will remain active. When elapsed, no more entities will be affected.
HarmonyEP.PushOperation.createdOn Date The date and time the operation was created.
HarmonyEP.PushOperation.type String Remediation operation type.
HarmonyEP.PushOperation.comment String A comment that was provided during the operation’s creation.
HarmonyEP.PushOperation.id String The operation’s ID.
HarmonyEP.PushOperation.overallStatus String Remediation operation status.
HarmonyEP.PushOperation.numberOfAffectedEntities Number The total number of entities affected by the operation.

Command example

!harmony-ep-push-operation-status-list remediation_operation_id=4d

Context Example

{
    "HarmonyEP": {
        "PushOperation": {
            "aborted": true,
            "adminName": "talg",
            "createdOn": "2024-06-20T10:58:19.407Z",
            "id": "d45",
            "job_id": "3",
            "numberOfAffectedEntities": 6,
            "operationParameters": {
                "allowPostpone": false,
                "informUser": true,
                "originalTimeoutSeconds": 86400,
                "schedulingType": "IMMEDIATE"
            },
            "overallStatus": "ABORTED",
            "remainingTimeoutSeconds": 0,
            "type": "AM_SCAN"
        }
    }
}

Human Readable Output

Push operations status list

Job ID: 3

Id Type Createdon Overallstatus
d45 AM_SCAN 2024-06-20T10:58:19.407Z ABORTED

harmony-ep-push-operation-get


Gets the results of a given Remediation Operation. Remediation Operations may produce results such a Forensics Report or yield status updates such as an anti-malware scan progress.

Base Command

harmony-ep-push-operation-get

Input

Argument Name Description Required
remediation_operation_id Remediation operation ID. Use the harmony-ep-remediation-status-list command to get all remediation operation IDs. Required
filter_text Optional free text search in any of the potential response fields excluding “id”. Can be used to search for specific results, devices or IPs, for example. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.PushOperation.response.status String Push operation response status.
HarmonyEP.PushOperation.response.output String Push operation response output.
HarmonyEP.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.PushOperation.machine.name String The client device’s name.
HarmonyEP.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-push-operation-get remediation_operation_id=4d

Context Example

{
    "HarmonyEP": {
        "PushOperation": [
            {
                "job_id": "6",
                "machine": {
                    "id": "5s",
                    "name": "DESKTOP-M4OAKII"
                },
                "operation": {
                    "id": null,
                    "response": null,
                    "status": "DA_NOT_INSTALLED"
                }
            }
        ]
    }
}

Human Readable Output

Push operations

Job ID: 6

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
5s DESKTOP-M4OAKII DA_NOT_INSTALLED

harmony-ep-push-operation-abort


Aborts the given remediation operation. Aborting an operation prevents it from being sent to further Harmony Endpoint Clients. Clients that have already received the operation are not affected.

Base Command

harmony-ep-push-operation-abort

Input

Argument Name Description Required
remediation_operation_id Remediation operation ID. Use the harmony-ep-remediation-status-list command to get all remediation operation IDs. Required
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.PushOperationAbort.job_id String The job ID of the remediation operation.

Command example

!harmony-ep-push-operation-abort remediation_operation_id=93 job_id=976

Context Example

{
    "HarmonyEP": {
        "PushOperationAbort": {
            "job_id": "976"
        }
    }
}

Human Readable Output

Remediation operation abort was added to the push operation list successfully

Job ID: 976
No entries.

harmony-ep-anti-malware-scan


Performs an anti-malware scan on computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-anti-malware-scan

Input

Argument Name Description Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.AntiMalwareScan.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.AntiMalwareScan.PushOperation.id String The remediation operation ID.
HarmonyEP.AntiMalwareScan.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.AntiMalwareScan.PushOperation.response.status String Push operation response status.
HarmonyEP.AntiMalwareScan.PushOperation.response.output String Push operation response output.
HarmonyEP.AntiMalwareScan.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.AntiMalwareScan.PushOperation.machine.name String The client device’s name.
HarmonyEP.AntiMalwareScan.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-anti-malware-scan computer_ids=1

Context Example

{
    "HarmonyEP": {
        "AntiMalwareScan": {
            "PushOperation": [
                {
                    "job_id": "13",
                    "machine": {
                        "id": "1",
                        "name": "DESKTOP-1"
                    },
                    "operation": {
                        "id": null,
                        "response": null,
                        "status": "DA_NOT_INSTALLED"
                    }
                }
            ]
        }
    }
}

Human Readable Output

Anti-Malware scan was added to the push operation list successfully

Job ID: 13

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-anti-malware-update


Updates the anti-malware Signature Database on computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-anti-malware-update

Input

Argument Name Description Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
update_from_ep_server Determines whether to update from the EP server. Possible values are: true, false. Default is false. Optional
update_from_cp_server Determines whether to update from the CP server. Possible values are: true, false. Default is false. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.AntiMalwareUpdate.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.AntiMalwareUpdate.PushOperation.id String The remediation operation ID.
HarmonyEP.AntiMalwareUpdate.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.AntiMalwareUpdate.PushOperation.response.status String Push operation response status.
HarmonyEP.AntiMalwareUpdate.PushOperation.response.output String Push operation response output.
HarmonyEP.AntiMalwareUpdate.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.AntiMalwareUpdate.PushOperation.machine.name String The client device’s name.
HarmonyEP.AntiMalwareUpdate.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-anti-malware-update computer_ids=1

Context Example

{
    "HarmonyEP": {
        "AntiMalwareUpdate": {
            "PushOperation": [
                {
                    "job_id": "16",
                    "machine": {
                        "id": "1",
                        "name": "DESKTOP-1"
                    },
                    "operation": {
                        "id": null,
                        "response": null,
                        "status": "DA_NOT_INSTALLED"
                    }
                }
            ]
        }
    }
}

Human Readable Output

Anti-Malware Signature Database update was added to the push operation list successfully

Job ID: 16

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-anti-malware-restore


Restores a file that was previously quarantined by the Harmony Endpoint Client’s anti-malware capability. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-anti-malware-restore

Input

Argument Name Description Required
files A list of file paths to restore. Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.AntiMalwareRestore.PushOperation.id String The remediation operation ID.
HarmonyEP.AntiMalwareRestore.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.AntiMalwareRestore.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.AntiMalwareRestore.PushOperation.response.status String Push operation response status.
HarmonyEP.AntiMalwareRestore.PushOperation.response.output String Push operation response output.
HarmonyEP.AntiMalwareRestore.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.AntiMalwareRestore.PushOperation.machine.name String The client device’s name.
HarmonyEP.AntiMalwareRestore.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-anti-malware-restore files=test computer_ids=1

Context Example

{
    "HarmonyEP": {
        "AntiMalwareRestore": {
            "PushOperation": [
                {
                    "job_id": "16",
                    "machine": {
                        "id": "1",
                        "name": "DESKTOP-1"
                    },
                    "operation": {
                        "id": null,
                        "response": null,
                        "status": "DA_NOT_INSTALLED"
                    }
                }
            ]
        }
    }
}

Human Readable Output

File restore was added to the push operation list successfully

Job ID: 16

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-forensics-indicator-analyze


Collects forensics data whenever a computer that matches the given query accesses or executes the given IP, URL, filename, MD5 or path. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-forensics-indicator-analyze

Input

Argument Name Description Required
indicator_type The indictor type to analyze. Possible values are: IP, URL, File, MD5, Path. Required
indicator_value A URL, IP, Path, File or MD5 that when accessed or executed will trigger a forensics report. Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
generate_activity_logs Determines whether to generate detailed activity logs. Possible values are: true, false. Default is true. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.IndicatorAnalyze.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.IndicatorAnalyze.PushOperation.id String The remediation operation ID.
HarmonyEP.IndicatorAnalyze.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.IndicatorAnalyze.PushOperation.response.status String Push operation response status.
HarmonyEP.IndicatorAnalyze.PushOperation.response.output String Push operation response output.
HarmonyEP.IndicatorAnalyze.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.IndicatorAnalyze.PushOperation.machine.name String The client device’s name.
HarmonyEP.IndicatorAnalyze.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-forensics-indicator-analyze indicator_type=IP indicator_value=8.8.8.8 computer_ids=1

Context Example

{
    "HarmonyEP": {
        "IndicatorAnalyze": {
            "PushOperation": [
                {
                    "job_id": "16",
                    "machine": {
                        "id": "1",
                        "name": "DESKTOP-1"
                    },
                    "operation": {
                        "id": null,
                        "response": null,
                        "status": "DA_NOT_INSTALLED"
                    }
                }
            ]
        }
    }
}

Human Readable Output

IOC analyze was added to the push operation list successfully

Job ID: 16

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-forensics-file-quarantine


Quarantines files given by path or MD5 or detections relating to a forensic incident. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-forensics-file-quarantine

Input

Argument Name Description Required
file_type The forensics quarantine item type. Possible values are: PATH, INCIDENT_ID, MD5. Required
file_value The forensics quarantine item value. Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.FileQuarantine.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.FileQuarantine.PushOperation.id String The remediation operation ID.
HarmonyEP.FileQuarantine.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.FileQuarantine.PushOperation.response.status String Push operation response status.
HarmonyEP.FileQuarantine.PushOperation.response.output String Push operation response output.
HarmonyEP.FileQuarantine.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.FileQuarantine.PushOperation.machine.name String The client device’s name.
HarmonyEP.FileQuarantine.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-forensics-file-quarantine file_type=PATH file_value=test computer_ids=1

Context Example

{
    "HarmonyEP": {
        "FileQuarantine": {
            "PushOperation": [
                {
                    "job_id": "16",
                    "machine": {
                        "id": "1",
                        "name": "DESKTOP-1"
                    },
                    "operation": {
                        "id": null,
                        "response": null,
                        "status": "DA_NOT_INSTALLED"
                    }
                }
            ]
        }
    }
}

Human Readable Output

File quarantine was added to the push operation list successfully

Job ID: 16

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-forensics-file-restore


Restores previously quarantined files given by path or MD5 or detections relating to a forensic incident. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-forensics-file-restore

Input

Argument Name Description Required
file_type The forensics quarantine item type. Possible values are: PATH, INCIDENT_ID, MD5. Required
file_value The forensics quarantine item value. Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.FileRestore.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.FileRestore.PushOperation.id String The remediation operation ID.
HarmonyEP.FileRestore.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.FileRestore.PushOperation.response.status String Push operation response status.
HarmonyEP.FileRestore.PushOperation.response.output String Push operation response output.
HarmonyEP.FileRestore.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.FileRestore.PushOperation.machine.name String The client device’s name.
HarmonyEP.FileRestore.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-forensics-file-restore file_type=PATH file_value=test computer_ids=1

Context Example

{
    "HarmonyEP": {
        "FileRestore": {
            "PushOperation": [
                {
                    "job_id": "16",
                    "machine": {
                        "id": "1",
                        "name": "DESKTOP-1"
                    },
                    "operation": {
                        "id": null,
                        "response": null,
                        "status": "DA_NOT_INSTALLED"
                    }
                }
            ]
        }
    }
}

Human Readable Output

File restore was added to the push operation list successfully

Job ID: 16

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-remediation-computer-isolate


Isolates the computers matching the given query. Isolation is the act of denying all network access from a given computer. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-remediation-computer-isolate

Input

Argument Name Description Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.ComputerIsolate.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.ComputerIsolate.PushOperation.id String The remediation operation ID.
HarmonyEP.ComputerIsolate.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.ComputerIsolate.PushOperation.response.status String Push operation response status.
HarmonyEP.ComputerIsolate.PushOperation.response.output String Push operation response output.
HarmonyEP.ComputerIsolate.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.ComputerIsolate.PushOperation.machine.name String The client device’s name.
HarmonyEP.ComputerIsolate.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-remediation-computer-isolate computer_ids=1

Context Example

{
    "HarmonyEP": {
        "ComputerIsolate": {
            "PushOperation": [
                {
                    "job_id": "16",
                    "machine": {
                        "id": "1",
                        "name": "DESKTOP-1"
                    },
                    "operation": {
                        "id": null,
                        "response": null,
                        "status": "DA_NOT_INSTALLED"
                    }
                }
            ]
        }
    }
}

Human Readable Output

Remediation isolate was added to the push operation list successfully

Job ID: 16

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-remediation-computer-deisolate


De-Isolates the computers matching the given query. De-isolating a computer restores its access to network resources. Affects only isolated computers. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-remediation-computer-deisolate

Input

Argument Name Description Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.ComputerDeisolate.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.ComputerDeisolate.PushOperation.id String The remediation operation ID.
HarmonyEP.ComputerDeisolate.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.ComputerDeisolate.PushOperation.response.status String Push operation response status.
HarmonyEP.ComputerDeisolate.PushOperation.response.output String Push operation response output.
HarmonyEP.ComputerDeisolate.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.ComputerDeisolate.PushOperation.machine.name String The client device’s name.
HarmonyEP.ComputerDeisolate.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-remediation-computer-deisolate computer_ids=1

Context Example

{
    "HarmonyEP": {
        "ComputerDeisolate": {
            "PushOperation": [
                {
                    "job_id": "16",
                    "machine": {
                        "id": "1",
                        "name": "DESKTOP-1"
                    },
                    "operation": {
                        "id": null,
                        "response": null,
                        "status": "DA_NOT_INSTALLED"
                    }
                }
            ]
        }
    }
}

Human Readable Output

Remediation de-isolate was added to the push operation list successfully

Job ID: 16

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-agent-computer-restart


Restarts computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-agent-computer-restart

Input

Argument Name Description Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
force_apps_shutdown Determines whether to force applications shutdown. Possible values are: true, false. Default is false. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.ComputerRestart.PushOperation.id String The remediation operation ID.
HarmonyEP.ComputerRestart.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.ComputerRestart.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.ComputerRestart.PushOperation.response.status String Push operation response status.
HarmonyEP.ComputerRestart.PushOperation.response.output String Push operation response output.
HarmonyEP.ComputerRestart.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.ComputerRestart.PushOperation.machine.name String The client device’s name.
HarmonyEP.ComputerRestart.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-agent-computer-restart computer_ids=1

Context Example

{
    "HarmonyEP": {
        "ComputerReset": {
            "PushOperation": [
                {
                    "job_id": "16",
                    "machine": {
                        "id": "1",
                        "name": "DESKTOP-1"
                    },
                    "operation": {
                        "id": null,
                        "response": null,
                        "status": "DA_NOT_INSTALLED"
                    }
                }
            ]
        }
    }
}

Human Readable Output

Computer reset restore was added to the push operation list successfully

Job ID: 16

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-agent-computer-shutdown


Shuts-down computers match the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-agent-computer-shutdown

Input

Argument Name Description Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
force_apps_shutdown Determines whether to force applications shutdown. Possible values are: true, false. Default is false. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.ComputerShutdown.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.ComputerShutdown.PushOperation.id String The remediation operation ID.
HarmonyEP.ComputerShutdown.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.ComputerShutdown.PushOperation.response.status String Push operation response status.
HarmonyEP.ComputerShutdown.PushOperation.response.output String Push operation response output.
HarmonyEP.ComputerShutdown.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.ComputerShutdown.PushOperation.machine.name String The client device’s name.
HarmonyEP.ComputerShutdown.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-agent-computer-shutdown computer_ids=1

Context Example

{
    "HarmonyEP": {
        "ComputerShutdown": {
            "PushOperation": [
                {
                    "job_id": "16",
                    "machine": {
                        "id": "1",
                        "name": "DESKTOP-1"
                    },
                    "operation": {
                        "id": null,
                        "response": null,
                        "status": "DA_NOT_INSTALLED"
                    }
                }
            ]
        }
    }
}

Human Readable Output

Computer shutdown was added to the push operation list successfully

Job ID: 16

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-agent-computer-repair


Repairs the Harmony Endpoint Client installation on computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-agent-computer-repair

Input

Argument Name Description Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.ComputerRepair.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.ComputerRepair.PushOperation.id String The remediation operation ID.
HarmonyEP.ComputerRepair.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.ComputerRepair.PushOperation.response.status String Push operation response status.
HarmonyEP.ComputerRepair.PushOperation.response.output String Push operation response output.
HarmonyEP.ComputerRepair.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.ComputerRepair.PushOperation.machine.name String The client device’s name.
HarmonyEP.ComputerRepair.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-agent-computer-repair computer_ids=1

Context Example

{
    "HarmonyEP": {
        "ComputerRepair": {
            "PushOperation": [
                {
                    "job_id": "16",
                    "machine": {
                        "id": "1",
                        "name": "DESKTOP-1"
                    },
                    "operation": {
                        "id": null,
                        "response": null,
                        "status": "DA_NOT_INSTALLED"
                    }
                }
            ]
        }
    }
}

Human Readable Output

Computer repair was added to the push operation list successfully

Job ID: 16

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-computer-list


Gets a list of computers matching the given filters. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-computer-list

Input

Argument Name Description Required
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.Computer.job_id String The job ID of the remediation operation.
HarmonyEP.Computer.CapabilitiesInstalled String A list of all installed capabilities.
HarmonyEP.Computer.InstalledAndRunning String A list of installed and running capabilities.
HarmonyEP.Computer.ClientVersion String The computer client version.
HarmonyEP.Computer.DeployTime String The computer deploy time.
HarmonyEP.Computer.Groups String The computer groups.
HarmonyEP.Computer.type String The computer type.
HarmonyEP.Computer.userName String The computer user name.
HarmonyEP.Computer.domainName String The computer domain name.
HarmonyEP.Computer.isolationStatus String The computer isolation status.
HarmonyEP.Computer.ClientVersion String The computer client veraion.
HarmonyEP.Computer.LastLoggedInUser String The computer last login user.
HarmonyEP.Computer.osName String The computer operating system name.
HarmonyEP.Computer.osVersion String The computer operating system version.
HarmonyEP.Computer.ip String The computer IP address.
HarmonyEP.Computer.DeploymentStatus String The computer deployment status.
HarmonyEP.Computer.name String The computer name.
HarmonyEP.Computer.id String The computer’s unique ID.

Command example

!harmony-ep-computer-list computer_ids=1 job_id=845

Context Example

{
    "HarmonyEP": {
        "Computer": {
            "Computer": [
                {
                    "client_version": "87.62.2002",
                    "deployment_status": "Completed",
                    "domain_name": ".WORKGROUP",
                    "groups": [
                        {
                            "id": "666",
                            "name": "Desktops"
                        },
                        {
                            "id": "222",
                            "name": "WinDesktops"
                        }
                    ],
                    "id": "888",
                    "ip": "1.1.1.1",
                    "isolation_status": "Not Isolated",
                    "last_logged_in_user": "ntlocal",
                    "name": "DESKTOP-E7V07D5",
                    "os_name": "Microsoft Windows 10 Pro",
                    "os_version": "10.0-19045-SP0.0-SMP",
                    "type": "Desktop",
                    "user_name": "ntlocal"
                }
            ],
            "job_id": "845"
        }
    }
}

Human Readable Output

Computer list

Job ID: 845

Showing page 1.
Current page size: 50.

Id Name Ip Type Groups User Name Client Version
888 DESKTOP-E7V07D5 1.1.1.1 Desktop {‘id’: ‘666’, ‘name’: ‘Desktops’},
{‘id’: ‘222’, ‘name’: ‘WinDesktops’}
ntlocal 87.62.2002

harmony-ep-agent-process-information-get


Collects information about processes on computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-agent-process-information-get

Input

Argument Name Description Required
process_name The name of the process to collect information on. If not provided, all running processes will be collected. Optional
additional_fields Additional process properties to collect. If not provided, only the process’s name and ID will be collected. Possible values are: SI, Handles, VM, WS, PM, NPM, Path, CPU, ExitCode, ExitTime, Handle, HandleCount, HasExited, Id, MachineName, MainModule, MainWindowHandle, MainWindowTitle, MaxWorkingSet, MinWorkingSet, Modules, NonpagedSystemMemorySize, NonpagedSystemMemorySize64, PagedMemorySize, PagedMemorySize64, PagedSystemMemorySize, PagedSystemMemorySize64, PeakPagedMemorySize, PeakPagedMemorySize64, PeakVirtualMemorySize, PeakVirtualMemorySize64, PeakWorkingSet, PeakWorkingSet64, PriorityBoostEnabled, PriorityClass, PrivateMemorySize, PrivateMemorySize64, PrivilegedProcessorTime, ProcessName, ProcessorAffinity, Responding, SafeHandle, SessionId, StandardError, StandardInput, StandardOutput, StartInfo, StartTime, SynchronizingObject, Threads, TotalProcessorTime, UserProcessorTime, VirtualMemorySize, VirtualMemorySize64, WorkingSet, WorkingSet64. Optional
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.ProcessInformation.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.ProcessInformation.PushOperation.id String The remediation operation ID.
HarmonyEP.ProcessInformation.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.ProcessInformation.PushOperation.response.status String Push operation response status.
HarmonyEP.ProcessInformation.PushOperation.response.output String Push operation response output.
HarmonyEP.ProcessInformation.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.ProcessInformation.PushOperation.machine.name String The client device’s name.
HarmonyEP.ProcessInformation.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-agent-process-information-get computer_ids=1

Context Example

{
    "HarmonyEP": {
        "ProcessInformation": {
            "PushOperation": [
                {
                    "job_id": "16",
                    "machine": {
                        "id": "1",
                        "name": "DESKTOP-1"
                    },
                    "operation": {
                        "id": null,
                        "response": null,
                        "status": "DA_NOT_INSTALLED"
                    }
                }
            ]
        }
    }
}

Human Readable Output

Process information fetch was added to the push operation list successfully

Job ID: 16

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-agent-process-terminate


Terminates the given process on computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-agent-process-terminate

Input

Argument Name Description Required
terminate_all_instances Indicates whether to terminate all processes matching the given name. If set to true while a non-zero PID is given, only a single process with the given name AND PID may be matched. If set to false or not provided, will terminate only the first matching process. Possible values are: true, false. Default is false. Optional
name The name of the process to terminate. Required
pid The ID (PID) of the process to terminate. When used in conjunction with the name field, the PID must match the named process. If both name and PID are provided but the process matching the PID does not match the provided name, the operation will be ignored by the agent. If set to 0 or not provided, the agent will seek to terminate the process or processes as indicated by the name field. Optional
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.ProcessTerminate.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.ProcessTerminate.PushOperation.id String The remediation operation ID.
HarmonyEP.ProcessTerminate.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.ProcessTerminate.PushOperation.response.status String Push operation response status.
HarmonyEP.ProcessTerminate.PushOperation.response.output String Push operation response output.
HarmonyEP.ProcessTerminate.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.ProcessTerminate.PushOperation.machine.name String The client device’s name.
HarmonyEP.ProcessTerminate.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-agent-process-terminate name=test computer_ids=1

Context Example

{
    "HarmonyEP": {
        "ProcessTerminate": {
            "PushOperation": [
                {
                    "job_id": "16",
                    "machine": {
                        "id": "1",
                        "name": "DESKTOP-1"
                    },
                    "operation": {
                        "id": null,
                        "response": null,
                        "status": "DA_NOT_INSTALLED"
                    }
                }
            ]
        }
    }
}

Human Readable Output

Process terminate was added to the push operation list successfully

Job ID: 16

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-agent-registry-key-add


Adds a given registry key and/or value to the registry of computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-agent-registry-key-add

Input

Argument Name Description Required
is_redirected Determines if the key should reside under WOW6432Node. Keys intended for 64bit versions of Windows may target 32bit versions by setting this value to ‘true, thus specifying that the registry key/value be added under the WOW6432Node. Possible values are: true, false. Optional
value_data The actual value to be added the the specified registry key. Required
value_type A registry value’s type. Possible values are: DWORD (REG_DWORD), STRING (REG_GZ). Required
value_name The name of the value to be added to the specified registry key. Required
key The full path path of the key to create or add a value to. For example, ‘SOFTWARE\Node.js\Components’. Required
hive Defines known Windows Registry Hives. For more information, see https://docs.microsoft.com/en-us/windows/win32/sysinfo/predefined-keys. Possible values are: HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, HKEY_CLASSES_ROOT, HKEY_USERS, HKEY_CURRENT_CONFIG. Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.RegistryKeyAdd.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.RegistryKeyAdd.PushOperation.id String The remediation operation ID.
HarmonyEP.RegistryKeyAdd.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.RegistryKeyAdd.PushOperation.response.status String Push operation response status.
HarmonyEP.RegistryKeyAdd.PushOperation.response.output String Push operation response output.
HarmonyEP.RegistryKeyAdd.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.RegistryKeyAdd.PushOperation.machine.name String The client device’s name.
HarmonyEP.RegistryKeyAdd.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-agent-registry-key-add value_data=test value_type="STRING (REG_GZ)" value_name=test key=test hive=HKEY_USERS computer_ids=1

Context Example

{
    "HarmonyEP": {
        "RegistryKeyAdd": {
            "PushOperation": {
                "job_id": "54",
                "machine": {
                    "id": "1",
                    "name": "DESKTOP-1"
                },
                "operation": {
                    "id": "88",
                    "response": null,
                    "status": "DA_NOT_INSTALLED"
                }
            }
        }
    }
}

Human Readable Output

Registry key add was added to the push operation list successfully

Job ID: 54

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-agent-registry-key-delete


Removes the given registry key or value to the registry of computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-agent-registry-key-delete

Input

Argument Name Description Required
is_redirected Determines if the key should be removed from under WOW6432Node. Keys intended for 64bit versions of Windows may target 32bit versions by setting this value to ‘true’, thus specifying that the registry key/value be removed under the WOW6432Node. Possible values are: true, false. Optional
value_name The value to remove from the key. If not provided, the entire key will be deleted. Optional
key The full path path of the key to delete or remove a value from. For example, ‘SOFTWARE\Node.js\Components’. Required
hive Defines known Windows Registry Hives. For more information, see https://docs.microsoft.com/en-us/windows/win32/sysinfo/predefined-keys. Possible values are: HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, HKEY_CLASSES_ROOT, HKEY_USERS, HKEY_CURRENT_CONFIG. Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.RegistryKeyDelete.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.RegistryKeyDelete.PushOperation.id String The remediation operation ID.
HarmonyEP.RegistryKeyDelete.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.RegistryKeyDelete.PushOperation.response.status String Push operation response status.
HarmonyEP.RegistryKeyDelete.PushOperation.response.output String Push operation response output.
HarmonyEP.RegistryKeyDelete.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.RegistryKeyDelete.PushOperation.machine.name String The client device’s name.
HarmonyEP.RegistryKeyDelete.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-agent-registry-key-delete value_name='test' key='test' hive=HKEY_USERS computer_ids=1

Context Example

{
    "HarmonyEP": {
        "RegistryKeyDelete": {
            "PushOperation": {
                "job_id": "54",
                "machine": {
                    "id": "1",
                    "name": "DESKTOP-1"
                },
                "operation": {
                    "id": "88",
                    "response": null,
                    "status": "DA_NOT_INSTALLED"
                }
            }
        }
    }
}

Human Readable Output

Registry key delete was added to the push operation list successfully

Job ID: 54

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-agent-file-copy


Copies the given file from the given source to the given destination on computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-agent-file-copy

Input

Argument Name Description Required
destination_absolute_path The absolute, full destination path. The provided path must include the target file’s name (e.g., c:\backup\backup1.txt). Required
source_absolute_path The absolute, full source path (e.g., c:\backup\backup1.txt). Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.FileCopy.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.FileCopy.PushOperation.id String The remediation operation ID.
HarmonyEP.FileCopy.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.FileCopy.PushOperation.response.status String Push operation response status.
HarmonyEP.FileCopy.PushOperation.response.output String Push operation response output.
HarmonyEP.FileCopy.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.FileCopy.PushOperation.machine.name String The client device’s name.
HarmonyEP.FileCopy.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-agent-file-copy destination_absolute_path='test.txt' source_absolute_path='test.txt' computer_ids=1

Context Example

{
    "HarmonyEP": {
        "FileCopy": {
            "PushOperation": [
                {
                    "job_id": "16",
                    "machine": {
                        "id": "1",
                        "name": "DESKTOP-1"
                    },
                    "operation": {
                        "id": null,
                        "response": null,
                        "status": "DA_NOT_INSTALLED"
                    }
                }
            ]
        }
    }
}

Human Readable Output

File copy was added to the push operation list successfully

Job ID: 16

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-agent-file-move


Moves the given file from the given source to the given destination on computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-agent-file-move

Input

Argument Name Description Required
destination_absolute_path The absolute, full destination path. The provided path must include the target file’s name (e.g., c:\backup\backup1.txt). Required
source_absolute_path The absolute, full source path (e.g., c:\backup\backup1.txt). Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.FileMove.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.FileMove.PushOperation.id String The remediation operation ID.
HarmonyEP.FileMove.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.FileMove.PushOperation.response.status String Push operation response status.
HarmonyEP.FileMove.PushOperation.response.output String Push operation response output.
HarmonyEP.FileMove.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.FileMove.PushOperation.machine.name String The client device’s name.
HarmonyEP.FileMove.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-agent-file-move destination_absolute_path='test.txt' source_absolute_path='test.txt' computer_ids=1

Context Example

{
    "HarmonyEP": {
        "FileMove": [
            {
                "job_id": "16",
                "machine": {
                    "id": "1",
                    "name": "DESKTOP-1"
                },
                "operation": {
                    "id": null,
                    "response": null,
                    "status": "DA_NOT_INSTALLED"
                }
            }
        ]
    }
}

Human Readable Output

File move was added to the push operation list successfully

Job ID: 16

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-agent-file-delete


Deletes the given file from the given source on computers matching the given query. This operation is risky! Use with caution as it allows you to change Harmony Endpoint protected files or registry entries that are in use by your operating system. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-agent-file-delete

Input

Argument Name Description Required
target_absolute_path The absolute, full path of the file to remove. Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.FileDelete.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.FileDelete.PushOperation.id String The remediation operation ID.
HarmonyEP.FileDelete.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.FileDelete.PushOperation.response.status String Push operation response status.
HarmonyEP.FileDelete.PushOperation.response.output String Push operation response output.
HarmonyEP.FileDelete.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.FileDelete.PushOperation.machine.name String The client device’s name.
HarmonyEP.FileDelete.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-agent-file-delete target_absolute_path='test.txt' computer_ids=1

Context Example

{
    "HarmonyEP": {
        "FileDelete": {
            "PushOperation": [
                {
                    "job_id": "16",
                    "machine": {
                        "id": "1",
                        "name": "DESKTOP-1"
                    },
                    "operation": {
                        "id": null,
                        "response": null,
                        "status": "DA_NOT_INSTALLED"
                    }
                }
            ]
        }
    }
}

Human Readable Output

File delete was added to the push operation list successfully

Job ID: 16

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-agent-vpn-site-add


Adds the given VPN site’s configuration to computers matching the given query. Adding a VPN site allows Harmony Endpoint Clients to connect to it. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-agent-vpn-site-add

Input

Argument Name Description Required
remote_access_gateway_name The remote gateway’s name. Required
fingerprint The remote gateway’s certificate fingerprint. Fingerprints are used to verify the authenticity of the gateway. Required
authentication_method Authentication methods used in conjunction with VPN site standard login. Possible values are: CERTIFICATE, P12_CERTIFICATE, USERNAME_PASSWORD, SECURID_KEY_FOB, SECURID_PIN_PAD, SOFTID, CHALLENGE_RESPONSE. Required
display_name The VPN site’s display name. Optional
host The target site’s host name or IP address. Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.VPNsiteConfigurationAdd.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.VPNsiteConfigurationAdd.PushOperation.id String The remediation operation ID.
HarmonyEP.VPNsiteConfigurationAdd.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.VPNsiteConfigurationAdd.PushOperation.response.status String Push operation response status.
HarmonyEP.VPNsiteConfigurationAdd.PushOperation.response.output String Push operation response output.
HarmonyEP.VPNsiteConfigurationAdd.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.VPNsiteConfigurationAdd.PushOperation.machine.name String The client device’s name.
HarmonyEP.VPNsiteConfigurationAdd.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-agent-vpn-site-add remote_access_gateway_name='test' fingerprint='test' authentication_method=CERTIFICATE host='test' computer_ids=1

Context Example

{
    "HarmonyEP": {
        "VPNsiteConfigurationAdd": {
            "PushOperation": {
                "job_id": "67",
                "machine": {
                    "id": "1",
                    "name": "DESKTOP-1"
                },
                "operation": {
                    "id": "23",
                    "response": null,
                    "status": "DA_NOT_INSTALLED"
                }
            }
        }
    }
}

Human Readable Output

VPN site configuration remove was added to the push operation list successfully

Job ID: 67

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

harmony-ep-agent-vpn-site-remove


Removes the given VPN site’s configuration to computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

Base Command

harmony-ep-agent-vpn-site-remove

Input

Argument Name Description Required
display_name The display name of the VPN site to remove. If a display name was not provided during the site’s creation, the host name/IP should be used instead. Required
comment Operation comment. Optional
scheduling_date_time Start the operation on a given date and time. If not specified, defaults to ‘Now’ (i.e. immediate execution). For example, “2024-04-12 03:59”. Optional
expiration_seconds The amount of time, in seconds, the operation will be valid for. When the specified time has elapsed, the operation will expire and will not be pushed to any more clients. If not specified, defaults to 86400 seconds (24 hours). Minimum value is 1. Optional
computer_ids A comma-separated list of computer IDs to include in the operation. Optional
computer_names A comma-separated list of computer names to include in the operation. Optional
computer_ips A comma-separated list of computer IPs to include in the operation. Optional
computer_types A comma-separated list of computer types to include in the operation. Possible values are: Desktop, Laptop, N/A, Domain Controller, Server. Optional
computer_deployment_statuses A comma-separated list of computer deployment statuses to include in the operation. Possible values are: Retrying, Error, Scheduled, Downloading, Deploying, Completed, Failed, Uninstalling, Not Scheduled, Not Installed, N/A. Optional
computer_last_connection Computer last connection range time (start time, end time) to include in the operation. For example, “2024-01-01 07:58, 2024-04-02 02:00”. Optional
filter A comma-separated list of list of search filters according to the following template: “column_name operator ‘values_list’ “. For example, the query “computerId Contains ‘1,2,3,4’ , computerIP Exact ‘1.1.1.1’ “ will refer to computers contains ‘1’, ‘2’, ‘3’, and ‘4’ in their ID and that their IP is ‘1.1.1.1’. For more optional ‘column_name’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/ComputerColumnNames. For more optional ‘operator’ values, see https://app.swaggerhub.com/apis/Check-Point/web-mgmt-external-api-production/1.9.179#/FilterType . Optional
groups_ids_to_exclude A comma-separated list of group IDs to exclude from the operation. Optional
computers_ids_to_exclude A comma-separated list of computer IDs to exclude from the operation. Optional
computers_ids_to_include A comma-separated list of computer IDs to include in the operation. Optional
inform_user Determines whether to inform the user, via a UserCheck (popup) message, that the operation is taking place. Possible values are: true, false. Default is true. Optional
allow_postpone Determines whether to allow the user to postpone the operation. Possible values are: true, false. Default is true. Optional
page Page number of paginated results. Minimum value: 1. Optional
page_size The number of items per page. Optional
limit The maximum number of records to retrieve. Default is 50. Optional
interval The interval between each poll in seconds. Minimum value is 10. Default is 30. Optional
timeout The timeout for the polling in seconds. Default is 600. Optional
job_id The job ID to fetch data for. Hidden argument. Optional

Context Output

Path Type Description
HarmonyEP.VPNsiteConfigurationRemove.PushOperation.job_id String The job ID of the remediation operation.
HarmonyEP.VPNsiteConfigurationRemove.PushOperation.id String The remediation operation ID.
HarmonyEP.VPNsiteConfigurationRemove.PushOperation.status String Describes possible states in which a push operation may be in regards to a specific device.
HarmonyEP.VPNsiteConfigurationRemove.PushOperation.response.status String Push operation response status.
HarmonyEP.VPNsiteConfigurationRemove.PushOperation.response.output String Push operation response output.
HarmonyEP.VPNsiteConfigurationRemove.PushOperation.machine.ipAddress String The client device’s IPv4 address.
HarmonyEP.VPNsiteConfigurationRemove.PushOperation.machine.name String The client device’s name.
HarmonyEP.VPNsiteConfigurationRemove.PushOperation.machine.id String The client device’s unique ID.

Command example

!harmony-ep-agent-vpn-site-remove display_name='test' computer_ids=1

Context Example

{
    "HarmonyEP": {
        "VPNsiteConfigurationRemove": {
            "PushOperation": {
                "job_id": "67",
                "machine": {
                    "id": "1",
                    "name": "DESKTOP-1"
                },
                "operation": {
                    "id": "23",
                    "response": null,
                    "status": "DA_NOT_INSTALLED"
                }
            }
        }
    }
}

Human Readable Output

VPN site configuration remove was added to the push operation list successfully

Job ID: 67

Showing page 1.
Current page size: 50.

Machine Id Machine Name Operation Status
1 DESKTOP-1 DA_NOT_INSTALLED

Configuration parameters

  • base_url — Base URL (required)
  • credentials — Client ID (required)
  • insecure — Trust any certificate (not secure)
  • proxy — Use system proxy settings

Commands (35)

  • harmony-ep-agent-computer-repair

    Repairs the Harmony Endpoint Client installation on computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-agent-computer-restart

    Restarts computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-agent-computer-shutdown

    Shuts-down computers match the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-agent-file-copy

    Copies the given file from the given source to the given destination on computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-agent-file-delete

    Deletes the given file from the given source on computers matching the given query. This operation is risky! Use with caution as it allows you to change Harmony Endpoint protected files or registry entries that are in use by your operating system. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-agent-file-move

    Moves the given file from the given source to the given destination on computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-agent-process-information-get

    Collects information about processes on computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-agent-process-terminate

    Terminates the given process on computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-agent-registry-key-add

    Adds a given registry key and/or value to the registry of computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-agent-registry-key-delete

    Removes the given registry key or value to the registry of computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-agent-vpn-site-add

    Adds the given VPN site's configuration to computers matching the given query. Adding a VPN site allows Harmony Endpoint Clients to connect to it. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-agent-vpn-site-remove

    Removes the given VPN site's configuration to computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-anti-malware-restore

    Restores a file that was previously quarantined by the Harmony Endpoint Client's anti-malware capability. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-anti-malware-scan

    Performs an anti-malware scan on computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-anti-malware-update

    Updates the anti-malware Signature Database on computers matching the given query. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-computer-list

    Gets a list of computers matching the given filters. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-forensics-file-quarantine

    Quarantines files given by path or MD5 or detections relating to a forensic incident. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-forensics-file-restore

    Restores previously quarantined files given by path or MD5 or detections relating to a forensic incident. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-forensics-indicator-analyze

    Collects forensics data whenever a computer that matches the given query accesses or executes the given IP, URL, filename, MD5 or path. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-ioc-create

    Creates new Indicators of Compromise using the given parameters.

  • harmony-ep-ioc-delete

    Deletes the given Indicators of Compromise by their ID.

  • harmony-ep-ioc-list

    Gets a list of all Indicators of Compromise. Use the filter parameters to fetch specific IOCs.

  • harmony-ep-ioc-update

    Updates the given Indicators of Compromise with the given parameters.

  • harmony-ep-job-status-get

    Retrieves the status and result (if any) of a given asynchronous operation. A job is a way to monitor the progress of an asynchronous operation while avoiding issues that may manifest during long synchronous waits.

  • harmony-ep-policy-rule-assignments-add

    Assigns the specified entities to the given rule. Specified IDs that are already assigned to the rule are ignored.

  • harmony-ep-policy-rule-assignments-get

    Gets all entities directly assigned to the given rule.

  • harmony-ep-policy-rule-assignments-remove

    Removes the specified entities from the given rule's assignments. Specified IDs that are not assigned to the rule are ignored.

  • harmony-ep-policy-rule-install

    Installs all policies.

  • harmony-ep-policy-rule-metadata-list

    Gets the metadata of all rules or the given rule's metadata. (Metadata refers to all information relating to the rule except it's actual settings).

  • harmony-ep-policy-rule-modifications-get

    Gets information on modifications to a given rule. (Modifications are the additions or removal of assignments on a rule since it was last installed).

  • harmony-ep-push-operation-abort

    Aborts the given remediation operation. Aborting an operation prevents it from being sent to further Harmony Endpoint Clients. Clients that have already received the operation are not affected.

  • harmony-ep-push-operation-get

    Gets the results of a given Remediation Operation. Remediation Operations may produce results such a Forensics Report or yield status updates such as an anti-malware scan progress.

  • harmony-ep-push-operation-status-list

    Gets the current statuses of all remediation operations or if a specific ID is specified, retrieve the current status of the given remediation operation.

  • harmony-ep-remediation-computer-deisolate

    De-Isolates the computers matching the given query. De-isolating a computer restores its access to network resources. Affects only isolated computers. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

  • harmony-ep-remediation-computer-isolate

    Isolates the computers matching the given query. Isolation is the act of denying all network access from a given computer. Note that you must specify at least one of the following filter arguments: computer_ids, computer_names, computer_ips, computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter.

import dataclasses
import http

import demistomock as demisto  # noqa: F401
from CommonServerPython import *  # noqa: F401


@dataclasses.dataclass
class ScheduleCommandMetadata:
    """Schedule commands metadata."""

    outputs_prefix: str
    message: str = ""
    headers: list[str] = dataclasses.field(default_factory=list)

    def format_message(self, id):
        self.message = self.message.format(id=id)


REGISTRY_VALUE_TYPE_MAP = {
    "DWORD (REG_DWORD)": "DWORD",
    "STRING (REG_GZ)": "STRING",
}

MIN_PAGE_NUM = 1
MAX_PAGE_SIZE = 50
MIN_PAGE_SIZE = 1
MAX_LIMIT = 50
MIN_LIMIT = 1
DEFAULT_HEADERS = [
    "machine_id",
    "machine_name",
    "operation_status",
    "operation_response_output",
    "operation_response_status",
]

DEFAULT_FILTER_TYPE = "Contains"
DEFAULT_SUFFIX_MESSAGE = "was added to the push operation list successfully."

COLUMN_NAMES_MAPPER = {
    "computer_ids": "computerId",
    "computer_names": "computerName",
    "computer_ips": "computerIP",
    "computer_types": "computerType",
    "computer_deployment_statuses": "computerDeploymentStatus",
}
COLUMN_NAMES = [
    "emonJsonDataColumns",
    "computerId",
    "computerName",
    "computerDeploymentStatus",
    "computerIP",
    "computerClientVersion",
    "osName",
    "osVersion",
    "daInstalled",
    "computerDeployTime",
    "computerDeployTimeFrom",
    "computerDeployTimeTo",
    "computerLastErrorCode",
    "computerLastErrorDescription",
    "computerLastConnection",
    "computerLastConnectionFrom",
    "computerLastConnectionTo",
    "computerSyncedonTo",
    "computerSyncedon",
    "computerSyncedonFrom",
    "syncedOn",
    "computerLastLoggedInUser",
    "computerLastLoggedInPrebootUser",
    "computerFdeStatus",
    "computerFdeVersion",
    "computerFdeLastRecoveryDate",
    "computerFdeLastRecoveryDateFrom",
    "computerFdeLastRecoveryDateTo",
    "computerFdeWilWolStatus",
    "computerFdeTpmId",
    "computerFdeTpmStatus",
    "computerFdeTpmVersion",
    "computerFdeWilWolStatusUpdatedOn",
    "computerFdeWilWolStatusUpdatedOnFrom",
    "computerFdeWilWolStatusUpdatedOnTo",
    "computerFdeProgress",
    "computerFdeProgressFrom",
    "computerFdeProgressTo",
    "computerType",
    "endpointType",
    "amUpdatedOn",
    "amUpdatedOnFrom",
    "amUpdatedOnTo",
    "amStatus",
    "isolated",
    "isDeleted",
    "complianceStatus",
    "amUpdatedIntervalStatus",
    "isInDomain",
    "domainName",
    "o_x",
    "devices_emon_status_data_selector",
    "deleted_devices_emon_status_data_selector",
    "computerAmDatVersion",
    "computerAmDatDate",
    "computerAmDatDateFrom",
    "computerAmDatDateTo",
    "computerAmLicExpirationDate",
    "computerAmProviderBrandReport",
    "computerAmLicExpirationDateFrom",
    "computerAmLicExpirationDateTo",
    "computerAmTotalInfected",
    "computerAmTotalInfectedFrom",
    "computerAmTotalInfectedTo",
    "computerAmInfections",
    "computerSdPackageName",
    "computerSdPolicyName",
    "computerSdPolicyVersion",
    "computerAbState",
    "computerAbStatusBotNames",
    "computerAmScannedon",
    "computerAmScannedonFrom",
    "computerAmScannedonTo",
    "computerAmTotalQuarantined",
    "computerAmTotalQuarantinedFrom",
    "computerAmTotalQuarantinedTo",
    "computerLastContactedPolicyServerIp",
    "computerLastContactedPolicyServerName",
    "computerSdPackageVersion",
    "computerComplianceViolationIds",
    "computerSmartCardStatus",
    "fdeRemoteUnlockOperation",
    "fdeRemoteUnlockStatus",
    "computerCanonicalName",
    "stoppedBlades",
    "enforcedModifiedOn",
    "enforcedPolicyMalware20",
    "enforcedPolicyTe130",
    "enforcedPolicyEfr120",
    "enforcedPolicyAntibot100",
    "enforcedPolicyMe30",
    "enforcedPolicyFdeDevice35",
    "enforcedPolicyFdeUser36",
    "enforcedPolicyFw10",
    "enforcedPolicyCompliance60",
    "enforcedPolicyApplicationControl22",
    "enforcedPolicySaAccessZones11",
    "enforcedPolicyCommonClientSettings51",
    "enforcedPolicyDocSecPolicy91",
    "enforcedVersionPolicyMalware20",
    "enforcedVersionPolicyTe130",
    "enforcedVersionPolicyEfr120",
    "enforcedVersionPolicyAntibot100",
    "enforcedVersionPolicyMe30",
    "enforcedVersionPolicyFdeDevice35",
    "enforcedVersionPolicyFdeUser36",
    "enforcedVersionPolicyFw10",
    "enforcedVersionPolicyCompliance60",
    "enforcedVersionPolicyApplicationControl22",
    "enforcedVersionPolicySaAccessZones11",
    "enforcedVersionPolicyCommonClientSettings51",
    "enforcedVersionPolicyDocSecPolicy91",
    "enforcedNamePolicyMalware20",
    "enforcedNamePolicyTe130",
    "enforcedNamePolicyEfr120",
    "enforcedNamePolicyAntibot100",
    "enforcedNamePolicyMe30",
    "enforcedNamePolicyFdeDevice35",
    "enforcedNamePolicyFdeUser36",
    "enforcedNamePolicyFw10",
    "enforcedNamePolicyCompliance60",
    "enforcedNamePolicyApplicationControl22",
    "enforcedNamePolicySaAccessZones11",
    "enforcedNamePolicyCommonClientSettings51",
    "enforcedNamePolicyDocSecPolicy91",
    "deployedModifiedOn",
    "deployedPolicyMalware20",
    "deployedPolicyTe130",
    "deployedPolicyEfr120",
    "deployedPolicyAntibot100",
    "deployedPolicyMe30",
    "deployedPolicyFdeDevice35",
    "deployedPolicyFdeUser36",
    "deployedPolicyFw10",
    "deployedPolicyCompliance60",
    "deployedPolicyApplicationControl22",
    "deployedPolicySaAccessZones11",
    "deployedPolicyCommonClientSettings51",
    "deployedPolicyDocSecPolicy91",
    "deployedVersionPolicyMalware20",
    "deployedVersionPolicyTe130",
    "deployedVersionPolicyEfr120",
    "deployedVersionPolicyAntibot100",
    "deployedVersionPolicyMe30",
    "deployedVersionPolicyFdeDevice35",
    "deployedVersionPolicyFdeUser36",
    "deployedVersionPolicyFw10",
    "deployedVersionPolicyCompliance60",
    "deployedVersionPolicyApplicationControl22",
    "deployedVersionPolicySaAccessZones11",
    "deployedVersionPolicyCommonClientSettings51",
    "deployedVersionPolicyDocSecPolicy91",
    "deployedNamePolicyMalware20",
    "deployedNamePolicyTe130",
    "deployedNamePolicyEfr120",
    "deployedNamePolicyAntibot100",
    "deployedNamePolicyMe30",
    "deployedNamePolicyFdeDevice35",
    "deployedNamePolicyFdeUser36",
    "deployedNamePolicyFw10",
    "deployedNamePolicyCompliance60",
    "deployedNamePolicyApplicationControl22",
    "deployedNamePolicySaAccessZones11",
    "deployedNamePolicyCommonClientSettings51",
    "deployedNamePolicyDocSecPolicy91",
    "computerCpuLoadCategory",
    "computerTotalCpuLoadCategory",
    "computerCpuRank",
    "computerTotalCpuRank",
    "computerGroups",
    "computerOrUsers",
    "computerInactiveCapabilities",
    "filterAndThoseComputers",
    "filterAndThoseComputersOrUsers",
    "filterComplianceStatus",
    "computerFreeSearch",
    "computerEnforcedInstalledPolicyName",
    "computerEnforcedInstalledPolicyVersion",
    "computerStoppedBlades",
    "Is_Device_In_Group",
    "global",
    "permission",
]
FILTER_TYPES = [
    "Contains",
    "StartsWith",
    "EndsWith",
    "Exact",
    "Grater",
    "Smaller",
    "BitOr",
    "BitAnd",
    "IsNull",
    "NotNull",
    "Not",
    "JsonbExact",
    "JsonbContainsAnd",
    "JsonbContainsOr",
    "NestedJsonbContainsAnd",
    "NestedJsonbContainsOr",
    "NestedJsonbExactAnd",
    "NestedJsonbExactOr",
    "NestedJsonbDateRange",
    "ArrayContains",
    "Between",
]
SCHEDULED_COMMANDS_MAPPER = {
    "harmony-ep-policy-rule-install": ScheduleCommandMetadata(
        outputs_prefix="PolicyRuleInstall", message="Policies have been installed successfully."
    ),
    "harmony-ep-policy-rule-modifications-get": ScheduleCommandMetadata(
        outputs_prefix="Rule",
        message="Rule {id} modification:",
        headers=["id", "name", "family", "connectionState", "lastModifiedBy", "job_id"],
    ),
    "harmony-ep-policy-rule-metadata-list": ScheduleCommandMetadata(outputs_prefix="Rule", message="Rule metadata list:"),
    "harmony-ep-push-operation-status-list": ScheduleCommandMetadata(
        outputs_prefix="PushOperation",
        message="Push operations status list:",
        headers=["id", "comment", "type", "createdOn", "overallStatus"],
    ),
    "harmony-ep-push-operation-get": ScheduleCommandMetadata(
        outputs_prefix="PushOperation",
        message="Push operations:",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-push-operation-abort": ScheduleCommandMetadata(
        outputs_prefix="PushOperationAbort",
        message=f"Remediation operation abort {DEFAULT_SUFFIX_MESSAGE}",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-remediation-computer-isolate": ScheduleCommandMetadata(
        outputs_prefix="ComputerIsolate.PushOperation",
        message=f"Remediation isolate {DEFAULT_SUFFIX_MESSAGE}",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-remediation-computer-deisolate": ScheduleCommandMetadata(
        outputs_prefix="ComputerDeisolate.PushOperation",
        message=f"Remediation de-isolate {DEFAULT_SUFFIX_MESSAGE}",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-anti-malware-scan": ScheduleCommandMetadata(
        outputs_prefix="AntiMalwareScan.PushOperation",
        message=f"Anti-Malware scan {DEFAULT_SUFFIX_MESSAGE}",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-anti-malware-update": ScheduleCommandMetadata(
        outputs_prefix="AntiMalwareUpdate.PushOperation",
        message=f"Anti-Malware Signature Database update {DEFAULT_SUFFIX_MESSAGE}",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-anti-malware-restore": ScheduleCommandMetadata(
        outputs_prefix="AntiMalwareRestore.PushOperation",
        message=f"File restore {DEFAULT_SUFFIX_MESSAGE}",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-forensics-indicator-analyze": ScheduleCommandMetadata(
        outputs_prefix="IndicatorAnalyze.PushOperation",
        message=f"IOC analyze {DEFAULT_SUFFIX_MESSAGE}",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-forensics-file-quarantine": ScheduleCommandMetadata(
        outputs_prefix="FileQuarantine.PushOperation",
        message=f"File quarantine {DEFAULT_SUFFIX_MESSAGE}",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-forensics-file-restore": ScheduleCommandMetadata(
        outputs_prefix="FileRestore.PushOperation",
        message=f"File restore {DEFAULT_SUFFIX_MESSAGE}",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-computer-list": ScheduleCommandMetadata(
        outputs_prefix="Computer",
        message="Computer list:",
        headers=[
            "id",
            "name",
            "ip",
            "type",
            "groups",
            "user_name",
            "client_version",
        ],
    ),
    "harmony-ep-agent-computer-restart": ScheduleCommandMetadata(
        outputs_prefix="ComputerReset.PushOperation",
        message=f"Computer reset restore {DEFAULT_SUFFIX_MESSAGE}",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-agent-computer-shutdown": ScheduleCommandMetadata(
        outputs_prefix="ComputerShutdown.PushOperation",
        message=f"Computer shutdown {DEFAULT_SUFFIX_MESSAGE}.",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-agent-computer-repair": ScheduleCommandMetadata(
        outputs_prefix="ComputerRepair.PushOperation",
        message=f"Computer repair {DEFAULT_SUFFIX_MESSAGE}.",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-agent-process-information-get": ScheduleCommandMetadata(
        outputs_prefix="ProcessInformation.PushOperation",
        message=f"Process information fetch {DEFAULT_SUFFIX_MESSAGE}.",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-agent-process-terminate": ScheduleCommandMetadata(
        outputs_prefix="ProcessTerminate.PushOperation",
        message=f"Process terminate {DEFAULT_SUFFIX_MESSAGE}.",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-agent-registry-key-add": ScheduleCommandMetadata(
        outputs_prefix="RegistryKeyAdd.PushOperation",
        message=f"Registry key addition {DEFAULT_SUFFIX_MESSAGE}.",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-agent-registry-key-delete": ScheduleCommandMetadata(
        outputs_prefix="RegistryKeyDelete.PushOperation",
        message=f"Registry key delete {DEFAULT_SUFFIX_MESSAGE}.",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-agent-file-copy": ScheduleCommandMetadata(
        outputs_prefix="FileCopy.PushOperation",
        message=f"File copy {DEFAULT_SUFFIX_MESSAGE}.",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-agent-file-move": ScheduleCommandMetadata(
        outputs_prefix="FileMove",
        message=f"File move {DEFAULT_SUFFIX_MESSAGE}.",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-agent-file-delete": ScheduleCommandMetadata(
        outputs_prefix="FileDelete.PushOperation",
        message=f"File delete {DEFAULT_SUFFIX_MESSAGE}.",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-agent-vpn-site-add": ScheduleCommandMetadata(
        outputs_prefix="VPNsiteConfigurationAdd.PushOperation",
        message=f"VPN site configuration addition {DEFAULT_SUFFIX_MESSAGE}.",
        headers=DEFAULT_HEADERS,
    ),
    "harmony-ep-agent-vpn-site-remove": ScheduleCommandMetadata(
        outputs_prefix="VPNsiteConfigurationRemove.PushOperation",
        message=f"VPN site configuration remove {DEFAULT_SUFFIX_MESSAGE}.",
        headers=DEFAULT_HEADERS,
    ),
}


class Client(BaseClient):
    URL_PREFIX = "app/endpoint-web-mgmt/harmony/endpoint/api/v1"

    def __init__(
        self,
        base_url: str,
        client_id: str,
        client_secret: str,
        verify_certificate: bool,
        proxy: bool,
    ):
        self.token: str
        self.client_id = client_id
        self.client_secret = client_secret
        self.base_url = base_url

        super().__init__(
            base_url=base_url,
            verify=verify_certificate,
            proxy=proxy,
            headers={},
        )

    def get_token(self):
        """Get temporary authentication token from CheckPoint.
        This token will expire 30 minutes from its generation time."""
        self._headers = {}
        self._session.cookies.clear()

        response = self._http_request(
            method="POST",
            url_suffix="auth/external",
            json_data={"clientId": self.client_id, "accessKey": self.client_secret},
        )
        try:
            self.token = response["data"]["token"]
        except DemistoException as exc:
            raise DemistoException(f"Authentication failed: token not found. {exc}")

    def login(self):
        """Login to Harmony with the generated temporary token and get new token for HarmonyEP."""
        self._session.cookies.clear()
        self._headers["Authorization"] = f"Bearer {self.token}"
        self._base_url = urljoin(self.base_url, self.URL_PREFIX)

        try:
            response = self._http_request(
                method="POST",
                url_suffix="/session/login/cloud",
            )
            self._headers["x-mgmt-api-token"] = response["apiToken"]

        except DemistoException as exc:
            if exc.res is not None and exc.res.status_code == http.HTTPStatus.BAD_REQUEST:
                raise DemistoException(f"Authentication failed: cookie not found. {exc}")

    def job_status_get(self, job_id: str) -> dict[str, Any]:
        """Get job status and data by ID.

        Args:
            job_id (str): The job ID.

        Returns:
            dict[str,Any]: API response.
        """

        return self._http_request(
            method="GET",
            url_suffix=f"/jobs/{job_id}",
        )

    def ioc_list(
        self,
        page: int,
        page_size: int,
        ioc_filter: str = None,
        field: str = None,
        sort_direction: str = None,
    ) -> dict[str, Any]:
        """Fetch IOCs list.

        Args:
            page (str): Index of page to return.
            page_size (int): Size of the page to return.
            ioc_filter (str, optional): The indicator value or comment to search for. Defaults to None.
            sort_field (str, optional): The Indicator of Compromise field to search by. Defaults to None.
            sort_direction (str, optional): The ways in which to sort the results. Defaults to None.

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "off"
        data = remove_empty_elements(
            {
                "filter": ioc_filter,
                "page": page,
                "size": page_size,
                "sort": [{"field": field, "direction": sort_direction}],
            }
        )
        return self._http_request(method="POST", url_suffix="/ioc/get", json_data=data)

    def ioc_update(
        self,
        ioc_type: str,
        value: str,
        comment: str,
        ioc_id: str,
    ) -> dict[str, Any]:
        """Update IOC by ID.

        Args:
            ioc_type (str): The IOC type to update.
            value (str): The IOC value to update.
            comment (str): The IOC comment to update.
            ioc_id (str): The ID of the IOC to update.

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "off"
        return self._http_request(
            method="PUT",
            url_suffix="/ioc/edit",
            json_data=[{"comment": comment, "id": ioc_id, "type": ioc_type, "value": value}],
        )

    def ioc_create(
        self,
        ioc_type: str | None = None,
        value: str | None = None,
        comment: str | None = None,
    ) -> dict[str, Any]:
        """Create an IOC.

        Args:
            ioc_type (str): The IOC type.
            value (str): The IOC value.
            comment (str): The IOC comment.

        Returns:
            dict[str,Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "off"

        return self._http_request(
            method="POST",
            url_suffix="/ioc/create",
            json_data=[{"comment": comment, "type": ioc_type, "value": value}],
        )

    def ioc_delete(
        self,
        delete_all: bool,
        ioc_ids: str | None,
    ) -> dict[str, Any]:
        """Delete IOCs by IDs or delete all IOCs.

        Args:
            ioc_ids (list[int]): IOC IDs list to delete.
            delete_all (bool): Whether to delete all IOCs or not.

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "off"
        url = "/ioc/delete/all" if delete_all else f"/ioc/delete?ids={ioc_ids}"
        return self._http_request(
            method="DELETE",
            url_suffix=url,
        )

    def rule_assignments_get(
        self,
        rule_id: str,
    ) -> dict[str, Any]:
        """Gets all entities directly assigned to the given rule.

        Args:
            rule_id (str): The rule ID.

        Returns:
            dict[str, Any]: API response.
        """

        self._headers["x-mgmt-run-as-job"] = "off"

        return self._http_request(
            "GET",
            f"/policy/{rule_id}/assignments",
        )

    def rule_assignments_add(self, rule_id: str, entities_ids: list[str]) -> dict[str, Any]:
        """Assigns the specified entities to the given rule.
            Specified IDs that are already assigned to the rule are ignored.

        Args:
            rule_id (str): The ID of the rule to add assignments to.
            entities_ids (list[str]): The entities IDs to assign.

        Returns:
            dict[str, Any]: API response.
        """

        self._headers["x-mgmt-run-as-job"] = "off"

        return self._http_request(
            "PUT",
            f"/policy/{rule_id}/assignments/add",
            json_data=entities_ids,
        )

    def rule_assignments_remove(self, rule_id: str, entities_ids: list[str]) -> dict[str, Any]:
        """Removes the specified entities from the given rule's assignments.
            Specified IDs that are not assigned to the rule are ignored.

        Args:
            rule_id (str): The ID of the rule to remove assignments from.
            entities_ids (list[str]): The entities IDs to remove.

        Returns:
            dict[str, Any]: API response.
        """

        self._headers["x-mgmt-run-as-job"] = "off"

        return self._http_request(
            "PUT",
            f"/policy/{rule_id}/assignments/remove",
            json_data=entities_ids,
        )

    def rule_policy_install(self) -> dict[str, Any]:
        """Installs all policies. If a rule ID is specified,
            only the policies associated with that rule will be installed.

        Args:
            rule_id (str, optional): The ID of the rule. Defaults to None.

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/policy/install",
        )

    def rule_modifications_get(
        self,
        rule_id: str,
    ) -> dict[str, Any]:
        """Gets information on modifications to a given rule
        (modifications are the addition or removal of assignments on a rule since it was last installed).

        Args:
            rule_id (str): The rule ID.

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"
        return self._http_request(
            "GET",
            f"/policy/{rule_id}/modifications",
        )

    def rule_metadata_list(
        self,
        rule_id: str | None = None,
        rule_family: str | None = None,
        connection_state: str | None = None,
    ) -> list[dict[str, Any]]:
        """Gets the metadata of all rules or the given rule's metadata
        (Metadata refers to all information relating to the rule except it's actual settings).

        Args:
            rule_id (str): The rule ID.
            rule_family (str): An optional filter.
                Used to filter the results to only the selected capability family (e.g. only 'Threat Prevention').
            connection_state (str): An optional filter. Used to filter the results to only
                the selected Connection State (e.g. only rules pertaining to policies for 'Connected' clients).

        Returns:
            list[dict[str,Any]]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "off"
        params = {"ruleFamily": rule_family, "connectionState": connection_state}

        return self._http_request(
            "GET",
            (f"/policy/{rule_id}/metadata" if rule_id else "/policy/metadata"),
            params=params,
        )

    def push_operation_status_list(self, remediation_operation_id: str | None) -> dict[str, Any]:
        """Gets the current statuses of all remediation operations or if a specific ID is specified,
        retrieve the current status of the given remediation operation.

        Args:
            remediation_operation_id (str): Remediation operations ID.

        Returns:
            Dict[str,Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "GET",
            (f"/remediation/{remediation_operation_id}/status" if remediation_operation_id else "/remediation/status"),
        )

    def push_operation_get(
        self,
        remediation_operation_id: str,
        filter_text: str | None = None,
        new_page: int | None = None,
        new_page_size: int | None = None,
    ) -> dict[str, Any]:
        """Gets the results of a given Remediation Operation. Remediation Operations may produce results
        such a Forensics Report or yield status updates such as an Anti-Malware scan progress.

        Args:
            remediation_operation_id (str): Remediation operation ID.

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            f"/remediation/{remediation_operation_id}/results/slim",
            json_data=remove_empty_elements(
                {
                    "filters": {"freeText": filter_text},
                    "paging": {"pageSize": new_page_size, "offset": new_page},
                }
            ),
        )

    def push_operation_abort(self, remediation_operation_id: str) -> dict[str, Any]:
        """Aborts the given Remediation Operation.
            Aborting an operation prevents it from being sent to further Harmony Endpoint Clients.
            Clients that have already received the operation are not affected.

        Args:
            remediation_operation_id (str): Remediation operation ID.

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            f"/remediation/{remediation_operation_id}/abort",
        )

    def anti_malware_scan(self, request_body: dict[str, Any]) -> dict[str, Any]:
        """Performs an Anti-Malware scan on computers matching the given query.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"
        return self._http_request(
            "POST",
            "/remediation/anti-malware/scan",
            json_data=request_body,
        )

    def anti_malware_update(self, request_body: dict[str, Any]) -> dict[str, Any]:
        """Updates the Anti-Malware Signature Database on computers matching the given query.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"
        return self._http_request(
            "POST",
            "/remediation/anti-malware/update",
            json_data=request_body,
        )

    def anti_malware_restore(self, request_body: dict[str, Any]) -> dict[str, Any]:
        """Restores a file that was previously quarantined by the Harmony Endpoint Client's Anti-Malware capability.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """

        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/remediation/anti-malware/restore",
            json_data=request_body,
        )

    def indicator_analyze(
        self,
        indicator_type: str,
        request_body: dict[str, Any],
    ) -> dict[str, Any]:
        """Collects forensics data whenever a computer that matches the given query
            accesses or executes the given IP, URL, file name, MD5, or path.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """

        self._headers["x-mgmt-run-as-job"] = "on"
        return self._http_request(
            "POST",
            f"/remediation/forensics/analyze-by-indicator/{indicator_type.lower()}",
            json_data=request_body,
        )

    def file_quarantine(
        self,
        request_body: dict[str, Any],
    ) -> dict[str, Any]:
        """Quarantines files given by path or MD5 or detections relating to a forensic incident.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/remediation/forensics/file/quarantine",
            json_data=request_body,
        )

    def file_restore(
        self,
        request_body: dict[str, Any],
    ) -> dict[str, Any]:
        """Restores previously quarantined files given by path or MD5 or detections relating to a forensic incident.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/remediation/forensics/file/restore",
            json_data=request_body,
        )

    def remediation_computer_isolate(self, request_body: dict[str, Any]) -> dict[str, Any]:
        """Isolates the computers matching the given query. Isolation is the act of denying all
        network access from a given computer.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/remediation/isolate",
            json_data=request_body,
        )

    def remediation_computer_deisolate(self, request_body: dict[str, Any]) -> dict[str, Any]:
        """De-Isolates the computers matching the given query. De-isolating a computer restores
            its access to network resources.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/remediation/de-isolate",
            json_data=request_body,
        )

    def computer_restart(
        self,
        request_body: dict[str, Any],
    ) -> dict[str, Any]:
        """Restarts computers matching the given query.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/remediation/agent/reset-computer",
            json_data=request_body,
        )

    def computer_shutdown(
        self,
        request_body: dict[str, Any],
    ) -> dict[str, Any]:
        """Shuts-down computers match the given query.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/remediation/agent/shutdown-computer",
            json_data=request_body,
        )

    def computer_repair(self, request_body: dict[str, Any]) -> dict[str, Any]:
        """Repairs the Harmony Endpoint Client installation on computers matching the given query.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/remediation/agent/repair-computer",
            json_data=request_body,
        )

    def computer_list(self, request_body: dict[str, Any]) -> dict[str, Any]:
        """Gets a list of computers matching the given filters.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/asset-management/computers/filtered",
            json_data=request_body,
        )

    def process_information_get(self, request_body: dict[str, Any]) -> dict[str, Any]:
        """Collects information about processes on computers matching the given query.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/remediation/agent/process/information",
            json_data=request_body,
        )

    def process_terminate(
        self,
        request_body: dict[str, Any],
    ) -> dict[str, Any]:
        """Terminates the given process on computers matching the given query.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/remediation/agent/process/terminate",
            json_data=request_body,
        )

    def agent_registry_key_add(
        self,
        request_body: dict[str, Any],
    ) -> dict[str, Any]:
        """Adds a given registry key and/or value to the registry of computers matching the given query.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/remediation/agent/registry/key/add",
            json_data=request_body,
        )

    def agent_registry_key_delete(
        self,
        request_body: dict[str, Any],
    ) -> dict[str, Any]:
        """Removes the given registry key or value to the registry of computers matching the given query.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"
        return self._http_request(
            "POST",
            "/remediation/agent/registry/key/delete",
            json_data=request_body,
        )

    def agent_file_copy(
        self,
        request_body: dict[str, Any],
    ) -> dict[str, Any]:
        """Copies the given file from the given source to the given destination on computers matching the given query.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/remediation/agent/file/copy",
            json_data=request_body,
        )

    def agent_file_move(
        self,
        request_body: dict[str, Any],
    ) -> dict[str, Any]:
        """Moves the given file from the given source to the given destination on computers matching the given query.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/remediation/agent/file/move",
            json_data=request_body,
        )

    def agent_file_delete(
        self,
        request_body: dict[str, Any],
    ) -> dict[str, Any]:
        """Deletes the given file from the given source on computers matching the given query.
            This operation is risky! Use with caution as it allows you to change Harmony Endpoint protected
            files or registry entries that are in use by your operating system.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/remediation/agent/file/delete",
            json_data=request_body,
        )

    def agent_vpn_site_add(
        self,
        request_body: dict[str, Any],
    ) -> dict[str, Any]:
        """Adds the given VPN Site's configuration to computers matching the given query.
            Adding a VPN Site allows Harmony Endpoint Clients to connect to it.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/remediation/agent/vpn/site/add",
            json_data=request_body,
        )

    def agent_vpn_site_remove(
        self,
        request_body: dict[str, Any],
    ) -> dict[str, Any]:
        """Removes the given VPN Site's configuration to computers matching the given query.

        Args:
            request_body (dict[str, Any]): The request body for the API request (query computers).

        Returns:
            dict[str, Any]: API response.
        """
        self._headers["x-mgmt-run-as-job"] = "on"

        return self._http_request(
            "POST",
            "/remediation/agent/vpn/site/remove",
            json_data=request_body,
        )


def job_status_get_command(args: dict[str, Any], client: Client) -> CommandResults:
    """Get job status and data by ID.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        CommandResults: outputs, readable outputs and raw response for XSOAR.
    """

    response = client.job_status_get(job_id=args.get("job_id", ""))

    return CommandResults(
        outputs_prefix="HarmonyEP.Job",
        outputs_key_field="id",
        outputs=response,
        raw_response=response,
    )


def ioc_list_command(args: dict[str, Any], client: Client) -> CommandResults:
    """Fetch IOCs list.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        CommandResults: outputs, readable outputs and raw response for XSOAR.
    """
    new_page, new_page_size, pagination_message = get_pagination_args(args)

    response = client.ioc_list(
        page=new_page,
        page_size=new_page_size,
        ioc_filter=args.get("filter"),
        field=args.get("field"),
        sort_direction=args.get("sort_direction"),
    )

    for ioc in response["content"]:
        ioc["modifiedOn"] = convert_unix_to_date_string(ioc["modifiedOn"])

    readable_output = tableToMarkdown(
        name="IOC List:",
        metadata=pagination_message,
        t=response["content"],
        headers=["id", "type", "value", "comment", "modifiedOn"],
        headerTransform=string_to_table_header,
    )
    return CommandResults(
        readable_output=readable_output,
        outputs_prefix="HarmonyEP.IOC",
        outputs_key_field="id",
        outputs=response["content"],
        raw_response=response,
    )


def ioc_update_command(args: dict[str, Any], client: Client) -> CommandResults:
    """Update IOC by ID.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        CommandResults: outputs, readable outputs and raw response for XSOAR.
    """
    ioc_id = args.get("ioc_id", "")

    response = client.ioc_update(
        ioc_type=args.get("type", ""),
        value=args.get("value", ""),
        comment=args.get("comment", ""),
        ioc_id=ioc_id,
    )
    readable_output = tableToMarkdown(
        name=f"IOC {ioc_id} was updated successfully.",
        t=response,
        headers=["id", "type", "value", "comment", "modifiedOn"],
        headerTransform=string_to_table_header,
    )
    return CommandResults(
        readable_output=readable_output,
        outputs_prefix="HarmonyEP.IOC",
        outputs_key_field="id",
        outputs=response,
        raw_response=response,
    )


def ioc_create_command(args: dict[str, Any], client: Client) -> CommandResults:
    """Create new IOC.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        CommandResults: outputs, readable outputs and raw response for XSOAR.
    """
    client.ioc_create(
        ioc_type=args.get("type"),
        value=args.get("value"),
        comment=args.get("comment"),
    )
    return CommandResults(readable_output="IOC was created successfully.")


def ioc_delete_command(args: dict[str, Any], client: Client) -> CommandResults:
    """Delete IOCs by IDs or delete all IOCs.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        CommandResults: outputs, readable outputs and raw response for XSOAR.
    """

    ioc_ids = args.get("ids")
    delete_all = argToBoolean(args.get("delete_all"))

    client.ioc_delete(ioc_ids=ioc_ids, delete_all=delete_all)

    return CommandResults(
        readable_output=("All IOCs were deleted successfully." if delete_all else f"IOCs {ioc_ids} was deleted successfully.")
    )


def rule_assignments_get_command(args: dict[str, Any], client: Client) -> CommandResults:
    """Gets all entities directly assigned to the given rule.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        CommandResults: outputs, readable outputs and raw response for XSOAR.
    """
    rule_id = args.get("rule_id", "")

    response = client.rule_assignments_get(
        rule_id=rule_id,
    )
    output = {"id": rule_id, "assignments": response}
    readable_output = tableToMarkdown(
        name=f"Rule {rule_id} assignments:",
        t=response,
        headers=["id", "name", "type"],
        headerTransform=string_to_table_header,
    )

    return CommandResults(
        readable_output=readable_output,
        outputs_prefix="HarmonyEP.Rule",
        outputs_key_field="id",
        outputs=output,
        raw_response=response,
    )


def rule_assignments_add_command(args: dict[str, Any], client: Client) -> CommandResults:
    """Assigns the specified entities to the given rule. Specified IDs that are already assigned to the rule are ignored.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        CommandResults: outputs, readable outputs and raw response for XSOAR.
    """
    rule_id = args.get("rule_id", "")
    entities_ids = argToList(args.get("entities_ids"))

    client.rule_assignments_add(rule_id=rule_id, entities_ids=entities_ids)
    return CommandResults(readable_output=f"Entities {entities_ids} were assigned to rule {rule_id} successfully.")


def rule_assignments_remove_command(args: dict[str, Any], client: Client) -> CommandResults:
    """Removes the specified entities from the given rule's assignments.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        CommandResults: outputs, readable outputs and raw response for XSOAR.
    """
    rule_id = args.get("rule_id", "")
    entities_ids = argToList(args.get("entities_ids"))

    client.rule_assignments_remove(rule_id=rule_id, entities_ids=entities_ids)
    return CommandResults(readable_output=f"Entities {entities_ids} were removed from rule {rule_id} successfully.")


@polling_function(
    name="harmony-ep-policy-rule-install",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Policy installation request is executing",
    requires_polling_arg=False,
)
def rule_policy_install_command(args: dict[str, Any], client: Client) -> PollResult:
    """Installs all policies. If a rule ID is specified, only the policies associated with that rule will be installed.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        response = client.rule_policy_install()
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-policy-rule-install")


@polling_function(
    name="harmony-ep-policy-rule-modifications-get",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Fetch rule modifications request is executing",
    requires_polling_arg=False,
)
def rule_modifications_get_command(args: dict[str, Any], client: Client) -> PollResult:
    """Gets information on modifications to a given rule (modifications are the addition or
        removal of assignments on a rule since it was last installed).

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    rule_id = args.get("rule_id", "")
    SCHEDULED_COMMANDS_MAPPER["harmony-ep-policy-rule-modifications-get"].format_message(rule_id)

    if not args.get("job_id"):
        response = client.rule_modifications_get(rule_id=rule_id)
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-policy-rule-modifications-get")


def rule_metadata_list_command(args: dict[str, Any], client: Client) -> CommandResults:
    """Gets the metadata of all rules or the given rule's metadata
        (Metadata refers to all information relating to the rule except it's actual settings).

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        CommandResults: outputs, readable outputs and raw response for XSOAR.
    """

    rule_id = args.get("rule_id")
    rule_family = args.get("rule_family")
    connection_state = args.get("connection_state")
    limit = arg_to_number(args.get("limit"))
    all_results = argToBoolean(args.get("all_results"))

    response = client.rule_metadata_list(rule_id, rule_family, connection_state)

    if not rule_id and not all_results:
        response = response[:limit]

    readable_output = tableToMarkdown(
        name="Rule metadata List:" if not rule_id else f"Rule {rule_id} metadata:",
        metadata=f"Showing {len(response)} items." if not rule_id else None,
        t=response,
        headers=[
            "id",
            "name",
            "family",
            "comment",
            "orientation",
            "connectionState",
            "assignments",
        ],
        headerTransform=string_to_table_header,
    )
    return CommandResults(
        readable_output=readable_output,
        outputs_prefix="HarmonyEP.Rule",
        outputs_key_field="id",
        outputs=response,
        raw_response=response,
    )


@polling_function(
    name="harmony-ep-push-operation-status-list",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Fetch remediation status list request is executing",
    requires_polling_arg=False,
)
def push_operation_status_list_command(args: dict[str, Any], client: Client) -> PollResult:
    """Gets the current statuses of all remediation operations or if a specific ID is specified,
        retrieve the current status of the given remediation operation.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """

    if not args.get("job_id"):
        remediation_operation_id = args.get("remediation_operation_id")
        response = client.push_operation_status_list(remediation_operation_id=remediation_operation_id)
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-push-operation-status-list")


@polling_function(
    name="harmony-ep-push-operation-get",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Fetch remediation request is executing",
    requires_polling_arg=False,
)
def push_operation_get_command(args: dict[str, Any], client: Client) -> PollResult:
    """Gets the results of a given Remediation Operation.
    Remediation Operations may produce results such a Forensics Report or yield status
    updates such as an Anti-Malware scan progress.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """

    if not args.get("job_id"):
        new_page, new_page_size, _ = get_pagination_args(args)

        response = client.push_operation_get(
            remediation_operation_id=args.get("remediation_operation_id", ""),
            filter_text=args.get("filter_text"),
            new_page=new_page,
            new_page_size=new_page_size,
        )
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-push-operation-get")


@polling_function(
    name="harmony-ep-push-operation-abort",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Remediation operation abort request is executing",
    requires_polling_arg=False,
)
def push_operation_abort_command(args: dict[str, Any], client: Client) -> PollResult:
    """Aborts the given Remediation Operation.
       Aborting an operation prevents it from being sent to further Harmony Endpoint Clients.
       Clients that have already received the operation are not affected.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        remediation_operation_id = args.get("remediation_operation_id", "")
        SCHEDULED_COMMANDS_MAPPER[
            "harmony-ep-push-operation-abort"
        ].message = f"Remediation operation {remediation_operation_id} was aborted successfully."

        response = client.push_operation_abort(remediation_operation_id=remediation_operation_id)
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-push-operation-abort")


@polling_function(
    name="harmony-ep-anti-malware-scan",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Anti malware scan request is executing",
    requires_polling_arg=False,
)
def anti_malware_scan_command(args: dict[str, Any], client: Client) -> PollResult:
    """Performs an Anti-Malware scan on computers matching the given query.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """

    if not args.get("job_id"):
        request_body = build_request_body(args)
        response = client.anti_malware_scan(request_body)
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-anti-malware-scan")


@polling_function(
    name="harmony-ep-anti-malware-update",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Anti malware update request is executing",
    requires_polling_arg=False,
)
def anti_malware_update_command(args: dict[str, Any], client: Client) -> PollResult:
    """Updates the Anti-Malware Signature Database on computers matching the given query.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        request_body["operationParameters"] |= {
            "updateFromEpServer": arg_to_bool(args.get("update_from_ep_server")),
            "updateFromCpServer": arg_to_bool(args.get("update_from_cp_server")),
        }

        response = client.anti_malware_update(request_body)
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-anti-malware-update")


@polling_function(
    name="harmony-ep-anti-malware-restore",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Anti malware restore request is executing",
    requires_polling_arg=False,
)
def anti_malware_restore_command(args: dict[str, Any], client: Client) -> PollResult:
    """Restores a file that was previously quarantined by the Harmony Endpoint Client's Anti-Malware capability.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        request_body["operationParameters"] |= {"files": argToList(args.get("files"))}

        response = client.anti_malware_restore(request_body)
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-anti-malware-restore")


@polling_function(
    name="harmony-ep-forensics-indicator-analyze",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Indicator analyze request is executing",
    requires_polling_arg=False,
)
def indicator_analyze_command(args: dict[str, Any], client: Client) -> PollResult:
    """Collects forensics data whenever a computer that matches the given query accesses
        or executes the given IP, URL, file name, MD5, or path.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """

    if not args.get("job_id"):
        request_body = build_request_body(args)
        request_body["operationParameters"] |= {
            "generateActivityLogs": arg_to_bool(args.get("generate_activity_logs")),
            "indicator": args.get("indicator_value"),
        }

        response = client.indicator_analyze(
            indicator_type=args.get("indicator_type", ""),
            request_body=request_body,
        )
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-forensics-indicator-analyze")


@polling_function(
    name="harmony-ep-forensics-file-quarantine",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="File quarantine request is executing",
    requires_polling_arg=False,
)
def file_quarantine_command(args: dict[str, Any], client: Client) -> PollResult:
    """Quarantines files given by path or MD5 or detections relating to a forensic incident.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        request_body["operationParameters"] |= {
            "items": {
                "type": args.get("file_type"),
                "value": args.get("file_value"),
            }
        }

        response = client.file_quarantine(request_body)
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-forensics-file-quarantine")


@polling_function(
    name="harmony-ep-forensics-file-restore",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="File restore request is executing",
    requires_polling_arg=False,
)
def file_restore_command(args: dict[str, Any], client: Client) -> PollResult:
    """Restores previously quarantined files given by path or MD5 or detections relating to a forensic incident.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        request_body["operationParameters"] |= {
            "items": {
                "type": args.get("file_type"),
                "value": args.get("file_value"),
            }
        }

        response = client.file_restore(request_body)
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-forensics-file-restore")


@polling_function(
    name="harmony-ep-remediation-computer-isolate",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Computer isolate request is executing",
    requires_polling_arg=False,
)
def remediation_computer_isolate_command(args: dict[str, Any], client: Client) -> PollResult:
    """Isolates the computers matching the given query. Isolation is the act of denying all network access from a given computer.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        response = client.remediation_computer_isolate(request_body)
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-remediation-computer-isolate")


@polling_function(
    name="harmony-ep-remediation-computer-deisolate",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Computer de-isolate request is executing",
    requires_polling_arg=False,
)
def remediation_computer_deisolate_command(args: dict[str, Any], client: Client) -> PollResult:
    """De-Isolates the computers matching the given query. De-isolating a computer restores its access to network resources.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        response = client.remediation_computer_deisolate(request_body)
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-remediation-computer-deisolate")


@polling_function(
    name="harmony-ep-agent-computer-restart",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Computer restart request is executing",
    requires_polling_arg=False,
)
def computer_restart_command(args: dict[str, Any], client: Client) -> PollResult:
    """Restarts computers matching the given query.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        request_body["operationParameters"] |= {
            "forceAppsShutdown": args.get("force_apps_shutdown"),
        }
        response = client.computer_restart(request_body)
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-agent-computer-restart")


@polling_function(
    name="harmony-ep-agent-computer-shutdown",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Computer shutdown request is executing",
    requires_polling_arg=False,
)
def computer_shutdown_command(args: dict[str, Any], client: Client) -> PollResult:
    """Shuts-down computers match the given query.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        request_body["operationParameters"] |= {
            "forceAppsShutdown": args.get("force_apps_shutdown"),
        }
        response = client.computer_shutdown(request_body)
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-agent-computer-shutdown")


@polling_function(
    name="harmony-ep-agent-computer-repair",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Computer repair request is executing",
    requires_polling_arg=False,
)
def computer_repair_command(args: dict[str, Any], client: Client) -> PollResult:
    """Repairs the Harmony Endpoint Client installation on computers matching the given query.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        response = client.computer_repair(request_body)
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-agent-computer-repair")


@polling_function(
    name="harmony-ep-computer-list",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Computer list fetch request is executing",
    requires_polling_arg=False,
)
def computer_list_command(args: dict[str, Any], client: Client) -> PollResult:
    """Gets a list of computers matching the given filters.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        new_page, new_page_size, _ = get_pagination_args(args)
        request_body = {
            "filters": extract_query_filter(args),
            "paging": {"pageSize": new_page_size, "offset": new_page},
        }

        response = client.computer_list(request_body)
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-computer-list")


@polling_function(
    name="harmony-ep-agent-process-information-get",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Process information fetch request is executing",
    requires_polling_arg=False,
)
def process_information_get_command(args: dict[str, Any], client: Client) -> PollResult:
    """Collects information about processes on computers matching the given query.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        request_body["operationParameters"] |= {
            "processName": args.get("process_name"),
            "additionalFields": argToList(args.get("additional_fields")),
        }
        response = client.process_information_get(remove_empty_elements(request_body))
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-agent-process-information-get")


@polling_function(
    name="harmony-ep-agent-process-terminate",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Process terminate request is executing",
    requires_polling_arg=False,
)
def process_terminate_command(args: dict[str, Any], client: Client) -> PollResult:
    """Terminates the given process on computers matching the given query.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        request_body["operationParameters"] |= {
            "name": args.get("name"),
            "pid": arg_to_number(args.get("pid")),
            "terminateAllInstances": arg_to_bool(args.get("terminate_all_instances")),
        }
        response = client.process_terminate(remove_empty_elements(request_body))
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-agent-process-terminate")


@polling_function(
    name="harmony-ep-agent-registry-key-add",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Registry key add request is executing",
    requires_polling_arg=False,
)
def agent_registry_key_add_command(args: dict[str, Any], client: Client) -> PollResult:
    """Adds a given registry key and/or value to the registry of computers matching the given query.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        request_body["operationParameters"] |= {
            "hive": args.get("hive"),
            "key": args.get("key"),
            "valueName": args.get("value_name"),
            "valueType": REGISTRY_VALUE_TYPE_MAP[args.get("value_type", "")],
            "valueData": args.get("value_data"),
            "isRedirected": arg_to_bool(args.get("is_redirected")),
        }
        response = client.agent_registry_key_add(remove_empty_elements(request_body))
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-agent-registry-key-add")


@polling_function(
    name="harmony-ep-agent-registry-key-delete",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Registry key remove request is executing",
    requires_polling_arg=False,
)
def agent_registry_key_delete_command(args: dict[str, Any], client: Client) -> PollResult:
    """Removes the given registry key or value to the registry of computers matching the given query.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        request_body["operationParameters"] |= {
            "hive": args.get("hive"),
            "key": args.get("key"),
            "valueName": args.get("value_name"),
            "isRedirected": arg_to_bool(args.get("is_redirected")),
        }
        response = client.agent_registry_key_delete(remove_empty_elements(request_body))
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-agent-registry-key-delete")


@polling_function(
    name="harmony-ep-agent-file-copy",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="File copy request is executing",
    requires_polling_arg=False,
)
def agent_file_copy_command(args: dict[str, Any], client: Client) -> PollResult:
    """Copies the given file from the given source to the given destination on computers matching the given query.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        request_body["operationParameters"] |= {
            "sourceAbsolutePath": args.get("destination_absolute_path"),
            "destinationAbsolutePath": args.get("source_absolute_path"),
        }
        response = client.agent_file_copy(remove_empty_elements(request_body))

        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-agent-file-copy")


@polling_function(
    name="harmony-ep-agent-file-move",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="File move request is executing",
    requires_polling_arg=False,
)
def agent_file_move_command(args: dict[str, Any], client: Client) -> PollResult:
    """Moves the given file from the given source to the given destination on computers matching the given query.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        request_body["operationParameters"] |= {
            "sourceAbsolutePath": args.get("destination_absolute_path"),
            "destinationAbsolutePath": args.get("source_absolute_path"),
        }
        response = client.agent_file_move(request_body)
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-agent-file-move")


@polling_function(
    name="harmony-ep-agent-file-delete",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="File delete request is executing",
    requires_polling_arg=False,
)
def agent_file_delete_command(args: dict[str, Any], client: Client) -> PollResult:
    """Deletes the given file from the given source on computers matching the given query.
        This operation is risky! Use with caution as it allows you to change Harmony Endpoint protected
        files or registry entries that are in use by your operating system.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        request_body["operationParameters"] |= {
            "targetAbsolutePath": args.get("target_absolute_path"),
        }
        response = client.agent_file_delete(request_body)
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-agent-file-delete")


@polling_function(
    name="harmony-ep-agent-vpn-site-add",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Add VPN Site's configuration request is executing",
    requires_polling_arg=False,
)
def agent_vpn_site_add_command(args: dict[str, Any], client: Client) -> PollResult:
    """Adds the given VPN Site's configuration to computers matching the given query.
        Adding a VPN Site allows Harmony Endpoint Clients to connect to it.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        request_body["operationParameters"] |= {
            "remoteAccessGatewayName": args.get("remote_access_gateway_name"),
            "fingerprint": args.get("fingerprint"),
            "authentication": {"method": args.get("authentication_method")},
            "host": args.get("host"),
            "displayName": args.get("display_name"),
        }
        response = client.agent_vpn_site_add(remove_empty_elements(request_body))
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-agent-vpn-site-add")


@polling_function(
    name="harmony-ep-agent-vpn-site-remove",
    interval=arg_to_number(demisto.args().get("interval", 30)),
    timeout=arg_to_number(demisto.args().get("timeout", 600)),
    poll_message="Remove VPN Site's configuration request is executing",
    requires_polling_arg=False,
)
def agent_vpn_site_remove_command(args: dict[str, Any], client: Client) -> PollResult:
    """Removes the given VPN Site's configuration to computers matching the given query.

    Args:
        client (Client): Harmony API client.
        args (dict): Command arguments from XSOAR.

    Returns:
        PollResult: outputs, readable outputs and raw response for XSOAR.
    """
    if not args.get("job_id"):
        request_body = build_request_body(args)
        request_body["operationParameters"] |= {
            "displayName": args.get("display_name"),
        }
        response = client.agent_vpn_site_remove(remove_empty_elements(request_body))
        args["job_id"] = response.get("jobId")

    return schedule_command(args, client, "harmony-ep-agent-vpn-site-remove")


def test_module(client: Client) -> str:
    """
    Builds the iterator to check that the feed is accessible.

    Args:
        client: Client object.

    Returns:
        Outputs.
    """
    try:
        client.ioc_list(0, 1)
    except DemistoException as exc:
        if exc.res is not None and (
            exc.res.status_code == http.HTTPStatus.UNAUTHORIZED or exc.res.status_code == http.HTTPStatus.FORBIDDEN
        ):
            return "Authorization Error: Invalid URL or credentials."
        raise exc

    return "ok"


# Helper Commands #


def schedule_command(args: dict[str, Any], client: Client, command_name: str) -> PollResult:
    """Build scheduled command in case:
        - Job state is not 'DONE'
        - Job state is 'DONE' but the API response data is a remediation operation ID.

    Args:
        client (Client): Harmony Endpoint API client.
        args (dict[str, Any]): Command arguments from XSOAR.

    Returns:
        PollResult: Command, args, timeout and interval for CommandResults.
    """
    if last_job_id := dict_safe_get(get_integration_context(), ["job_id"]):
        args["job_id"] = last_job_id

    command_results: CommandResults = job_status_get_command(args, client)
    sample_state = dict_safe_get(command_results.raw_response, ["status"])

    if sample_state == "DONE":
        command_data = dict_safe_get(command_results.raw_response, ["data"])

        # Check if data is a remediation operation ID
        # If so, will fetch another job ID for the push operation data
        if isinstance(command_data, str):
            response = client.push_operation_get(command_data)

            # Save new schedule arguments in integration context
            # (cause for the second run there are new arguments or/and values)
            set_integration_context({"job_id": response["jobId"], "remediation_operation_id": command_data})
            return PollResult(
                response=command_results,
                continue_to_poll=True,
                args_for_next_run=args,
            )
        else:
            updated_command_readable_output, updated_command_response = prepare_command_output_and_readable_output(
                command_data=command_data,
                command_name=command_name,
                job_id=args["job_id"],
            )

            command_results.readable_output = get_readable_output(
                command_name=command_name,
                updated_command_data=updated_command_readable_output,
                args=args,
            )

            clear_integration_context()

            return PollResult(
                response=update_command_results(
                    command_name=command_name,
                    updated_command_response=updated_command_response,
                    command_results=command_results,
                ),
                continue_to_poll=False,
            )

    if sample_state == "FAILED":
        clear_integration_context()
        # In case the job not succeeded raise the error
        raise DemistoException(f"Executing {args['job_id']} for Harmony Endpoint failed. Error: {command_results.raw_response}")

    return PollResult(
        response=command_results,
        continue_to_poll=True,
        args_for_next_run=args,
    )


def update_command_results(
    command_name: str,
    updated_command_response: dict | list,
    command_results: CommandResults,
) -> CommandResults:
    """Update the command results for schedule commands.

    Args:
        command_name (str): The command name.
        updated_command_response (dict | list): The updated command response.
        command_results (CommandResults): The exist command results.

    Returns:
        CommandResults: The updated command results.
    """
    command_results.raw_response = updated_command_response
    command_results.outputs = updated_command_response
    command_results.outputs_key_field = "job_id"
    command_results.outputs_prefix = f"HarmonyEP.{SCHEDULED_COMMANDS_MAPPER[command_name].outputs_prefix}"

    return command_results


def get_readable_output(
    command_name: str,
    updated_command_data: list | dict[str, Any] | None,
    args: dict[str, Any],
) -> Any:
    """Get readable output for schedule command.

    Args:
        command_name (str): The command name.
        updated_command_data (list | dict[str, Any]): The updated command data.
        args (dict[str, Any]): Command arguments.

    Returns:
        Any: tableToMarkdown object.
    """
    _, page_size, pagination_message = get_pagination_args(args)
    if page_size:
        SCHEDULED_COMMANDS_MAPPER[command_name].message += f"\n\n{pagination_message}"

    return tableToMarkdown(
        name=SCHEDULED_COMMANDS_MAPPER[command_name].message,
        t=remove_empty_elements(updated_command_data),
        headers=SCHEDULED_COMMANDS_MAPPER[command_name].headers,
        headerTransform=string_to_table_header,
        removeNull=True,
    )


def prepare_command_output_and_readable_output(
    command_data: dict[str, Any],
    command_name: str,
    job_id: str,
) -> tuple[dict | list | None, dict | list]:
    """Prepare the command output and readable output according the API response type.

    Args:
        command_data (dict[str, Any]): The command data.
        command_name (str): The command name.
        job_id (str): The job ID.

    Returns:
        tuple: The command output and readable output for the command results.
    """
    SCHEDULED_COMMANDS_MAPPER[command_name].message += f"\nJob ID: {job_id}"

    # check if API response is empty
    if not command_data:
        return None, {"job_id": job_id}

    # check if API return computers data
    if computer_list := dict_safe_get(command_data, ["computers"]):
        return prepare_computer_list_output_and_readable_output(
            computers_data=computer_list,
            job_id=job_id,
        )

    # check if API return data is push operation list
    if SCHEDULED_COMMANDS_MAPPER[command_name].headers == DEFAULT_HEADERS:
        return prepare_push_operation_output_and_readable_output(
            command_data=dict_safe_get(
                dict_object=command_data,
                keys=["data"],
                default_return_value=command_data,
            ),
            job_id=job_id,
        )

    if isinstance(command_data, list):
        for data in command_data:
            data["job_id"] = job_id

    else:
        command_data["job_id"] = job_id

    return command_data, command_data


def prepare_computer_list_output_and_readable_output(
    computers_data: list[dict[str, Any]], job_id: str
) -> tuple[list, dict[str, Any]]:
    """Prepare the computer list command output and readable output.

    Args:
        computers_data (list[dict[str, Any]]): The computer list data.
        job_id (str): The job ID.

    Returns:
        tuple[list, dict[str, Any]]: The command output and readable output.
    """
    updated_response = []
    for computer in computers_data:
        updated_response.append(
            {
                "id": computer.get("computerId"),
                "name": computer.get("computerName"),
                "ip": computer.get("computerIP"),
                "type": computer.get("computerType"),
                "deployment_status": computer.get("computerDeploymentStatus"),
                "client_version": computer.get("computerClientVersion"),
                "groups": computer.get("computerGroups"),
                "user_name": computer.get("computerUserName"),
                "domain_name": computer.get("domainName"),
                "isolation_status": computer.get("isolationStatus"),
                "last_logged_in_user": computer.get("computerLastLoggedInUser"),
                "os_name": computer.get("osName"),
                "os_version": computer.get("osVersion"),
            }
        )
    return updated_response, {"job_id": job_id, "Computer": updated_response}


def prepare_push_operation_output_and_readable_output(
    command_data: list[dict[str, Any]],
    job_id: str,
) -> tuple[list | dict[str, Any], list | dict[str, Any]]:
    """Update the API response data for the readable output in case the API response is push operation data.

    Args:
        command_name (str): The commands name.
        command_data (dict[str, Any]): The API response.
        job_id (str): The job ID.

    Returns:
        Tuple[list | dict[str, Any], list | dict[str, Any]]: The updated command data.
    """
    updated_command_readable_output = []

    for data in command_data:
        updated_command_readable_output.append(
            {
                "machine_id": dict_safe_get(data, ["machine", "id"]),
                "machine_name": dict_safe_get(data, ["machine", "name"]),
                "operation_status": dict_safe_get(data, ["operation", "status"]),
                "operation_response_status": dict_safe_get(data, ["operation", "response", "status"]),
                "operation_response_output": dict_safe_get(data, ["operation", "response", "output"]),
            }
        )
        data["operation"] |= {"id": dict_safe_get(get_integration_context(), ["remediation_operation_id"])}
        data["job_id"] = job_id

    return updated_command_readable_output, command_data


def validate_pagination_arguments(
    page: int | None | None = None,
    page_size: int | None | None = None,
    limit: int | None | None = None,
):
    """Validate pagination arguments according to their default.

    Args:
        page (int, optional): Page number of paginated results.
        page_size (int, optional): Number of items per page.
        limit (int, optional): The maximum number of records to retrieve.

    Raises:
        ValueError: Appropriate error message.
    """
    if page_size and (page_size < MIN_PAGE_SIZE or page_size > MAX_PAGE_SIZE):
        raise ValueError(f"page_size argument must be greater than {MIN_PAGE_SIZE} and smaller than {MAX_PAGE_SIZE}.")
    if page and page < MIN_PAGE_NUM:
        raise ValueError(f"page argument must be greater than {MIN_PAGE_NUM - 1}.")
    if limit and limit <= MIN_LIMIT:
        raise ValueError(f"limit argument must be greater than {MIN_LIMIT}.")


def get_pagination_args(args: dict[str, Any]) -> tuple:
    """Return the correct limit and offset for the API
        based on the user arguments page, page_size and limit.

    Args:
        args (dict[str, Any]): Command arguments from XSOAR.

    Returns:
        Tuple: new_limit, offset, pagination_message.
    """
    page = arg_to_number(args.get("page"))
    page_size = arg_to_number(args.get("page_size"))
    limit = arg_to_number(args.get("limit"))

    validate_pagination_arguments(page, page_size, limit)

    new_page = 0
    new_page_size = limit

    if page and page_size:
        new_page_size = page_size
        new_page = page - 1

    pagination_message = f"Showing page {new_page+1}.\nCurrent page size: {new_page_size}."

    return new_page, new_page_size, pagination_message


def validate_filter_arguments(column_name: str | None = None, filter_type: str = None):
    """Validate filter arguments values are allowed.

    Args:
        column_name (str, optional): The column name to filter by. Defaults to None.
        filter_type (str, optional): The filter operator. Defaults to None.

    Raises:
        ValueError: Raise error in case column_name or filter_type values are not allowed.
    """
    if column_name and column_name not in COLUMN_NAMES:
        raise ValueError(f"'column_name' must be one of the followings: {COLUMN_NAMES}.")

    if filter_type and filter_type not in FILTER_TYPES:
        raise ValueError(f"'filter_type' must be one of the followings: {FILTER_TYPES}.")


def extract_query_filter(args: dict[str, Any]) -> list[dict[str, Any]]:
    """Extract query filters from the specified arguments.

    Args:
        args (dict[str, Any]): Command arguments from XSOAR.

    Returns:
        list[dict[str, Any]]: The updated query filter according to Harmony requirements.
    """
    query_filter = []

    if filter_by_query := args.get("filter"):
        queries = argToList(filter_by_query, "' , ")

        for query in queries:
            query_parts = query.split(" ")

            if len(query_parts) != 3:
                raise ValueError("'filter' must be in the following format: 'column_name filter_type filter_value'.")

            column_name = query_parts[0]
            filter_type = query_parts[1]
            filter_values = query_parts[2].replace("'", "")

            validate_filter_arguments(column_name, filter_type)

            query_filter.append(
                {
                    "columnName": column_name,
                    "filterValues": argToList(filter_values),
                    "filterType": filter_type,
                }
            )
    for key, value in args.items():
        if key in COLUMN_NAMES_MAPPER:
            query_filter.append(
                {
                    "columnName": COLUMN_NAMES_MAPPER[key],
                    "filterValues": argToList(value),
                    "filterType": DEFAULT_FILTER_TYPE,
                }
            )

    if computer_last_connection := args.get("computer_last_connection"):
        computer_last_connection_times = argToList(computer_last_connection)

        if len(computer_last_connection_times) != 2:
            raise ValueError("'computer_last_connection' must be in the following format: 'YYYY-MM-DD HH:MM, YYYY-MM-DD HH:MM'.")

        query_filter += [
            {
                "columnName": "computerLastConnection",
                "filterValues": computer_last_connection_times[0],
                "filterType": "Grater",
            },
            {
                "columnName": "computerLastConnection",
                "filterValues": computer_last_connection_times[1],
                "filterType": "Smaller",
            },
        ]

    if not query_filter:
        raise DemistoException(
            """At least one of the following query arguments are required: computer_ids, computer_names, computer_ips,
            computer_group_names, computer_types, computer_deployment_status, computer_last_connection, or filter."""
        )

    return query_filter


def build_request_body(args: dict[str, Any]) -> dict[str, Any]:
    """Build a query for Harmony API.

    Args:
        args (dict[str, Any]): Command arguments from XSOAR.

    Returns:
        dict[str, Any]: The query for Harmony API.
    """

    new_page, new_page_size, _ = get_pagination_args(args)

    computers_to_include = []
    if computers_ids_to_include := args.get("computers_ids_to_include"):
        for computer_id in argToList(computers_ids_to_include):
            computers_to_include.append({"id": computer_id})

    return remove_empty_elements(
        {
            "comment": args.get("comment"),
            "timing": {
                "expirationSeconds": args.get("expiration_seconds"),
                "schedulingDateTime": args.get("scheduling_date_time"),
            },
            "targets": {
                "query": {
                    "filter": extract_query_filter(args),
                    "paging": {"pageSize": new_page_size, "offset": new_page},
                },
                "exclude": {
                    "groupsIds": argToList(args.get("groups_ids_to_exclude")),
                    "computerIds": argToList(args.get("computers_ids_to_exclude")),
                },
                "include": {"computers": computers_to_include},
            },
            "operationParameters": {
                "informUser": arg_to_bool(args.get("inform_user")),
                "allowPostpone": arg_to_bool(args.get("allow_postpone")),
            },
        }
    )


def arg_to_bool(arg: str = None) -> bool | None:
    """Convert string to boolean if value is not none.

    Args:
        arg (str, optional): The argument value. Defaults to None.

    Returns:
        bool | None: The converted value or none.
    """
    return argToBoolean(arg) if arg else None


def clear_integration_context() -> None:
    """Reset integration context."""
    set_integration_context({"job_id": None, "remediation_operation_id": None})


def convert_unix_to_date_string(unix_timestamp: int) -> str:
    """Convert unix timestamp to date string.

    Args:
        unix_timestamp (int): unix.

    Returns:
        str: Datetime string.
    """
    timestamp_in_seconds = unix_timestamp / 1000
    date_time = datetime.fromtimestamp(timestamp_in_seconds, tz=timezone.utc)
    return date_time.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3] + "Z"


def main() -> None:
    params: dict[str, Any] = demisto.params()
    args: dict[str, Any] = demisto.args()
    base_url = params.get("base_url", "")
    client_id = dict_safe_get(params, ["credentials", "identifier"])
    secret_key = dict_safe_get(params, ["credentials", "password"])

    verify_certificate: bool = not params.get("insecure", False)
    proxy = params.get("proxy", False)

    command = demisto.command()
    demisto.debug(f"Command being called is {command}")

    try:
        client: Client = Client(
            base_url=base_url,
            client_id=client_id,
            client_secret=secret_key,
            verify_certificate=verify_certificate,
            proxy=proxy,
        )
        client.get_token()
        client.login()

        commands = {
            "harmony-ep-job-status-get": job_status_get_command,
            "harmony-ep-ioc-list": ioc_list_command,
            "harmony-ep-ioc-update": ioc_update_command,
            "harmony-ep-ioc-create": ioc_create_command,
            "harmony-ep-ioc-delete": ioc_delete_command,
            "harmony-ep-policy-rule-assignments-get": rule_assignments_get_command,
            "harmony-ep-policy-rule-assignments-add": rule_assignments_add_command,
            "harmony-ep-policy-rule-assignments-remove": rule_assignments_remove_command,
            "harmony-ep-policy-rule-install": rule_policy_install_command,
            "harmony-ep-policy-rule-modifications-get": rule_modifications_get_command,
            "harmony-ep-policy-rule-metadata-list": rule_metadata_list_command,
            "harmony-ep-push-operation-status-list": push_operation_status_list_command,
            "harmony-ep-push-operation-get": push_operation_get_command,
            "harmony-ep-push-operation-abort": push_operation_abort_command,
            "harmony-ep-anti-malware-scan": anti_malware_scan_command,
            "harmony-ep-anti-malware-update": anti_malware_update_command,
            "harmony-ep-anti-malware-restore": anti_malware_restore_command,
            "harmony-ep-forensics-indicator-analyze": indicator_analyze_command,
            "harmony-ep-forensics-file-quarantine": file_quarantine_command,
            "harmony-ep-forensics-file-restore": file_restore_command,
            "harmony-ep-remediation-computer-isolate": remediation_computer_isolate_command,
            "harmony-ep-remediation-computer-deisolate": remediation_computer_deisolate_command,
            "harmony-ep-computer-list": computer_list_command,
            "harmony-ep-agent-computer-restart": computer_restart_command,
            "harmony-ep-agent-computer-shutdown": computer_shutdown_command,
            "harmony-ep-agent-computer-repair": computer_repair_command,
            "harmony-ep-agent-process-information-get": process_information_get_command,
            "harmony-ep-agent-process-terminate": process_terminate_command,
            "harmony-ep-agent-registry-key-add": agent_registry_key_add_command,
            "harmony-ep-agent-registry-key-delete": agent_registry_key_delete_command,
            "harmony-ep-agent-file-copy": agent_file_copy_command,
            "harmony-ep-agent-file-move": agent_file_move_command,
            "harmony-ep-agent-file-delete": agent_file_delete_command,
            "harmony-ep-agent-vpn-site-add": agent_vpn_site_add_command,
            "harmony-ep-agent-vpn-site-remove": agent_vpn_site_remove_command,
        }

        if command == "test-module":
            return_results(test_module(client))
        elif command in commands:
            return_results(commands[command](args, client))
        else:
            raise NotImplementedError(f"{command} command is not implemented.")

    except Exception as e:
        clear_integration_context()
        return_error(str(e))


if __name__ in ["__main__", "builtin", "builtins"]:
    main()