#!/usr/bin/env python # v4 # known bugs: # * very long words may break all the things or end up longer than the maximum limit __usage__ = "{} $network 60: while word: l.append(word[:60]) word = word[60:] else: l.append(word) else: overflow.append(word) ip = ".".join(str(next(subnet)).split(".")[::-1]) print("^{}.in-addr.arpa:{}:86400".format(ip, ".".join(l))) if overflow: get_ip_for_line(" ".join(overflow)) for line in sys.stdin: try: get_ip_for_line(line) except StopIteration: print("out of IPs!", file=sys.stderr) break