blob: d0c4982b4324a5ccdb93f345a5e7e8234ad5fe5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#!/usr/bin/python
# From http://www.perkin.org.uk/posts/serving-multiple-dns-search-domains-in-ios-dhcp.html
import sys
hexlist = []
for domain in sys.argv[1:]:
for part in domain.split("."):
hexlist.append("%02x" % len(part))
for c in part:
hexlist.append(c.encode("hex"))
hexlist.append("00")
print "".join([(".%s" % (x) if i and not i % 2 else x) \
for i, x in enumerate(hexlist)])
|