@@ -262,6 +262,8 @@ http://webstersprodigy.net
262262
263263 [String []] $iHosts = $Hosts.Split (" ," )
264264
265+ $IPRangeRegex = " \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}-\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"
266+
265267 foreach ($iHost in $iHosts )
266268 {
267269 $iHost = $iHost.Replace (" " , " " )
@@ -315,6 +317,65 @@ http://webstersprodigy.net
315317
316318 }
317319
320+ }
321+
322+ if ($iHost -match $IPRangeRegex )
323+ {
324+
325+ $iHostPart1 = ($iHost.Split (" -" ))[0 ]
326+ $iHostPart2 = ($iHost.Split (" -" ))[1 ]
327+
328+ $LowerBound = $iHostPart1.Split (" ." )
329+ $UpperBound = $iHostPart2.Split (" ." )
330+
331+ $LowerBoundInt = ($LowerBound [0 ].ToInt32($null ), $LowerBound [1 ].ToInt32($null ), $LowerBound [2 ].ToInt32($null ), $LowerBound [3 ].ToInt32($null ))
332+ $UpperBoundInt = ($UpperBound [0 ].ToInt32($null ), $UpperBound [1 ].ToInt32($null ), $UpperBound [2 ].ToInt32($null ), $UpperBound [3 ].ToInt32($null ))
333+
334+ $CurrentIP = $LowerBoundInt
335+ $CurrentIPString = $null
336+ $ControlArray = @ (0 , 0 , 0 , 0 )
337+
338+ $null = $hostList.Add ($iHostPart1 )
339+
340+ while ($CurrentIPString -ne $iHostPart2 )
341+ {
342+ for ($i = 0 ;$i -lt 4 ;$i ++ )
343+ {
344+
345+ if (($CurrentIP [$i ] -eq $UpperBoundInt [$i ]) -and (($i -eq 0 ) -or $ControlArray [$i - 1 ] -eq 1 ))
346+ {
347+ $ControlArray [$i ] = 1
348+ continue
349+ }
350+ else
351+ {
352+
353+ $Max = 254
354+ if (($i -ne 0 ) -and ($ControlArray [$i - 1 ] -eq 1 ))
355+ {
356+ $Max = $UpperBoundInt [$i ]
357+ }
358+
359+ if (($i -ne 3 ) -and ($CurrentIP [$i + 1 ] -eq 254 ))
360+ {
361+ $CurrentIP [$i ]++
362+ $CurrentIP [$i + 1 ]= 0
363+
364+ $CurrentIPString = ($CurrentIP [0 ].ToString() + " ." + $CurrentIP [1 ].ToString() + " ." + $CurrentIP [2 ].ToString() + " ." + $CurrentIP [3 ].ToString())
365+ $null = $hostList.Add ($CurrentIPString )
366+ }
367+
368+ if (($i -eq 3 ) -and ($CurrentIP [$i ] -lt $Max ))
369+ {
370+ $CurrentIP [$i ]++
371+
372+ $CurrentIPString = ($CurrentIP [0 ].ToString() + " ." + $CurrentIP [1 ].ToString() + " ." + $CurrentIP [2 ].ToString() + " ." + $CurrentIP [3 ].ToString())
373+ $null = $hostList.Add ($CurrentIPString )
374+ }
375+ }
376+ }
377+ }
378+
318379 }
319380 else
320381 {
0 commit comments