Lo tenía hace mucho en un paper, y decidí postiarlo. Tal ves les sirva.
$target = "72.14.207.99"; // your target
$ports = array(21, 25, 79, 80); // http://www.iss.net/security_center/advice/Exploits/Ports/default.htm
$timeout = 1; // ...timeout
function portScan($host, $port, $timeout=30) {
$fp = @fsockopen($host, $port, $errno, $errstr, $timeout);
if ($fp) {
return True;
} else {
return False;
}
}
ob_start();
foreach($ports as $port) {
$scan=portScan($target, $port, $timeout);
if($scan[0]) {
echo "Success $target:$port
";
} else {
echo "Fail $target:$port
";
}
ob_flush(); // Used to send data right after instead of waiting for entire scan
flush(); // See last comment.
}
?>
* code=php establecido XD
Salu2
[vHn]