-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- format Get-DnsServerResourceRecord and convert to internal dns Record object - add/remove A and Txt records - query dns records - unit tests are written - python type hint is added - Python Packaging Authority LICENCE added - Makefile for packaging and etc.
- Loading branch information
1 parent
6446b93
commit 4579f4f
Showing
17 changed files
with
420 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2018 The Python Packaging Authority | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
python = python | ||
ifdef PYTHON | ||
python = ${PYTHON} | ||
endif | ||
|
||
twine = ${python} -m twine | ||
pip = ${python} -m pip | ||
|
||
upload: build | ||
@${twine} upload dist/* -r testpypi | ||
|
||
build: | ||
rm -rf build | ||
rm -rf dist | ||
${python} setup.py sdist | ||
${python} setup.py bdist_wheel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## microsoftdnsserver-py | ||
|
||
microsoftdnsserver-py is a wrapper Python library for [DnsServer](https://docs.microsoft.com/en-us/powershell/module/dnsserver/?view=win10-ps) module. | ||
|
||
Subprocess module is used to perform process calls to interact with DnsServer module. | ||
|
||
## Features | ||
- Convenient as a Python library | ||
- Supports A and Txt record | ||
- Query DNS records | ||
|
||
## Installation | ||
|
||
```shell | ||
``` | ||
|
||
## Limitations | ||
- Libray is not able to work remotely, currently, it is able to call DnsServer module on localhost. | ||
Since, the remote session feature is not on the table, the software that uses this module | ||
must be installed on windows server where Microsoft Dns Server is located. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,27 @@ | ||
from enum import Enum | ||
|
||
|
||
class RecordType(Enum): | ||
A = 'A' | ||
TXT = 'Txt' | ||
|
||
@staticmethod | ||
def list(): | ||
return [t.value for t in RecordType] | ||
|
||
@staticmethod | ||
def value_of(value): | ||
return next((t for t in RecordType if t.value == value)) | ||
|
||
|
||
class Record(object): | ||
|
||
def __init__(self, zone, name, type, content, ttl=1): | ||
def __init__(self, zone: str, name: str, recordType: RecordType, content: str, ttl: str = '1h'): | ||
self.zone = zone | ||
self.name = name | ||
self.type = type | ||
self.type = recordType | ||
self.content = content | ||
self.ttl = ttl | ||
self.ttl = ttl | ||
|
||
def __repr__(self): | ||
return '[%s] record - zone: [%s], name: [%s]' % (self.type, self.zone, self.name) |
Oops, something went wrong.