def parsensout(cfdbpath):
"""Parse CrimeFlare's nsout.zip archive into a dictionary."""
# Open nsout archive, parse out required data, store into a list
try:
znsout = zipfile.ZipFile('{}/nsout.zip'.format(cfdbpath))
for finfo in znsout.infolist():
ifile = znsout.open(finfo)
for record in ifile.readlines():
try:
NS1, NS2, DOMAIN = record.decode('utf-8').split()
except Exception:
NSPLIT = record.decode('utf-8').split()
if len(NSPLIT) > 3:
DOMAIN = NSPLIT[-1]
NSPLIT.remove(DOMAIN)
NS1 = ' '.join(NSPLIT[:-2])
NS2 = ' '.join(NSPLIT[-2:])
pass
_nsdict[DOMAIN] = '{} {}'.format(NS1, NS2)
except(zipfile.BadZipfile):
print("[-] Bad checksum on downloaded archive. Try to update again.")
raise SystemExit
cflareupdate.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录