{"id":20183004,"url":"https://github.com/emibcn/pywisp","last_synced_at":"2025-07-08T17:42:07.647Z","repository":{"id":38184048,"uuid":"148063309","full_name":"emibcn/pywisp","owner":"emibcn","description":"Access AirControl2 (API), AirOS (SSH) \u0026 Mikrotik (SSH) from the same place","archived":false,"fork":false,"pushed_at":"2024-04-26T10:38:34.000Z","size":129,"stargazers_count":8,"open_issues_count":7,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-26T11:41:50.207Z","etag":null,"topics":["aircontrol2","airos","device","devops","hacktoberfest","mikrotik","pypi","ssh","wisp"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pywisp-emibcn/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emibcn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-09T20:31:15.000Z","updated_at":"2023-04-05T07:18:23.000Z","dependencies_parsed_at":"2024-04-26T11:39:43.091Z","dependency_job_id":"3ac840e8-a77a-4d8d-917a-3999493c265d","html_url":"https://github.com/emibcn/pywisp","commit_stats":{"total_commits":67,"total_committers":5,"mean_commits":13.4,"dds":0.3731343283582089,"last_synced_commit":"623c59d4e2ee0bf1f3d1012f2ca53ecb0f97ab8f"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emibcn%2Fpywisp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emibcn%2Fpywisp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emibcn%2Fpywisp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emibcn%2Fpywisp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emibcn","download_url":"https://codeload.github.com/emibcn/pywisp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161739,"owners_count":21057643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aircontrol2","airos","device","devops","hacktoberfest","mikrotik","pypi","ssh","wisp"],"created_at":"2024-11-14T02:43:41.129Z","updated_at":"2025-04-10T05:23:56.311Z","avatar_url":"https://github.com/emibcn.png","language":"Python","readme":"![Coverage](https://raw.githubusercontent.com/emibcn/pywisp/badges/master/test-coverage.svg)\n[![Python CI](https://github.com/emibcn/pywisp/actions/workflows/test.yml/badge.svg)](https://github.com/emibcn/pywisp/actions/workflows/test.yml)\n[![Build Status](https://travis-ci.com/emibcn/pywisp.svg?branch=master)](https://travis-ci.com/emibcn/pywisp)\n\n\n# PyWisp installation\n## Install pywisp\n```shell\npip3 install --user pywisp_emibcn\n```\n\n## Configure PyWisp\nThen configure as per [~/.pywisp](#pywisp-config-file-pywisp)\n\nFinally, create the python script which implements the WISP infrastructure and authentication\nmechanisms, as per [wisp.py](#wisp-infrastructure-and-host-authentication-definitions)\n\n# PyWisp usage\n```\nusage: pywisp [-h] [--conf CONF] {backup_ac,backup_mt,reorder_ac,host} ...\n\npositional arguments:\n  {backup_ac,backup_mt,reorder_ac,host}\n    backup_ac           Backup all AirControl devices\n    backup_mt           Backup all Mikrotik devices\n    reorder_ac          Reorder branches from AirControl devices\n    host                Find device by it's hostname, MAC or IP\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --conf CONF           Reads configuration from this file instead of default\n                        (default: $HOME/.pywisp)\n```\n\n\n### Backup all Ubiquiti's devices\n```\nusage: pywisp backup_ac [-h] [--retries] [PATH]\n\npositional arguments:\n  PATH        Directory in which save backup files (default: None)\n\noptional arguments:\n  -h, --help  show this help message and exit\n  --retries   Retries for every device before stop trying (default: 3)\n```\n\n### Backup all Mikrotik's devices\n```\nusage: pywisp backup_mt [-h] [--retries] [PATH]\n\npositional arguments:\n  PATH        Directory in which save backup files (default: None)\n\noptional arguments:\n  -h, --help  show this help message and exit\n  --retries   Retries for every device before stop trying (default: 3)\n```\n\n### Host lookup and actions\n```\nusage: pywisp host [-h] [--deep] [--from-br FROM_BR] [--getname] [--getjson]\n                    [--getip] [--getid] [--getmac] [--getdhcp] [--getwifi]\n                    [--getwifistations] [--getstatus] [--url] [--ssh]\n                    [--cmd CMD]\n                    host\n\npositional arguments:\n  host               Devices hostname, MAC or IP\n\noptional arguments:\n  -h, --help         show this help message and exit\n  --deep             Find device by it's hostname, MAC or IP, using all BRs\n                     station list as haystack (default: False)\n  --from-br FROM_BR  Deep find only in this BR (default: None)\n  --getname          Gets device name (default: False)\n  --getjson          Gets device full data (default: False)\n  --getip            Gets device IP (default: False)\n  --getid            Gets device ID (default: False)\n  --getmac           Gets device MAC (default: False)\n  --getdhcp          Gets device's DHCP leases/stations (default: False)\n  --getwifi          Gets device's wifi status (default: False)\n  --getwifistations  Gets device's wifi stations (default: False)\n  --getstatus        Gets device status (default: False)\n  --url              Gets an authenticated URL to connect to the device using\n                     browser (default: False)\n  --ssh              Connects to device using SSH (default: False)\n  --cmd CMD          Connects to device and run a command (default: None)\n```\n\n\n# PyWisp config file: `~/.pywisp`\n```\n[wisp]\npath = ${env:HOME}/MyWISP/\nmodule = wisp\nclass = MyWISP\n\n[ac]\nurl = https://10.100.1.102:9082\nuser = admin\npassword = MyNotSoSecurePassword\n\n[backup]\nac = /var/backups/mywisp/ac/\nmt = /var/backups/mywisp/mt/\n```\n\n# WISP infrastructure and host authentication definitions\n## `${env:HOME}/MyWISP/wisp.py`\nIn [this example](/examples/Wisp_1.py), we hardcode relations between IPs, some device names, users and passwords. We could be getting those relations from where ever, for example, an SQL database, a secure wallet downloaded from an S3, an spreadsheet at GoogleDocs (sic), an internal REST API, etc. Examples are welcome via pull request.\n\nYou can add more types of devices (for example, Mimosa) subclassing [`SSHDevice`](/pywisp_emibcn/sshdevice.py) and instantiating it correctly from your `wisp.py`. If you do so, I appreciate pull requests ;) \n\nYou can create a complete subclassed [`Wisp`](/pywisp_emibcn/wisp.py) object and pass it to `PyWisp` on instantiation. This way you can use PyWisp from within other projects, like from your Django APP or from your Zabbix scripts, mantaining your infrastructure and authentication mechanisms centralized.\n\n\n# TODO list\n- [x] Move `print`s and similars to a ~~good~~ logging system.\n- [ ] Enhance logging system\n- [x] Create examples repo with one `wisp.py` example\n- [ ] Create more examples (useful for testing, too)\n- [ ] Create more and useful documentation\n- [x] Testing\n- [ ] Testing, testing, testing...\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femibcn%2Fpywisp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femibcn%2Fpywisp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femibcn%2Fpywisp/lists"}