Determining company name from IP address

后端 未结 4 1898
执笔经年
执笔经年 2021-02-01 10:06

I apologize for the broad question. But I have a list of IP addresses, and would like to connect them to the companies they came from.

I\'m not interested in identifyin

4条回答
  •  独厮守ぢ
    2021-02-01 10:20

    The http://ipinfo.io API (my own service) returns the company name as the org field:

    $ curl http://ipinfo.io/198.252.206.16
    {
      "ip": "198.252.206.16",
      "hostname": "stackoverflow.com",
      "city": null,
      "region": null,
      "country": "US",
      "loc": "38.0000,-97.0000",
      "org": "AS25791 Stack Exchange, Inc."
    }
    

    You can get just that field by adding /org to the URL:

    $ curl http://ipinfo.io/198.252.206.16/org
    AS25791 Stack Exchange, Inc.
    

    You can combine this with some other commands to do a bulk lookup of all of your IPs and see what company they belong to:

    $ cat ips.txt | xargs -I% curl -s http://ipinfo.io/%/org | paste ips.txt -
    198.252.206.16  AS25791 Stack Exchange, Inc.
    173.252.110.27  AS32934 Facebook, Inc.
    74.125.239.132  AS15169 Google Inc.
    206.190.36.45   AS36647 Yahoo
    

    You can find out more details about the API at http://ipinfo.io/developers.

提交回复
热议问题