I am trying to configure a php scanner I found on this forum to a specific need.
I am trying to manipulate it so It will only scan the remote ip address of the user, no others. And also only to scan for popular services on the users system. Then of course all of it to be displayed to the user.
As you can see I haven't got to far in terms of scanning popular services, but I think I have set to only scan the remote ip address of the user:
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<head>
<title>Title here!</title>
</head>
<body>
<?
// port.php,v 1.3 2001/08/21 19:54:19 barce Exp
//
// A basic port scanner written in PHP.
//
/*************************************
$min is the first port scanned
$max is the last port scanned
*************************************/
$timeout = 1; // Use a timeout with a short duration
if ($pressed)
{
set_time_limit(0);
echo "Scanning $REMOTE_ADDR" . "...<br>\n"; flush();
for ($i = 21; $i <= $max; $i++) {
/******************************************************
Open a Socket Connection with fsockopen
******************************************************/
$handle = fsockopen($REMOTE_ADDR, $i, $errno, $errstr, $timeout);
/******************************************************
Test connection to see if port is open
******************************************************/
if (!$handle) {
echo "No connection at port $i<br>\n"; flush();
}
else {
echo "Open port at $i<br>\n"; flush();
fclose($handle);
}
}
}
else
{
/******************************************************
A form to ask user for a host to target
******************************************************/
echo "<form method=post action=\"$PHP_SELF\">\n";
echo "Host to portscan: ";
echo "<input type=text name=target><br>\n";
echo "Starting port number: ";
echo "<input type=text name=min value=1><br>\n";
echo "Ending port number: ";
echo "<input type=text name=max value=113><br>\n";
echo "<input type=submit name=pressed value=' Scan '>\n";
echo "<input type=reset name=clear value=' Clear '>\n";
echo "</form>\n";
}
?>
</body>