Skip to main content

Check Point API

coverage

Installation

  • pip install checkpoint-api

Basic usage

  • get object
from checkpoint_api.checkpoint import CheckpointSession

with CheckpointSession("10.111.30.25", "api", "CGx3IjUSd47TrXKh6zJ7") as cps:
    data = {'name': 'IP_10.14.1.2_xlsrv02', 'details-level': 'standard'}
    response_json = cps.post("show-host", json=data)
    print(response_json)

Output:

{'color': 'black',
 'comments': '',
 'domain': {'domain-type': 'domain',
            'name': 'SMC User',
            'uid': '41e821a0-3720-11e3-aa6e-0800200c9fde'},
 'groups': [],
 'icon': 'Objects/host',
 'interfaces': [],
 'ipv4-address': '10.14.1.2',
 'meta-info': {'creation-time': {'iso-8601': '2020-05-27T10:26+0200',
                                 'posix': 1590567969972},
               'creator': 'user01',
               'last-modifier': 'user01',
               'last-modify-time': {'iso-8601': '2020-05-27T10:26+0200',
                                    'posix': 1590567969972},
               'lock': 'unlocked',
               'validation-state': 'ok'},
 'name': 'IP_10.14.1.2_xlsrv02',
 'nat-settings': {'auto-rule': False},
 'read-only': False,
 'tags': [],
 'type': 'host',
 'uid': '8874eceb-e217-476e-a16c-b1ec2926b921'}
  • get gateways and servers for MDS
from checkpoint_api.checkpoint import CheckpointSession
from pprint import pprint

checkpoint_username = "user01"
checkpoint_password = "toosecret"

with CheckpointSession(
    "10.1.235.2",
    checkpoint_user=checkpoint_username,
    checkpoint_pass=checkpoint_password,
) as cps:
    pprint(cps.post("show-gateways-and-servers", json={"details-level": "full"}))
  • Authenticate via api_key and add new access rule
from checkpoint_api.checkpoint import CheckpointSession
import logging
from datetime import datetime

cp_firewall_policy = "PoC Network"

source_zone = "TRUST"
destination_zone = "UNTRUST"
now = datetime.now()
user = "userxyz"

with CheckpointSession(
    "192.168.20.100", api_key="hc9emRAB+fECy7VJkLEIeg==", read_only=False
) as cps:
    logging.info(
        cps.post(
            "add-access-rule",
            json={
                "layer": cp_firewall_policy,
                "position": {"above": "Cleanup rule"},
                "name": f"Drop_zone_from_{source_zone}_to_{destination_zone}",
                "source": f"GRP_ZONE_{source_zone}",
                "destination": f"GRP_ZONE_{destination_zone}",
                "track": {"type": "Log"},
                "action": "Reject",
                "comments": f"{now}-{user}",
            },
        )
    )

Metadata

Release files for checkpoint-api 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for checkpoint-api 0.1.8
File Interpreter ABI Platform
checkpoint_api-0.1.8-py3-none-any.whl Python 3 none any Details

Release files / checkpoint_api-0.1.8-py3-none-any.whl

Download URL checkpoint_api-0.1.8-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
778b0aa9cefe1eb3a4e674ecee11af03095c81bd4afa16b1a37eb4b24e753340
BLAKE2b-256 checksum
How to use checksums
60c5437de2c36c55ddf75180f2f5e4a92ae2ee55c85104d868de42c1899b8d45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.1.8 This release

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

2 release files

0.0.3

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page