• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 Can we search for partial IP addresses?

Rudy

Well-known member
#1
Is there a way to search for partial IP addresses? Some of the staff uses it to cross-check suspicious members. I tried a wildcard (like 127.0.0.*) and that didn't work, and neither did entering just a partial bit of the address (127.0.0).

Could this be because of the way the IP address is stored?
 

Kent

Active member
#2
I don't think there is a way to do that, but you can use a query:
Code:
SELECT `xf_user`.`username`
FROM `xf_ip`
JOIN `xf_user` ON (`xf_user`.`user_id` = `xf_ip`.`user_id`)
WHERE `ip` >= INET_ATON('86.17.48.0') AND `ip` <= INET_ATON('86.17.63.255')
GROUP BY `xf_ip`.`user_id`
LIMIT 100;
I'm not sure how this query may perform on larger databases. With 100 results this query took 0.78 seconds on my database with 1216900 rows.

XenForo stores IP addresses a number, so this searches inclusively from 1443966976 to 1443971071.

These may also help you:
https://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xml

https://www.arin.net/
https://www.ripe.net/
https://www.apnic.net/
https://lacnic.net/en/
https://www.afrinic.net/
 

Rudy

Well-known member
#3
The staff needs the ability to search the membership for partial IP addresses--that's what I'm looking for. It's likely not available as of yet?
 

Rudy

Well-known member
#5
This sounds like a good idea for a feature request. I wanted to be sure it wasn't already available before I submitted it. Thanks!

I don't think any forum moderation staff is going to know how to run queries, or have the permissions to... ;)