vickerps Posted April 29, 2008 Share Posted April 29, 2008 Hi has anyone wrote a script that will calculate IP by a given number for example 10.0.0.1 + 64 = 10.0.0.65 +64 = 10.0.0.129 +64 = 10.0.0.193 at this point i need it to start again but to increment the third octet to 1 for example 10.0.1.1 + 64 = 10.0.1.65 +64 = 10.0.1.129 +64 = 10.0.1.193 etc ,etc Link to comment Share on other sites More sharing options...
AzKay Posted April 29, 2008 Share Posted April 29, 2008 For $i = 0 To 3 ConsoleWrite("10.0.1." & $i*64 & @CRLF) Next I dont know. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
spudw2k Posted April 29, 2008 Share Posted April 29, 2008 (edited) Here's something I threw together. It's not perfect, but may do what you want. It will only increase the 3rd and 4th octets. #include <Array.au3> ;IPRange(start ip address,end ip address,step) $result = IPRange("10.0.0.1","10.0.1.254",64) _ArrayDisplay($result) Func IPRange($ipAddr,$lastip,$step = 1) Dim $iparr[1] $ip = StringSplit($ipAddr,".") $orgip = StringSplit($ipAddr,".") $endip = StringSplit($lastip,".") If $ip[0] = 0 Or $endip[0] = 0 Then Return 0 Do Do Do Do _ArrayAdd($iparr,$ip[1] & "." & $ip[2] & "." & $ip[3] & "." & $ip[4]) $ip[4] += $step Until $ip[4] > 254 $ip[4] = $orgip[4] $ip[3] += 1 Until $ip[3] > $endip[3] Until $ip[2] >= $endip[2] And $ip[3] >= $endip[3] Until $ip[1] >= $endip[1] And $ip[2] >= $endip[2] And $ip[3] >= $endip[3] $iparr[0] = UBound($iparr) - 1 Return $iparr EndFunc Edited April 29, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now