Heyho hatte irgendwann mal den hier geschrieben.
Vielleicht braucht den jemand :)
Vielleicht braucht den jemand :)
Code:
<?php
set_time_limit(0);
error_reporting(E_ALL);
ob_start();
$oHost = 'www.domain.com';
$host = gethostbyname($oHost);
// Hier kannst du Ports hinzufuegen, oder du benutzt $ports = range(1,10000); fuer 10.000 Ports
$ports = array('FTP' => 21,
'http' => 80,
'cPanel http' => 2082,
'cPanel https' => 2095,
'directadmin http' =>2222,
'directadmin https' => 2223,
'MYSQL'=> 3306,
'MSSQL' => 1433,
'SSH' => 22,
'SMTP' => 25,
'DNS' => 53,
'POP3' => 110,
'HTTPS' => 443,
'SMTP(2)' => 587);
if(isset($host) && strlen($host) >= 1)
{
$handles = array();
echo '<strong>'.$host.' - '.$oHost.'</strong><br />';
$i = 0;
foreach($ports as $key => $port)
{
$ch = array('handle' => curl_init(), 'port' => $port, 'name' => $key);
curl_setopt($ch['handle'], CURLOPT_HEADER, 0);
curl_setopt($ch['handle'], CURLOPT_NOBODY, true);
curl_setopt($ch['handle'], CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch['handle'], CURLOPT_URL, 'http://'.$host);
curl_setopt($ch['handle'], CURLOPT_PORT, $port);
curl_setopt($ch['handle'], CURLOPT_REFERER, 'http://'.$oHost);
curl_setopt($ch['handle'], CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch['handle'], CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9');
curl_setopt($ch['handle'], CURLOPT_TIMEOUT, 3);
curl_setopt($ch['handle'], CURLOPT_CONNECTTIMEOUT, 3);
curl_exec($ch['handle']);
if(curl_getinfo($ch['handle'],CURLINFO_REQUEST_SIZE) > 0)
{
echo "<span style=\"color:green\">Port: " . $ch['port'] . " is open (".$ch['name'].")</span>";
}
else
{
echo "<span style=\"color:red\">Port: " . $ch['port'] . " is closed (".$ch['name'].")</span>";
}
echo '<br />';
curl_close($ch['handle']);
ob_end_flush();
ob_flush();
flush();
ob_start();
}
}