From cca234e2656c9f9db68d60a9d90a04ce97d41933 Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Sat, 28 May 2022 14:14:08 -0500 Subject: [PATCH] first --- .gitignore | 3 + .vscode/settings.json | 4 + flake.lock | 27 ++++ flake.nix | 61 +++++++++ hostapps/__init__.py | 0 hostapps/run.py | 117 ++++++++++++++++ hostapps/update.py | 88 ++++++++++++ poetry.lock | 301 ++++++++++++++++++++++++++++++++++++++++++ poetry.toml | 2 + pyproject.toml | 22 +++ shell.nix | 19 +++ 11 files changed, 644 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/settings.json create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hostapps/__init__.py create mode 100644 hostapps/run.py create mode 100644 hostapps/update.py create mode 100644 poetry.lock create mode 100644 poetry.toml create mode 100644 pyproject.toml create mode 100644 shell.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9ec4e0f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +__pycache__ +/result +/.venv diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..bc3800d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "python.formatting.provider": "black", + "python.formatting.blackPath": "/run/current-system/sw/bin/black" +} \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4d66373 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1653581809, + "narHash": "sha256-Uvka0V5MTGbeOfWte25+tfRL3moECDh1VwokWSZUdoY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "83658b28fe638a170a19b8933aa008b30640fbd1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a56645d --- /dev/null +++ b/flake.nix @@ -0,0 +1,61 @@ +{ + description = "hostapps"; + # nixConfig.bash-prompt-suffix = "develop"; + inputs = { + nixpkgs = { + url = "github:nixos/nixpkgs/nixos-unstable"; + }; + }; + outputs = { self, nixpkgs }@input: + let + version = self.lastModifiedDate; + supportedSystems = [ "x86_64-linux" "aarch64-linux" ]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); + in + { + packages = forAllSystems + ( + system: + let + pkgs = nixpkgsFor.${system}; + in + { + hostapps = pkgs.poetry2nix.mkPoetryApplication { + python = pkgs.python310; + projectDir = ./.; + propagatedBuildInputs = [ + pkgs.openssh + ]; + }; + } + ); + defaultPackage = forAllSystems (system: self.packages.${system}.hostapps); + devShells = forAllSystems + ( + system: + let + pkgs = nixpkgsFor.${system}; + python = pkgs.python310.withPackages ( + ps: with ps; [ + poetry + black + flake8 + ] + ); + in + { + default = + pkgs.mkShell { + buildInputs = with pkgs; [ + python + openssh + ]; + shellHook = '' + export POETRY_VIRTUALENVS_IN_PROJECT=true + ''; + }; + } + ); + }; +} diff --git a/hostapps/__init__.py b/hostapps/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/hostapps/run.py b/hostapps/run.py new file mode 100644 index 0000000..87200c8 --- /dev/null +++ b/hostapps/run.py @@ -0,0 +1,117 @@ +#!/usr/bin/python3 +# -*- mode: python; coding: utf-8 -*- + +import os +import sys +import socket + +import click + +kex_algorithms = [ + "diffie-hellman-group1-sha1", + "diffie-hellman-group-exchange-sha1", + "diffie-hellman-group14-sha1", +] + +ciphers = [ + "aes256-cbc", + "aes192-cbc", + "3des-cbc", + "aes128-cbc", + "aes256-ctr", + "aes192-ctr", + "aes128-ctr", +] + +macs = [ + "hmac-md5", + "hmac-sha1", + "hmac-sha2-256-etm@openssh.com", + "hmac-sha2-512-etm@openssh.com", + "hmac-sha2-256", + "hmac-sha2-512", +] + +options = [ + ("Ciphers", f"{','.join(ciphers)}"), + ("ControlMaster", "no"), + ("ControlPath", "none"), + ("ForwardX11", "no"), + ("ForwardX11Trusted", "no"), + ("HostKeyAlgorithms", "+ssh-rsa"), + ("KexAlgorithms", f"{','.join(kex_algorithms)}"), + ("MACs", f"{','.join(macs)}"), + ("PubkeyAcceptedKeyTypes", "+ssh-rsa"), +] + + +@click.command() +@click.option("--ssh-command", default="ssh") +@click.option("--telnet-command", default="telnet") +@click.option("--connection-type") +@click.option("--name") +@click.option("--username") +@click.option("--address") +@click.option("--port") +def main( + ssh_command: str, + telnet_command: str, + connection_type: str, + name: str, + username: str, + address: str, + port: int, +): + + sys.stdout.write("\033]0;") + sys.stdout.write(name) + sys.stdout.write(" - ") + sys.stdout.write(address) + sys.stdout.write("\007") + sys.stdout.flush() + + # if 'SSH_AUTH_SOCK' in os.environ: + # journal.send('Removing SSH_AUTH_SOCK from environment') + # del os.environ['SSH_AUTH_SOCK'] + + command = [] + + match connection_type: + case "ssh": + command = [ + ssh_command, + "ssh", + "-v", + "-y", + ] + + if socket.gethostname() != "pc60929": + command += ["-o", "ProxyCommand=ssh -W %h:%p jcollie@pc60929"] + + command += [ + "-i", + "~/.ssh/id_dmacc_rsa", + ] + + for k, v in options: + command += ["-o", f"{k}={v}"] + + command += [ + "-o", + f"User={username}", + address, + ] + + case "telnet": + command = [telnet_command, "telnet"] + + if socket.gethostname() != "pc60929": + command = [ssh_command, "ssh", "-t", "ssh://jcollie@pc60929", "telnet"] + + command += [address] + + os.execlp(*command) + + +if __name__ == "__main__": + main() diff --git a/hostapps/update.py b/hostapps/update.py new file mode 100644 index 0000000..5c52a92 --- /dev/null +++ b/hostapps/update.py @@ -0,0 +1,88 @@ +"""Install desktop entries.""" + +import ipaddress +import os +import pathlib + +import json + +import click +import pynetbox + + +@click.command() +def main(): + + data = json.load(open(f"/run/user/{os.getuid()}/secrets/netbox.json")) + nb = pynetbox.api( + data["url"], + token=data["token"], + threading=True, + ) + + appdir = pathlib.Path("~/.config/nixpkgs/hostapps.json").expanduser().resolve() + + data = {} + + cisco = nb.dcim.manufacturers.get(name="Cisco") + network = nb.dcim.device_roles.get(name="Network") + for device in nb.dcim.devices.filter( + manufacturer_id=cisco.id, + role_id=network.id, + status="active", + has_primary_ip="true", + ): + if device.virtual_chassis is not None: + name = device.virtual_chassis.name + else: + name = device.name + + services = nb.ipam.services.filter(device_id=device.id) + for service in services: + if service.name.lower() in ["ssh", "telnet"]: + for port in service.ports: + data[f"{name}:{service.name.lower()}:{port}"] = { + "name": name, + "type": service.name.lower(), + "comment": " ".join(name.split("-")), + "address": str( + ipaddress.ip_interface(device.primary_ip.address).ip + ), + "port": port, + "username": "jcollie", + } + + print(name, str(ipaddress.ip_interface(device.primary_ip.address).ip)) + + schneider = nb.dcim.manufacturers.get(name="Schneider") + power_protection = nb.dcim.device_roles.get(name="Power Protection") + for device in nb.dcim.devices.filter( + manufacturer_id=schneider.id, + role_id=power_protection.id, + status="active", + has_primary_ip="true", + ): + name = device.name + + services = nb.ipam.services.filter(device_id=device.id) + for service in services: + if service.name.lower() in ["ssh", "telnet"]: + for port in service.ports: + data[f"{name}:{service.name.lower()}:{port}"] = { + "name": name, + "type": service.name.lower(), + "comment": " ".join(name.split("-")), + "address": str( + ipaddress.ip_interface(device.primary_ip.address).ip + ), + "port": port, + "username": "apc", + } + + print(name, str(ipaddress.ip_interface(device.primary_ip.address).ip)) + + open(appdir, "w").write(json.dumps(data, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..9f2db6d --- /dev/null +++ b/poetry.lock @@ -0,0 +1,301 @@ +[[package]] +name = "black" +version = "22.3.0" +description = "The uncompromising code formatter." +category = "dev" +optional = false +python-versions = ">=3.6.2" + +[package.dependencies] +click = ">=8.0.0" +mypy-extensions = ">=0.4.3" +pathspec = ">=0.9.0" +platformdirs = ">=2" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.7.4)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +uvloop = ["uvloop (>=0.15.2)"] + +[[package]] +name = "certifi" +version = "2022.5.18.1" +description = "Python package for providing Mozilla's CA Bundle." +category = "main" +optional = false +python-versions = ">=3.6" + +[[package]] +name = "charset-normalizer" +version = "2.0.12" +description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." +category = "main" +optional = false +python-versions = ">=3.5.0" + +[package.extras] +unicode_backport = ["unicodedata2"] + +[[package]] +name = "click" +version = "8.1.3" +description = "Composable command line interface toolkit" +category = "main" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "colorama" +version = "0.4.4" +description = "Cross-platform colored terminal text." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[[package]] +name = "flake8" +version = "4.0.1" +description = "the modular source code checker: pep8 pyflakes and co" +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +mccabe = ">=0.6.0,<0.7.0" +pycodestyle = ">=2.8.0,<2.9.0" +pyflakes = ">=2.4.0,<2.5.0" + +[[package]] +name = "idna" +version = "3.3" +description = "Internationalized Domain Names in Applications (IDNA)" +category = "main" +optional = false +python-versions = ">=3.5" + +[[package]] +name = "mccabe" +version = "0.6.1" +description = "McCabe checker, plugin for flake8" +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "mypy-extensions" +version = "0.4.3" +description = "Experimental type system extensions for programs checked with the mypy typechecker." +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "pathspec" +version = "0.9.0" +description = "Utility library for gitignore style pattern matching of file paths." +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" + +[[package]] +name = "platformdirs" +version = "2.5.2" +description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.extras] +docs = ["furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx-autodoc-typehints (>=1.12)", "sphinx (>=4)"] +test = ["appdirs (==1.4.4)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)", "pytest (>=6)"] + +[[package]] +name = "pycodestyle" +version = "2.8.0" +description = "Python style guide checker" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[[package]] +name = "pyflakes" +version = "2.4.0" +description = "passive checker of Python programs" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + +[[package]] +name = "pynetbox" +version = "6.6.2" +description = "NetBox API client library" +category = "main" +optional = false +python-versions = "*" + +[package.dependencies] +requests = ">=2.20.0,<3.0" +six = ">=1.0.0,<2.0.0" + +[[package]] +name = "requests" +version = "2.27.1" +description = "Python HTTP for Humans." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" + +[package.dependencies] +certifi = ">=2017.4.17" +charset-normalizer = {version = ">=2.0.0,<2.1.0", markers = "python_version >= \"3\""} +idna = {version = ">=2.5,<4", markers = "python_version >= \"3\""} +urllib3 = ">=1.21.1,<1.27" + +[package.extras] +socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"] +use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"] + +[[package]] +name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" + +[[package]] +name = "systemd" +version = "0.16.1" +description = "Python systemd wrapper" +category = "main" +optional = false +python-versions = "*" + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +category = "dev" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "urllib3" +version = "1.26.9" +description = "HTTP library with thread-safe connection pooling, file post, and more." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" + +[package.extras] +brotli = ["brotlicffi (>=0.8.0)", "brotli (>=1.0.9)", "brotlipy (>=0.6.0)"] +secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] +socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] + +[metadata] +lock-version = "1.1" +python-versions = "^3.10" +content-hash = "1f070315a02f97f88d0a9fa9ad33a3550e211d77f49d7a3da7d11de30f608007" + +[metadata.files] +black = [ + {file = "black-22.3.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:2497f9c2386572e28921fa8bec7be3e51de6801f7459dffd6e62492531c47e09"}, + {file = "black-22.3.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5795a0375eb87bfe902e80e0c8cfaedf8af4d49694d69161e5bd3206c18618bb"}, + {file = "black-22.3.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e3556168e2e5c49629f7b0f377070240bd5511e45e25a4497bb0073d9dda776a"}, + {file = "black-22.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:67c8301ec94e3bcc8906740fe071391bce40a862b7be0b86fb5382beefecd968"}, + {file = "black-22.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:fd57160949179ec517d32ac2ac898b5f20d68ed1a9c977346efbac9c2f1e779d"}, + {file = "black-22.3.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:cc1e1de68c8e5444e8f94c3670bb48a2beef0e91dddfd4fcc29595ebd90bb9ce"}, + {file = "black-22.3.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d2fc92002d44746d3e7db7cf9313cf4452f43e9ea77a2c939defce3b10b5c82"}, + {file = "black-22.3.0-cp36-cp36m-win_amd64.whl", hash = "sha256:a6342964b43a99dbc72f72812bf88cad8f0217ae9acb47c0d4f141a6416d2d7b"}, + {file = "black-22.3.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:328efc0cc70ccb23429d6be184a15ce613f676bdfc85e5fe8ea2a9354b4e9015"}, + {file = "black-22.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:06f9d8846f2340dfac80ceb20200ea5d1b3f181dd0556b47af4e8e0b24fa0a6b"}, + {file = "black-22.3.0-cp37-cp37m-win_amd64.whl", hash = "sha256:ad4efa5fad66b903b4a5f96d91461d90b9507a812b3c5de657d544215bb7877a"}, + {file = "black-22.3.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e8477ec6bbfe0312c128e74644ac8a02ca06bcdb8982d4ee06f209be28cdf163"}, + {file = "black-22.3.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:637a4014c63fbf42a692d22b55d8ad6968a946b4a6ebc385c5505d9625b6a464"}, + {file = "black-22.3.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:863714200ada56cbc366dc9ae5291ceb936573155f8bf8e9de92aef51f3ad0f0"}, + {file = "black-22.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:10dbe6e6d2988049b4655b2b739f98785a884d4d6b85bc35133a8fb9a2233176"}, + {file = "black-22.3.0-cp38-cp38-win_amd64.whl", hash = "sha256:cee3e11161dde1b2a33a904b850b0899e0424cc331b7295f2a9698e79f9a69a0"}, + {file = "black-22.3.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:5891ef8abc06576985de8fa88e95ab70641de6c1fca97e2a15820a9b69e51b20"}, + {file = "black-22.3.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:30d78ba6bf080eeaf0b7b875d924b15cd46fec5fd044ddfbad38c8ea9171043a"}, + {file = "black-22.3.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ee8f1f7228cce7dffc2b464f07ce769f478968bfb3dd1254a4c2eeed84928aad"}, + {file = "black-22.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6ee227b696ca60dd1c507be80a6bc849a5a6ab57ac7352aad1ffec9e8b805f21"}, + {file = "black-22.3.0-cp39-cp39-win_amd64.whl", hash = "sha256:9b542ced1ec0ceeff5b37d69838106a6348e60db7b8fdd245294dc1d26136265"}, + {file = "black-22.3.0-py3-none-any.whl", hash = "sha256:bc58025940a896d7e5356952228b68f793cf5fcb342be703c3a2669a1488cb72"}, + {file = "black-22.3.0.tar.gz", hash = "sha256:35020b8886c022ced9282b51b5a875b6d1ab0c387b31a065b84db7c33085ca79"}, +] +certifi = [ + {file = "certifi-2022.5.18.1-py3-none-any.whl", hash = "sha256:f1d53542ee8cbedbe2118b5686372fb33c297fcd6379b050cca0ef13a597382a"}, + {file = "certifi-2022.5.18.1.tar.gz", hash = "sha256:9c5705e395cd70084351dd8ad5c41e65655e08ce46f2ec9cf6c2c08390f71eb7"}, +] +charset-normalizer = [ + {file = "charset-normalizer-2.0.12.tar.gz", hash = "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597"}, + {file = "charset_normalizer-2.0.12-py3-none-any.whl", hash = "sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df"}, +] +click = [ + {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, + {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, +] +colorama = [ + {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, + {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, +] +flake8 = [ + {file = "flake8-4.0.1-py2.py3-none-any.whl", hash = "sha256:479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d"}, + {file = "flake8-4.0.1.tar.gz", hash = "sha256:806e034dda44114815e23c16ef92f95c91e4c71100ff52813adf7132a6ad870d"}, +] +idna = [ + {file = "idna-3.3-py3-none-any.whl", hash = "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff"}, + {file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"}, +] +mccabe = [ + {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, + {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, +] +mypy-extensions = [ + {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, + {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, +] +pathspec = [ + {file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"}, + {file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"}, +] +platformdirs = [ + {file = "platformdirs-2.5.2-py3-none-any.whl", hash = "sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788"}, + {file = "platformdirs-2.5.2.tar.gz", hash = "sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19"}, +] +pycodestyle = [ + {file = "pycodestyle-2.8.0-py2.py3-none-any.whl", hash = "sha256:720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20"}, + {file = "pycodestyle-2.8.0.tar.gz", hash = "sha256:eddd5847ef438ea1c7870ca7eb78a9d47ce0cdb4851a5523949f2601d0cbbe7f"}, +] +pyflakes = [ + {file = "pyflakes-2.4.0-py2.py3-none-any.whl", hash = "sha256:3bb3a3f256f4b7968c9c788781e4ff07dce46bdf12339dcda61053375426ee2e"}, + {file = "pyflakes-2.4.0.tar.gz", hash = "sha256:05a85c2872edf37a4ed30b0cce2f6093e1d0581f8c19d7393122da7e25b2b24c"}, +] +pynetbox = [ + {file = "pynetbox-6.6.2-py3-none-any.whl", hash = "sha256:3202e5c253c1c1b5e53c42f8e5475552c068b816e214fe060d98673f7d78c16a"}, + {file = "pynetbox-6.6.2.tar.gz", hash = "sha256:83b840aeaed49bacde6962d29f4550e4bd35b2e273e9f65c1f8cbe0883fe74db"}, +] +requests = [ + {file = "requests-2.27.1-py2.py3-none-any.whl", hash = "sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d"}, + {file = "requests-2.27.1.tar.gz", hash = "sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61"}, +] +six = [ + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, +] +systemd = [ + {file = "systemd-0.16.1.tar.gz", hash = "sha256:f44a02434cb1e6ff686bc7d25a7a665cc7af665965e933df3e76fa02d351a75b"}, +] +tomli = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] +urllib3 = [ + {file = "urllib3-1.26.9-py2.py3-none-any.whl", hash = "sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14"}, + {file = "urllib3-1.26.9.tar.gz", hash = "sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"}, +] diff --git a/poetry.toml b/poetry.toml new file mode 100644 index 0000000..c0c340a --- /dev/null +++ b/poetry.toml @@ -0,0 +1,2 @@ +[virtualenvs] +in-project = false diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..464ecd8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,22 @@ +[tool.poetry] +name = "hostapps" +version = "0.1.0" +description = "" +authors = ["Jeffrey C. Ollie "] + +[tool.poetry.dependencies] +python = "^3.10" +pynetbox = "^6.6.2" +click = "^8.1.3" + +[tool.poetry.dev-dependencies] +black = "^22.3.0" +flake8 = "^4.0.1" + +[tool.poetry.scripts] +hostapps-update = "hostapps.update:main" +hostapps-run = "hostapps.run:main" + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..a64688f --- /dev/null +++ b/shell.nix @@ -0,0 +1,19 @@ +{ pkgs ? import { } }: +let + python = pkgs.python310.withPackages ( + ps: with ps; [ + poetry + black + flake8 + ] + ); +in +pkgs.mkShell { + buildInputs = with pkgs; [ + python + openssh + ]; + shellHook = '' + export POETRY_VIRTUALENVS_IN_PROJECT=true + ''; +}