<?php
$host = $_POST['host'];
$start = $_POST['start'];
$end = $_POST['end'];
$proto = $_POST['protocol'];
$serv = $_POST['services'];
// Start table
?>
<div align="center">
<div align="center">
<div align="center">
<div align="center">
<div align="left">
<div align="center"><img src="http://img190.imageshack.us/img190/2239/sloganleft.png" alt="" width="305" height="130" />
<table width='300' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td>Host name or IP:</td>
<td><input type='text' name='host' value='<?php echo $host; ?>' /></td>
</tr>
<tr>
<td>Starting Port:</td>
<td><input type='text' name='start' value='<?php echo $start; ?>' /></td>
</tr>
<tr>
<td>Ending Port:</td>
<td><input type='text' name='end' value='<?php echo $end; ?>' /></td>
</tr>
<tr>
<td>Protocol:</td>
<td>
<select name='protocol'>
<option value='tcp'>tcp</option>
<option value='udp'>udp</option>
</select>
</td>
</tr>
<tr>
<td>Show services:</td>
<td><input name='services' type='checkbox' value='yes' /></td>
</tr>
<tr>
<td colspan='2'><input type='submit' value='Scan Ports' /></td>
</tr>
</table>
<br /><br />
<?php
// End table
if(isset($host) && isset($start) && isset($end) && isset($proto))
{
echo "<strong>Results:</strong><br />";
for($current = $start; $current <= $end; $current++)
{
if($serv == "yes")
{
$service = getservbyport($current, $proto);
}
// Try to connect to port
$result = fsockopen($host, $current, $errno, $errstr, 1);
// Show results
if($serv == "yes")
{
echo "Port: <strong>".$current."</strong> is commonly used for: <strong>".$service."</strong> and was ";
}
else
{
echo "Port: <strong>".$current."</strong> was ";
}
if($result)
{
echo "<font color='green'><strong>OPEN</strong></font><br />";
}
else
{
echo "<font color='red'><strong>CLOSED</strong></font><br />";
}
}
}
?>
Autor: Phantom