Sign in to follow this  
Followers 0
EndFunc

Compare IPaddresses

4 posts in this topic

I can't figure out how you would compare an IPAddress of a machine to a range or subnet it belongs to. Maybe someone can shed some light?


EndFuncAutoIt is the shiznit. I love it.

Share this post


Link to post
Share on other sites



Hi,

where is the problem? Just compare the numbers.

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Hi,

where is the problem? Just compare the numbers.

So long,

Mega

I guess I can do single IP's but wasn't sure how to do a range if it was possible.


EndFuncAutoIt is the shiznit. I love it.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I guess I can do single IP's but wasn't sure how to do a range if it was possible.

im doing the exact same thing.

without giving you my source (which is being used in a bigger project), the way i went about it was;

1) split @ipaddress1 into four different variables (i put them into an array)

you can do this with a for..then loop and stringmid()

2) big 'if..then' or 'case..select' blocks to determine where the user is running the program from

ie.

if $octetarray[0]="10" then

if $octetarray[1]="56" then

if $octetarray[2]="62" then $location = "... Area Office"

and for subnetting where more than one network is on the one c class (ie. network 1 is 100.10.10.1-127, network 2 is 100.10.10.128-254)

if $octetarray[3]=>96 AND $octetarray[3]=<126 then $location="... District"

if $octetarray[3]=>160 AND $octetarray[3]=<174 then $location="... Campus"

hope this helps..

Edited by logik

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0