First described in this post, bindnorm.py reads a BIND zone file, and expands all the shortcuts ($ORIGIN, $TTL, non-FQDN or “relative” names, etc), and outputs the same zone in what I call “normalized” form. It’s really a trivial script, thanks to the dnspython module.
Download [523 B]: bindnorm.py
This script reads the binary
addresses.wbx file that MikrotTik’s winbox application outputs using the
Tools->Export function. It is useful if you stored a number of device passwords with winbox, and you want to retrieve them in a format somewhat friendlier than you would get by running
strings addresses.wbx. Be warned though, this code is not well tested: YMMV.
Download [2 KB]: wbx.py
This script accepts a list of networks (in CIDR format, one per line) from STDIN, and the desired sub-net as the first command line argument. It loops through the input subnets, looking for the one that overlaps with the desired prefix. If a network doesn’t match, the script just prints it out untouched, if it does, then the script will de-aggregate that network into the minimum number of sub-nets in order to get the desired sub-net as one of the outputs. It prints the surrounding pieces, and unless you specify “-exclude” as the second argument, the desired sub-net itself is also added to the output.
Download [2 KB]: deaggregate.py