How to use the ipdb.City function in ipdb

To help you get started, we’ve selected a few ipdb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ipipdotnet / ipdb-python / example.py View on Github external
def test_city_ipv6_test():

    db = ipdb.City("c:/work/ipdb/mydata6vipday2.ipdb")

    print(db.find("2001:44c8:4644:1191:3c41:724d:e391:51b0", "CN"))
    print(db.find_map("2a04:3543:1000:2310:ecb3:3eff:fef0:20e1", "CN"))
    print(db.find_info("2a04:3543:1000:2310:ecb3:3eff:fef0:20e1", "CN").country_name)
github ipipdotnet / ipdb-python / example.py View on Github external
def test_city_ipv6():
    db4 = ipdb.City("c:/tiantexin/download/mydata4vipday4_cn.ipdb")
    db = ipdb.City("c:/work/ipdb/mydata6vipday2.ipdb")

    df = pd.read_csv("C:\\Users\\GAOCHUNHUI\\Documents\\WeChat Files\\daxime\\FileStorage\\File\\2019-10\\ipiptest\\ip_data.csv")
    for i, row in df.iterrows():
        if ipaddress.ip_address(row['request_ip']).version == 4:

            db4.find(row['request_ip'], "CN")
        else:
            print(db.find(row['request_ip'], "CN"), row['request_ip'])

    try:
        print(db.find("2000:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", "CN"))
    except Exception as e:
        print(e)
github ipipdotnet / ipdb-python / example.py View on Github external
def test_city_ipv4():
    db = ipdb.City("c:/tiantexin/download/mydata4vipday4_cn.ipdb")
    print(db.is_ipv4(), db.is_ipv6())
    print(db.languages())
    print(db.fields())
    print(db.build_time())
    print(db.find("1.1.1.1", "CN"))
    print(db.find_map("8.8.8.8", "CN"))
    print(db.find_info("118.28.1.1", "CN").country_name)
github ipipdotnet / ipdb-python / example.py View on Github external
def test_city_ipv6():
    db4 = ipdb.City("c:/tiantexin/download/mydata4vipday4_cn.ipdb")
    db = ipdb.City("c:/work/ipdb/mydata6vipday2.ipdb")

    df = pd.read_csv("C:\\Users\\GAOCHUNHUI\\Documents\\WeChat Files\\daxime\\FileStorage\\File\\2019-10\\ipiptest\\ip_data.csv")
    for i, row in df.iterrows():
        if ipaddress.ip_address(row['request_ip']).version == 4:

            db4.find(row['request_ip'], "CN")
        else:
            print(db.find(row['request_ip'], "CN"), row['request_ip'])

    try:
        print(db.find("2000:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", "CN"))
    except Exception as e:
        print(e)
github ipipdotnet / ipdb-python / example.py View on Github external
def test_free():
    db = ipdb.City("c:/work/ipdb/mydata4vipweek2.ipdb")
    print(db.is_ipv4(), db.is_ipv6())
    print(db.languages())
    print(db.fields())
    print(db.build_time())
    print(db.find("1.1.1.1", "CN"))

    print("ipdb reload", db.reload("c:/work/ipdb/city.free.ipdb"))
    print(db.find("118.28.1.1", "CN"))


    try:
        print(db.find("2000:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", "CN"))
    except Exception as e:
        print(e)