Net_Portscan::checkPortRange() -- check for avaible services
Description
This function checks if there are services available at the
specified ports on the specified machine.
Parameter
string $host - address of the host
to check
string $minPort - starting port to test
to check
string $maxPort - last port to test
to check
string $timeout -
time in seconds to wait for every response from host
Return value
array - the array key corresponds with
the port number.
Note
This function can be called statically
Example
Example 31-1. Using checkPortRange require_once "Net_Portscan/Portscan.php";
echo "Scanning localhost ports 70-90\n";
$result = Net_Portscan::checkPortRange("localhost", 70, 90);
foreach ($result as $port => $element) {
if ($element == NET_PORTSCAN_SERVICE_FOUND) {
echo "On port " . $port . " there is running a service.\n";
} else {
echo "On port " . $port . " there is no service running.\n";
}
} |
|