Get college/university from ip address
Asked Answered
N

2

6

I have a list of ip addresses many of which will be from a university network. What is the best way to find out which universities are in this list?

Nevis answered 24/4, 2014 at 17:8 Comment(0)
S
10

You could use http://ipinfo.io (a service I built) for this. Here's some example output from the API:

$ curl ipinfo.io/128.32.0.1 
{
    "ip": "128.32.0.1",
    "hostname": "No Hostname",
    "city": "Berkeley",
    "region": "California",
    "country": "US",
    "loc": "37.8668,-122.2536",
    "org": "AS25 University of California at Berkeley",
    "postal": "94720"
}

Notice the org field, "AS25 University of California at Berkeley". You can get just those details by appending /org to the URL:

$ curl ipinfo.io/128.32.0.1/org
AS25 University of California at Berkeley

You can do a bulk lookup of your IP addresses by putting them in a file and running the following command:

$ cat ips.txt | xargs -I% curl -s http://ipinfo.io/%/org | paste ips.txt -
128.32.0.1  AS25 University of California at Berkeley
128.62.76.244   AS18 University of Texas at Austin
24.32.142.2 AS7018 AT&T Services, Inc.
171.64.84.194   AS32 Stanford University
18.9.44.47  AS3 Massachusetts Institute of Technology
67.188.232.130  AS7922 Comcast Cable Communications, Inc.

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

Suds answered 6/8, 2014 at 21:10 Comment(0)
O
1

Universities and colleges used to be their own Internet Service Provider (ISP) and you should be able to get these universities.

I played with a world uinversity names database collected from LinkedIn and Webometric and with an old IP-ISP database I had under my hand (dating from 2012) to get a list of about 5800 universities / colleges.

The list is probably not exhaustive because the name of the IP-ISP database may differs from the university names database and because the IP-ISP database could be a bit outdated.

But, it should be a good start if you don't want to use any API.

Then, you should be able to do something similar to:

SELECT * FROM `isp_universities`
WHERE INET_ATON('192.16.181.4')
BETWEEN from_dec AND to_dec

to obtain:

192.16.181.0 to 192.16.181.255
Massachusetts Institute of Technology
http://www.mit.edu/

Take a look here, I pushed the database on Bitbucket.

Otho answered 12/11, 2014 at 6:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.