@@ -256,6 +256,8 @@ http://webstersprodigy.net
256256
257257 [String []] $iHosts = $Hosts.Split (" ," )
258258
259+ $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}"
260+
259261 foreach ($iHost in $iHosts )
260262 {
261263 $iHost = $iHost.Replace (" " , " " )
@@ -309,6 +311,65 @@ http://webstersprodigy.net
309311
310312 }
311313
314+ }
315+
316+ if ($iHost -match $IPRangeRegex )
317+ {
318+
319+ $iHostPart1 = ($iHost.Split (" -" ))[0 ]
320+ $iHostPart2 = ($iHost.Split (" -" ))[1 ]
321+
322+ $LowerBound = $iHostPart1.Split (" ." )
323+ $UpperBound = $iHostPart2.Split (" ." )
324+
325+ $LowerBoundInt = ($LowerBound [0 ].ToInt32($null ), $LowerBound [1 ].ToInt32($null ), $LowerBound [2 ].ToInt32($null ), $LowerBound [3 ].ToInt32($null ))
326+ $UpperBoundInt = ($UpperBound [0 ].ToInt32($null ), $UpperBound [1 ].ToInt32($null ), $UpperBound [2 ].ToInt32($null ), $UpperBound [3 ].ToInt32($null ))
327+
328+ $CurrentIP = $LowerBoundInt
329+ $CurrentIPString = $null
330+ $ControlArray = @ (0 , 0 , 0 , 0 )
331+
332+ $null = $hostList.Add ($iHostPart1 )
333+
334+ while ($CurrentIPString -ne $iHostPart2 )
335+ {
336+ for ($i = 0 ;$i -lt 4 ;$i ++ )
337+ {
338+
339+ if (($CurrentIP [$i ] -eq $UpperBoundInt [$i ]) -and (($i -eq 0 ) -or $ControlArray [$i - 1 ] -eq 1 ))
340+ {
341+ $ControlArray [$i ] = 1
342+ continue
343+ }
344+ else
345+ {
346+
347+ $Max = 254
348+ if (($i -ne 0 ) -and ($ControlArray [$i - 1 ] -eq 1 ))
349+ {
350+ $Max = $UpperBoundInt [$i ]
351+ }
352+
353+ if (($i -ne 3 ) -and ($CurrentIP [$i + 1 ] -eq 254 ))
354+ {
355+ $CurrentIP [$i ]++
356+ $CurrentIP [$i + 1 ]= 0
357+
358+ $CurrentIPString = ($CurrentIP [0 ].ToString() + " ." + $CurrentIP [1 ].ToString() + " ." + $CurrentIP [2 ].ToString() + " ." + $CurrentIP [3 ].ToString())
359+ $null = $hostList.Add ($CurrentIPString )
360+ }
361+
362+ if (($i -eq 3 ) -and ($CurrentIP [$i ] -lt $Max ))
363+ {
364+ $CurrentIP [$i ]++
365+
366+ $CurrentIPString = ($CurrentIP [0 ].ToString() + " ." + $CurrentIP [1 ].ToString() + " ." + $CurrentIP [2 ].ToString() + " ." + $CurrentIP [3 ].ToString())
367+ $null = $hostList.Add ($CurrentIPString )
368+ }
369+ }
370+ }
371+ }
372+
312373 }
313374 else
314375 {
0 commit comments