This commit is contained in:
25
dnscompr.py
Normal file
25
dnscompr.py
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright 2005 Peter Poeml <poeml@suse.de>. All Rights Reserved.
|
||||
#
|
||||
# This software may be used and distributed according to the terms
|
||||
# of the GNU General Public License, incorporated herein by reference.
|
||||
|
||||
|
||||
def compr(names):
|
||||
import dns, dns.name, cStringIO
|
||||
|
||||
f = cStringIO.StringIO()
|
||||
compress = {}
|
||||
|
||||
for i in names:
|
||||
n = dns.name.from_text(i)
|
||||
n.to_wire(f, compress)
|
||||
|
||||
|
||||
return f.getvalue()
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
nlist = sys.argv[1:]
|
||||
print repr(compr(nlist))
|
Reference in New Issue
Block a user