• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Batch: If the IP is in the IP range

Be a kicker than cheater.
Joined
Dec 17, 2009
Messages
733
Reaction score
26
I don't know how to make a code lines for checking "if an IP Address is in the IP range"

I know it might need VBS (file) language or something, please help me.

This is the example of IP range (IP/mask):
162.158.0.0/15
 
Last edited:
Junior Spellweaver
Joined
Jun 1, 2018
Messages
105
Reaction score
40
I don't know how to make a code lines for checking if IP is in the IP range

I know it need VBS file/code, please help me.

This is the example of IP range (IP/mask):
162.158.0.0/15
You could use an enum to declare reserved IP's such as 127.0.0.1 and 000.000.000 etc.
Then you could read the IP you need to check as a string, split it around "." and stick the segments into an array, then check that each part is between 0 and 255 as those are the valid values of an IPv4 address.
Obviously this is a very generic way to solve the problem and many languages like Java and C# will have built in tools for this that may prove to be easier.
 
Back
Top