Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
python-rndc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
python-rndc
Commits
9db48d23
Commit
9db48d23
authored
May 09, 2018
by
Matthew Pounsett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PEP8 cleanup
parent
6ed107c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
rndc.py
rndc.py
+12
-12
No files found.
rndc.py
View file @
9db48d23
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
############################################################################
############################################################################
from
collections
import
OrderedDict
from
collections
import
OrderedDict
from
exceptions
import
TypeError
import
time
import
time
import
struct
import
struct
import
hashlib
import
hashlib
...
@@ -30,12 +29,14 @@ import socket
...
@@ -30,12 +29,14 @@ import socket
class
rndc
(
object
):
class
rndc
(
object
):
"""RNDC protocol client library"""
"""RNDC protocol client library"""
__algos
=
{
'md5'
:
157
,
__algos
=
{
'sha1'
:
161
,
'md5'
:
157
,
'sha224'
:
162
,
'sha1'
:
161
,
'sha256'
:
163
,
'sha224'
:
162
,
'sha384'
:
164
,
'sha256'
:
163
,
'sha512'
:
165
}
'sha384'
:
164
,
'sha512'
:
165
}
def
__init__
(
self
,
host
,
algo
,
secret
):
def
__init__
(
self
,
host
,
algo
,
secret
):
"""Creates a persistent connection to RNDC and logs in
"""Creates a persistent connection to RNDC and logs in
...
@@ -83,7 +84,7 @@ class rndc(object):
...
@@ -83,7 +84,7 @@ class rndc(object):
d
[
'_ctrl'
]
=
OrderedDict
()
d
[
'_ctrl'
]
=
OrderedDict
()
d
[
'_ctrl'
][
'_ser'
]
=
str
(
self
.
ser
)
d
[
'_ctrl'
][
'_ser'
]
=
str
(
self
.
ser
)
d
[
'_ctrl'
][
'_tim'
]
=
str
(
now
)
d
[
'_ctrl'
][
'_tim'
]
=
str
(
now
)
d
[
'_ctrl'
][
'_exp'
]
=
str
(
now
+
60
)
d
[
'_ctrl'
][
'_exp'
]
=
str
(
now
+
60
)
if
self
.
nonce
is
not
None
:
if
self
.
nonce
is
not
None
:
d
[
'_ctrl'
][
'_nonce'
]
=
self
.
nonce
d
[
'_ctrl'
][
'_nonce'
]
=
self
.
nonce
d
[
'_data'
]
=
data
d
[
'_data'
]
=
data
...
@@ -147,13 +148,13 @@ class rndc(object):
...
@@ -147,13 +148,13 @@ class rndc(object):
pos
=
0
pos
=
0
labellen
=
ord
(
input
[
pos
])
labellen
=
ord
(
input
[
pos
])
pos
+=
1
pos
+=
1
label
=
input
[
pos
:
pos
+
labellen
]
label
=
input
[
pos
:
pos
+
labellen
]
pos
+=
labellen
pos
+=
labellen
type
=
ord
(
input
[
pos
])
type
=
ord
(
input
[
pos
])
pos
+=
1
pos
+=
1
datalen
=
struct
.
unpack
(
'>I'
,
input
[
pos
:
pos
+
4
])[
0
]
datalen
=
struct
.
unpack
(
'>I'
,
input
[
pos
:
pos
+
4
])[
0
]
pos
+=
4
pos
+=
4
data
=
input
[
pos
:
pos
+
datalen
]
data
=
input
[
pos
:
pos
+
datalen
]
pos
+=
datalen
pos
+=
datalen
rest
=
input
[
pos
:]
rest
=
input
[
pos
:]
...
@@ -171,7 +172,6 @@ class rndc(object):
...
@@ -171,7 +172,6 @@ class rndc(object):
def
__parse_message
(
self
,
input
):
def
__parse_message
(
self
,
input
):
rv
=
OrderedDict
()
rv
=
OrderedDict
()
hdata
=
None
while
len
(
input
)
>
0
:
while
len
(
input
)
>
0
:
label
,
value
,
input
=
self
.
__parse_element
(
input
)
label
,
value
,
input
=
self
.
__parse_element
(
input
)
rv
[
label
]
=
value
rv
[
label
]
=
value
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment