Security
|
|
|
|
Here's the html page
<html>
<head>
<title>PORT SCANNER</title></head>
<body bgcolor="black" text="white">
<center>
<br>
<br>
<form action="scan.php" method="post">
<input type="text" size="26" name="host"> target<br><p>
<input type="submit" value="go!">
</form>
</body>
</html>
...and here's the php related code
<html>
<head><title>PORTSCANNER</title></head>
<body bgcolor="black" text="white">
<h3>PORTSCAN RESULTS ON <STRONG><? echo $host ?></strong> :</h3>
</body>
</html>
<?
$lport = 1; $hport = 80;
if ($host == "") { header("Location: http://localhost/scan.htm");
exit;
}
for ( $port=$lport; $port<=$hport; $port++ )
{ $fp = fsockopen( "$host", $port, &$errno, &$errstr, 4 );
if ( !$fp )
{
echo "Port $port seems to be closed/filtered:nDesc: $errstr<br>n";
}
else
{ $serv = getservbyport($port, TCP);
echo "<strong>Port $port / $serv seems open...</strong><br>n";
}
}
?>
|
|
|
Usage Example
|
|
|
Rate This Script
|
|
|
|