1.介绍
纯真(CZ88.NET)自2005年起一直为广大社区用户提供社区版IP地址库,只要获得纯真的授权就能免费使用,并不断获取后续更新的版本。如果有需要免费版IP库的朋友可以前往纯真的官网进行申请。
2.工具
官方提供的Python项目:https://github.com/tagphi/czdb_searcher_python
3.使用
1)使用git clone克隆Python项目或直接下载压缩包
2)下载Python库,pip install msgpack pycryptodome
3)代码使用
import sys
from czdb.db_searcher import DbSearcher
database_path = "/path/to/your/database.czdb"
query_type = "BTREE"
key = "YourEncryptionKey"
ip = "8.8.8.8"
db_searcher = DbSearcher(database_path, query_type, key)
try:
region = db_searcher.search(ip)
print("搜索结果:")
print(region)
except Exception as e:
print(f"An error occurred during the search: {e}")
db_searcher.close()