Page MenuHomePhabricator

Automated smallest-CIDR calculation from within Checkuser UI
Closed, ResolvedPublic

Description

Author: mapellegrini

Description:
There should be a feature within the checkuser interface to automatically calculate the smallest CIDR necessary to block some given set of IPs. Manually calculating it is time-consuming and error-prone.


Version: unspecified
Severity: enhancement

Details

Reference
bz17018

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:24 PM
bzimport added a project: CheckUser.
bzimport set Reference to bz17018.

Can any of the IPs in the list be a CIDR?

mike.lifeguard+bugs wrote:

(In reply to comment #0)

There should be a feature within the checkuser interface to automatically
calculate the smallest CIDR necessary to block some given set of IPs. Manually
calculating it is time-consuming and error-prone.

There is a tool on the toolserver you can use until this is done: http://toolserver.org/~chm/blockcalc.php

(In reply to comment #1)

Can any of the IPs in the list be a CIDR?

Won't be too hard actually. Almost finished with the JS (for IPv4)

mike.lifeguard+bugs wrote:

(In reply to comment #4)

Done in r47226

Any chance you could have this filter out only valid IPs/ranges from copy-pasted text akin to the tool linked in comment 2? This just makes it easier to copy and paste stuff from results (or page history or whatever) without having to manually make sure you've got only the IPs.

I tested copy-pasting the auto-WHOIS JS tool output and such when I wrote it. If there is another type of output that it doesn't filter out, you should paste out a sample so I know what to tweak.

mike.lifeguard+bugs wrote:

(In reply to comment #6)

I tested copy-pasting the auto-WHOIS JS tool output and such when I wrote it.
If there is another type of output that it doesn't filter out, you should paste
out a sample so I know what to tweak.

I think it was version numbers from the UA: 2.0.4.16 for example. It looks like an IP, but really that's not valid: http://toolserver.org/~chm/whois.php?ip=2.0.4.16

& forgot to reopen this previously.

(In reply to comment #7)

(In reply to comment #6)

I tested copy-pasting the auto-WHOIS JS tool output and such when I wrote it.
If there is another type of output that it doesn't filter out, you should paste
out a sample so I know what to tweak.

I think it was version numbers from the UA: 2.0.4.16 for example. It looks like
an IP, but really that's not valid:
http://toolserver.org/~chm/whois.php?ip=2.0.4.16

& forgot to reopen this previously.

I'm not sure how simple it is to check for that.

Various fixes in r51179. Some reserved IPs treated as such.