First commit

This commit is contained in:
wcolmenares 2019-04-27 00:56:57 -04:00
commit 83c00fee5d
5 changed files with 82 additions and 0 deletions

9
LICENSE Normal file
View File

@ -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.

16
README.md Normal file
View File

@ -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 <ip> --user <username> --token <token> --name mirror.example.com
```

2
setup.cfg Normal file
View File

@ -0,0 +1,2 @@
[metadata]
description-file = README.md

35
setup.py Normal file
View File

@ -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"
]
},
)

20
ungleichcli.py Normal file
View File

@ -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 <ip> --user <username> --token <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)