commit 83c00fee5d7383ab5f92e0ebf0495b746bd8b2df Author: William Colmenares Date: Sat Apr 27 00:56:57 2019 -0400 First commit diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..45e4486 --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +LICENSE + +Copyright + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f642972 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# Ungleich dns cli tool + +A python package to set reverse dns in ungleich vm. + +## Usage + +installing the package via pip (python3 required) + +```angular2 +python3 -m pip install ungleich-cli --user +``` +after installed you can set the reverse dns by typing + +```angular2 +ungleich-cli dns --set-reverse --user --token --name mirror.example.com +``` \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..224a779 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[metadata] +description-file = README.md \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..6985799 --- /dev/null +++ b/setup.py @@ -0,0 +1,35 @@ +from setuptools import setup + + +def readme(): + with open('README.md') as f: + README = f.read() + return README + + +setup( + name='ungleich-cli', + version='1.0.0', + description="A Python package for ungleich dns administration.", + long_description=readme(), + long_description_content_type="text/markdown", + author="William Colmenares", + author_email="colmenares.william@gmail.com", + license="MIT", + classifiers=[ + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + ], + + py_modules=['ungleichcli'], + install_requires=[ + 'Click', + 'requests', + ], + entry_points={ + "console_scripts": [ + "ungleich-cli=ungleichcli:cli" + ] + }, +) diff --git a/ungleichcli.py b/ungleichcli.py new file mode 100644 index 0000000..e7e39f1 --- /dev/null +++ b/ungleichcli.py @@ -0,0 +1,20 @@ +import requests +import click + + +@click.command() +@click.argument('dns', required=False) +@click.option('--set-reverse', help='REQUIRED: IPv6 Address of your VM', required=True) +@click.option('--user', help='Your ungleich username', required=True) +@click.option('--token', help='REQUIRED: Your ungleich 6 digit OTP generated token', type=int) +@click.option('--name', help='REQUIRED: Hostname', required=True) +def cli(dns, set_reverse, user, token, name): + """This script set the reverse dns for your VM + + Example Usage: + + ungleich-cli dns --set-reverse --user --token --name mirror.example.com + + """ + r = requests.post('https://ungleich.ch/dns/reverse/', json={'username': user, 'token': token, 'ipaddress': set_reverse, 'name': name}) + return click.echo(r.text)