# Add IP info lookup for Admins

**URL:** <https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626>\
**Category:** Feature\
**Tags:** rfc, spec\
**Created:** [2014年五月14日 07:13 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626 "2014-05-14T07:13:11Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2014年五月14日 07:13 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/1 "2014-05-14T07:13:12Z")

</div>

I propose adding a “lookup” button next to most IP addresses in user fields that are visible to admins:

![](https://global.discourse-cdn.com/meta/original/2X/7/7f011278cdfae0efa72bcb34f8a5b6cbca2f3d71.png)

Clicking the lookup button would pop up a dynamically queried box that shows a spinner, which will populate with additional lookup info about that IP as the data arrives, e.g.

![](https://global.discourse-cdn.com/meta/original/2X/f/fab53e3f42236e7e4f7b3d935c7df59c8072124a.png)

We can start simple with just the top 3 here:

> 1. Geolocation info for this IP, with Google Maps link
> 2. reverse DNS lookup info for this IP
> 3. lookup other accounts sharing this IP
> 4. query server logs for this IP
> 5. query flags filed against this IP
> 
> etc, whatever else it makes sense to query or show for an IP

This way if you have a sketchy user, you can verify where they’re coming from.

---

<div class="post-metadata">

**Author:** ![lightyear](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lightyear](https://meta.discourse.org/u/lightyear)\
**Post date:** [2014年五月14日 07:32 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/2 "2014-05-14T07:32:00Z")

</div>

Unless we do the lookup at the time of creation, the geolocation could’ve changed no? Is there a way to do a lookup of an IP for the past?

![](https://global.discourse-cdn.com/meta/original/2X/6/60735783036309f9f619b0c69a51915f96828f5a.gif)

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2014年五月14日 07:34 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/3 "2014-05-14T07:34:03Z")

</div>

It says “Last IP address”. That’s where we last saw them. So what’s the issue, again?

---

<div class="post-metadata">

**Author:** ![lightyear](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lightyear](https://meta.discourse.org/u/lightyear)\
**Post date:** [2014年五月14日 08:07 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/4 "2014-05-14T08:07:25Z")

</div>

Yes, sure the last IP. But if you’d query for the GEO-Data of the IP, lets say a day later, when the user clicks on it, most services will give you the geoposition of it right now (not where it has been when we registered it). I was just wondering whether we want to take that into account, query at the time of registration for the data or whether there are services that keep a record we can look up at.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2014年五月14日 08:24 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/5 "2014-05-14T08:24:19Z")

</div>

This seems like extreme hair-splitting, considering what we have now is _nothing_.

---

<div class="post-metadata">

**Author:** ![lightyear](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lightyear](https://meta.discourse.org/u/lightyear)\
**Post date:** [2014年五月14日 08:44 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/6 "2014-05-14T08:44:15Z")

</div>

Oh, don’t misunderstand my request as critique please. I am totally up for it. That was merely an implementation detail question out of curiosity.

---

<div class="post-metadata">

**Author:** ![coderholic](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/coderholic/32/108825_2.png) [@coderholic](https://meta.discourse.org/u/coderholic)\
**Post date:** [2014年五月14日 14:05 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/7 "2014-05-14T14:05:13Z")

</div>

IP locations don’t change that frequently, and even less frequently at the country level, so looking up the current geolocation details is probably going to be OK.

To get this up and running quickly you could use the [http://ipinfo.io](http://ipinfo.io) API, which gives you a bunch of different details:

```
$ curl ipinfo.io/67.188.232.130
{
  "ip": "67.188.232.130",
  "hostname": "c-67-188-232-130.hsd1.ca.comcast.net",
  "city": "Mountain View",
  "region": "California",
  "country": "US",
  "loc": "37.4192,-122.0574",
  "org": "AS7922 Comcast Cable Communications, Inc.",
  "postal": "94043"
}

```

---

<div class="post-metadata">

**Author:** ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)\
**Post date:** [2014年五月14日 17:25 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/8 "2014-05-14T17:25:13Z")

</div>

Oh wow, it includes the AS number? That could be useful for detecting cheap proxies.

Here’s what it returns for my droplet in the SF cluster:

```plaintext
curl ipinfo.io/107.170.242.76
{
  "ip": "107.170.242.76",
  "hostname": "hello.from.riking.org",
  "city": "New York",
  "region": "New York",
  "country": "US",
  "loc": "40.7267,-73.9981",
  "org": "AS14061 Digital Ocean, Inc.",
  "postal": "10012"
}

```

Yeah, “Digital Ocean” is _way_ more useful than “New York” there.

And my current location on campus WiFi:

```plaintext
{
  "ip": "129.65.150.6",
  "hostname": "pcp069467pcs.wireless.calpoly.edu",
  "city": "San Luis Obispo",
  "region": "California",
  "country": "US",
  "loc": "35.3471,-120.4553",
  "org": "AS2152 California State University Network",
  "postal": "93407"
}

```

Again, AS number is really useful!

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2014年五月14日 19:01 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/9 "2014-05-14T19:01:42Z")

</div>

Well, if you want to work on this @riking be my guest 😉

---

<div class="post-metadata">

**Author:** ![lightyear](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lightyear](https://meta.discourse.org/u/lightyear)\
**Post date:** [2014年六月3日 09:46 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/10 "2014-06-03T09:46:21Z")

</div>

Is anyone on this? @riking, @coderholic, @codinghorror? Otherwise I’d volunteer to work on it (this week).

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2014年六月3日 10:55 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/11 "2014-06-03T10:55:35Z")

</div>

Nobody is working on this, feel free to give it a shot. Also any bugs, bugs are our top priority at the moment. (hence I am slowing down on PR review work)

---

<div class="post-metadata">

**Author:** ![lightyear](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lightyear](https://meta.discourse.org/u/lightyear)\
**Post date:** [2014年六月3日 17:41 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/12 "2014-06-03T17:41:18Z")

</div>

@sam, I see, thanks for the heads-up. Running through that category now and let me know if there is anything I can help with.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2014年六月3日 18:56 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/13 "2014-06-03T18:56:03Z")

</div>

I would personally very much like to see this added!

---

<div class="post-metadata">

**Author:** ![lightyear](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lightyear](https://meta.discourse.org/u/lightyear)\
**Post date:** [2014年六月15日 17:11 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/14 "2014-06-15T17:11:48Z")

</div>

As promised:

[https://github.com/discourse/discourse/pull/2446](https://github.com/discourse/discourse/pull/2446)

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2014年六月18日 08:52 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/15 "2014-06-18T08:52:47Z")

</div>

@lightyear this looks great. Copy added. 👍 The accounts with same IP is a _huge, huge_ help.

Thank you. Big step forward.

---

<div class="post-metadata">

**Author:** ![lightyear](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lightyear](https://meta.discourse.org/u/lightyear)\
**Post date:** [2014年六月18日 08:53 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/16 "2014-06-18T08:53:40Z")

</div>

always a pleasure. Do I get pinned global banner topics now 😃 ?

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2014年六月18日 08:57 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/17 "2014-06-18T08:57:27Z")

</div>

ask @zogstrip he is working on it.

The bulk of this, and the important parts, are definitely all there now. The only bits left are:

1. query flags filed against this IP
2. query server logs for this IP

I’ll leave this open in case anyone wants to take those.

---

<div class="post-metadata">

**Author:** ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)\
**Post date:** [2014年六月18日 18:15 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/18 "2014-06-18T18:15:08Z")

</div>

> [@lightyear](#):
>
> Do I get pinned global banner topics now ?

[Yes, sir!](https://github.com/discourse/discourse/commit/00117c18c3c7838d89be8e0cf18da1bb2f01bd17)

 ![](https://global.discourse-cdn.com/meta/original/3X/b/8/b8ade5463e0841133a1546e4093342c73c411e19.jpg "SIR, YES SIR!")

---

<div class="post-metadata">

**Author:** ![lightyear](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lightyear](https://meta.discourse.org/u/lightyear)\
**Post date:** [2014年六月18日 18:42 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/19 "2014-06-18T18:42:57Z")

</div>

![](https://global.discourse-cdn.com/meta/original/3X/3/3/33f4580efa5d7909fe1b37e12087189fe3fddb00.gif)

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2014年六月23日 08:08 UTC](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626/20 "2014-06-23T08:08:08Z")

</div>

@lightyear I noticed this does not work at all for IPV6, e.g. this:

 ![](https://global.discourse-cdn.com/meta/original/3X/4/2/42f6a66e6b83ab3424116190811d5014e098de49.png) 

Any comment @supermathie?

[下一頁](https://meta.discourse.org/t/add-ip-info-lookup-for-admins/15626.md?page=2)
