Check Point Deprecated
Deprecated. Use the Check Point Firewall v2 integration instead. Manage Check Point firewall via API
Network Security · Check Point Firewall
Details
| ID | Check Point |
|---|---|
| Provider | CheckPoint Software Technologies |
| Category | Network Security |
| From Version | 5.0.0 |
| Supported Modules | Agentix XSIAM EDR Cortex Cloud Cloud Runtime Security |
README
Use the Check Point Firewall integration to identify and control applications by user and scan content to stop threats.
Configure Check Point on Cortex XSOAR
- Navigate to Settings > Integrations > Servers & Services.
- Search for Check Point.
- Click Add instance to create and configure a new integration instance.
- Name: a textual name for the integration instance.
- Server URL (e.g., https://192.168.0.1)
- Port
- Username
- Trust any certificate (not secure)
- Use system proxy settings
- Click Test to validate the URLs, token, and connection.
Commands
You can execute these commands from the Cortex XSOAR 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.
- Get items in an access rulebase: checkpoint-show-access-rule-base
- Set attributes of an access rule object: checkpoint-set-rule
- Get the status of a Check Point task: checkpoint-task-status
- Get all host objects: checkpoint-show-hosts
- Block an IP address: checkpoint-block-ip
- Use the Check Point Management API: checkpoint
- Delete a rule: checkpoint-delete-rule
1. Get items in an access rulebase
Show items in an access rulebase configured in Check Point Firewall.
Base Command
checkpoint-show-access-rule-base
Input
| Argument Name | Description | Required |
|---|---|---|
| name | The object name. Should be unique in the domain. | Required |
| uid | The unique identifier of the object. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckpointFWRule.Name | string | The object name. Should be unique in the domain. |
| CheckpointFWRule.UID | string | The unique identifier of the object. |
| CheckpointFWRule.Type | string | The object type. |
| CheckpointFWRule.Action | string | The level of detail returned depends on the “details-level” field of the request (Accept, Drop, Apply Layer, Ask, Info). This table shows the level of detail shown when “details-level” is set to standard. |
| CheckpointFWRule.ActionSetting | string | Action settings. |
| CheckpointFWRule.CustomFields | string | Custom fields. |
| CheckpointFWRule.Data | string | The level of detail returned depends on the “details-level” field of the request. This table shows the level of detail shown when “details-level” is set to standard. |
| CheckpointFWRule.Data.Name | string | The object name. Should be unique in the domain. |
| CheckpointFWRule.UID | string | The unique identifier of the object. |
| CheckpointFWRule.Type | string | The object type. |
| CheckpointFWRule.Data.Domain | string | Information about the domain that the object belongs to. |
| CheckpointFWRule.DataDirection | string | The direction the file types processing is applied to. |
| CheckpointFWRule.DataNegate | string | “True” if negate is set for data. |
| CheckpointFWRule.Destination | string | Collection of network objects identified by the name or UID. The level of detail returned depends on the “details-level” field of the request. This table shows the level of detail shown when “details-level” is set to standard. |
| CheckpointFWRule.DestinationNegate | string | “True” if negate is set for the destination. |
| CheckpointFWRule.Domain | string | Information about the domain that the object belongs to. |
| CheckpointFWRule.Domain.Name | string | The object name. Should be unique in the domain. |
| CheckpointFWRule.Domain.UID | string | The unique identifier of the object. |
| CheckpointFWRule.Domain.Type | string | The domain type. |
| CheckpointFWRule.Enabled | string | Whether the rule is enabled or disabled. |
| CheckpointFWRule.Hits | number | The hits count object. |
| CheckpointFWRule.Hits.FirstDate | string | The first date of hits. |
| CheckpointFWRule.Hits.LastDate | string | The last date of hits. |
| CheckpointFWRule.Hits.Level | string | The level of hits. |
| CheckpointFWRule.Hits.Percentage | string | The percentage of hits. |
| CheckpointFWRule.Hits.Value | string | The value of hits. |
Command Example
!checkpoint-show-access-rule-base name="Network"
Human Readable Output

2. Set attributes of an access rule object
Sets attributes of an access rule object configured in Check Point Firewall.
Base Command
checkpoint-set-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| uid | The unique identifier of the object. | Optional |
| name | The object name. | Optional |
| rule_number | The rule number. | Optional |
| layer | The layer that the rule belongs to, identified by the name or UID. | Required |
| enabled | If “true”, the rule will be enabled. If “false”, the rule will be disabled. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckpointFWRule.Name | string | The object name. Should be unique in the domain. |
| CheckpointFWRule.UID | string | The unique identifier of the object. |
| CheckpointFWRule.Type | string | The object type. |
| CheckpointFWRule.Action | string | The level of detail returned depends on the “details-level” field of the request (Accept, Drop, Apply Layer, Ask, Info). This table shows the level of detail shown when “details-level” is set to standard. |
| CheckpointFWRule.ActionSetting | string | Action settings. |
| CheckpointFWRule.CustomFields | string | Custom fields. |
| CheckpointFWRule.Data | string | The level of detail returned depends on the “details-level” field of the request. This table shows the level of detail shown when “details-level” is set to standard. |
| CheckpointFWRule.Data.Name | string | The object name. Should be unique in the domain. |
| CheckpointFWRule.UID | string | The unique identifier of the object. |
| CheckpointFWRule.Type | string | The object type. |
| CheckpointFWRule.Data.Domain | string | Information about the domain that the object belongs to. |
| CheckpointFWRule.DataDirection | string | The direction the file types processing is applied to. |
| CheckpointFWRule.DataNegate | string | “True” if negate is set for data. |
| CheckpointFWRule.Destination | string | Collection of network objects identified by the name or UID. The level of detail returned depends on the “details-level” field of the request. This table shows the level of detail shown when “details-level” is set to standard. |
| CheckpointFWRule.DestinationNegate | string | “True” if negate is set for the destination. |
| CheckpointFWRule.Domain | string | Information about the domain that the object belongs to. |
| CheckpointFWRule.Domain.Name | string | Object name. Should be unique in domain |
| CheckpointFWRule.Domain.UID | string | The unique identifier of the object. |
| CheckpointFWRule.Domain.Type | string | Domain type. |
| CheckpointFWRule.Enabled | string | Whether the rule is enabled or disabled. |
| CheckpointFWRule.Hits | number | The hits count object. |
| CheckpointFWRule.Hits.FirstDate | string | The first date of hits. |
| CheckpointFWRule.Hits.LastDate | string | The last date of hits. |
| CheckpointFWRule.Hits.Level | string | The level of hits. |
| CheckpointFWRule.Hits.Percentage | string | The percentage of hits. |
| CheckpointFWRule.Hits.Value | string | The value of hits. |
Command Example
!checkpoint-set-rule name="bar-from-6.6.6.5" layer="8a5e96fb-c793-457f-b78f-c667074223a5"
Human Readable Output

3. Get the status of a Check Point task
Shows status of a Check Point task, by task UUID.
Base Command
checkpoint-task-status
Input
| Argument Name | Description | Required |
|---|---|---|
| task_id | A CSV list of task unique identifiers. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckpointFWTask.Name | string | The object name. Should be unique in the domain. |
| CheckpointFWTask.UID | string | The unique identifier of the object. |
| CheckpointFWTask.Type | string | The object type. |
| CheckpointFWTask.Domain | string | Information about the domain that the object belongs to. |
| CheckpointFWTask.Domain.Name | string | The object name. Should be unique in the domain. |
| CheckpointFWTask.Domain.UID | string | The unique identifier of the object. |
| CheckpointFWTask.Domain.Type | string | Domain type. |
| CheckpointFWTask.LastUpdateTime | string | The last update date and time (in international ISO 8601 format). |
| CheckpointFWTask.MetaInfo.CreationTime | string | The object creation time. |
| CheckpointFWTask.MetaInfo.Creator | string | The object creator. |
| CheckpointFWTask.MetaInfo.LastModifier | string | The last modifier of object. |
| CheckpointFWTask.MetaInfo.LastModifyTime | string | The object last modification time. |
| CheckpointFWTask.MetaInfo.LockStatus | string | The object lock state. Editing objects locked by other sessions is not supported. |
| CheckpointFWTask.MetaInfo.ValidationStatus | string | The object validation state (ok, info, warning, error). |
| CheckpointFWTask.ProgressPercentage | string | The object progress percentage. |
| CheckpointFWTask.ReadOnly | string | Read only. |
| CheckpointFWTask.StartTime | string | The start time date and time (in international ISO 8601 format). |
| CheckpointFWTask.Status | string | The task status. |
| CheckpointFWTask.Suppressed | string | Is suppressed. |
| CheckpointFWTask.Tags | string | A collection of tag objects identified by the name or UID. The level of detail returned depends on the “details-level” field of the request. This table shows the level of detail shown when “details-level” is set to standard. |
| CheckpointFWTask.Details | string | The task details. The level of detail returned depends on the “details-level” field of the request. This table shows the level of detail shown when “details-level” is set to standard. |
| CheckpointFWTask.ID | string | The asynchronous unique identifier of the task. |
| CheckpointFWTask.TaskName | string | The task name. |
4. Get all host objects
Shows all host objects configured in Check Point Firewall.
Base Command
checkpoint-show-hosts
Input
| Argument Name | Description | Required |
|---|---|---|
| limit | The maximum number of results to return. | Optional |
| offset | The number of results to skip before starting to return them. | Optional |
| order | Sorts results by the given field. The default is the random order. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Endpoint.Hostname | string | Object name. Should be unique in domain |
| Endpoint.UID | string | The unique identifier of the object. |
| Endpoint.Type | string | The object type. |
| Endpoint.Domain | string | Information about the domain that the object belongs to. |
| Endpoint.Domain.Name | string | The object name. Should be unique in the domain. |
| Endpoint.Domain.UID | string | Object unique identifier |
| Endpoint.Domain.Type | string | Type of the object |
Command Example
!checkpoint-show-hosts
Human Readable Output

5. Block an IP address
Block one or more IP addresses using Checkpoint Firewall
Base Command
checkpoint-block-ip
Input
| Argument Name | Description | Required |
|---|---|---|
| ip | A CSV list of IP addresses to block. | Required |
| direction | Whether to block traffic “to” or “from” the IPs, or “both”. Default is “both”. | Optional |
| rulename | The base name for added rules inside Check Point DB. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| CheckpointFWRule.Name | string | The object name. Should be unique in the domain. |
| CheckpointFWRule.UID | string | The unique identifier of the object. |
| CheckpointFWRule.Type | string | Type of the object |
| CheckpointFWRule.Action | string | The level of detail returned depends on the "details-level" field of the request (Accept, Drop, Apply Layer, Ask, Info). This table shows the level of detail shown when 'details-level" is set to standard. |
| CheckpointFWRule.ActionSetting | string | Action settings. |
| CheckpointFWRule.CustomFields | string | Custom fields. |
| CheckpointFWRule.Data | string | The level of detail returned depends on the “details-level” field of the request. This table shows the level of detail shown when “details-level” is set to standard. |
| CheckpointFWRule.Data.Name | string | The object name. Should be unique in the domain. |
| CheckpointFWRule.UID | string | The unique identifier of the object. |
| CheckpointFWRule.Type | string | The object type. |
| CheckpointFWRule.Data.Domain | string | Information about the domain that the object belongs to. |
| CheckpointFWRule.DataDirection | string | The direction the file types processing is applied to. |
| CheckpointFWRule.DataNegate | string | "True" if negate is set for data. |
| CheckpointFWRule.Destination | string | A collection of network objects identified by the name or UID. The level of detail returned depends on the “details-level” field of the request. This table shows the level of detail shown when details-level is set to standard. |
| CheckpointFWRule.DestinationNegate | string | “True” if negate is set for the destination. |
| CheckpointFWRule.Domain | string | Information about the domain that the object belongs to. |
| CheckpointFWRule.Domain.Name | string | The object name. Should be unique in the domain. |
| CheckpointFWRule.Domain.UID | string | The unique identifer of the object. |
| CheckpointFWRule.Domain.Type | string | The domain type. |
| CheckpointFWRule.Enabled | string | Whether the rule is enabled or disabled. |
| CheckpointFWRule.Hits | number | Hits count object |
| CheckpointFWRule.Hits.FirstDate | string | First of hits |
| CheckpointFWRule.Hits.LastDate | string | The last date of hits. |
| CheckpointFWRule.Hits.Level | string | The level of hits. |
| CheckpointFWRule.Hits.Percentage | string | The percentage of hits. |
| CheckpointFWRule.Hits.Value | string | The value of hits. |
6. Use the Check Point Management API
Enables you to use the Check Point Management API. When using this command, the required format is: ‘command’=.
This command requires management server R80 or later.
Base Command
checkpoint
Input
There are no inputs for this command.
Context Output
There is no context output for this command.
7. Delete a rule
Deletes a rule from Check Point Firewall.
Base Command
checkpoint-delete-rule
Input
| Argument Name | Description | Required |
|---|---|---|
| uid | The UID of the rule. | Optional |
| name | The name of the rule. | Optional |
| layer | The layer, for example: Network | Required |
Context Output
There is no context output for this command.
Troubleshooting
If you receive the following 400 Bad Request error when running the checkpoint-block-ip command, you need to disconnect (clear) all other sessions in the SmartConsole, even if they appear to be disconnected. In SmartConsole, navigate to Manage & Settings > Sessions > View Sessions.
400 Bad Request - Runtime error: An object is locked by another session
Configuration parameters
server— Server URL (e.g. https://192.168.0.1) (required)port— Port (required)credentials— Username (required)insecure— Trust any certificate (not secure)proxy— Use system proxy settings
Commands (7)
-
checkpointUse Check Point's Management API (requires management server R80 or later). Specifying 'command'=<API command> is mandatory
-
checkpoint-block-ipBlock one or more IP addresses using Checkpoint Firewall
-
checkpoint-delete-ruleDelete rule from firewall
-
checkpoint-set-ruleSet attributes of an access rule object configured in Checkpoint FW
-
checkpoint-show-access-rule-baseShow items in an access rulebase configured in Checkpoint FW
-
checkpoint-show-hostsShow host objects configured in Checkpoint FW
-
checkpoint-task-statusShows status of a checkpoint task by task uuid
//GLOBALS// var SERVER = params.server.replace(/[\/]+$/, '') + ':' + params.port + '/web_api/'; var SESSION_ID; //DICTIONARIES// var entityDict = { CheckpointFWRule: { 'name' : 'Name', 'uid' : 'UID', 'type' : 'Type', 'action' : 'Action', 'action-settings' : 'ActionSetting', 'custom-fields' : 'CustomFields', 'data.name' : 'Data.Name', 'data.uid' : 'Data.UID', 'data.type' : 'Data.Type', 'data.domain' : 'Data.Domain', 'data-direction' : 'DataDirection', 'data-negate' : 'DataNegate', 'destination' : 'Destination', 'destination-negate' : 'DestinationNegate', 'domain.name' : 'Domain.Name', 'domain.uid' : 'Domain.UID', 'domain.domain-type': 'Domain.Type', 'enabled' : 'Enabled', 'hits.first-date' : 'Hits.FirstDate', 'hits.last-date' : 'Hits.LastDate', 'hits.level' : 'Hits.Level', 'hits.percentage' : 'Hits.Percentage', 'hits.value' : 'Hits.Value' }, Endpoint: { 'name' : 'Hostname', 'uid' : 'UID', 'type' : 'Type', 'domain.name' : 'Domain.Name', 'domain.uid' : 'Domain.UID', 'domain.domain-type' : 'Domain.Type' }, CheckpointFWTask: { 'name' : 'Name', 'uid' : 'UID', 'type' : 'Type', 'domain.name' : 'Domian.Name', 'domain.uid' : 'Domain.UID', 'domain.domain-type': 'Domain.Type', 'last-update-time.iso-8601' : 'LastUpdateTime', 'meta-info.creation-time' : 'MetaInfo.CreationTime', 'meta-info.creator' : 'MetaInfo.Creator', 'meta-info.last-modifier' : 'MetaInfo.LastModifier', 'meta-info.last-modify-time' : 'MetaInfo.LastModifyTime', 'meta-info.lock' : 'MetaInfo.LockStatus', 'meta-info.validation-state' : 'MetaInfo.ValidationStatus', 'progress-percentage' : 'ProgressPercentage', 'read-only' : 'ReadOnly', 'start-time' : 'StartTime', 'status' : 'Status', 'suppressed' : 'Suppressed', 'tags' : 'Tags', 'task-details' : 'Details', 'task-id' : 'ID', 'task-name': 'TaskName' } }; //HELPERS// function extend(obj, src) { Object.keys(src).forEach(function(key) { obj[key] = src[key]; }); return obj; } //returns single object withing entity (i.e. File[0]) function jsonToEntityObject(origObj, newKeys) { //log("func started"); var ret = {}; var path; var newField; //var temp; for(var key in newKeys){ if(newKeys[key]){ path = newKeys[key].split('.'); origPath = key.split('.'); if(path.length == 1){ ret[newKeys[key]] = dq(origObj, '.'+key); } else{ newField = dq(origObj, '.'+key); if(!ret[path[0]] && newField){ ret[path[0]] = {}; } if(newField){ ret[path[0]][path[1]] = newField; } } } } return ret; } //returns entire entity array (i.e. File) function jsonToEntity(origObj, newKeys) { var j; var ret; if(!Array.isArray(origObj)){ ret = [jsonToEntityObject(origObj, newKeys)]; return ret; } else if(origObj.length > 0){ //makes sure no empty arrays are pushed ret = []; for(j=0; j<origObj.length; j++){ ret.push(jsonToEntityObject(origObj[j], newKeys)); } return ret; } } function prettify_show_hosts(hosts){ var pretty_hosts = []; for (i = 0; i < hosts.length; i++) { pretty_hosts[i] = {}; if (hosts[i].uid) { pretty_hosts[i].UID = hosts[i].uid; } if (hosts[i].name) { pretty_hosts[i].Name = hosts[i].name; } if (hosts[i]['ipv4-address']) { pretty_hosts[i].IPV4 = hosts[i]['ipv4-address']; } if (hosts[i].domain) { pretty_hosts[i].Domain = 'Name: ' + hosts[i].domain.name + ', UID: ' + hosts[i].domain.uid + ', Type: ' + hosts[i].domain['domain-type']; } } return pretty_hosts; } function prettify_rule_data(rule_data) { var pretty_rule_data = {}; if (rule_data.name) { pretty_rule_data.Name = rule_data.name; } if (rule_data.action && rule_data.action.name) { pretty_rule_data.Action = rule_data.action.name; } if (rule_data.enabled) { pretty_rule_data.Enabled = rule_data.enabled; } if (rule_data.layer) { pretty_rule_data.Layer = rule_data.layer; } if (rule_data['content-direction']) { pretty_rule_data['Content Direction'] = rule_data['content-direction']; } if (rule_data.content && rule_data.content.name) { pretty_rule_data.Content = rule_data.content.name; } if (rule_data['content-negate']) { pretty_rule_data['Content Negate'] = rule_data['content-negate']; } if (rule_data.destination && rule_data.destination.name) { pretty_rule_data.Destination = rule_data.destination.name; } if (rule_data['destination-negate']) { pretty_rule_data['Destination Negate'] = rule_data['destination-negate']; } if (rule_data.service && rule_data.service.name) { pretty_rule_data.Service = rule_data.service.name; } if (rule_data['service-negate']) { pretty_rule_data['Service Negate'] = rule_data['service-negate']; } if (rule_data.source && rule_data.source.name) { pretty_rule_data.Source = rule_data.source.name; } if (rule_data['source-negate']) { pretty_rule_data['Source Negate'] = rule_data['source-negate']; } return pretty_rule_data; } function prettify_rule_base(rule_base) { var pretty_rule_base = []; for (i = 0; i < rule_base.length; i++) { pretty_rule_base[i] = {}; if (rule_base[i]['rule-number']) { pretty_rule_base[i]['Rule Number'] = rule_base[i]['rule-number']; } if (rule_base[i].name) { pretty_rule_base[i].Name = rule_base[i].name; } if (rule_base[i]['rule-number']) { pretty_rule_base[i].Name = rule_base[i]['rule-number']; } if (rule_base[i].uid) { pretty_rule_base[i].UID = rule_base[i].uid; } if (rule_base[i].action) { pretty_rule_base[i].Action = rule_base[i].action; } if (rule_base[i].enabled) { pretty_rule_base[i].Enabled = rule_base[i].enabled; } if (rule_base[i]['content-direction']) { pretty_rule_base[i].Content = rule_base[i]['content-direction']; } } return pretty_rule_base; } function sendRequest(cmdURL, body, cmdHeaders) { var headers = cmdHeaders? cmdHeaders : {'content-type': ['application/json'], 'X-chkp-sid' : [SESSION_ID]}; var res = http( SERVER + cmdURL, { Method: 'POST', Headers: headers, Body: body }, params.insecure, params.proxy ); if (res.StatusCode < 200 || res.StatusCode >= 300) { throw 'Request Failed.\nStatus code: ' + res.StatusCode + '.\nBody: ' + JSON.stringify(res) + '.'; } return res; } function login() { var res = sendRequest('login', JSON.stringify({'user':params.credentials.identifier,'password':params.credentials.password}), {'content-type': ['application/json']}); try { SESSION_ID = JSON.parse(res.Body).sid; return SESSION_ID; } catch(err){ throw 'Login failed. Answer from Checkpoint is: ' + JSON.stringify(res.Body); } } function logout() { if (SESSION_ID) { var res = sendRequest('logout', '{}'); SESSION_ID = undefined; try { return JSON.parse(res.Body).message; } catch(err) { throw 'Logout failed. Answer from Checkpoint is: ' + JSON.stringify(res.Body); } } return 'Already logged out'; } //COMMANDS// function add_host() { sendRequest('add-host', JSON.stringify({name:args.ip, 'ip-address':args.ip})); sendRequest('publish', '{}'); } function block_ip() { var md = ''; var temp = []; var result; var res; try{ sendRequest('add-host', JSON.stringify({name:args.ip, 'ip-address':args.ip})); } catch(err){ } sendRequest('publish', '{}'); if(!args.direction){ args.direction = 'both'; } var requestBody = { position : '1', layer: 'Network', service: 'any', action: 'Drop' }; if(args.direction === 'both' || args.direction === 'from'){ requestBody.name = args.rulename + '-from-' + args.ip; requestBody.source = args.ip; requestBody.destination = 'ANY'; result = sendRequest('add-access-rule', JSON.stringify(requestBody)); sendRequest('publish', '{}'); res = JSON.parse(result.Body); md += tableToMarkdown('Blocked Source IP Table', prettify_rule_data(res)); temp.push(res); } if(args.direction === 'both' || args.direction === 'to'){ requestBody.name = args.rulename + '-to-' + args.ip; requestBody.destination = args.ip; requestBody.source = 'ANY'; result = sendRequest('add-access-rule', JSON.stringify(requestBody)); sendRequest('publish', '{}'); res = JSON.parse(result.Body); md += tableToMarkdown('Blocked Destination IP Table', prettify_rule_data(res)); temp.push(res); } context = {CheckpointFWRule : jsonToEntity(temp,entityDict.CheckpointFWRule)}; return { Type: entryTypes.note, Contents: result, ContentsFormat: formats.json, HumanReadable: md, EntryContext: context }; } function show_hosts() { var context = {}; var res; var body = {limit: args.limit, offset: args.offset, order: args.order}; var result = sendRequest('show-hosts', JSON.stringify(body)); try{ res = JSON.parse(result.Body); } catch(err){ return result.Body; } context.Endpoint = jsonToEntity(res.objects, entityDict.Endpoint); var md = tableToMarkdown('Hosts table', prettify_show_hosts(res.objects), ['UID', 'Name', 'IPV4', 'Domain']); return { Type: entryTypes.note, Contents: result, ContentsFormat: formats.json, HumanReadable: md, EntryContext: context }; } function task_status() { var result = sendRequest('show-task', JSON.stringify({'task-id':args.task_id})); var res = JSON.parse(result.Body); var md = tableToMarkdown('Task Status Table', res.tasks); var context = {CheckpointFWTask : jsonToEntity(res.tasks, entityDict.CheckpointFWTask)}; return { Type: entryTypes.note, Contents: result, ContentsFormat: formats.json, HumanReadable: md, EntryContext: context }; } function set_rule() { var result; if(args.uid || args.name || args.rule_number){ var body = { uid : args.uid, name: args.name, 'rule-number': args.rule_number, layer: args.layer, enabled: args.enabled }; result = sendRequest('set-access-rule', JSON.stringify(body)); sendRequest('publish', '{}'); } else{ logout(); throw 'Set rule requires at least one of the following arguments - uid, name, rule_number'; } var res = JSON.parse(result.Body); var md = tableToMarkdown('Set Rule', prettify_rule_data(res)); var context = {CheckpointFWRule : jsonToEntity(res, entityDict.CheckpointFWRule)}; return { Type: entryTypes.note, Contents: result, ContentsFormat: formats.json, HumanReadable: md, EntryContext: context }; } function delete_rule() { var res; if(args.uid || args.name || args.rule_number){ var body = { uid : args.uid, name: args.name, 'rule-number': args.rule_number, layer: args.layer }; res = sendRequest('delete-access-rule', JSON.stringify(body)); sendRequest('publish', '{}'); } else{ logout(); throw 'Delete rule requires at least one of the following arguments - uid, name, rule_number'; } return JSON.parse(res.Body); } function show_access_rule_base() { var result = sendRequest('show-access-rulebase', JSON.stringify({name:args.name})); var res = JSON.parse(result.Body); var md = tableToMarkdown('Access rulebase table', prettify_rule_base(res.rulebase), ['Rule Number', 'Name', 'UID', 'Action', 'Enabled', 'Content']) var context = {CheckpointFWRule : jsonToEntity(res.rulebase, entityDict.CheckpointFWRule)}; return { Type: entryTypes.note, Contents: res, ContentsFormat: formats.json, HumanReadable: md, EntryContext: context }; } function checkpoint() { var res; var cmd = args.command; if(!cmd){ throw 'Missing API command name'; } delete args.command; res = sendRequest(cmd, JSON.stringify(args)); sendRequest('publish', '{}'); return JSON.parse(res.Body); } //EXECUTION// var answer; login(); switch (command) { case 'test-module': show_hosts(); logout(); return 'ok'; case 'checkpoint-block-ip': answer = block_ip(); break; case 'checkpoint-show-hosts': answer = show_hosts(); break; case 'checkpoint-task-status': answer = task_status(); break; case 'checkpoint-show-access-rule-base': answer = show_access_rule_base(); break; case 'checkpoint-set-rule': answer = set_rule(); break; case 'checkpoint-delete-rule': answer = delete_rule(); break; case 'checkpoint': answer = checkpoint(); break; } logout(); return answer;