コード例 #1
0
 def __init__(self):
     zip_path = data_storage_dir.joinpath("IP2LOCATION-LITE-DB3.BIN.ZIP")
     bin_path = data_storage_dir.joinpath("IP2LOCATION-LITE-DB3.BIN")
     if not bin_path.exists():
         zf = zipfile.ZipFile(zip_path)
         zf.extract('IP2LOCATION-LITE-DB3.BIN', data_storage_dir)
     IP2Location.__init__(self, bin_path)
コード例 #2
0
ファイル: ipasn.py プロジェクト: popmedd/infoscaner
def get_db_path():
    zip_path = data_storage_dir.joinpath('ip2location.zip')
    db_path = data_storage_dir.joinpath('ip2location.db')
    if db_path.exists():
        return db_path
    zf = zipfile.ZipFile(zip_path)
    zf.extract('ip2location.db', data_storage_dir)
    return db_path
コード例 #3
0
ファイル: ipasn.py プロジェクト: zkbupt/OneForAll
 def __init__(self):
     zip_path = data_storage_dir.joinpath("IP2LOCATION-LITE-ASN.CSV.ZIP")
     csv_path = data_storage_dir.joinpath("IP2LOCATION-LITE-ASN.CSV")
     if csv_path.exists():
         asn_fp = open(csv_path)
     else:
         zf = zipfile.ZipFile(zip_path)
         zf.extract('IP2LOCATION-LITE-ASN.CSV', data_storage_dir)
         asn_fp = open(csv_path)
     self.data = []
     reader = csv.reader(asn_fp, delimiter=',', quotechar='"')
     for row in reader:
         e = Entry(row[0], row[1], row)
         self.data.append(e)
     asn_fp.close()
コード例 #4
0
ファイル: srv.py プロジェクト: zkbupt/OneForAll
    def gen_names(self):
        path = data_storage_dir.joinpath('srv_prefixes.json')
        with open(path, encoding='utf-8', errors='ignore') as file:
            prefixes = json.load(file)
        names = map(lambda prefix: prefix + self.domain, prefixes)

        for name in names:
            self.names_que.put(name)
コード例 #5
0
ファイル: ipgeo.py プロジェクト: zkbupt/OneForAll
import zipfile
import IP2Location
from config.setting import data_storage_dir

zip_path = data_storage_dir.joinpath("IP2LOCATION-LITE-DB3.BIN.ZIP")
bin_path = data_storage_dir.joinpath("IP2LOCATION-LITE-DB3.BIN")
if not bin_path.exists():
    zf = zipfile.ZipFile(zip_path)
    zf.extract('IP2LOCATION-LITE-DB3.BIN', data_storage_dir)
IpGeoInfo = IP2Location.IP2Location(bin_path)