It looks like you're new here. If you want to get involved, click one of these buttons!
<?php
set_time_limit(0);
$errorArr = array();
if (!isset($argv[1]))
{
array_push($errorArr, \"You didn't enter a subnet to loop through.\n\");
}
if (isset($argv[1]) && !is_numeric($argv[1]))
{
array_push($errorArr, \"The first argument needs to be an integer.\n\");
}
if (isset($argv[1]) && ($argv[1] > 255 || $argv[1] < 66))
{
array_push($errorArr, \"The entered subnet is outside of the recommended limit.\n\");
}
if (!empty($errorArr))
{
echo \"Your syntax is incorrect:\n\";
foreach ($errorArr as $errorStr)
{
echo $errorStr;
}
die(\"Proper syntax is: php {$argv[0]} <subnet>\n\");
}
$startIP = \"{$argv[1]}.0.0.0\";
$exIP = explode(\".\", $startIP);
while (1)
{
$exIP[3]++;
if ($exIP[3] == 256)
{
$exIP[2]++;
$exIP[3] = 0;
}
if ($exIP[2] == 256)
{
$exIP[1]++;
$exIP[2] = 0;
}
if ($exIP[1] == 256)
{
break;
}
}
?>