{ "info": { "author": "vavarachen", "author_email": "vavarachen@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: User Interfaces" ], "description": "# checkpoint_client\nA python client to interact with CheckPoint R80 API (https://sc1.checkpoint.com/documents/R80/APIs/#ws).\n\n# Installation\n```\npip install checkpoint-client\n```\n\n# Features\n1. Perform basic functionality such as add/delete objects, get tags, show objects in group, publish and install policy.\n2. Authentication session (sid) can persist using configuration file. If session is invalid, automatically re-authenticate and update sid.\n3. Management server fingerprint verification.\n\n# Disclaimers\n1. CheckPoint R80 API does not allow adding/deleting multiple host objects to a group in one call. Each host object must be created and then added/deleted to the group. This results in very slow (serial) execution.\n2. In our testing, we have noticed some instability with very large set (10k+) of changes.\n\n# Example\nSample configuration file\n```\n[checkpoint]\nusername = myusername\n# API does not support cert based authentication\npassword = mypassword\ndomain = DMZ\n\n# Some useful fileds to make CP session more descriptive\nsession-name = inet_blacklist\nsession-comments = API automation example\nsession-description = Automated DMZ blacklisting of known malicious IPs (from TIP).\ncp_server = 10.10.100.32\n\n# Exit if fingerprint verification fails\nfingerprint = 82C9C0B60850901BBDF5653D794ADF8E8AAEA1B7\nverify_fingerprint = True\n\n# No changes made if set to True\ndryrun = False\n\n# Automatically populated if authentication successful\nsid = \n\n[dmz_blacklist]\ncolor = red\ngroup = GRP-DMZ_BAD_IP_FROM_TIP\ntarget = LAB_DMZ_CLUSTER\n```\n\nA simple script to add host objects to an existing group object, publish changes and finally, install the policy.\n```\nfrom checkpoint_client import CheckPointClient\nfrom checkpoint_client.utils import set_default_logger, add_logger_streamhandler\n\n# Instantiate a client\nlogger = set_default_logger(\"inet_blacklist_mgr\", \"DEBUG\")\nadd_logger_streamhandler(logger, \"INFO\")\ncpc = CheckPointClient('configs/example.ini', logger)\n\nbad_IPs = ['1.2.3.4', '5.6.7.8', '9.0.11.12', '13.14.15.16']\n\ncolor = config.get('dmz_blacklist', 'color', fallback=cpc.default_color),\ngroup = config.get('dmz_blacklist', 'group', fallback=\"MY_DEFAULT_GROUP\")\ntarget = config.get('dmz_blacklist', 'target', fallback=\"DMZ_CLUSTER\")\n\nsuccess_count = 0\nfail_count = 0\nfor bad_ip in bad_IPs:\n resp = cpc.add_host(\n name=bad_ip,\n ipaddr=bad_ip,\n tags=\"bad_ips_from_tip\",\n comments=\"Import example using API wrapper\",\n color=color,\n groups=group)\n if resp.success:\n success_count += 1\n else:\n fail_count += 1\n\nlogger.info({'message': {'total': len(bad_IPs), 'success': success_count, 'fail': fail_count})\n\n# Publish changes\nresp = cpc.publish()\nif resp.success:\n logger.info({'message': \"Policy publication successful\"})\nelse:\n logger.error('message': \"Policy publication failed.\")\n\n# Install policy\n# https://sc1.checkpoint.com/documents/R80/APIs/?#gui-cli/install-policy\nparams = {'access': True, 'threat-prevention': False, 'install-on-all-cluster-members-or-fail': True} \n\nresp = cpc.install_policy(group, target, **params)\nif resp.success:\n logger.info({'message': \"Policy installation successful\"})\nelse:\n logger.error('message': \"Policy installation failed.\")\n\ncpc.logout()\n```\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/vavarachen/checkpoint_client", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "checkpoint-client", "package_url": "https://pypi.org/project/checkpoint-client/", "platform": "", "project_url": "https://pypi.org/project/checkpoint-client/", "project_urls": { "Homepage": "https://github.com/vavarachen/checkpoint_client" }, "release_url": "https://pypi.org/project/checkpoint-client/0.0.1/", "requires_dist": [ "requests (<3.0.0,>=2.6.0)", "requests" ], "requires_python": "", "summary": "A python client to interact with CheckPoint R80 API.", "version": "0.0.1" }, "last_serial": 4886959, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "bee9e85c98c95f025169ea04bef75355", "sha256": "36a4b85c3d442be0881c4cb889f7c36875299c9216f6d5ce8dd83fa670e7d0ee" }, "downloads": -1, "filename": "checkpoint_client-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "bee9e85c98c95f025169ea04bef75355", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13835, "upload_time": "2019-03-01T22:44:05", "url": "https://files.pythonhosted.org/packages/b0/65/8fba22bb2d05ad6099e2a87047469e24ac0e8ba98370ba2c59ae8b3d2b58/checkpoint_client-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7452151f33415164bab70268b3cfb10e", "sha256": "b1ae3696eb7fe98ed9cfe73839cb62b424afb5c5d083f19641e04de32b4497d3" }, "downloads": -1, "filename": "checkpoint_client-0.0.1.tar.gz", "has_sig": false, "md5_digest": "7452151f33415164bab70268b3cfb10e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11865, "upload_time": "2019-03-01T22:44:07", "url": "https://files.pythonhosted.org/packages/2b/34/cf77ebdd158451f28149c295264618815de42fe82de2f593edf19150bbd3/checkpoint_client-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bee9e85c98c95f025169ea04bef75355", "sha256": "36a4b85c3d442be0881c4cb889f7c36875299c9216f6d5ce8dd83fa670e7d0ee" }, "downloads": -1, "filename": "checkpoint_client-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "bee9e85c98c95f025169ea04bef75355", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13835, "upload_time": "2019-03-01T22:44:05", "url": "https://files.pythonhosted.org/packages/b0/65/8fba22bb2d05ad6099e2a87047469e24ac0e8ba98370ba2c59ae8b3d2b58/checkpoint_client-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7452151f33415164bab70268b3cfb10e", "sha256": "b1ae3696eb7fe98ed9cfe73839cb62b424afb5c5d083f19641e04de32b4497d3" }, "downloads": -1, "filename": "checkpoint_client-0.0.1.tar.gz", "has_sig": false, "md5_digest": "7452151f33415164bab70268b3cfb10e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11865, "upload_time": "2019-03-01T22:44:07", "url": "https://files.pythonhosted.org/packages/2b/34/cf77ebdd158451f28149c295264618815de42fe82de2f593edf19150bbd3/checkpoint_client-0.0.1.tar.gz" } ] }