Detect ISP (or/and country) by IP Address

2019-02-17 06:42发布

There are plenty of services over the Internet where we can find out the external IP address of our machine, but also such services usually provide information about Internet provider or country (or both).

So my question is: how can I obtain such information programmatically knowing the IP Address? Are there some public catalogs or some API's for retrieving such kind of information?

标签: ip
6条回答
兄弟一词,经得起流年.
2楼-- · 2019-02-17 07:06

Maxmind's GeoLite Legacy Downloadable Databases contain ASN for IPv4 and IPv6 at:

http://dev.maxmind.com/geoip/legacy/geolite/

Both binary and CSV data formats are available to download for free. A CSV entry may look like this:

2383101952,2383116287,"AS20001 Time Warner Cable Internet LLC"

The first two fields are IP address range in decimal. The last field contains the ASN and the entity name.

Alternatively, Internet-Wide Scan Data Repository (which recently launched Censys with free online search and API) includes a regular DNS lookup for all IPv4 PTR records at:

https://scans.io/study/sonar.rdns

The freely downloadable CSV file contains entries such as:

99.99.99.90,adsl-99-99-99-90.dsl.lsan03.sbcglobal.net

The first field is the IP and the second field is the host name which you may be able to use to infer ISP.

查看更多
迷人小祖宗
3楼-- · 2019-02-17 07:08

Technology is progressing. After reviewing your question 6 years later, IP2Location is providing country, region or state, city, latitude and longitude, ZIP code, time zone, Internet Service Provider (ISP) or company name, domain name, net speed, area code, weather station code, weather station name, mobile country code (MCC), mobile network code (MNC) and carrier brand, elevation, usage type, proxy detection and types from IP address.

查看更多
Ridiculous、
4楼-- · 2019-02-17 07:13

Try the ipdata.co API. It provides a lot more data on the IP address and is also extremely scalable. i.e. it has 10 global endpoints each of which can handle >800M calls a day!

Example;

curl https://api.ipdata.co/70.70.70.70
{
    "ip": "70.70.70.70",
    "city": "",
    "region": "",
    "region_code": "",
    "country_name": "Canada",
    "country_code": "CA",
    "continent_name": "North America",
    "continent_code": "NA",
    "latitude": 43.6319,
    "longitude": -79.3716,
    "asn": "AS6327",
    "organisation": "Shaw Communications Inc.",
    "postal": "",
    "currency": "CAD",
    "currency_symbol": "$",
    "calling_code": "1",
    "flag": "https://ipdata.co/flags/ca.png",
    "emoji_flag": "\ud83c\udde8\ud83c\udde6",
    "time_zone": "",
    "is_eu": false,
    "suspicious_factors": {
        "is_tor": false
    }
}⏎ 
查看更多
仙女界的扛把子
5楼-- · 2019-02-17 07:18

Check out the GeoIP database by Maxmind. It's free and I've been using it in many of my java applications.

see http://dev.maxmind.com/geoip/geoip2/geolite2/

查看更多
SAY GOODBYE
6楼-- · 2019-02-17 07:23

You can use my service, the http://ipinfo.io API. Here's an example of the details it provides:

$ curl ipinfo.io
{
  "ip": "67.188.232.131",
  "hostname": "c-67-188-232-131.hsd1.ca.comcast.net",
  "city": "Milpitas",
  "region": "California",
  "country": "US",
  "loc": "37.44040000000001,-121.87049999999999",
  "org": "AS7922 Comcast Cable Communications, Inc.",
  "postal": "95035",
  "phone": 408
}

See http://ipinfo.io/developers for more information.

查看更多
走好不送
7楼-- · 2019-02-17 07:24

use this http://ip-api.com/json/[ip address] example: http://ip-api.com/json/113.14.168.85

output:

{"as":"AS4134 Chinanet","city":"Nanning","country":"China","countryCode":"CN","isp":"China Telecom","lat":22.8167,"lon":108.3167,"org":"China Telecom","query":"113.14.168.85","region":"45","regionName":"Guangxi Zhuangzu Zizhiqu","status":"success","timezone":"Asia/Shanghai","zip":""}
查看更多
登录 后发表回答