CheckPointHEC
The Best Way to Protect Enterprise Email & Collaboration from phishing, malware, account takeover, data loss, etc.
Details
| ID | CheckPointHEC |
|---|---|
| Provider | CheckPoint Software Technologies Ltd. |
| Category | |
| From Version | 6.9.0 |
| Docker Image | demisto/python3:3.12.13.10116658 |
| Supported Modules | Agentix XSIAM |
README
The Best Way to Protect Enterprise Email & Collaboration from phishing, malware, account takeover, data loss, etc.
This integration was integrated and tested with version 1.1.14 of CheckPointHEC
Configure Check Point Harmony Email and Collaboration (HEC) in Cortex
| Parameter | Description | Required |
|---|---|---|
| Smart API URL or Check Point Infinity API URL | The URL of the Smart API or Check Point Infinity API. | True |
| Fetch incidents | False | |
| Incident type | False | |
| Client ID | The client ID of the Smart API or Check Point Infinity API. | True |
| Client Secret | The client secret of the Smart API or Check Point Infinity API. | True |
| First fetch time | The time range for the first fetch. The default is 1 hour. | False |
| SaaS Application | Get incidents from the selected SaaS. | False |
| State | Get incidents with only the selected states. | False |
| Severity | Get incidents with only the selected severities. | False |
| Threat Type | Get incidents with only the selected types. | False |
| Maximum number of incidents per fetch | The maximum number of incidents to retrieve per fetch. | False |
| Collect restore requests | Collect restore requests as incidents. | False |
| Include denied requests | Include denied restore requests in the results, do not check with “Include accepted requests”. | False |
| Include accepted requests | Include accepted restore requests in the results, do not check with “Include denied requests”. | False |
| Trust any certificate (not secure) | Trust server certificate. | False |
| Use system proxy settings | Use system proxy settings. | False |
| Incidents Fetch Interval | The interval in minutes to fetch incidents. The default is 1 minute. | 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.
checkpointhec-get-entity
Retrieve specific entity.
Base Command
checkpointhec-get-entity
Input
| Argument Name | Description | Required |
|---|---|---|
| entity | Entity id to retrieve. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.Entity.internetMessageId | String | Email message id in internet. |
| CheckPointHEC.Entity.received | String | Datetime email was received in iso 8601 format. |
| CheckPointHEC.Entity.size | String | Email size. |
| CheckPointHEC.Entity.emailLinks | unknown | Links in email. |
| CheckPointHEC.Entity.attachmentCount | Number | Number of attachments in email. |
| CheckPointHEC.Entity.attachments | unknown | File attachments in email. |
| CheckPointHEC.Entity.mode | String | Internal policy rule. |
| CheckPointHEC.Entity.recipients | unknown | Recipient email addresses. |
| CheckPointHEC.Entity.subject | String | Email subject. |
| CheckPointHEC.Entity.fromEmail | String | Email sender. |
| CheckPointHEC.Entity.fromDomain | String | Domain where the email was sent from. |
| CheckPointHEC.Entity.fromUser | unknown | Sender user details. |
| CheckPointHEC.Entity.fromName | String | Sender name. |
| CheckPointHEC.Entity.to | unknown | Email main recipients. |
| CheckPointHEC.Entity.toUser | unknown | User details for main recipients. |
| CheckPointHEC.Entity.cc | unknown | Email carbon copy recipients. |
| CheckPointHEC.Entity.ccUser | unknown | User details for carbon copy recipients. |
| CheckPointHEC.Entity.bcc | unknown | Email blind carbon copy recipients. |
| CheckPointHEC.Entity.bccUser | unknown | User details for blind carbon copy recipients. |
| CheckPointHEC.Entity.replyToEmail | String | Email reply. |
| CheckPointHEC.Entity.replyToNickname | String | Email reply nickname. |
| CheckPointHEC.Entity.isRead | Boolean | Email has been read. |
| CheckPointHEC.Entity.isDeleted | Boolean | Email has been deleted. |
| CheckPointHEC.Entity.isIncoming | Boolean | Email is from external organization. |
| CheckPointHEC.Entity.isInternal | Boolean | Email is from same organization. |
| CheckPointHEC.Entity.isOutgoing | Boolean | Email is to an external organization. |
| CheckPointHEC.Entity.isQuarantined | Boolean | Email has been quarantined. |
| CheckPointHEC.Entity.isQuarantineNotification | Boolean | Email is a notification of another quarantined email. |
| CheckPointHEC.Entity.isRestored | Boolean | Email is restored from quarantine. |
| CheckPointHEC.Entity.isRestoreRequested | Boolean | Email is a request to restore. |
| CheckPointHEC.Entity.isRestoreDeclined | Boolean | Email is a declined restore request. |
| CheckPointHEC.Entity.saasSpamVerdict | String | Spam verdict. |
| CheckPointHEC.Entity.SpfResult | String | Sender Policy Framework check result. |
| CheckPointHEC.Entity.restoreRequestTime | String | Restore request datetime in iso 8601 format. |
| CheckPointHEC.Entity.isUserExposed | Boolean | Email reached user inbox. |
checkpointhec-get-email-info
Retrieve specific email entity
Base Command
checkpointhec-get-email-info
Input
| Argument Name | Description | Required |
|---|---|---|
| entity | Email entity id. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.Email.fromEmail | String | Email sender. |
| CheckPointHEC.Email.to | unknown | Email main recipients. |
| CheckPointHEC.Email.replyToEmail | String | Email reply. |
| CheckPointHEC.Email.replyToNickname | String | Email reply nickname. |
| CheckPointHEC.Email.recipients | unknown | Recipient email addresses. |
| CheckPointHEC.Email.subject | String | Email subject. |
| CheckPointHEC.Email.cc | unknown | Email carbon copy recipients. |
| CheckPointHEC.Email.bcc | unknown | Email blind carbon copy recipients. |
| CheckPointHEC.Email.isRead | Boolean | Email has been read. |
| CheckPointHEC.Email.received | String | Datetime email was received in iso 8601 format. |
| CheckPointHEC.Email.isDeleted | Boolean | Email has been deleted. |
| CheckPointHEC.Email.isIncoming | Boolean | Email is from external organization. |
| CheckPointHEC.Email.isOutgoing | Boolean | Email is to an external organization. |
| CheckPointHEC.Email.internetMessageId | String | Email message id in internet. |
| CheckPointHEC.Email.isUserExposed | Boolean | Email reached user inbox |
checkpointhec-get-scan-info
Retrieve specific email scan with positive threats.
Base Command
checkpointhec-get-scan-info
Input
| Argument Name | Description | Required |
|---|---|---|
| entity | Scanned entity id. | Required |
| include_clean | Include clean scans. Possible values are: True, False. Default is False. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.ScanResult.ap | unknown | Anti-phishing scan results. |
| CheckPointHEC.ScanResult.dlp | unknown | Data Loss Prevention scan results. |
| CheckPointHEC.ScanResult.clicktimeProtection | unknown | Click Time Protection scan results. |
| CheckPointHEC.ScanResult.shadowIt | unknown | Shadow IT scan results. |
| CheckPointHEC.ScanResult.av | unknown | Antivirus scan results. |
checkpointhec-search-emails
Search for emails.
Base Command
checkpointhec-search-emails
Input
| Argument Name | Description | Required |
|---|---|---|
| date_last | Emails not older than (1 day, 2 weeks, etc.). The arguments date_last and date_from with date_to are mutually exclusive and cannot be specified together in the same request. |
Optional |
| date_from | Start date to get emails in ISO 8601 format. The arguments date_last and date_from with date_to are mutually exclusive and cannot be specified together in the same request. |
Optional |
| date_to | End date to get emails in ISO 8601 format. The arguments date_last and date_from with date_to are mutually exclusive and cannot be specified together in the same request. |
Optional |
| saas | SaaS application to retrieve emails from. Possible values are: Microsoft Exchange, Gmail. | Optional |
| direction | Email precedence. Possible values are: Internal, Incoming, Outgoing. | Optional |
| subject_contains | Emails with subject containing the given value. The arguments subject_contains and subject_match are mutually exclusive and cannot be specified together in the same request. |
Optional |
| subject_match | Emails with subject matching the given value. The arguments subject_contains and subject_match are mutually exclusive and cannot be specified together in the same request. |
Optional |
| sender_contains | Emails with sender email containing the given value. The arguments sender_contains and sender_match are mutually exclusive and cannot be specified together in the same request. |
Optional |
| sender_match | Emails with sender email matching the given value. The arguments sender_contains and sender_match are mutually exclusive and cannot be specified together in the same request. |
Optional |
| domain | Emails with sender domain matching the given value. | Optional |
| cp_detection | Detection by Check Point. Possible values are: Phishing, Suspected Phishing, Malware, Suspected Malware, Spam, Clean, DLP, Malicious URL Click, Malicious URL. | Optional |
| ms_detection | Detection by Microsoft. Possible values are: Malware, High Confidence Phishing, Phishing, High Confidence Spam, Spam, Bulk, Clean. | Optional |
| detection_op | Detection operator. Possible values are: OR, AND. | Optional |
| server_ip | Sender server ip. | Optional |
| recipients_contains | Emails with recipients containing the given value. The arguments recipients_contains and recipients_match are mutually exclusive and cannot be specified together in the same request. |
Optional |
| recipients_match | Emails with recipients matching the given value. The arguments recipients_contains and recipients_match are mutually exclusive and cannot be specified together in the same request. |
Optional |
| links | Emails with links in body matching the given value. | Optional |
| message_id | Get specific email by id. | Optional |
| cp_quarantined_state | Quarantine authored by Check Point. Possible values are: Quarantined (Any source), Not Quarantined, Quarantined by Check Point, Quarantined by CP Analyst, Quarantined by Admin. | Optional |
| ms_quarantined_state | Quarantine authored by Microsoft. Possible values are: Quarantined, Not Quarantined, Not Quarantined Delivered to Inbox, Not Quarantined Delivered to Junk. | Optional |
| quarantined_state_op | Quarantine state operator. Possible values are: OR, AND. | Optional |
| name_contains | Emails with sender name containing the given value. The arguments name_contains and name_match are mutually exclusive and cannot be specified together in the same request. |
Optional |
| name_match | Emails with sender name matching the given value. The arguments name_contains and name_match are mutually exclusive and cannot be specified together in the same request. |
Optional |
| client_ip | Sender client IP. | Optional |
| attachment_md5 | Attachment MD5 checksum. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.Entity.internetMessageId | String | Email message id in internet. |
| CheckPointHEC.Entity.received | String | Datetime email was received in iso 8601 format. |
| CheckPointHEC.Entity.size | String | Email size. |
| CheckPointHEC.Entity.emailLinks | unknown | Links in email. |
| CheckPointHEC.Entity.attachmentCount | Number | Number of attachments in email. |
| CheckPointHEC.Entity.attachments | unknown | File attachments in email. |
| CheckPointHEC.Entity.mode | String | Internal policy rule. |
| CheckPointHEC.Entity.recipients | unknown | Recipient email addresses. |
| CheckPointHEC.Entity.subject | String | Email subject. |
| CheckPointHEC.Entity.fromEmail | String | Email sender. |
| CheckPointHEC.Entity.fromDomain | String | Domain where the email was sent from. |
| CheckPointHEC.Entity.fromUser | unknown | Sender user details. |
| CheckPointHEC.Entity.fromName | String | Sender name. |
| CheckPointHEC.Entity.to | unknown | Email main recipients. |
| CheckPointHEC.Entity.toUser | unknown | User details for main recipients. |
| CheckPointHEC.Entity.cc | unknown | Email carbon copy recipients. |
| CheckPointHEC.Entity.ccUser | unknown | User details for carbon copy recipients. |
| CheckPointHEC.Entity.bcc | unknown | Email blind carbon copy recipients. |
| CheckPointHEC.Entity.bccUser | unknown | User details for blind carbon copy recipients. |
| CheckPointHEC.Entity.replyToEmail | String | Email reply. |
| CheckPointHEC.Entity.replyToNickname | String | Email reply nickname. |
| CheckPointHEC.Entity.isRead | Boolean | Email has been read. |
| CheckPointHEC.Entity.isDeleted | Boolean | Email has been deleted. |
| CheckPointHEC.Entity.isIncoming | Boolean | Email is from external organization. |
| CheckPointHEC.Entity.isInternal | Boolean | Email is from same organization. |
| CheckPointHEC.Entity.isOutgoing | Boolean | Email is to an external organization. |
| CheckPointHEC.Entity.isQuarantined | Boolean | Email has been quarantined. |
| CheckPointHEC.Entity.isQuarantineNotification | Boolean | Email is a notification of another quarantined email. |
| CheckPointHEC.Entity.isRestored | Boolean | Email is restored from quarantine. |
| CheckPointHEC.Entity.isRestoreRequested | Boolean | Email is a request to restore. |
| CheckPointHEC.Entity.isRestoreDeclined | Boolean | Email is a declined restore request. |
| CheckPointHEC.Entity.saasSpamVerdict | String | Spam verdict. |
| CheckPointHEC.Entity.SpfResult | String | Sender Policy Framework check result. |
| CheckPointHEC.Entity.restoreRequestTime | String | Restore request datetime in iso 8601 format. |
| CheckPointHEC.Entity.isUserExposed | Boolean | Email reached user inbox. |
checkpointhec-send-action
Action for one or more emails.
Base Command
checkpointhec-send-action
Input
| Argument Name | Description | Required |
|---|---|---|
| entity | One or multiple Email ids to apply action over. | Required |
| saas | SaaS application to apply action over. Possible values are: Microsoft Exchange, Gmail. | Required |
| action | Action to perform. Possible values are: quarantine, restore, decline_restore_request. | Required |
| restore_decline_reason | Reason to decline restore request. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.Task.task | String | Task id of the sent action. |
checkpointhec-get-action-result
Get task info related to a sent action
Base Command
checkpointhec-get-action-result
Input
| Argument Name | Description | Required |
|---|---|---|
| farm | Customer farm. | Required |
| customer | Customer portal name. | Required |
| task | Task id to retrieve. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.ActionResult.actions | unknown | Action information for each sent entity |
| CheckPointHEC.ActionResult.created | String | Date when action was created in iso 8601 format |
| CheckPointHEC.ActionResult.customer | String | Customer portal name |
| CheckPointHEC.ActionResult.failed | Number | Number of failed actions |
| CheckPointHEC.ActionResult.id | Number | Action task id |
| CheckPointHEC.ActionResult.name | String | Action name |
| CheckPointHEC.ActionResult.owner | String | Action owner |
| CheckPointHEC.ActionResult.progress | Number | Number of actions in progress |
| CheckPointHEC.ActionResult.sequential | Boolean | Actions are in sequence |
| CheckPointHEC.ActionResult.status | String | Action status |
| CheckPointHEC.ActionResult.succeed | Number | Number of succeed actions |
| CheckPointHEC.ActionResult.total | Number | Total of actions |
| CheckPointHEC.ActionResult.type | String | Action internal name |
| CheckPointHEC.ActionResult.updated | String | Date when action last updated in iso 8601 format |
checkpointhec-send-notification
Send notification about user exposition for the specific entity to the list of emails
Base Command
checkpointhec-send-notification
Input
| Argument Name | Description | Required |
|---|---|---|
| entity | Email entity id. | Required |
| emails | List of emails to send notification. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.Notification.ok | Boolean | Result of the operation. |
checkpointhec-get-events
Retrieve security events.
Base Command
checkpointhec-get-events
Input
| Argument Name | Description | Required |
|---|---|---|
| start_date | Start date in ISO 8601 format. | Required |
| end_date | End date in ISO 8601 format, now by default. | Optional |
| saas_apps | SaaS application to retrieve events from. Possible values are: Microsoft Exchange, Gmail. | Optional |
| states | Event states to be retrieved. Possible values are: New, Remediated, Detected, Exception, Dismissed. | Optional |
| severities | Severity levels to be retrieved. Possible values are: Critical, High, Medium, Low, Very Low. | Optional |
| threat_types | Threat types to be retrieved. Possible values are: DLP, Malware, Phishing, Anomaly, Suspicious Phishing, Suspicious Malware, Shadow IT, Alert, Spam, Malicious URL, Malicious URL Click. | Optional |
| limit | Number of events to be returned. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.Event.eventId | String | Security event id. |
| CheckPointHEC.Event.customerId | String | Customer portal name. |
| CheckPointHEC.Event.saas | String | SaaS internal name. |
| CheckPointHEC.Event.entityId | String | Email entity id related to the security event. |
| CheckPointHEC.Event.state | String | Security event state. |
| CheckPointHEC.Event.type | String | Security event threat type. |
| CheckPointHEC.Event.confidenceIndicator | String | Security event threat type. |
| CheckPointHEC.Event.eventCreated | String | Security event creation date. |
| CheckPointHEC.Event.severity | String | Security event severity 1 - 5. |
| CheckPointHEC.Event.description | String | Security event description. |
| CheckPointHEC.Event.data | String | Security event data information. |
| CheckPointHEC.Event.additionalData | String | Security event additional data information if available. |
| CheckPointHEC.Event.availableEventActions | unknown | Actions available for the security event. |
| CheckPointHEC.Event.actions | unknown | Performed actions related to the security event. |
| CheckPointHEC.Event.senderAddress | String | Sender of email related to the security event. |
| CheckPointHEC.Event.entityLink | String | Email link. |
checkpointhec-get-ctp-list
Get Click Time Protection list.
Base Command
checkpointhec-get-ctp-list
Input
| Argument Name | Description | Required |
|---|---|---|
| list_id | List id to retrieve. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.CTPList.listid | String | List id. |
| CheckPointHEC.CTPList.listname | String | List name. |
| CheckPointHEC.CTPList.listitem | String | List of items in the list. |
checkpointhec-delete-avurl-exceptions
Delete Avanan URL exceptions.
Base Command
checkpointhec-delete-avurl-exceptions
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | Exception type. Possible values are: allow-url, allow-domain, block-url, block-domain. | Required |
| exc_str_list | List of exception strings to delete. | Required |
| entity_type | Entity type. | Optional |
| entity_id | Entity id. | Optional |
Context Output
There is no context output for this command.
checkpointhec-delete-avdlp-exception
Delete Avanan URL exception.
Base Command
checkpointhec-delete-avdlp-exception
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | Exception type. Possible values are: hash, text_content, sender_email, recipient_email. | Required |
| exc_str | Exception string. | Required |
| entity_type | Entity type. | Optional |
| entity_id | Entity id. | Optional |
Context Output
There is no context output for this command.
checkpointhec-get-anomaly-exceptions
Get Anomaly exceptions.
Base Command
checkpointhec-get-anomaly-exceptions
Input
There are no input arguments for this command.
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.AnomalyException.id | String | Anomaly exception id. |
| CheckPointHEC.AnomalyException.anomaly_type | String | Anomaly type. |
| CheckPointHEC.AnomalyException.insert_time | String | Anomaly exception creation time. |
| CheckPointHEC.AnomalyException.update_time | String | Anomaly exception update time. |
| CheckPointHEC.AnomalyException.added_by | String | Anomaly exception creator. |
| CheckPointHEC.AnomalyException.event_id | String | Security event id. |
| CheckPointHEC.AnomalyException.customer_domain | String | Customer domain. |
| CheckPointHEC.AnomalyException.comments | String | Anomaly exception comment. |
| CheckPointHEC.AnomalyException.enabled | Boolean | Anomaly exception enabled. |
| CheckPointHEC.AnomalyException.exception_rule | String | Anomaly exception rule. |
| CheckPointHEC.AnomalyException.expiration_date | String | Anomaly exception expiration date. |
checkpointhec-update-cp2-exception
Update Anti-Malware exception.
Base Command
checkpointhec-update-cp2-exception
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | Exception type. Possible values are: hash, macro_hash, file_type, ppat_sender_name. | Required |
| exc_str | Exception string. | Required |
| comment | Exception comment. | Optional |
| exc_payload_condition | Exception payload condition. Possible values are: with_or_without_link, with_link, without_link. | Optional |
Context Output
There is no context output for this command.
checkpointhec-create-avdlp-exception
Create Avanan DLP exception.
Base Command
checkpointhec-create-avdlp-exception
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | Exception type. Possible values are: hash, text_content, sender_email, recipient_email. | Required |
| exc_str | Exception string. | Required |
| entity_type | Entity type. | Optional |
| entity_id | Entity id. | Optional |
| comment | Exception comment. | Optional |
| exc_payload_condition | Exception payload condition. Possible values are: with_or_without_link, with_link, without_link. | Optional |
| file_name | File name. | Optional |
| created_by_email | Exception creator email. | Optional |
| is_exclusive | Exclusive exception. Possible values are: yes, no. | Optional |
Context Output
There is no context output for this command.
checkpointhec-delete-ctp-list-items
Delete Click Time Protection list items.
Base Command
checkpointhec-delete-ctp-list-items
Input
| Argument Name | Description | Required |
|---|---|---|
| list_item_ids | List of item ids to delete. | Required |
Context Output
There is no context output for this command.
checkpointhec-update-avdlp-exception
Update Avanan URL exception.
Base Command
checkpointhec-update-avdlp-exception
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | Exception type. Possible values are: hash, text_content, sender_email, recipient_email. | Required |
| exc_str | Exception string. | Required |
| comment | Exception comment. | Optional |
| exc_payload_condition | Exception payload condition. Possible values are: with_or_without_link, with_link, without_link. | Optional |
Context Output
There is no context output for this command.
checkpointhec-get-ap-exceptions
Get Anti-Phishing and Anti-Spam exceptions or exception.
Base Command
checkpointhec-get-ap-exceptions
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | List name of exceptions to retrieve. Possible values are: whitelist, blacklist, spam_whitelist. | Required |
| exc_id | Exception id to retrieve. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.AntiPhishingException.added_by | Number | Exception added by user id. |
| CheckPointHEC.AntiPhishingException.affected_count | String | Affected count. |
| CheckPointHEC.AntiPhishingException.allowed_links | String | Allowed links. |
| CheckPointHEC.AntiPhishingException.attachment_md5 | String | Email attachment MD5. |
| CheckPointHEC.AntiPhishingException.auto_classify_as | String | Auto classify as. |
| CheckPointHEC.AntiPhishingException.comment | String | Exception description. |
| CheckPointHEC.AntiPhishingException.customer_domain | String | Customer name. |
| CheckPointHEC.AntiPhishingException.edited_by | String | Exception edited by. |
| CheckPointHEC.AntiPhishingException.email_link | String | Email link. |
| CheckPointHEC.AntiPhishingException.email_link_matching | String | Email link field condition. |
| CheckPointHEC.AntiPhishingException.entity_id | Number | Entity id. |
| CheckPointHEC.AntiPhishingException.exception_type | String | Exception type. |
| CheckPointHEC.AntiPhishingException.expiration_time | String | Exception expiration time. |
| CheckPointHEC.AntiPhishingException.from_domain | String | From domain. |
| CheckPointHEC.AntiPhishingException.from_domain_ends_with | String | From domain field ends with. |
| CheckPointHEC.AntiPhishingException.from_domain_matching | String | From domain field condition. |
| CheckPointHEC.AntiPhishingException.from_email | String | Email sender. |
| CheckPointHEC.AntiPhishingException.from_email_matching | String | From email field condition. |
| CheckPointHEC.AntiPhishingException.from_name_matching | String | From name field condition. |
| CheckPointHEC.AntiPhishingException.headers | String | Email headers. |
| CheckPointHEC.AntiPhishingException.ignoring_spf_check | Boolean | Ignore SPF check. |
| CheckPointHEC.AntiPhishingException.insert_time | String | Exception creation time. |
| CheckPointHEC.AntiPhishingException.max_confidence | String | Maximum confidence. |
| CheckPointHEC.AntiPhishingException.max_confidence_spam | String | Maximum confidence for spam. |
| CheckPointHEC.AntiPhishingException.message_headers | String | Message headers. |
| CheckPointHEC.AntiPhishingException.nickname | String | Sender name. |
| CheckPointHEC.AntiPhishingException.owner_email | String | Exception owner email. |
| CheckPointHEC.AntiPhishingException.override | Boolean | Override. |
| CheckPointHEC.AntiPhishingException.recipient | String | Email recipient. |
| CheckPointHEC.AntiPhishingException.recipient_matching | String | Recipient field condition. |
| CheckPointHEC.AntiPhishingException.sender_client_ip | String | Sender client IP. |
| CheckPointHEC.AntiPhishingException.sender_ip | String | Sender IP. |
| CheckPointHEC.AntiPhishingException.signature_key | String | Signature key. |
| CheckPointHEC.AntiPhishingException.subject | String | Email subject. |
| CheckPointHEC.AntiPhishingException.subject_matching | String | Subject field condition. |
| CheckPointHEC.AntiPhishingException.update_time | String | Exception update. |
| CheckPointHEC.AntiPhishingException.user_label | String | User label. |
checkpointhec-create-avurl-exception
Create Avanan URL exception.
Base Command
checkpointhec-create-avurl-exception
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | Exception type. Possible values are: allow-url, allow-domain, block-url, block-domain. | Required |
| exc_str | Exception string. | Required |
| entity_type | Entity type. | Optional |
| entity_id | Entity id. | Optional |
| comment | Exception comment. | Optional |
| exc_payload_condition | Exception payload condition. Possible values are: with_or_without_link, with_link, without_link. | Optional |
| file_name | File name. | Optional |
| created_by_email | Exception creator email. | Optional |
| is_exclusive | Exclusive exception. Possible values are: yes, no. | Optional |
Context Output
There is no context output for this command.
checkpointhec-get-avdlp-exceptions
Get Avanan DLP exceptions.
Base Command
checkpointhec-get-avdlp-exceptions
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | List name of exceptions to retrieve. Possible values are: hash, text_content, sender_email, recipient_email. | Required |
| filter_str | Search string. | Optional |
| filter_index | Search index. Possible values are: insert_time, entity_type_id, exception_str, file_name, created_by_email, comment. | Optional |
| sort_dir | Sort direction. Possible values are: asc, desc. | Optional |
| last_evaluated_key | Last evaluated key. | Optional |
| insert_time_gte | Insert time field condition. Possible values are: yes, no. | Optional |
| limit | Number of exceptions to retrieve. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.AvananDLPException.insert_time | String | Exception insert time. |
| CheckPointHEC.AvananDLPException.farm_customer_exception_type | String | Farm, customer and exception type info. |
| CheckPointHEC.AvananDLPException.exception_str | String | Exception string, for id purposes. |
| CheckPointHEC.AvananDLPException.created_by_email | String | Exception email creator. |
| CheckPointHEC.AvananDLPException.comment | String | Exception comment. |
| CheckPointHEC.AvananDLPException.exception_payload | String | Exception payload information. |
checkpointhec-delete-ctp-lists
Delete Click Time Protection lists.
Base Command
checkpointhec-delete-ctp-lists
Input
There are no input arguments for this command.
Context Output
There is no context output for this command.
checkpointhec-create-anomaly-exception
Create Anomaly exception.
Base Command
checkpointhec-create-anomaly-exception
Input
| Argument Name | Description | Required |
|---|---|---|
| request_json | Anomaly exception request json. | Required |
| added_by | User id exception creator. | Optional |
Context Output
There is no context output for this command.
checkpointhec-delete-cp2-exception
Delete Anti-Malware exception.
Base Command
checkpointhec-delete-cp2-exception
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | Exception type. Possible values are: hash, macro_hash, file_type, ppat_sender_name. | Required |
| exc_str | Exception string. | Required |
| entity_type | Entity type. | Optional |
| entity_id | Entity id. | Optional |
Context Output
There is no context output for this command.
checkpointhec-delete-anomaly-exceptions
Delete Anomaly exceptions.
Base Command
checkpointhec-delete-anomaly-exceptions
Input
| Argument Name | Description | Required |
|---|---|---|
| rule_ids | Exceptions to delete. | Required |
Context Output
There is no context output for this command.
checkpointhec-report-mis-classification
Report email mis-classification.
Base Command
checkpointhec-report-mis-classification
Input
| Argument Name | Description | Required |
|---|---|---|
| entities | Email entity ids. | Required |
| classification | New classification. Possible values are: Clean Email, Spam, Phishing, Legit Marketing Email. | Required |
| confident | Confidence level. Possible values are: Not so sure, Medium Confidence, High Confidence. | Required |
Context Output
There is no context output for this command.
checkpointhec-get-avdlp-exception
Get Avanan DLP exception.
Base Command
checkpointhec-get-avdlp-exception
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | List name of exceptions to retrieve. Possible values are: hash, text_content, sender_email, recipient_email. | Required |
| exc_str | Exception id to retrieve. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.AvananDLPException.insert_time | String | Exception insert time. |
| CheckPointHEC.AvananDLPException.farm_customer_exception_type | String | Farm, customer and exception type info. |
| CheckPointHEC.AvananDLPException.exception_str | String | Exception string, for id purposes. |
| CheckPointHEC.AvananDLPException.created_by_email | String | Exception email creator. |
| CheckPointHEC.AvananDLPException.comment | String | Exception comment. |
| CheckPointHEC.AvananDLPException.exception_payload | String | Exception payload information. |
checkpointhec-delete-ctp-list-item
Delete Click Time Protection list item.
Base Command
checkpointhec-delete-ctp-list-item
Input
| Argument Name | Description | Required |
|---|---|---|
| item_id | Item id to delete. | Required |
Context Output
There is no context output for this command.
checkpointhec-get-ctp-list-item
Get Click Time Protection list item.
Base Command
checkpointhec-get-ctp-list-item
Input
| Argument Name | Description | Required |
|---|---|---|
| item_id | Item id to retrieve. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.CTPListItem.created_at | String | List item creation time. |
| CheckPointHEC.CTPListItem.created_by | String | List item creator. |
| CheckPointHEC.CTPListItem.listid | String | List id. |
| CheckPointHEC.CTPListItem.listitemid | String | List item id. |
| CheckPointHEC.CTPListItem.listitemname | String | List item name. |
| CheckPointHEC.CTPListItem.listname | String | List name. |
checkpointhec-update-avurl-exception
Update Avanan URL exception.
Base Command
checkpointhec-update-avurl-exception
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | Exception type. Possible values are: allow-url, allow-domain, block-url, block-domain. | Required |
| exc_str | Exception string. | Required |
| comment | Exception comment. | Optional |
| exc_payload_condition | Exception payload condition. Possible values are: with_or_without_link, with_link, without_link. | Optional |
Context Output
There is no context output for this command.
checkpointhec-create-ctp-list-item
Create Click Time Protection list item.
Base Command
checkpointhec-create-ctp-list-item
Input
| Argument Name | Description | Required |
|---|---|---|
| list_id | List id. | Required |
| list_item_name | List item name. | Required |
| created_by | List item creator. | Required |
Context Output
There is no context output for this command.
checkpointhec-delete-ap-exception
Delete Anti-Phishing and Anti-Spam exception.
Base Command
checkpointhec-delete-ap-exception
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | Exception type. Possible values are: whitelist, blacklist, spam_whitelist. | Required |
| exc_id | Exception id. | Required |
Context Output
There is no context output for this command.
checkpointhec-delete-avurl-exception
Delete Avanan URL exception.
Base Command
checkpointhec-delete-avurl-exception
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | Exception type. Possible values are: allow-url, allow-domain, block-url, block-domain. | Required |
| exc_str | Exception string. | Required |
| entity_type | Entity type. | Optional |
| entity_id | Entity id. | Optional |
Context Output
There is no context output for this command.
checkpointhec-get-cp2-exception
Get Anti-Malware exception.
Base Command
checkpointhec-get-cp2-exception
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | List name of exceptions to retrieve. Possible values are: hash, macro_hash, file_type, ppat_sender_name. | Required |
| exc_str | Exception id to retrieve. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.AntiMalwareException.insert_time | String | Exception insert time. |
| CheckPointHEC.AntiMalwareException.farm_customer_exception_type | String | Farm, customer and exception type info. |
| CheckPointHEC.AntiMalwareException.exception_str | String | Exception string, for id purposes. |
| CheckPointHEC.AntiMalwareException.created_by_email | String | Exception email creator. |
| CheckPointHEC.AntiMalwareException.comment | String | Exception comment. |
| CheckPointHEC.AntiMalwareException.exception_payload | String | Exception payload information. |
checkpointhec-update-ap-exception
Update Anti-Phishing and Anti-Spam exception.
Base Command
checkpointhec-update-ap-exception
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | Exception type. Possible values are: whitelist, blacklist, spam_whitelist. | Required |
| exc_id | Exception id. | Required |
| entity_id | Entity id. | Optional |
| attachment_md5 | Attachment MD5 checksum. | Optional |
| from_email | Email sender. | Optional |
| nickname | Sender name. | Optional |
| recipient | Email recipient. | Optional |
| sender_client_ip | Sender client IP. | Optional |
| from_domain_ends_with | From domain ends with. | Optional |
| sender_ip | Sender IP. | Optional |
| email_link | Email link or links separated by comma. | Optional |
| subject | Email subject. | Optional |
| comment | Exception comment. | Optional |
| action_needed | Action needed. | Optional |
| ignoring_spf_check | Ignoring SPF check. | Optional |
| subject_matching | Subject field condition. Possible values are: matching, contains, exact. | Optional |
| email_link_matching | Email link field condition. Possible values are: matching, contains, exact. | Optional |
| from_name_matching | From name field condition. Possible values are: matching, contains, exact. | Optional |
| from_domain_matching | From domain field condition. Possible values are: contains, ends_with, exact. | Optional |
| from_email_matching | From email field condition. Possible values are: matching, contains, exact. | Optional |
| recipient_matching | Recipient field condition. Possible values are: matching, contains, exact. | Optional |
Context Output
There is no context output for this command.
checkpointhec-create-cp2-exception
Create Anti-Malware exception.
Base Command
checkpointhec-create-cp2-exception
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | Exception type. Possible values are: hash, macro_hash, file_type, ppat_sender_name. | Required |
| exc_str | Exception string. | Required |
| entity_type | Entity type. | Optional |
| entity_id | Entity id. | Optional |
| comment | Exception comment. | Optional |
| exc_payload_condition | Exception payload condition. Possible values are: with_or_without_link, with_link, without_link. | Optional |
| file_name | File name. | Optional |
| created_by_email | Exception creator email. | Optional |
| is_exclusive | Exclusive exception. Possible values are: yes, no. | Optional |
Context Output
There is no context output for this command.
checkpointhec-delete-cp2-exceptions
Delete Anti-Malware exceptions.
Base Command
checkpointhec-delete-cp2-exceptions
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | Exception type. Possible values are: hash, macro_hash, file_type, ppat_sender_name. | Required |
| exc_str_list | List of exception strings to delete. | Required |
| entity_type | Entity type. | Optional |
| entity_id | Entity id. | Optional |
Context Output
There is no context output for this command.
checkpointhec-get-ctp-lists
Get Click Time Protection lists.
Base Command
checkpointhec-get-ctp-lists
Input
There are no input arguments for this command.
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.CTPList.listid | String | List id. |
| CheckPointHEC.CTPList.listname | String | List name. |
| CheckPointHEC.CTPList.listitem | unknown | List item in the list. |
checkpointhec-update-ctp-list-item
Update Click Time Protection list item.
Base Command
checkpointhec-update-ctp-list-item
Input
| Argument Name | Description | Required |
|---|---|---|
| item_id | Item id to update. | Required |
| list_id | List id. | Required |
| list_item_name | List item name. | Required |
| created_by | List item creator. | Required |
Context Output
There is no context output for this command.
checkpointhec-create-ap-exception
Create Anti-Phishing and Anti-Spam exception.
Base Command
checkpointhec-create-ap-exception
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | Exception type. Possible values are: whitelist, blacklist, spam_whitelist. | Required |
| entity_id | Entity id. | Optional |
| attachment_md5 | Attachment MD5 checksum. | Optional |
| from_email | Email sender. | Optional |
| nickname | Sender name. | Optional |
| recipient | Email recipient. | Optional |
| sender_client_ip | Sender client IP. | Optional |
| from_domain_ends_with | From domain ends with. | Optional |
| sender_ip | Sender IP. | Optional |
| email_link | Email link or links separated by comma. | Optional |
| subject | Email subject. | Optional |
| comment | Exception comment. | Optional |
| action_needed | Action needed. | Optional |
| ignoring_spf_check | Ignoring SPF check. | Optional |
| subject_matching | Subject field condition. Possible values are: matching, contains, exact. | Optional |
| email_link_matching | Email link field condition. Possible values are: matching, contains, exact. | Optional |
| from_name_matching | From name field condition. Possible values are: matching, contains, exact. | Optional |
| from_domain_matching | From domain field condition. Possible values are: contains, ends_with, exact. | Optional |
| from_email_matching | From email field condition. Possible values are: matching, contains, exact. | Optional |
| recipient_matching | Recipient field condition. Possible values are: matching, contains, exact. | Optional |
Context Output
There is no context output for this command.
checkpointhec-get-avurl-exceptions
Get Avanan URL exceptions.
Base Command
checkpointhec-get-avurl-exceptions
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | List name of exceptions to retrieve. Possible values are: allow-url, allow-domain, block-url, block-domain. | Required |
| filter_str | Search string. | Optional |
| filter_index | Search index. Possible values are: insert_time, entity_type_id, exception_str, file_name, created_by_email, comment. | Optional |
| sort_dir | Sort direction. Possible values are: asc, desc. | Optional |
| last_evaluated_key | Last evaluated key. | Optional |
| insert_time_gte | Insert time field condition. Possible values are: yes, no. | Optional |
| limit | Number of exceptions to retrieve. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.AvananURLException.insert_time | String | Exception insert time. |
| CheckPointHEC.AvananURLException.farm_customer_exception_type | String | Farm, customer and exception type info. |
| CheckPointHEC.AvananURLException.exception_str | String | Exception string, for id purposes. |
| CheckPointHEC.AvananURLException.created_by_email | String | Exception email creator. |
| CheckPointHEC.AvananURLException.comment | String | Exception comment. |
| CheckPointHEC.AvananURLException.exception_payload | String | Exception payload information. |
checkpointhec-get-ctp-list-items
Get Click Time Protection list items.
Base Command
checkpointhec-get-ctp-list-items
Input
There are no input arguments for this command.
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.CTPListItem.created_at | String | List item creation time. |
| CheckPointHEC.CTPListItem.created_by | String | List item creator. |
| CheckPointHEC.CTPListItem.listid | String | List id. |
| CheckPointHEC.CTPListItem.listitemid | String | List item id. |
| CheckPointHEC.CTPListItem.listitemname | String | List item name. |
| CheckPointHEC.CTPListItem.listname | String | List name. |
checkpointhec-get-cp2-exceptions
Get Anti-Malware exceptions.
Base Command
checkpointhec-get-cp2-exceptions
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | List name of exceptions to retrieve. Possible values are: hash, macro_hash, file_type, ppat_sender_name. | Required |
| filter_str | Search string. | Optional |
| filter_index | Search index. Possible values are: insert_time, entity_type_id, exception_str, file_name, created_by_email, comment. | Optional |
| sort_dir | Sort direction. Possible values are: asc, desc. | Optional |
| last_evaluated_key | Last evaluated key. | Optional |
| insert_time_gte | Insert time field condition. Possible values are: yes, no. | Optional |
| limit | Number of exceptions to retrieve. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.AntiMalwareException.insert_time | String | Exception insert time. |
| CheckPointHEC.AntiMalwareException.farm_customer_exception_type | String | Farm, customer and exception type info. |
| CheckPointHEC.AntiMalwareException.exception_str | String | Exception string, for id purposes. |
| CheckPointHEC.AntiMalwareException.created_by_email | String | Exception email creator. |
| CheckPointHEC.AntiMalwareException.comment | String | Exception comment. |
| CheckPointHEC.AntiMalwareException.exception_payload | String | Exception payload information. |
checkpointhec-get-avurl-exception
Get Avanan URL exception.
Base Command
checkpointhec-get-avurl-exception
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | List name of exceptions to retrieve. Possible values are: allow-url, allow-domain, block-url, block-domain. | Required |
| exc_str | Exception id to retrieve. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckPointHEC.AvananURLException.insert_time | String | Exception insert time. |
| CheckPointHEC.AvananURLException.farm_customer_exception_type | String | Farm, customer and exception type info. |
| CheckPointHEC.AvananURLException.exception_str | String | Exception string, for id purposes. |
| CheckPointHEC.AvananURLException.created_by_email | String | Exception email creator. |
| CheckPointHEC.AvananURLException.comment | String | Exception comment. |
| CheckPointHEC.AvananURLException.exception_payload | String | Exception payload information. |
checkpointhec-delete-avdlp-exceptions
Delete Avanan DLP exceptions.
Base Command
checkpointhec-delete-avdlp-exceptions
Input
| Argument Name | Description | Required |
|---|---|---|
| exc_type | Exception type. Possible values are: hash, text_content, sender_email, recipient_email. | Required |
| exc_str_list | List of exception strings to delete. | Required |
| entity_type | Entity type. | Optional |
| entity_id | Entity id. | Optional |
Context Output
There is no context output for this command.
checkpointhec-download-email
Download email file.
Base Command
checkpointhec-download-email
Input
| Argument Name | Description | Required |
|---|---|---|
| entity_id | Email entity id, currently available in the incident’s mirror external id. | Required |
| original | Whether to download original email or with modifications. Possible values are: True, False. Default is False. | Optional |
Context Output
There is no context output for this command.
checkpointhec-download-large-email
Download large email file.
Base Command
checkpointhec-download-large-email
Input
| Argument Name | Description | Required |
|---|---|---|
| entity_id | Email entity id, currently available in the incident’s mirror external id. | Required |
Context Output
There is no context output for this command.
Configuration parameters
url— Smart API URL or Check Point Infinity API URL (required)isFetch— Fetch incidentsincidentType— Incident typeclient_id— (required)client_secret— (required)first_fetch— First fetch timesaas_apps— SaaS Applicationevent_state— Stateevent_severity— Severitythreat_type— Threat Typemax_fetch— Maximum number of incidents per fetchcollect_restore_requests— Collect restore requestsinclude_denied_requests— Include denied requestsinclude_accepted_requests— Include accepted requestsinsecure— Trust any certificate (not secure)proxy— Use system proxy settingsincidentFetchInterval— Incidents Fetch Interval
Commands (44)
-
checkpointhec-create-anomaly-exceptionCreate Anomaly exception.
-
checkpointhec-create-ap-exceptionCreate Anti-Phishing and Anti-Spam exception.
-
checkpointhec-create-avdlp-exceptionCreate Avanan DLP exception.
-
checkpointhec-create-avurl-exceptionCreate Avanan URL exception.
-
checkpointhec-create-cp2-exceptionCreate Anti-Malware exception.
-
checkpointhec-create-ctp-list-itemCreate Click Time Protection list item.
-
checkpointhec-delete-anomaly-exceptionsDelete Anomaly exceptions.
-
checkpointhec-delete-ap-exceptionDelete Anti-Phishing and Anti-Spam exception.
-
checkpointhec-delete-avdlp-exceptionDelete Avanan URL exception.
-
checkpointhec-delete-avdlp-exceptionsDelete Avanan DLP exceptions.
-
checkpointhec-delete-avurl-exceptionDelete Avanan URL exception.
-
checkpointhec-delete-avurl-exceptionsDelete Avanan URL exceptions.
-
checkpointhec-delete-cp2-exceptionDelete Anti-Malware exception.
-
checkpointhec-delete-cp2-exceptionsDelete Anti-Malware exceptions.
-
checkpointhec-delete-ctp-list-itemDelete Click Time Protection list item.
-
checkpointhec-delete-ctp-list-itemsDelete Click Time Protection list items.
-
checkpointhec-delete-ctp-listsDelete Click Time Protection lists.
-
checkpointhec-download-emailDownload email file.
-
checkpointhec-download-large-emailDownload large email file.
-
checkpointhec-get-action-resultGet task info related to a sent action.
-
checkpointhec-get-anomaly-exceptionsGet Anomaly exceptions.
-
checkpointhec-get-ap-exceptionsGet Anti-Phishing and Anti-Spam exceptions or exception.
-
checkpointhec-get-avdlp-exceptionGet Avanan DLP exception.
-
checkpointhec-get-avdlp-exceptionsGet Avanan DLP exceptions.
-
checkpointhec-get-avurl-exceptionGet Avanan URL exception.
-
checkpointhec-get-avurl-exceptionsGet Avanan URL exceptions.
-
checkpointhec-get-cp2-exceptionGet Anti-Malware exception.
-
checkpointhec-get-cp2-exceptionsGet Anti-Malware exceptions.
-
checkpointhec-get-ctp-listGet Click Time Protection list.
-
checkpointhec-get-ctp-list-itemGet Click Time Protection list item.
-
checkpointhec-get-ctp-list-itemsGet Click Time Protection list items.
-
checkpointhec-get-ctp-listsGet Click Time Protection lists.
-
checkpointhec-get-entityRetrieve specific entity.
-
checkpointhec-get-eventsRetrieve security events.
-
checkpointhec-get-scan-infoRetrieve specific email scan with positive threats.
-
checkpointhec-report-mis-classificationReport email mis-classification.
-
checkpointhec-search-emailsSearch for emails.
-
checkpointhec-send-actionAction for one or more emails.
-
checkpointhec-send-notificationSend notification about user exposition for the specific entity to the list of emails.
-
checkpointhec-update-ap-exceptionUpdate Anti-Phishing and Anti-Spam exception.
-
checkpointhec-update-avdlp-exceptionUpdate Avanan URL exception.
-
checkpointhec-update-avurl-exceptionUpdate Avanan URL exception.
-
checkpointhec-update-cp2-exceptionUpdate Anti-Malware exception.
-
checkpointhec-update-ctp-list-itemUpdate Click Time Protection list item.
import json from datetime import datetime, timedelta, UTC import demistomock as demisto import pytest from CheckPointHEC import ( MAX_LOOK_BACK_DAYS, SAAS_APPS_TO_SAAS_NAMES, SAAS_NAMES, Client, checkpointhec_create_anomaly_exception, checkpointhec_create_ap_exception, checkpointhec_create_avdlp_exception, checkpointhec_create_avurl_exception, checkpointhec_create_cp2_exception, checkpointhec_create_ctp_list_item, checkpointhec_delete_anomaly_exceptions, checkpointhec_delete_ap_exception, checkpointhec_delete_avdlp_exception, checkpointhec_delete_avdlp_exceptions, checkpointhec_delete_avurl_exception, checkpointhec_delete_avurl_exceptions, checkpointhec_delete_cp2_exception, checkpointhec_delete_cp2_exceptions, checkpointhec_delete_ctp_list_item, checkpointhec_delete_ctp_list_items, checkpointhec_delete_ctp_lists, checkpointhec_download_email, checkpointhec_get_action_result, checkpointhec_get_anomaly_exceptions, checkpointhec_get_ap_exceptions, checkpointhec_get_cp2_exception, checkpointhec_get_cp2_exceptions, checkpointhec_get_ctp_list, checkpointhec_get_ctp_list_item, checkpointhec_get_ctp_list_items, checkpointhec_get_ctp_lists, checkpointhec_get_entity, checkpointhec_get_events, checkpointhec_get_scan_info, checkpointhec_report_mis_classification, checkpointhec_search_emails, checkpointhec_send_action, checkpointhec_send_notification, checkpointhec_update_ap_exception, checkpointhec_update_avdlp_exception, checkpointhec_update_avurl_exception, checkpointhec_update_cp2_exception, checkpointhec_update_ctp_list_item, fetch_incidents, fetch_restore_requests, checkpointhec_download_large_email, ) from CheckPointHEC import test_module as check_module from CommonServerPython import DemistoException def util_load_json(path): with open(path, encoding="utf-8") as f: return json.loads(f.read()) def test_generate_infinity_token(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) _token = "infinity token" _inf_token = {"data": {"token": _token, "expiresIn": 1000}} mocker.patch.object(Client, "_http_request", return_value=_inf_token) assert client._generate_infinity_token() == _token assert client.token == _token def test_generate_signature_with_request_string(): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) assert ( client._generate_signature( f"{'0' * 8}-{'0' * 4}-{'0' * 4}-{'0' * 4}-{'0' * 12}", "2023-08-13T19:08:35.263817", "/v1.0/soar/test" ) == "66968b7de6a44c879eedc2a426ec76c254c203d60ce746236645b52b5b5dcddb" ) def test_generate_signature_with_no_request_string(): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) assert ( client._generate_signature(f"{'0' * 8}-{'0' * 4}-{'0' * 4}-{'0' * 4}-{'0' * 12}", "2023-08-13T19:08:35.263817") == "ac07ea6ddd026cbbfad8751d45d6e9e1823bc03e227eeb117976834391b629b8" ) def test_token_header(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) get_token = mocker.patch.object(Client, "_get_token") client._get_headers(auth=True) get_token.assert_not_called() client._get_headers(auth=False) get_token.assert_called_once() def test_infinity_token_header(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) get_token = mocker.patch.object(Client, "_generate_infinity_token") client._get_headers() get_token.assert_called_once() def test_get_token_empty(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) _token = "super token" mocker.patch.object(Client, "_http_request", return_value=_token) token = client._get_token() assert token == _token def test_get_token_existing(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) _token = "super token" mocker.patch.object(Client, "_http_request", return_value=_token) client.token = "nice token" token = client._get_token() assert token != _token def test_call_smart_api(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) get_headers = mocker.patch.object(Client, "_get_headers", return_value={}) http_request = mocker.patch.object(Client, "_http_request") method = "GET" url_suffix = "soar/test" path = "/".join([client.api_version, url_suffix]) request_string = f"/{path}" client._call_api(method, url_suffix) get_headers.assert_called_with(request_string) http_request.assert_called_with(method, url_suffix=path, headers={}, params=None, json_data=None, resp_type="json") params = {"param1": "value1"} request_string += "?param1=value1" client._call_api(method, url_suffix, params=params) get_headers.assert_called_with(request_string) http_request.assert_called_with(method, url_suffix=path, headers={}, params=params, json_data=None, resp_type="json") def test_call_infinity_api(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) get_headers = mocker.patch.object(Client, "_get_headers", return_value={}) http_request = mocker.patch.object(Client, "_http_request") method = "GET" url_suffix = "soar/test" path = "/".join(["app", "hec-api", client.api_version, url_suffix]) client._call_api(method, url_suffix) get_headers.assert_called_with(None) http_request.assert_called_with(method, url_suffix=path, headers={}, params=None, json_data=None, resp_type="json") def test_test_module(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-test_api.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = check_module(client) call_api.assert_called_once() assert result == "ok" def test_fetch_incidents(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-query_events.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) mocker.patch.object(demisto, "getLastRun", return_value={"last_fetch": "2023-06-30T00:00:00"}) demisto_incidents = mocker.patch.object(demisto, "incidents") fetch_incidents(client, {"first_fetch": "1 day", "saas_apps": "Microsoft Exchange"}) call_api.assert_called_once() demisto_incidents.assert_called_once() def test_fetch_restore_requests(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) mocker.patch.object(demisto, "getLastRun", return_value={"last_rr_fetch": "2023-06-30T00:00:00"}) demisto_incidents = mocker.patch.object(demisto, "incidents") fetch_restore_requests(client, {"first_fetch": "1 day"}) call_api.assert_called() demisto_incidents.assert_called_once() def _restore_requests_client(): return Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=True, proxy=False, ) def _hours_ago(hours: int, suffix: str = "Z"): """Restore request timestamps have to be recent, otherwise the look back clamp filters them out.""" return (datetime.now(UTC).replace(tzinfo=None) - timedelta(hours=hours)).isoformat() + suffix def _restore_request_entry(entity_id: str, occurred, **payload): return { "entityInfo": {"entityId": entity_id}, "entityPayload": {"restoreRequestTime": occurred, "restoreCommentary": "please restore", **payload}, } def _restore_requests_response(entries: list, scroll_id: str = "", total: int = None): return { "responseEnvelope": { "recordsNumber": len(entries) if total is None else total, "scrollId": scroll_id, }, "responseData": entries, } def test_fetch_restore_requests_empty_keeps_cursor(mocker): """An empty result must leave the cursor untouched, otherwise requests that are not yet searchable are skipped.""" client = _restore_requests_client() mocker.patch.object(Client, "_call_api", return_value=_restore_requests_response([])) mocker.patch.object(demisto, "getLastRun", return_value={"last_rr_fetch": "2023-06-30T00:00:00"}) demisto_incidents = mocker.patch.object(demisto, "incidents") set_last_run = mocker.patch.object(demisto, "setLastRun") fetch_restore_requests(client, {"first_fetch": "1 day", "saas_apps": "Microsoft Exchange"}) exchange = SAAS_APPS_TO_SAAS_NAMES["Microsoft Exchange"] assert set_last_run.call_args[0][0]["last_rr_fetch"] == {exchange: "2023-06-30T00:00:00"} demisto_incidents.assert_called_once_with([]) def test_fetch_restore_requests_cursor_is_per_saas(mocker): """Each saas app must advance to its own newest record, not to the newest record across every app.""" client = _restore_requests_client() first_saas, second_saas = SAAS_NAMES newer, older = _hours_ago(1), _hours_ago(2) mocker.patch.object( Client, "_call_api", side_effect=[ _restore_requests_response([_restore_request_entry("newer", newer)]), _restore_requests_response([_restore_request_entry("older", older)]), ], ) mocker.patch.object(demisto, "getLastRun", return_value={"last_rr_fetch": _hours_ago(3, "")}) demisto_incidents = mocker.patch.object(demisto, "incidents") set_last_run = mocker.patch.object(demisto, "setLastRun") fetch_restore_requests(client, {"first_fetch": "1 day"}) incidents = demisto_incidents.call_args[0][0] assert [incident["dbotMirrorId"] for incident in incidents] == ["older", "newer"] assert set_last_run.call_args[0][0]["last_rr_fetch"] == {first_saas: newer, second_saas: older} def test_fetch_restore_requests_queries_each_saas_from_its_own_cursor(mocker): """A stored per saas cursor must scope that app's query window, so a busy app cannot skip a quiet app's records.""" client = _restore_requests_client() first_saas, second_saas = SAAS_NAMES ahead, behind = _hours_ago(1, ""), _hours_ago(5, "") call_api = mocker.patch.object(Client, "_call_api", return_value=_restore_requests_response([])) mocker.patch.object(demisto, "getLastRun", return_value={"last_rr_fetch": {first_saas: ahead, second_saas: behind}}) mocker.patch.object(demisto, "incidents") mocker.patch.object(demisto, "setLastRun") fetch_restore_requests(client, {"first_fetch": "1 day"}) start_dates = [ next( f["saasAttrValue"] for f in call.kwargs["json_data"]["requestData"]["entityExtendedFilter"] if f["saasAttrName"] == "entityPayload.restoreRequestTime" ) for call in call_api.call_args_list ] assert start_dates == [ahead, behind] def test_fetch_restore_requests_clamps_stale_cursor(mocker): """A cursor older than the look back limit must be clamped so the query window stays bounded.""" client = _restore_requests_client() call_api = mocker.patch.object(Client, "_call_api", return_value=_restore_requests_response([])) mocker.patch.object(demisto, "getLastRun", return_value={"last_rr_fetch": "2020-01-01T00:00:00"}) mocker.patch.object(demisto, "incidents") mocker.patch.object(demisto, "setLastRun") fetch_restore_requests(client, {"first_fetch": "1 day", "saas_apps": "Microsoft Exchange"}) extended_filter = call_api.call_args.kwargs["json_data"]["requestData"]["entityExtendedFilter"] start_date = next(f["saasAttrValue"] for f in extended_filter if f["saasAttrName"] == "entityPayload.restoreRequestTime") expected = datetime.now(UTC).replace(tzinfo=None) - timedelta(days=MAX_LOOK_BACK_DAYS) assert abs((datetime.fromisoformat(start_date) - expected).total_seconds()) < 60 def test_fetch_restore_requests_max_fetch_across_saas(mocker): """max_fetch must be enforced across all saas apps, and the remainder left for the next fetch.""" client = _restore_requests_client() first_saas, second_saas = SAAS_NAMES seeded = _hours_ago(3, "") newer, older = _hours_ago(1), _hours_ago(2) mocker.patch.object( Client, "_call_api", side_effect=[ _restore_requests_response([_restore_request_entry("newer", newer)]), _restore_requests_response([_restore_request_entry("older", older)]), ], ) mocker.patch.object(demisto, "getLastRun", return_value={"last_rr_fetch": seeded}) demisto_incidents = mocker.patch.object(demisto, "incidents") set_last_run = mocker.patch.object(demisto, "setLastRun") fetch_restore_requests(client, {"first_fetch": "1 day", "max_fetch": "1"}) incidents = demisto_incidents.call_args[0][0] assert [incident["dbotMirrorId"] for incident in incidents] == ["older"] # Truncation dropped the first app's record, so only the app we emitted for may advance. assert set_last_run.call_args[0][0]["last_rr_fetch"] == {first_saas: seeded, second_saas: older} def test_fetch_restore_requests_skips_missing_request_time(mocker): """A restore request without a restoreRequestTime must be skipped instead of failing the whole fetch.""" client = _restore_requests_client() mocker.patch.object( Client, "_call_api", return_value=_restore_requests_response( [ _restore_request_entry("no-time", None), _restore_request_entry("valid", _hours_ago(1)), ] ), ) mocker.patch.object(demisto, "getLastRun", return_value={"last_rr_fetch": _hours_ago(3, "")}) demisto_incidents = mocker.patch.object(demisto, "incidents") mocker.patch.object(demisto, "setLastRun") fetch_restore_requests(client, {"first_fetch": "1 day", "saas_apps": "Microsoft Exchange"}) incidents = demisto_incidents.call_args[0][0] assert [incident["dbotMirrorId"] for incident in incidents] == ["valid"] def test_fetch_restore_requests_follows_scroll(mocker): """Results beyond the first page must be retrieved by sending the scroll id back.""" client = _restore_requests_client() call_api = mocker.patch.object( Client, "_call_api", side_effect=[ _restore_requests_response( [ _restore_request_entry("first", _hours_ago(3)), _restore_request_entry("second", _hours_ago(2)), ], scroll_id="abc", total=3, ), # The server returns the same scroll id for every page of a scroll. _restore_requests_response([_restore_request_entry("third", _hours_ago(1))], scroll_id="abc", total=3), ], ) mocker.patch.object(demisto, "getLastRun", return_value={"last_rr_fetch": _hours_ago(5, "")}) demisto_incidents = mocker.patch.object(demisto, "incidents") mocker.patch.object(demisto, "setLastRun") fetch_restore_requests(client, {"first_fetch": "1 day", "saas_apps": "Microsoft Exchange"}) assert call_api.call_count == 2 assert call_api.call_args_list[1].kwargs["json_data"]["requestData"]["scrollId"] == "abc" incidents = demisto_incidents.call_args[0][0] assert [incident["dbotMirrorId"] for incident in incidents] == ["first", "second", "third"] def test_fetch_restore_requests_stops_paging_at_max_fetch(mocker): """Since pages arrive oldest first, paging must stop once enough records are held.""" client = _restore_requests_client() call_api = mocker.patch.object( Client, "_call_api", return_value=_restore_requests_response( [ _restore_request_entry("first", _hours_ago(2)), _restore_request_entry("second", _hours_ago(1)), ], scroll_id="abc", total=50, ), ) mocker.patch.object(demisto, "getLastRun", return_value={"last_rr_fetch": _hours_ago(3, "")}) demisto_incidents = mocker.patch.object(demisto, "incidents") mocker.patch.object(demisto, "setLastRun") fetch_restore_requests(client, {"first_fetch": "1 day", "saas_apps": "Microsoft Exchange", "max_fetch": "1"}) call_api.assert_called_once() assert [incident["dbotMirrorId"] for incident in demisto_incidents.call_args[0][0]] == ["first"] def test_checkpointhec_get_entity_success(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-get_entity.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_entity(client, {"entity": "0" * 32}) call_api.assert_called_once() assert result.outputs == mock_response["responseData"][0]["entityPayload"] def test_checkpointhec_get_entity_fail(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) call_api = mocker.patch.object(Client, "_call_api", return_value={"responseData": []}) entity = "0" * 31 + "1" result = checkpointhec_get_entity(client, {"entity": entity}) call_api.assert_called_once() assert result.readable_output == f"Entity with id {entity} not found" def test_checkpointhec_get_events_success(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-query_events.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_events( client, { "start_date": "2023-11-01 00:00:00", "saas_apps": ["Microsoft Exchange"], "states": "New", "severities": "critical", "threat_types": "DLP", }, ) call_api.assert_called_once() assert result.outputs == mock_response["responseData"] def test_checkpointhec_get_events_fail(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) call_api = mocker.patch.object(Client, "_call_api", return_value={"responseData": []}) result = checkpointhec_get_events(client, {"start_date": "2023-11-01 00:00:00"}) call_api.assert_called_once() assert result.readable_output == "Events not found with the given criteria" def test_checkpointhec_get_scan_info_success(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-get_entity.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_scan_info(client, {"entity": "0" * 32}) call_api.assert_called_once() assert result.outputs == {"av": json.dumps(mock_response["responseData"][0]["entitySecurityResult"]["av"])} def test_checkpointhec_get_scan_info_fail(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) call_api = mocker.patch.object(Client, "_call_api", return_value={"responseData": []}) entity = "0" * 31 + "1" result = checkpointhec_get_scan_info(client, {"entity": entity}) call_api.assert_called_once() assert result.readable_output == f"Entity with id {entity} not found" def test_checkpointhec_search_emails_success(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) mocker.patch.object(demisto, "args", return_value={}) mock_response = util_load_json("./test_data/checkpointhec-search_emails.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) emails = [] for entity in mock_response["responseData"]: email = entity["entityPayload"] email["entityId"] = entity["entityInfo"]["entityId"] emails.append(email) result = checkpointhec_search_emails(client, {"date_last": "1 day"}, {}) call_api.assert_called() assert result.outputs == emails checkpointhec_search_emails(client, {"date_from": "2023-11-01 00:00:00", "date_to": "2023-11-02 00:00:00"}, {}) call_api.assert_called() assert result.outputs == emails def test_checkpointhec_search_emails_fail(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) call_api = mocker.patch.object(Client, "_call_api") result = checkpointhec_search_emails(client, {"date_last": "1 day", "date_from": "2023-11-01 00:00:00", "date_to": None}, {}) call_api.assert_not_called() assert result.readable_output == ( "Argument date_last='1 day' cannot be used with date_from='2023-11-01 00:00:00' or date_to=None" ) result = checkpointhec_search_emails(client, {"date_last": "uno week"}, {}) call_api.assert_not_called() assert result.readable_output == "Could not establish start date with date_last='uno week'" result = checkpointhec_search_emails(client, {}, {}) call_api.assert_not_called() assert result.readable_output == "Argument date_last and date_from cannot be both empty" result = checkpointhec_search_emails( client, {"date_last": "1 day", "subject_contains": "Any subject, ...", "subject_match": "This subject"}, {} ) call_api.assert_not_called() assert result.readable_output == ( "Argument subject_contains='Any subject, ...' and subject_match='This subject' cannot be both set" ) result = checkpointhec_search_emails(client, {"date_last": "1 day", "sender_contains": "a@b.c", "sender_match": "d@e.f"}, {}) call_api.assert_not_called() assert result.readable_output == "Argument sender_contains='a@b.c' and sender_match='d@e.f' cannot be both set" result = checkpointhec_search_emails( client, {"date_last": "1 day", "recipients_contains": "a@b.c", "recipients_match": "d@e.f"}, {} ) call_api.assert_not_called() assert result.readable_output == "Argument recipients_contains='a@b.c' and recipients_match='d@e.f' cannot be both set" result = checkpointhec_search_emails(client, {"date_last": "1 day", "name_contains": "My Nam", "name_match": "My Name"}, {}) call_api.assert_not_called() assert result.readable_output == "Argument name_contains='My Nam' and name_match='My Name' cannot be both set" def test_checkpointhec_send_action(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-send_action.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_send_action(client, {"entity": "0" * 32, "saas": "Microsoft Exchange", "action": "restore"}) call_api.assert_called_once() assert result.outputs == {"task": mock_response["responseData"][0]["taskId"]} def test_checkpointhec_get_action_result(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-get_action_result.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_action_result(client, {"task": "0" * 16}) call_api.assert_called_once() assert result.outputs == mock_response["responseData"] def test_send_notification_success(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-ok-true.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_send_notification(client, {"entity": "0" * 32, "emails": "a@b.c, d@e.f"}) call_api.assert_called_once() assert result.outputs == mock_response def test_send_notification_fail(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-ok-false.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_send_notification(client, {"entity": "0" * 32, "emails": "a@b.c, d@e.f"}) assert str(e.value) == "Error sending notification email" call_api.assert_called() def test_report_mis_classification_success(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_report_mis_classification( client, {"entities": "0" * 32, "classification": "Clean Email", "confident": "Not so sure"} ) call_api.assert_called_once() assert result.readable_output == "Mis-classification reported successfully" def test_report_mis_classification_fail(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_report_mis_classification( client, {"entities": "0" * 32, "classification": "Clean Email", "confident": "Not so sure"} ) assert str(e.value) == "Error reporting mis-classification" call_api.assert_called() def test_checkpointhec_download_email(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) content = b"abc123" entity_id = "0" * 32 import CheckPointHEC file_result = mocker.patch.object(CheckPointHEC, "fileResult") call_api = mocker.patch.object(client, "_call_api", return_value=content) checkpointhec_download_email(client, {"entity_id": entity_id}) call_api.assert_called() file_result.assert_called_once_with(filename=f"{entity_id}.eml", data=content) def test_checkpointhec_download_large_email(mocker): client = Client( base_url="https://smart-api-example-1-us.avanan-example.net", client_id="****", client_secret="****", verify=False, proxy=False, ) content = b"abc123" entity_id = "0" * 32 import CheckPointHEC import requests file_result = mocker.patch.object(CheckPointHEC, "fileResult") mock_response = util_load_json("./test_data/checkpointhec-presignurl.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) presign_url = mock_response["responseData"]["url"] mock_eml_response = mocker.Mock() mock_eml_response.status_code = 200 mock_eml_response.content = content def _mock_get(url, *args, **kwargs): if url == presign_url: return mock_eml_response raise requests.exceptions.RequestException(f"Unexpected URL: {url}") requests_get_mock = mocker.patch( "CheckPointHEC.requests.get", side_effect=_mock_get, ) checkpointhec_download_large_email(client, {"entity_id": entity_id}) call_api.assert_called() requests_get_mock.assert_called_once_with(presign_url) file_result.assert_called_once_with(filename=f"{entity_id}.eml", data=content) def test_get_ap_exceptions_empty(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_ap_exceptions(client, {"exc_type": "whitelist"}) call_api.assert_called_once() assert result.readable_output == "No Anti-Phishing exceptions found" def test_get_ap_exceptions_non_empty(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-get_ap_exceptions.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_ap_exceptions(client, {"exc_type": "whitelist"}) call_api.assert_called_once() assert result.outputs == mock_response["responseData"] def test_create_ap_exception_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_create_ap_exception(client, {"exc_type": "whitelist", "comment": "From Unit Tests"}) call_api.assert_called() assert result.readable_output == "Anti-Phishing exception created successfully" def test_create_ap_exception_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_create_ap_exception(client, {"exc_type": "not_whitelist", "comment": "From Unit Tests"}) assert str(e.value) == "Error creating Anti-Phishing exception" call_api.assert_called() def test_update_ap_exception_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_update_ap_exception(client, {"exc_type": "whitelist", "exc_id": "0000", "comment": "New comment"}) call_api.assert_called() assert result.readable_output == "Anti-Phishing exception updated successfully" def test_update_ap_exception_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_update_ap_exception(client, {"exc_type": "not_whitelist", "exc_id": "0000", "comment": "New comment"}) assert str(e.value) == "Error updating Anti-Phishing exception" call_api.assert_called() def test_delete_ap_exception_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") mock_response["responseEnvelope"]["responseCode"] = 204 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_delete_ap_exception(client, {"exc_type": "whitelist", "exc_id": "0000"}) call_api.assert_called() assert result.readable_output == "Anti-Phishing exception deleted successfully" def test_delete_ap_exception_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_delete_ap_exception(client, {"exc_type": "not_whitelist", "exc_id": "0000"}) assert str(e.value) == "Error deleting Anti-Phishing exception" call_api.assert_called() def test_get_cp2_exception_empty(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_cp2_exception(client, {"exc_type": "hash", "exc_str": "0" * 32}) call_api.assert_called_once() assert result.readable_output == "No Anti-Malware exception found" def test_get_cp2_exception_not_empty(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-get_cp2_exception.json") mock_response["responseData"] = mock_response["responseData"][0] call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_cp2_exception(client, {"exc_type": "hash", "exc_str": "0" * 32}) call_api.assert_called_once() assert result.outputs == mock_response["responseData"] def test_create_cp2_exception_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") mock_response["responseEnvelope"]["responseCode"] = 201 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_create_cp2_exception( client, {"exc_type": "file_type", "exc_str": ".pdf", "comment": "From Unit Tests"} ) call_api.assert_called() assert result.readable_output == "Anti-Malware exception created successfully" def test_create_cp2_exception_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_create_cp2_exception(client, {"exc_type": "not_file_type", "exc_str": ".pdf", "comment": "From Unit Tests"}) assert str(e.value) == "Error creating Anti-Malware exception" call_api.assert_called() def test_update_cp2_exception_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_update_cp2_exception(client, {"exc_type": "file_type", "exc_str": ".pdf", "comment": "New comment"}) call_api.assert_called() assert result.readable_output == "Anti-Malware exception updated successfully" def test_update_cp2_exception_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_update_cp2_exception(client, {"exc_type": "not_file_type", "exc_str": ".pdf", "comment": "New comment"}) assert str(e.value) == "Error updating Anti-Malware exception" call_api.assert_called() def test_delete_cp2_exception_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") mock_response["responseEnvelope"]["responseCode"] = 204 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_delete_cp2_exception(client, {"exc_type": "file_type", "exc_str": ".pdf"}) call_api.assert_called() assert result.readable_output == "Anti-Malware exception deleted successfully" def test_delete_cp2_exception_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_delete_cp2_exception(client, {"exc_type": "not_file_type", "exc_str": ".pdf"}) assert str(e.value) == "Error deleting Anti-Malware exception" call_api.assert_called() def test_get_cp2_exceptions_empty(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_cp2_exceptions(client, {"exc_type": "hash"}) call_api.assert_called_once() assert result.readable_output == "No Anti-Malware exceptions found" def test_get_cp2_exceptions_not_empty(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-get_cp2_exception.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_cp2_exceptions(client, {"exc_type": "hash"}) call_api.assert_called_once() assert result.outputs == mock_response["responseData"] def test_delete_cp2_exceptions_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") mock_response["responseEnvelope"]["responseCode"] = 204 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_delete_cp2_exceptions(client, {"exc_type": "file_type", "exc_str_list": ".pdf"}) call_api.assert_called() assert result.readable_output == "Anti-Malware exceptions deleted successfully" def test_delete_cp2_exceptions_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_delete_cp2_exceptions(client, {"exc_type": "not_file_type", "exc_str_list": ".pdf"}) assert str(e.value) == "Error deleting Anti-Malware exceptions" call_api.assert_called() def test_get_anomaly_exceptions_empty(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_anomaly_exceptions(client) call_api.assert_called_once() assert result.readable_output == "No Anomaly exceptions found" def test_get_anomaly_exceptions_not_empty(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-get_anomaly_exceptions.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_anomaly_exceptions(client) call_api.assert_called_once() assert result.outputs == mock_response["responseData"] def test_create_anomaly_exception_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") mock_response["responseEnvelope"]["responseCode"] = 201 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_create_anomaly_exception( client, { "request_json": { "whitelist-option:superman_anomaly": "0" * 32, "apply-to-past": "Yes", "anomaly-comment": "Test for XSOAR", "event_id": "0" * 32, }, "added_by": "a@b.test", }, ) call_api.assert_called() assert result.readable_output == "Anomaly exception created successfully" def test_create_anomaly_exception_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_create_anomaly_exception( client, { "request_json": { "whitelist-option:superman_anomaly": "0" * 32, "apply-to-past": "Yes", "anomaly-comment": "Test for XSOAR", "event_id": "0" * 32, }, "added_by": "a@b.test", }, ) assert str(e.value) == "Error creating Anomaly exception" call_api.assert_called() def test_delete_anomaly_exception_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") mock_response["responseEnvelope"]["responseCode"] = 204 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_delete_anomaly_exceptions(client, {"rule_ids": "00000"}) call_api.assert_called() assert result.readable_output == "Anomaly exceptions deleted successfully" def test_delete_anomaly_exceptions_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_delete_anomaly_exceptions(client, {"rule_ids": "00000"}) assert str(e.value) == "Error deleting Anomaly exceptions" call_api.assert_called() def test_get_ctp_lists_empty(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_ctp_lists(client) call_api.assert_called_once() assert result.readable_output == "No CTP lists found" def test_get_ctp_lists_not_empty(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-get_ctp_lists.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_ctp_lists(client) call_api.assert_called_once() assert result.outputs == mock_response["responseData"] def test_get_ctp_list_empty(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_ctp_list(client, {"list_id": "0"}) call_api.assert_called_once() assert result.readable_output == "No CTP list found" def test_get_ctp_list_not_empty(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-get_ctp_list.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_ctp_list(client, {"list_id": "0"}) call_api.assert_called_once() assert result.outputs == mock_response["responseData"] def test_get_ctp_list_items_empty(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_ctp_list_items(client) call_api.assert_called_once() assert result.readable_output == "No CTP list items found" def test_get_ctp_list_items_not_empty(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-get_ctp_list_items.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_ctp_list_items(client) call_api.assert_called_once() assert result.outputs == mock_response["responseData"] def test_get_ctp_list_item_empty(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_ctp_list_item(client, {"item_id": "0000000000000000"}) call_api.assert_called_once() assert result.readable_output == "No CTP list items found" def test_get_ctp_list_item_not_empty(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-get_ctp_list_item.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_get_ctp_list_item(client, {"item_id": "0000000000000000"}) call_api.assert_called_once() assert result.outputs == mock_response["responseData"] def test_create_ctp_list_item_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") mock_response["responseEnvelope"]["responseCode"] = 201 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_create_ctp_list_item( client, {"list_id": "0", "list_item_name": "example.com", "created_by": "a@b.test"} ) call_api.assert_called() assert result.readable_output == "CTP list item created successfully" def test_create_ctp_list_item_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_create_ctp_list_item(client, {"list_id": "-1", "list_item_name": "example.com", "created_by": "a@b.test"}) assert str(e.value) == "Error creating CTP list item" call_api.assert_called() def test_update_ctp_list_item_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_update_ctp_list_item( client, {"item_id": "00000000000", "list_id": "0", "list_item_name": "new.example.com", "created_by": "a@b.test"} ) call_api.assert_called() assert result.readable_output == "CTP list item updated successfully" def test_update_ctp_list_item_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_update_ctp_list_item( client, {"item_id": "00000000000", "list_id": "-1", "list_item_name": "example.com", "created_by": "a@b.test"} ) assert str(e.value) == "Error updating CTP list item" call_api.assert_called() def test_delete_ctp_list_item_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") mock_response["responseEnvelope"]["responseCode"] = 204 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_delete_ctp_list_item(client, {"item_id": "0" * 11}) call_api.assert_called() assert result.readable_output == "CTP list item deleted successfully" def test_delete_ctp_list_item_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") mock_response["responseEnvelope"]["responseCode"] = 404 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_delete_ctp_list_item(client, {"item_id": "0" * 11}) assert str(e.value) == "Error deleting CTP list item" call_api.assert_called() def test_delete_ctp_list_items_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") mock_response["responseEnvelope"]["responseCode"] = 204 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_delete_ctp_list_items(client, {"list_item_ids": "0" * 11}) call_api.assert_called() assert result.readable_output == "CTP list items deleted successfully" def test_delete_ctp_list_items_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") mock_response["responseEnvelope"]["responseCode"] = 404 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_delete_ctp_list_items(client, {"list_item_ids": "0" * 11}) assert str(e.value) == "Error deleting CTP list items" call_api.assert_called() def test_delete_ctp_lists_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") mock_response["responseEnvelope"]["responseCode"] = 204 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_delete_ctp_lists(client) call_api.assert_called() assert result.readable_output == "CTP lists deleted successfully" def test_delete_ctp_lists_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") mock_response["responseEnvelope"]["responseCode"] = 404 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_delete_ctp_lists(client) assert str(e.value) == "Error deleting CTP lists" call_api.assert_called() def test_create_avurl_exception_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") mock_response["responseEnvelope"]["responseCode"] = 201 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_create_avurl_exception( client, {"exc_type": "allow-url", "exc_str": "example.com", "comment": "From Unit Tests"} ) call_api.assert_called() assert result.readable_output == "Avanan URL exception created successfully" def test_create_avurl_exception_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_create_avurl_exception( client, {"exc_type": "not-allow-url", "exc_str": "example.com", "comment": "From Unit Tests"} ) assert str(e.value) == "Error creating Avanan URL exception" call_api.assert_called() def test_update_avurl_exception_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_update_avurl_exception( client, {"exc_type": "allow-url", "exc_str": "example.com", "comment": "New comment"} ) call_api.assert_called() assert result.readable_output == "Avanan URL exception updated successfully" def test_update_avurl_exception_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_update_avurl_exception( client, {"exc_type": "not-allow-url", "exc_str": "example.com", "comment": "New comment"} ) assert str(e.value) == "Error updating Avanan URL exception" call_api.assert_called() def test_delete_avurl_exception_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") mock_response["responseEnvelope"]["responseCode"] = 204 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_delete_avurl_exception(client, {"exc_type": "allow-url", "exc_str": "example.com"}) call_api.assert_called() assert result.readable_output == "Avanan URL exception deleted successfully" def test_delete_avurl_exception_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_delete_avurl_exception(client, {"exc_type": "not-allow-url", "exc_str": "example.com"}) assert str(e.value) == "Error deleting Avanan URL exception" call_api.assert_called() def test_delete_avurl_exceptions_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") mock_response["responseEnvelope"]["responseCode"] = 204 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_delete_avurl_exceptions(client, {"exc_type": "allow-url", "exc_str_list": "example.com"}) call_api.assert_called() assert result.readable_output == "Avanan URL exceptions deleted successfully" def test_delete_avurl_exceptions_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_delete_avurl_exceptions(client, {"exc_type": "not-allow-url", "exc_str_list": "example.com"}) assert str(e.value) == "Error deleting Avanan URL exceptions" call_api.assert_called() def test_create_avdlp_exception_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") mock_response["responseEnvelope"]["responseCode"] = 201 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_create_avdlp_exception(client, {"exc_type": "hash", "exc_str": "0" * 32, "comment": "From Unit Tests"}) call_api.assert_called() assert result.readable_output == "Avanan DLP exception created successfully" def test_create_avdlp_exception_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_create_avdlp_exception(client, {"exc_type": "not_hash", "exc_str": "0" * 32, "comment": "From Unit Tests"}) assert str(e.value) == "Error creating Avanan DLP exception" call_api.assert_called() def test_update_avdlp_exception_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_update_avdlp_exception(client, {"exc_type": "hash", "exc_str": "0" * 32, "comment": "New comment"}) call_api.assert_called() assert result.readable_output == "Avanan DLP exception updated successfully" def test_update_avdlp_exception_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_update_avdlp_exception(client, {"exc_type": "not_hash", "exc_str": "0" * 32, "comment": "New comment"}) assert str(e.value) == "Error updating Avanan DLP exception" call_api.assert_called() def test_delete_avdlp_exception_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") mock_response["responseEnvelope"]["responseCode"] = 204 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_delete_avdlp_exception(client, {"exc_type": "hash", "exc_str": "0" * 32}) call_api.assert_called() assert result.readable_output == "Avanan DLP exception deleted successfully" def test_delete_avdlp_exception_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_delete_avdlp_exception(client, {"exc_type": "not_hash", "exc_str": "0" * 32}) assert str(e.value) == "Error deleting Avanan DLP exception" call_api.assert_called() def test_delete_avdlp_exceptions_success(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-success_response.json") mock_response["responseEnvelope"]["responseCode"] = 204 call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) result = checkpointhec_delete_avdlp_exceptions(client, {"exc_type": "hash", "exc_str_list": "0" * 32}) call_api.assert_called() assert result.readable_output == "Avanan DLP exceptions deleted successfully" def test_delete_avdlp_exceptions_fail(mocker): client = Client( base_url="https://cloudinfra-gw.example.checkpoint-example.com", client_id="****", client_secret="****", verify=False, proxy=False, ) mock_response = util_load_json("./test_data/checkpointhec-fail_response.json") call_api = mocker.patch.object( Client, "_call_api", return_value=mock_response, ) with pytest.raises(DemistoException) as e: checkpointhec_delete_avdlp_exceptions(client, {"exc_type": "not_hash", "exc_str_list": "0" * 32}) assert str(e.value) == "Error deleting Avanan DLP exceptions" call_api.assert_called()