{ "info": { "author": "Remi Pauchet", "author_email": "remi.pauchet@stormshield.eu", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: System :: Networking" ], "description": "# python-SNS-API\n\nA Python client for the Stormshield Network Security appliance SSL API.\n\nNote: this module requires python2.7 or python3.3\n\n## API usage\n\n```python\nfrom stormshield.sns.sslclient import SSLClient\n\nclient = SSLClient(\n host=\"10.0.0.254\", port=443,\n user='admin', password='password',\n sslverifyhost=False)\n\nresponse = client.send_command(\"SYSTEM PROPERTY\")\n\nif response:\n model = response.data['Result']['Model']\n version = response.data['Result']['Version']\n\n print(\"Model: {}\".format(model))\n print(\"Firmware version: {}\".format(version))\nelse:\n print(\"Command failed: {}\".format(response.output))\n\nclient.disconnect()\n\n```\n\n### Command results\n\nCommand results are available in text, xml or python structure formats:\n\n```python\n>>> response = client.send_command(\"CONFIG NTP SERVER LIST\")\n\n>>> print(response.output)\n101 code=00a01000 msg=\"Begin\" format=\"section_line\"\n[Result]\nname=ntp1.stormshieldcs.eu keynum=none type=host\nname=ntp2.stormshieldcs.eu keynum=none type=host\n100 code=00a00100 msg=\"Ok\"\n\n>>> print(response.xml)\n\n
\n\n>>> print(response.data)\n{'Result': [{'name': 'ntp1.stormshieldcs.eu', 'keynum': 'none', 'type': 'host'}, {'name': 'ntp2.stormshieldcs.eu', 'keynum': 'none', 'type': 'host'}]}\n\n```\n\nThe keys of the `data` property are case insensitive, `response.data['Result'][0]['name']` and `response.data['ReSuLt'][0]['NaMe']` will return the same value.\n\nResults token are also available via `response.parser.get()` method which accepts a default parameter to return if the token is not present.\n\n```python\n>>> print(response.output)\n101 code=00a01000 msg=\"Begin\" format=\"section\"\n[Server]\n1=dns1.google.com\n2=dns2.google.com\n100 code=00a00100 msg=\"Ok\"\n\n>>> print(response.data['Server']['3'])\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"/usr/local/lib/python3.7/site-packages/requests/structures.py\", line 52, in __getitem__\n return self._store[key.lower()][1]\nKeyError: '3'\n\n>>> print(response.parser.get(section='Server', token='3', default=None))\nNone\n\n```\n\n### File upload/download\n\nFiles can be downloaded or uploaded by adding a redirection to a file with '>' or '<' at the end of the configuration command.\n\n```python\n>>> client.send_command(\"CONFIG BACKUP list=all > /tmp/mybackup.na\")\n100 code=00a00100 msg=\"Ok\"\n```\n\n## snscli\n\n `snscli` is a python cli for executing configuration commands and scripts on Stormshield Network Security appliances.\n\n* Output format can be chosen between section/ini or xml\n* File upload and download available with adding `< upload` or `> download` at the end of the command\n* Client can execute script files using `--script` option.\n* Comments are allowed with `#`\n\n`$ snscli --host `\n\n`$ snscli --host --user admin --password admin --script config.script`\n\nConcerning the SSL validation:\n\n* For the first connection to a new appliance, ssl host name verification can be bypassed with `--no-sslverifyhost` option.\n* To connect to a known appliance with the default certificate use `--host --ip ` to validate the peer certificate.\n* If a custom CA and certificate is installed, use `--host myfirewall.tld --cabundle `.\n* For client certificate authentication, the expected format is a PEM file with the certificate and the unencrypted key concatenated.\n\n## Proxy\n\nThe library and `snscli` tool support HTTP and SOCKS proxies, use `--proxy scheme://user:password@host:port` option.\n\n\n## Build\n\n`$ python3 setup.py sdist bdist_wheel`\n\n\n## Install\n\n## From PyPI:\n\n`$ pip3 install stormshield.sns.sslclient`\n\n## From source:\n\n`$ python3 setup.py install`\n\n\n## Tests\n\nWarning: some tests require a remote SNS appliance.\n\n`$ PASSWORD=password APPLIANCE=10.0.0.254 python3 setup.py test`\n\n\nTo run `snscli` from the source folder without install:\n\n`$ python3 stormshield/sns/cli.py --help`\n\n\n## Links\n\n* [Stormshield corporate website](https://www.stormshield.com)\n* [CLI commands reference guide](https://documentation.stormshield.eu/SNS/v3/en/Content/CLI_Serverd_Commands_reference_Guide_v3/Introduction.htm)\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/stormshield/python-SNS-API", "keywords": "", "license": "Apache License 2.0", "maintainer": "", "maintainer_email": "", "name": "stormshield.sns.sslclient", "package_url": "https://pypi.org/project/stormshield.sns.sslclient/", "platform": "", "project_url": "https://pypi.org/project/stormshield.sns.sslclient/", "project_urls": { "Homepage": "https://github.com/stormshield/python-SNS-API" }, "release_url": "https://pypi.org/project/stormshield.sns.sslclient/1.0.0/", "requires_dist": [ "pygments", "requests[socks]", "requests-toolbelt", "colorlog", "defusedxml", "pyreadline ; platform_system == \"Windows\"", "py2-ipaddress ; python_version < \"3\"" ], "requires_python": "", "summary": "SSL API client for Stormshield Network Security appliances", "version": "1.0.0" }, "last_serial": 5444424, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "85ad750993a759f3372eb0a05e49f1f1", "sha256": "4482e843ef343df1630823efff100168c32b774829243500ec9f57a7f46bd87f" }, "downloads": -1, "filename": "stormshield.sns.sslclient-1.0.0-py2-none-any.whl", "has_sig": false, "md5_digest": "85ad750993a759f3372eb0a05e49f1f1", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 37543, "upload_time": "2019-06-25T08:18:20", "url": "https://files.pythonhosted.org/packages/9d/12/bac2d1d85db037a4dcdd0db8832281bfea215e0d4fe1f7256751e2e530cc/stormshield.sns.sslclient-1.0.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f665f3dd99cb601cf6d59edf2d707d75", "sha256": "5da66723cad21629be09afe1df7abba494a2191ec6860ecf8016ea30a2a5bafd" }, "downloads": -1, "filename": "stormshield.sns.sslclient-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f665f3dd99cb601cf6d59edf2d707d75", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 37542, "upload_time": "2019-06-25T08:18:22", "url": "https://files.pythonhosted.org/packages/9b/48/a180bd46be0da7cc03061e51aab866165e7baf7b90cdd00df76bca1e715f/stormshield.sns.sslclient-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6937cce998720cb72ef0492493b0a238", "sha256": "9757ae6def2a52a76bc1bdb754a8c3e8c8d89ce2d134224fb18578677de38e14" }, "downloads": -1, "filename": "stormshield.sns.sslclient-1.0.0.tar.gz", "has_sig": false, "md5_digest": "6937cce998720cb72ef0492493b0a238", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30053, "upload_time": "2019-06-25T08:18:24", "url": "https://files.pythonhosted.org/packages/9f/a5/651b1e7f6d0953e9ea9fa5b029024c16441b164475d70b89fb855feeb580/stormshield.sns.sslclient-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "85ad750993a759f3372eb0a05e49f1f1", "sha256": "4482e843ef343df1630823efff100168c32b774829243500ec9f57a7f46bd87f" }, "downloads": -1, "filename": "stormshield.sns.sslclient-1.0.0-py2-none-any.whl", "has_sig": false, "md5_digest": "85ad750993a759f3372eb0a05e49f1f1", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 37543, "upload_time": "2019-06-25T08:18:20", "url": "https://files.pythonhosted.org/packages/9d/12/bac2d1d85db037a4dcdd0db8832281bfea215e0d4fe1f7256751e2e530cc/stormshield.sns.sslclient-1.0.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f665f3dd99cb601cf6d59edf2d707d75", "sha256": "5da66723cad21629be09afe1df7abba494a2191ec6860ecf8016ea30a2a5bafd" }, "downloads": -1, "filename": "stormshield.sns.sslclient-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f665f3dd99cb601cf6d59edf2d707d75", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 37542, "upload_time": "2019-06-25T08:18:22", "url": "https://files.pythonhosted.org/packages/9b/48/a180bd46be0da7cc03061e51aab866165e7baf7b90cdd00df76bca1e715f/stormshield.sns.sslclient-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6937cce998720cb72ef0492493b0a238", "sha256": "9757ae6def2a52a76bc1bdb754a8c3e8c8d89ce2d134224fb18578677de38e14" }, "downloads": -1, "filename": "stormshield.sns.sslclient-1.0.0.tar.gz", "has_sig": false, "md5_digest": "6937cce998720cb72ef0492493b0a238", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30053, "upload_time": "2019-06-25T08:18:24", "url": "https://files.pythonhosted.org/packages/9f/a5/651b1e7f6d0953e9ea9fa5b029024c16441b164475d70b89fb855feeb580/stormshield.sns.sslclient-1.0.0.tar.gz" } ] }