Scan IP matched accounts

I know in the user admin we can see if there is another account on a IP address when you click the registered IP or last login IP, can we also see all users that have been matched with double IP’s instead of checking all my users one by one?

1 Like

Here’s a data explorer query. It’d be better if it did a group by so that it could sort by most-recent-create-date or something like that, but maybe this’ll help.

WITH users_per_ip AS (
SELECT
count(1) AS user_count,
u.registration_ip_address AS ip,
max(u.created_at) last_create,
min(u.created_at) first_create,
(max(u.created_at) - min(u.created_at)) diff,
case when (max(u.suspended_at) is not null 
      or max(u.silenced_till) is not null )
      then 1 else 0 end bad
FROM users u
GROUP BY ip
)

SELECT
u.id AS user_id,
date_trunc('day',u.created_at)::date created,
date_trunc('day',upi.diff) days,
bad,
upi.ip AS ip_address
FROM users_per_ip upi
JOIN users u
ON u.registration_ip_address = upi.ip
WHERE upi.user_count > 1
ORDER BY upi.last_create DESC
7 Likes

This seems to be working fine for me, didn’t know about Data Explorer Plugin at all… Thanks!

4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.