Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re6stnet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
re6stnet
Commits
3dc25c00
Commit
3dc25c00
authored
Dec 18, 2014
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 2 new experimental commands: re6st-cn & re6st-geo
parent
ee745d9b
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
314 additions
and
0 deletions
+314
-0
draft/re6st-cn
draft/re6st-cn
+33
-0
draft/re6st-geo
draft/re6st-geo
+281
-0
No files found.
draft/re6st-cn
0 → 100755
View file @
3dc25c00
#!/usr/bin/python
import
sqlite3
,
sys
import
os
;
sys
.
path
[
0
]
=
os
.
path
.
dirname
(
sys
.
path
[
0
])
from
re6st
import
utils
from
OpenSSL
import
crypto
with
open
(
"/etc/re6stnet/ca.crt"
)
as
f
:
ca
=
crypto
.
load_certificate
(
crypto
.
FILETYPE_PEM
,
f
.
read
())
network
=
utils
.
networkFromCa
(
ca
)
db
=
sqlite3
.
connect
(
"/var/lib/re6stnet/registry.db"
)
for
x
in
sys
.
argv
[
1
:]:
try
:
a
,
b
=
x
.
split
(
'/'
)
except
ValueError
:
prefix
=
x
else
:
b
=
int
(
b
)
try
:
prefix
=
bin
(
int
(
a
))[
2
:].
zfill
(
b
)
except
ValueError
:
a
=
utils
.
binFromIp
(
a
)
assert
a
.
startswith
(
network
)
prefix
=
a
[
len
(
network
):
b
]
a
=
db
.
execute
(
"select * from cert where prefix=?"
,
(
prefix
,)).
fetchone
()
b
=
network
+
prefix
b
=
'%s/%s'
%
(
utils
.
ipFromBin
(
b
),
len
(
b
))
if
a
:
subject
=
crypto
.
load_certificate
(
crypto
.
FILETYPE_PEM
,
a
[
2
]).
get_subject
()
print
"%s
\
t
%s
\
t
%s"
%
(
b
,
a
[
1
],
''
.
join
(
'/%s=%s'
%
x
for
x
in
subject
.
get_components
()))
else
:
print
"%s
\
t
-"
%
b
db
.
close
()
draft/re6st-geo
0 → 100755
View file @
3dc25c00
This diff is collapsed.
Click to expand it.
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