Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
37470325
authored
Feb 11, 2014
by
Bach Dániel
Committed by
Őry Máté
Feb 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: remove old code
parent
d22b8ada
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
28 deletions
+2
-28
circle/firewall/fw.py
+2
-28
No files found.
circle/firewall/fw.py
View file @
37470325
...
...
@@ -2,6 +2,7 @@ from firewall import models
import
django.conf
import
re
import
netaddr
from
datetime
import
datetime
,
timedelta
from
django.db.models
import
Q
...
...
@@ -302,33 +303,6 @@ def ipv6_to_octal(ipv6):
return
'
\\
'
+
'
\\
'
.
join
([
'
%03
o'
%
x
for
x
in
octets
])
def
ipv4_to_arpa
(
ipv4
,
cname
=
False
):
m2
=
re
.
search
(
r'^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$'
,
ipv4
)
if
cname
:
return
(
'
%
s.dns1.
%
s.
%
s.
%
s.in-addr.arpa'
%
(
m2
.
group
(
4
),
m2
.
group
(
3
),
m2
.
group
(
2
),
m2
.
group
(
1
)))
else
:
return
(
'
%
s.
%
s.
%
s.
%
s.in-addr.arpa'
%
(
m2
.
group
(
4
),
m2
.
group
(
3
),
m2
.
group
(
2
),
m2
.
group
(
1
)))
def
ipv6_to_arpa
(
ipv6
):
while
len
(
ipv6
.
split
(
':'
))
<
8
:
ipv6
=
ipv6
.
replace
(
'::'
,
':::'
)
octets
=
[]
for
part
in
ipv6
.
split
(
':'
):
if
not
part
:
octets
.
extend
([
0
,
0
,
0
,
0
])
else
:
# Pad hex part to 4 digits.
part
=
'
%04
x'
%
int
(
part
,
16
)
octets
.
insert
(
0
,
int
(
part
[
0
],
16
))
octets
.
insert
(
0
,
int
(
part
[
1
],
16
))
octets
.
insert
(
0
,
int
(
part
[
2
],
16
))
octets
.
insert
(
0
,
int
(
part
[
3
],
16
))
return
'.'
.
join
([
'
%1
x'
%
x
for
x
in
octets
])
+
'.ip6.arpa'
# =fqdn:ip:ttl A, PTR
# &fqdn:ip:x:ttl NS
# ZfqdnSOA
...
...
@@ -358,7 +332,7 @@ def generate_ptr_records():
# ipv6
if
host
.
ipv6
:
DNS
.
append
(
"^
%
s:
%
s:
%
s"
%
(
ipv6_to_arpa
(
str
(
host
.
ipv6
))
,
DNS
.
append
(
"^
%
s:
%
s:
%
s"
%
(
host
.
ipv6
.
reverse_dns
,
reverse
,
models
.
settings
[
'dns_ttl'
]))
return
DNS
...
...
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