Giter Site home page Giter Site logo

datx-python's Introduction

重要提示

datx格式将全面升级为ipdb格式 IPDB格式解析代码

ipdb 格式优点

  • 可同时支持IPv4与IPv6
  • 可同时支持中文与英文
  • 查询性能大幅度提高

Python Parse datx file

Installing

pip install ipip-datx

Code Example


import datx
c = datx.City("/path/to/mydata4vipday2.datx")
print(c.find("8.8.8.258"))
print(c.find("255.255.255.255"))
  

Output for IP 8.8.8.8 Results


[
"GOOGLE.COM", // country_name
"GOOGLE.COM", // region_name
"",             // city_name
"google.com", // owner_domain
"level3.com", // isp_domain
"", // latitude
"", // longitude
"", // timezone
"", // utc_offset
"", // china_admin_code
"", // idd_code
"", // country_code
"", // continent_code
"IDC", // idc
"", // base_station
"", // country_code3
"", // european_union
"", // currency_code
"", // currency_name
"ANYCAST" // anycast
]
  


# For China district datx file
d = datx.District("/path/to/quxian.datx")
print(d.find("123.121.117.72"))

# For China Base Station datx file
d = datx.BaseStation("/path/to/station_ip.datx")
print(d.find("223.221.121.0"))

datx-python's People

Contributors

ilsanbao avatar ipipdotnet avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.