def load_file(csvfile):
with open(csvfile, "r") as handle:
data = handle.read()
names = []
for match in AXFR_RE.finditer(data, re.MULTILINE):
names.append((match.group(1).strip('.'), match.group(3)))
suffix = os.path.commonprefix([X[0][::-1] for X in names])[::-1]
names = filter(lambda X: X[0],
[(X[0].replace(suffix, '').strip('.').lower(), X[1])
for X in names])
for name, rectype in set(names):
if not name or name == '*': # Ignore single wildcard or empty
continue
if name[:2] == '*.': # Strip wildcard off beginning
name = name[2:]
subnames = name.split('.')
for subname in iter_names(subnames):
yield subname, rectype
评论列表
文章目录