Closed postmodern closed 9 months ago
Is it still something that you want to do by yourself or can I try to do it?
@AI-Mozi I'm a little nervous about writing the regex to matching nmap style IP glob-ranges (ex: 1.2.3-4.*
). That is going to be really hard.
Ok, I'll leave it to you then :D
I wrote the Regexs to identify a glob range, however ran into some spec failures when changing Values::IPRange#range
to be a Ronin::Support::Network::IPRange
. Values::IPRange#===
may be given another Values::IPRange
, in which case it has to identify if the other range is a sub-set of the Values::IPRange#range
. However, Ronin::Support::Network::IPRange#include?
expects to only be given an individual IP address, not another range. I may have to add a Ronin::Support::Network::IPRange#===
to determine if two IP ranges intersect? Trying to compare IP CIDR ranges with IP glob ranges might get complex or inefficient really fast.
The only place where we actually compare one Values::IPRange
to another Values::IPRange
using Values::IPRange#===
is if the Engine
is given a Values::IPRange
value and Scope#ignore
contains a different Values::IPRange
to ignore.
A general way to determine if one IP range is a sub-set of another IP range, would be range1.include?(range2.first) && range1.include?(range2.last)
. However, calling range2.last
on a Ronin::Support::Network::IPRange::Glob
would require enumerating the IP glob and generating each IP in the glob range.
Use
Ronin::Support::Network::IPRange
instead ofIPAddr
to parse the given IP range String.Ronin::Support::Network::IPRange
supports both CIDR ranges (ex:192.168.1.1/24
) andnmap
glob-ranges (ex:192.168.1-4.*
).This will entail adding a
Values::IPRange.parse
method which accepts aString
and passes it toSupport::Network::IPRange.parse
before callingnew()
.Value::Parser
will also need to be updated to recognize both CIDR ranges and IP-glob ranges and callValues::IPRange.parse
, instead ofValues::IPRange.new
.