{ "info": { "author": "Ed Garabito", "author_email": "eduardo@gottabegarabi.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n[![Build Status](https://travis-ci.org/DazEdword/synology-toolset.svg?branch=master)](https://travis-ci.org/DazEdword/synology-toolset.svg)\n[![Coverage Status](https://coveralls.io/repos/github/DazEdword/synology-toolset/badge.svg?branch=master)](https://coveralls.io/github/DazEdword/synology-toolset?branch=master)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)\n\n\n# Synotools\nA Python API wrapper and toolset for interacting with Synology NAS devices using DiskStation Manager (DSM). The repository provides two different toolsets to communicate with your NAS:\n\n* API: Through a Python wrapper simplifying DSM queries.\n* Command system: Through sh scripts hosted in the device, but called from any unix system capable of running `fabric` and python.\n\nAPI requires valid credentials as described in the section below.\n\n## Getting Started\nInstall the package with pip:\n\n```bash\npython -m pip install synotools\n```\n\nCreate your credentials file in `~/.synotools/credentials`:\n\n```\n# Device access credentials\nSYNOLOGY_IP=your-ip\nSYNOLOGY_PORT=your-port\nSYNOLOGY_USERNAME=your-username\nSYNOLOGY_PASSWORD=your-password\n\n# Deluge service credentials\nDELUGE_IP=deluge-ip\nDELUGE_PORT=deluge-port\nDELUGE_USERNAME=deluge-username\nDELUGE_PASSWORD=deluge-password\n\n# VPN settings\nVPN_ID=vpn-config-id\nVPN_NAME=vpn-config-name\nVPN_PROTOCOL=vpn-protocol\n```\n\nA list of all fields can be found on `env.sample`, and this file can be used as a template for your credentials. Once populated and after completing [setup](#setup) you will be able to run commands:\n\n```bash\npython /commands/ \n``` \n\nRead the [Using the tools](#using-the-tools) section for more information about available commands!\n\n## Setup\n\n### Credentials\nValid credentials are expected to be stored locally, allowing the tools to connect to the device via local network. Fill in the following credentials in your `credentials` file:\n\n1. IP: E.g. `192.168.1.35`\n2. Port: `5000` for http, or `5001` for https\n3. Username: Same username you normally use to log in through the web interface\n4. Password: Corresponding password\n\nFinding out your local IP will depend on your OS, router configuration and other factors. Please refer to [DSM's User Guide](https://global.download.synology.com/download/Document/UserGuide/DSM/6.2/Syno_UsersGuide_NAServer_enu.pdf) for more details on how to get or set your device's IP. It is strongly recommended to set a static IP to your NAS, so that the commands and SSH access works reliably without the need to update IP.\n\n*Note: Fore security reasons remember not share your personal credentials file or password! Do not commit to repository, or share it with anybody. That file should be private and stored safely, locally.*\n\n### SSH key\n`synotools` uses `fabric` (built in top of `paramiko`) to handle SSH connections. Certain assumptions are made regarding credentials configurations and SSH keys. It is recommended to set up a SSH Key in your default SO's SSH location. This [guide](https://help.github.com/en/enterprise/2.16/user/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent), although focused on GitHub, can assist. Make sure to store the private key in your default location (`~/.ssh` for Unix systems), and make a note of your public key contents or location, as it will be required for the next step.\n\n### Enabling NAS SSH access\nBy default terminal access is disabled in your device. Enable it as described [in the official support](https://www.synology.com/en-global/knowledgebase/SRM/help/SRM/RouterApp/admin_services#t1_1).\n\nThen, the public key needs to be added to authorized_keys in your device, and correct permissions set. This handy [guide](https://blog.aaronlenoir.com/2018/05/06/ssh-into-synology-nas-with-ssh-key/) may help.\n\n### Installing Deluge in your NAS\nThe download command uses Deluge remotely, so it has to be installed and configured before attempting.\n\n1- Download and install [Synocomunity](https://synocommunity.com/).\n2- Deluge's auth config has to include a user, password and permission level that will be used to connect remotely.\n3- Deluge server's host ip and port. Defaulted to `127.0.0.1` and `58846` respectively.\n4- Once those variables are set, copy them to their relevant fields in your `credentials` file.\n\nIn order to set up Deluge, you can either:\n\na) Use Deluge's default username: `deluge` and password `deluge`, or\nb) Create your own user, as [described here](https://dev.deluge-torrent.org/wiki/UserGuide/ThinClient).\n\n_Note: If a user is going to be created, folders in the NAS are likely to differ compared with the guide above depending on your system. Auth file might be located in `/var/packages/deluge/target/var`, for instance._\n\n### VPN client configuration ###\nThe NAS can connect through a VPN network interface, which needs to be set up first. [This document](https://www.synology.com/en-us/knowledgebase/DSM/help/DSM/AdminCenter/connection_network_vpnclient) explains the process. Once a VPN profile has been set up and used at least once, VPN configuration may be retrieved from configuration and copied into the `credentials` file. These details can be obtained from `vpnc_last_connect` as [explained here](https://mickderksen.wordpress.com/2016/06/08/how-to-schedule-a-vpn-connection-on-synology/).\n\n## Using the tools\nMost commands currently included in the tools are sh scripts expected to be hosted in the NAS, with either sh or python scripts that are run locally. Although most scripts can be run directly from python, a number of .docker scripts have been added so that anything can be run in one command.\n\n### NAS script installation\nThis step is necessary before attempting to run any other script, as they rely in the scripts having been installed first!\n\n```\n./install.docker \n\n# e.g. ./install.docker paulo_rsa\n```\n\nGathers all scripts in `synotools/scripts`, zips them and deploys them to your NAS `~/.scripts` folder. User is taken from the `credentials` file. SSH is required to connect to the NAS without additional authentication.\n\n_Note: Adding ssh key to Docker `install` image means that this image should never be shared publicly (i.e. pushed to Docker repo) for security reasons._\n\n### Download torrent\nAdd a torrent to Deluge in the NAS, downloading it to default download folder.\n\n```python\npython synotools/command/download.py \"\"\n\n# e.g python synotools/commands/download.py \"https://torrents.linuxmint.com/torrents/linuxmint-17-cinnamon-32bit-v2.iso.torrent\"\n\n# e.g python synotools/commands/download.py \"magnet:?xt=urn:btih:336165b4134e3754fa6996d881a7e7b55a40eb68&dn=archlinux-2019.06.01-x86_64.iso&tr=udp://tracker.archlinux.org:6969&tr=http://tracker.archlinux.org:6969/announce\"\n```\n\n### Connect to VPN\nCheck whether NAS is connected through a VPN, and connect if it's not.\n\n```python\npython synotools/commands/vpn_connect.py\n```\n\n## Compatibility\nTested with Synology's DS218j model.\n\n## Development\nThis software has been created and is maintained in Linux Mint, but developers should be able to contribute using practically any Unix platform. Before starting, the following tools will need to be installed and configured:\n\n* Docker\n* Git\n\n### Dependencies\nThere are two types of dependencies:\n\n* Python Packages: Handled automatically thanks to `pip3`. They are included in requirements file, `requirements.txt` for the tools themselves, and `requirements-dev.txt` for all peripheric development tools. \n* Other Dependencies: In order to prevent the developers' system from cluttering, all external dependencies that are not installable with package managers are supposed to sit in the `dependencies` folder. Scripts are provided to install these automatically.\n\n### Development environment setup\n1- Clone the base repository on a location of your choice.\n\n```\ngit clone git@github.com:DazEdword/synology-toolset.git\n```\n\n2- Configure your `credentials` file and ssh keys as explained in the [Getting Started section](#getting-started).\n\n3- Ensure all scripts are executable.\n\n```\ncd \nfind . -type f -iname \"*.sh\" -exec chmod +x {} \\;\nfind docker/scripts/ -type f -exec chmod +x {} \\;\n```\n\n### Running tests\n\nSeveral Docker scripts have been set up to unambiguously run a subset of tests, while taking care of all required dependencies. Using these scripts Docker should handle everything for you:\n\n```bash\n# Unit tests\n./tests.docker\n```\n\n```bash\n# Scripts tests (bash unit tests)\n./tests-scripts.docker\n```\n\n```bash\n# Integration tests\n./integration-tests.docker\n```\n\nAlternatively, a virtual environment could be created and all dependencies installed via scripts, allowing for richer test runs as covered in [pytest's documentation](https://docs.pytest.org/en/latest/).\n\n_Note: Integration tests may require your NAS to be on and available in your local network in order to pass, as tests could be directly interacting with it._\n\n\n\n\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/DazEdword/synology-toolset", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "synotools", "package_url": "https://pypi.org/project/synotools/", "platform": "", "project_url": "https://pypi.org/project/synotools/", "project_urls": { "Homepage": "https://github.com/DazEdword/synology-toolset" }, "release_url": "https://pypi.org/project/synotools/0.3.17/", "requires_dist": [ "fabric", "python-dotenv", "python-synology" ], "requires_python": "", "summary": "A Python API wrapper and toolset to interact with Synology NAS devices.", "version": "0.3.17" }, "last_serial": 5732185, "releases": { "0.3.10": [ { "comment_text": "", "digests": { "md5": "febd8dc98687305a27eb75f6f61b0ce0", "sha256": "a99756d15701765352e0b9feeeb5cf930e5092d572a305b235f0cbda9feab12e" }, "downloads": -1, "filename": "synotools-0.3.10-py3-none-any.whl", "has_sig": false, "md5_digest": "febd8dc98687305a27eb75f6f61b0ce0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 24983, "upload_time": "2019-07-01T19:05:44", "url": "https://files.pythonhosted.org/packages/2a/a3/92dad01272e5303e40ddb12fa82956872fdf8651882ac03ad0f6248a4165/synotools-0.3.10-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2c3343ccb84ce93cb9b4a9869d6e985a", "sha256": "0725cdccca90b9e68c075f8af870353b4824eb053b459a328b2f9ad0b0827c0f" }, "downloads": -1, "filename": "synotools-0.3.10.tar.gz", "has_sig": false, "md5_digest": "2c3343ccb84ce93cb9b4a9869d6e985a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11882, "upload_time": "2019-07-01T19:05:46", "url": "https://files.pythonhosted.org/packages/48/2f/39eaa8415c40a22daf3de0ee22c4ab2bcb635a4105ed5bdf485495d41691/synotools-0.3.10.tar.gz" } ], "0.3.11": [ { "comment_text": "", "digests": { "md5": "f5009bfbe41de02ab95d10cfd4f2edf2", "sha256": "5522ee55c9db656cfa1c719f980a9b866ab09c103d7431454a1ab2e319e86917" }, "downloads": -1, "filename": "synotools-0.3.11-py3-none-any.whl", "has_sig": false, "md5_digest": "f5009bfbe41de02ab95d10cfd4f2edf2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 24326, "upload_time": "2019-07-01T21:00:28", "url": "https://files.pythonhosted.org/packages/08/f3/0b85bb0565dd11a36a852c1b5278a7b0516a8b298e29ef526bcef0c340aa/synotools-0.3.11-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6c7a6b3d075c2600c8bbea355b6b1ef6", "sha256": "ce26a168898e7d73a355275019ca7b0077eece4897839d12cb8a7a677233b1df" }, "downloads": -1, "filename": "synotools-0.3.11.tar.gz", "has_sig": false, "md5_digest": "6c7a6b3d075c2600c8bbea355b6b1ef6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12122, "upload_time": "2019-07-01T21:00:30", "url": "https://files.pythonhosted.org/packages/d2/e6/aad2b9abfca96a5fadfb6a46a1baf09b41ebb48bcd5ca5e50bd4a80359c6/synotools-0.3.11.tar.gz" } ], "0.3.13": [ { "comment_text": "", "digests": { "md5": "dd2f340e32acb22b583258812cf45984", "sha256": "b555e4a87104c14f503b68749300fb35e6c568dbbd74865ffdbe05c92abb481c" }, "downloads": -1, "filename": "synotools-0.3.13-py3-none-any.whl", "has_sig": false, "md5_digest": "dd2f340e32acb22b583258812cf45984", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 24619, "upload_time": "2019-07-17T18:53:36", "url": "https://files.pythonhosted.org/packages/35/9a/1e24bee0e17b54dd18942174c772a195644cd9c75fa76d16e62e79843faf/synotools-0.3.13-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8346bd4c14c28f1181e97c522e4e92eb", "sha256": "fdac93df8b6ba6738d392f39dae624c0f4d87c966318dddae60f2098e02c0455" }, "downloads": -1, "filename": "synotools-0.3.13.tar.gz", "has_sig": false, "md5_digest": "8346bd4c14c28f1181e97c522e4e92eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12717, "upload_time": "2019-07-17T18:53:37", "url": "https://files.pythonhosted.org/packages/7c/43/9d82bb4a265f3eb28d55d21864ca816d6a73c03d363d409a0dafb81c418f/synotools-0.3.13.tar.gz" } ], "0.3.16": [ { "comment_text": "", "digests": { "md5": "ed554301e156ba8d3ea973dadf0b21b3", "sha256": "bbd8f1b301c4db358e31f592baebd5f6a651db14f3d90fb3068b55a089d23296" }, "downloads": -1, "filename": "synotools-0.3.16-py3-none-any.whl", "has_sig": false, "md5_digest": "ed554301e156ba8d3ea973dadf0b21b3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 26437, "upload_time": "2019-07-17T18:57:04", "url": "https://files.pythonhosted.org/packages/e9/e5/c21f693293828fc112e2475a1eaeb038db41f1b067a943b1119291308ff1/synotools-0.3.16-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1e6092e0b0efe0847fef4f3d690b69ce", "sha256": "d3782830acb837ca4534396765dbf931100616693de143baf7660bff12ddcbca" }, "downloads": -1, "filename": "synotools-0.3.16.tar.gz", "has_sig": false, "md5_digest": "1e6092e0b0efe0847fef4f3d690b69ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14084, "upload_time": "2019-07-17T18:57:06", "url": "https://files.pythonhosted.org/packages/55/f5/ca2f9bae486bed8b2515feca155aa786ecdae702c0ce90a3ae2e35fcb567/synotools-0.3.16.tar.gz" } ], "0.3.17": [ { "comment_text": "", "digests": { "md5": "e88d541c752a493b6ce127e18b9cf913", "sha256": "1ff701784b743c4e1163d2e136581cc86d8af707d94d5b81188826bb93caa004" }, "downloads": -1, "filename": "synotools-0.3.17-py3-none-any.whl", "has_sig": false, "md5_digest": "e88d541c752a493b6ce127e18b9cf913", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 26512, "upload_time": "2019-08-26T17:41:36", "url": "https://files.pythonhosted.org/packages/6d/a2/e33eb597ba8406ce058de45e7854d6f459171e84624d2e3dbd2df9b96569/synotools-0.3.17-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3e0f377f182afb9a4732cee400e35aa3", "sha256": "70eae3996a4f7bf45440a76ffdd5429f6eb786de61d9f4b4f5e760de03058565" }, "downloads": -1, "filename": "synotools-0.3.17.tar.gz", "has_sig": false, "md5_digest": "3e0f377f182afb9a4732cee400e35aa3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14187, "upload_time": "2019-08-26T17:41:38", "url": "https://files.pythonhosted.org/packages/dd/be/04f547d8036c95dee03d5a53eb8eaa07e5eff117150327b3cca0b03e4198/synotools-0.3.17.tar.gz" } ], "0.3.9": [ { "comment_text": "", "digests": { "md5": "9ddf42f0ca4d5cf6a7eadb41b52335cd", "sha256": "5d27cbc72c93beecc76f73efbc92ee70dab49bc801a5a166c4d250b2c6f75ca1" }, "downloads": -1, "filename": "synotools-0.3.9-py3-none-any.whl", "has_sig": false, "md5_digest": "9ddf42f0ca4d5cf6a7eadb41b52335cd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 24230, "upload_time": "2019-06-29T17:34:15", "url": "https://files.pythonhosted.org/packages/65/b8/691fb4525aadb6282f3239b0f5f178cd043fbd7597a8a52082accfcc0b1f/synotools-0.3.9-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9ff0e4e5211d1bcc85aad48478514464", "sha256": "80bf44a26dcdd4f5b803cdb8ce749d4e2be073a9be4d60f2f86c87ff70fceb71" }, "downloads": -1, "filename": "synotools-0.3.9.tar.gz", "has_sig": false, "md5_digest": "9ff0e4e5211d1bcc85aad48478514464", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11785, "upload_time": "2019-06-29T17:34:16", "url": "https://files.pythonhosted.org/packages/87/0f/2554da3c8e7beac2c804df6b3c59f3045f65cb684bf97a31718f8e2c7a0d/synotools-0.3.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e88d541c752a493b6ce127e18b9cf913", "sha256": "1ff701784b743c4e1163d2e136581cc86d8af707d94d5b81188826bb93caa004" }, "downloads": -1, "filename": "synotools-0.3.17-py3-none-any.whl", "has_sig": false, "md5_digest": "e88d541c752a493b6ce127e18b9cf913", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 26512, "upload_time": "2019-08-26T17:41:36", "url": "https://files.pythonhosted.org/packages/6d/a2/e33eb597ba8406ce058de45e7854d6f459171e84624d2e3dbd2df9b96569/synotools-0.3.17-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3e0f377f182afb9a4732cee400e35aa3", "sha256": "70eae3996a4f7bf45440a76ffdd5429f6eb786de61d9f4b4f5e760de03058565" }, "downloads": -1, "filename": "synotools-0.3.17.tar.gz", "has_sig": false, "md5_digest": "3e0f377f182afb9a4732cee400e35aa3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14187, "upload_time": "2019-08-26T17:41:38", "url": "https://files.pythonhosted.org/packages/dd/be/04f547d8036c95dee03d5a53eb8eaa07e5eff117150327b3cca0b03e4198/synotools-0.3.17.tar.gz" } ] }