cflareupdate.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Security-Research 作者: RhinoSecurityLabs 项目源码 文件源码
def parsecountry(cfdbpath):
    """Parse CrimeFlare's country.zip archive into a dictionary."""
    # Open country archive, parse out required data, store into a list
    try:
        zcountry = zipfile.ZipFile('{}/country.zip'.format(cfdbpath))
        for finfo in zcountry.infolist():
            ifile = zcountry.open(finfo)
            for record in ifile.readlines():
                try:
                    DOMAIN, IP, COUNTRY = record.decode('utf-8').split()
                except(ValueError):
                    COUNTRY = ' '.join(map(str, record.decode('utf-8').split()[2:]))
                _countrydict[DOMAIN] = '{}'.format(COUNTRY)
    except(zipfile.BadZipfile):
        print("[-] Bad checksum on downloaded archive. Try to update again.")
        raise SystemExit
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号