# Write all records
self.write(self, f)
- def _write_record(self, f, network, type, content):
+ def _write_network(self, f, network, *args, **kwargs):
"""
Writes a single record to the output file
"""
name = network.reverse_pointer(suffix="")
if name is None:
for subnet in network.subnets:
- self._write_record(f, subnet, type, content)
+ self._write_record(f, subnet, *args, **kwargs)
return
+ self._write_record(f, network, *args, **kwargs)
+
+ def _write_record(self, f, name, type, content):
f.write("%s IN %s %s\n" % (name, type, content))
+ # ASN
+
+ def _write_asn(self, f):
+ for asn in self.db.ases:
+ self._write_record(f, asn.number, "TXT", "\"%s\"" % asn.name)
+
# Bogons
def _write_bogons(self, f):
self._write_record(f, network, "TXT", "\"%s\"" % asn)
formats = {
+ "asn" : _write_asn,
"bogons" : _write_bogons,
"origin" : _write_origin,
}