Artykuły na każdy temat
[PHP] Skanowanie portów z użyciem fsocketopen
<?php
$cfg['target'] = '127.0.0.1';
$cfg['timeout'] = 0.5;
$cfg['port']['from'] = 25;
$cfg['port']['to'] = 100;
for($h = 0, $tmp['how'] = $cfg['port']['to'] - $cfg['port']['from']; $h <= $tmp['how']; ++$h)
{
$tmp['port'] = $h + $cfg['port']['from'];
if(@fsockopen($cfg['target'], $tmp['port'], $errno, $errstr, $cfg['timeout']))
{
$tmp['open'][] = $tmp['port'];
}
}
echo (!empty($tmp['open']) ? 'Otwarte porty to: '.implode(', ', $tmp['open']) : 'Nie wykryto otwartych portów');
?>
Więcej informacji na:
Komentarze
Dodaj komentarz