Sign in to follow this  
Followers 0
Zer0Velocity

ip range list

7 posts in this topic

Hey all, I have a IP range list which I would like to output the possible IP's in the range to another text. I'm hoping someone can help me.

Example of first 2 IP ranges in the text file.

109.104.32-63.0-255
109.109.0-31.0-255

Share this post


Link to post
Share on other sites



What is the input and what is the output?

Please post example

Share this post


Link to post
Share on other sites

You mean

109.104.32-63.0-255

should become

109.104.32.0
... 
109.104.32.255 
...
109.104.33.0
...
109.104.33.255 
...
...
109.104.63.255

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Something like this?

Global $sIP = "109.104.32-63.0-255"
Global $aiIP = StringSplit($sIP, ".")
Global $aiIP1 = StringSplit($aiIP[1], "-")
If @error Then
    $iEnd1 = $aiIP1[1]
Else
    $iEnd1 = $aiIP1[2]
EndIf
$iStart1 = $aiIP1[1]
Global $aiIP2 = StringSplit($aiIP[2], "-")
If @error Then
    $iEnd2 = $aiIP2[1]
Else
    $iEnd2 = $aiIP2[2]
EndIf
$iStart2 = $aiIP2[1]
Global $aiIP3 = StringSplit($aiIP[3], "-")
If @error Then
    $iEnd3 = $aiIP3[1]
Else
    $iEnd3 = $aiIP3[2]
EndIf
$iStart3 = $aiIP3[1]
Global $aiIP4 = StringSplit($aiIP[4], "-")
If @error Then
    $iEnd4 = $aiIP4[1]
Else
    $iEnd4 = $aiIP4[2]
EndIf
$iStart4 = $aiIP4[1]
For $iIndex1 = $iStart1 To $iEnd1
    For $iIndex2 = $iStart2 To $iEnd2
        For $iIndex3 = $iStart3 To $iEnd3
            For $iIndex4 = $iStart4 To $iEnd4
                ConsoleWrite($iIndex1 & "." &  $iIndex2 & "." & $iIndex3 & "." & $iIndex4 & @LF)
            Next
        Next
    Next
Next

Results in

109.104.32.0
109.104.32.1
109.104.32.2
...
109.104.32.255
109.104.33.0
...
109.104.33.255
...
109.104.63.255

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I wrote a general purpose >multiping utility/udf that, among other things, it can also generate a list of IP starting from ranges passed in the the shape that you're asking. (but not only)

Here an example:

#include <multiping.au3>
#include <array.au3>

$MyRange = _GetIpAddressList("109.104.32-63.0-255")

_ArrayDisplay($MyRange)

>here you can find Multiping.au3


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

I wrote a general purpose >multiping utility/udf that, among other things, it can also generate a list of IP starting from ranges passed in the the shape that you're asking. (but not only)

Here an example:

#include <multiping.au3>
#include <array.au3>

$MyRange = _GetIpAddressList("109.104.32-63.0-255")

_ArrayDisplay($MyRange)

>here you can find Multiping.au3

 

I just tested the udf and so far it seems to be working brill. Thank you for pointing me to this. And thank you all for helping  :thumbsup:

Share this post


Link to post
Share on other sites

;)


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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