Location: PHPKode > projects > Php Admin Tools > EasyPHP/www/PAT_0.0.9b/extra/PAT/apps/caffeine_monkey/cm.php
<?php

/* Copyright 2002-2003 Phillip Stansell & Damien Heiser
 *
 * This file is part of Caffeine Monkey.
 *
 * Caffeine Monkey is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Caffeine Monkey is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Caffeine Monkey; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

require_once "HTML/IT.php";

// parse the config.ini file and place the result in an array
$settings = parse_ini_file( './includes/config.ini', TRUE );

// initialize an integrated template object and set the path for template files
$tpl = new IntegratedTemplate( $settings['include_path'] );

/**
 *	html_header(array $params)
 *
 *	Optional more detailed description.
 *
 *	@param $params - array - An array containing variables and replacement
 *		values for the Integrated Template. If this variable is null
 *		the header is not processed as a template.
 *
 *	@return A single string containing the final HTML header
 *
 */
function html_header($params = NULL)
{
	global $settings;

	$file_name = $settings['html_header'];
	$file_path = $settings['include_path'];

	if ( is_null($params) ) {
		return include_html($file_path . $file_name);
	} else {
		return include_IT($file_name, $params);
	}
}

/**
 *	html_footer(array $params)
 *
 *	Optional more detailed description.
 *
 *	@param $params - array - An array containing variables and replacement
 *		values for the Integrated Template. If this variable is null
 *		the footer is not processed as a template.
 *
 *	@return A single string containing the final HTML footer
 *
 */
function html_footer($params = NULL)
{
	global $settings;

	$file_name = $settings['html_footer'];
	$file_path = $settings['include_path'];

	if ( is_null($params) ) {
		return include_html($file_path . $file_name);
	} else {
		return include_IT($file_name, $params);
	}
}

/**
 *	include_html(string $file_name)
 *
 *	Optional more detailed description.
 *
 *	@param $file_name - string - The name of the file containing the HTML
 *		code you wish to include
 *
 *	@return A single string containing unmodified HTML
 *
 */
function include_html($file_name)
{
        $htmlfile = file($file_name);

        return implode ("\n", $htmlfile);
}

/**
 *	include_IT(string $file_name, array $params)
 *
 *	Optional more detailed description.
 *
 *	@param $file_name - string - The name of the file containing the HTML
 *		template to be processed
 *	@param $params - array - An array containing key/value pairs to be
 *		used in processing the template. If a key matches a variable
 *		in the template, that variable is replaced the corresponding
 *		value.
 *
 *	@return A single string containing the parsed HTML template
 *
 */
function include_IT($file_name, $params)
{
	global $tpl;

	$tpl->loadTemplatefile( $file_name, true, true );

	$tpl->setCurrentBlock();
	$tpl->setVariable( $params );
	$tpl->parseCurrentBlock();

	return $tpl->get();
}

/**
 *	include_ping()
 *	
 *	Includes the ping form into your index.html
 *
 *	Usage <?php echo include_ping();?>
 *
 */
function include_ping()
{

	global $tpl;
	global $settings;

	$tpl->loadTemplatefile( "ping.inc", true, true );
	$ping_form = $settings['PING_FORM'];

	foreach ( explode( ',', $ping_form['form_options'] ) as $value ) {
		if ( strcasecmp( $value, 'count' ) == 0 ) {

			foreach ( explode( ',', $ping_form['count_options'] ) as $key => $value ) {
				$tpl->setCurrentBlock( "coptions" );

				if ( strcasecmp( $key, 'SELECTED' ) == 0 ) {
					$tpl->setVariable( 'SELECTED', $key );
				} else {
					$tpl->setVariable( 'SELECTED', '' );
				}

				$tpl->setVariable( 'VALUE', $value );
				$tpl->parseCurrentBlock( "coptions" );
			}

		} elseif ( strcasecmp( $value, 'size' ) == 0 ) {

			foreach ( explode( ',', $ping_form['size_options'] ) as $key => $value ) {
				$tpl->setCurrentBlock( 'soptions' );

				if ( strcasecmp( $key, 'SELECTED' ) == 0 ) {
					$tpl->setVariable( 'SELECTED', $key );
				} else {
					$tpl->setVariable( 'SELECTED', '' );
				}
		
			$tpl->setVariable( 'VALUE', $value );
			$tpl->parseCurrentBlock( 'soptions' );
		}

		$tpl->setCurrentBlock( 'size' );
		$tpl->setVariable( 'SIZE_UNITS', $ping_form['size_units'] );
		$tpl->parseCurrentBlock( 'size' );

		} elseif ( strcasecmp( $value, 'timeout' ) == 0 ) {

			foreach ( explode( ',', $ping_form['timeout_options'] ) as $key => $value ) {
				$tpl->setCurrentBlock( "toptions" );

				if ( strcasecmp( $key, 'SELECTED' ) == 0 ) {
					$tpl->setVariable( 'SELECTED', $key );
				} else {
					$tpl->setVariable( 'SELECTED', '' );
				}

			$tpl->setVariable( 'VALUE', $value );
			$tpl->parseCurrentBlock( "toptions" );
		}

		$tpl->setCurrentBlock( 'timeout' );
		$tpl->setVariable( 'TIMEOUT_UNITS', $ping_form['timeout_units'] );
		$tpl->parseCurrentBlock( 'timeout' );

		} elseif ( strcasecmp( $value, '\n' ) == 0 ) {
			$tpl->setCurrentBlock( 'line_break' );
			$tpl->setVariable( 'BR', '<br>' );
			$tpl->parseCurrentBlock( 'line_break' );
		}
	}

	$tpl->setCurrentBlock();
	$tpl->setVariable( 'ACTION', $ping_form['action'] );
	$tpl->setVariable( 'ENCODING', $ping_form['encoding'] );
	$tpl->setVariable( 'TARGET', $ping_form['target'] );
	$tpl->parseCurrentBlock();

	return $tpl->get();
}

/**
 *	include_trace()
 *
 *	Includes the traceroute form into your index.html
 *
 *	Usage <?php echo include_trace();?>
 *
 */
function include_trace()
{

	global $tpl;
	global $settings;

	$tpl->loadTemplatefile( "trace.inc", true, true );
	$trace_form = $settings['TRACE_FORM'];

	foreach ( explode( ',', $trace_form['form_options'] ) as $value ) {
		if ( strcasecmp( $value, 'hops' ) == 0 ) {

			foreach ( explode( ',', $trace_form['hops_options'] ) as $value ) {
				$tpl->setCurrentBlock( "hoptions" );
				$tpl->setVariable( 'VALUE', $value );
				$tpl->parseCurrentBlock( "hoptions" );
			}

		} elseif ( strcasecmp( $value, 'size' ) == 0 ) {

			foreach ( explode( ',', $trace_form['size_options'] ) as $value ) {
				$tpl->setCurrentBlock( "soptions" );
				$tpl->setVariable( 'VALUE', $value );
				$tpl->parseCurrentBlock( "soptions" );
			}

			$tpl->setCurrentBlock( 'size' );
			$tpl->setVariable( 'SIZE_UNITS', $trace_form['size_units'] );
			$tpl->parseCurrentBlock( 'size' );

		} elseif ( strcasecmp( $value, 'timeout' ) == 0 ) {

			foreach ( explode( ',', $trace_form['timeout_options'] ) as $value ) {
				$tpl->setCurrentBlock( "toptions" );
				$tpl->setVariable( 'VALUE', $value );
				$tpl->parseCurrentBlock( "toptions" );
			}

			$tpl->setCurrentBlock( 'timeout' );
			$tpl->setVariable( 'TIMEOUT_UNITS', $trace_form['timeout_units'] );
			$tpl->parseCurrentBlock( 'timeout' );

		} elseif ( strcasecmp( $value, 'dodns' ) == 0 ) {

			$tpl->setCurrentBlock( "dodns" );
			$tpl->setVariable( 'CHECKED', $trace_form['dodns'] );
			$tpl->parseCurrentBlock( "dodns" );

		}
	}

	$tpl->setCurrentBlock();
	$tpl->setVariable( 'ACTION', $trace_form['action'] );
	$tpl->setVariable( 'ENCODING', $trace_form['encoding'] );
	$tpl->setVariable( 'TARGET', $trace_form['target'] );
	$tpl->parseCurrentBlock();

	return $tpl->get();
}

/**
 *	include_nslookup()
 *
 *	Includes the nslookup form into your index.html
 *
 *	Usage <?php echo include_nslookup();?>
 *
 */
function include_nslookup()
{

	global $tpl;
	global $settings;

	$tpl->loadTemplatefile( "nslookup.inc", true, true );
	$ns_form = $settings['NS_FORM'];

	foreach ( explode(',', $ns_form['query_options']) as $type ) {
		$radio_options = explode( ',', $ns_form[$type] );
		$radio_options[] = $type;

		$tpl->setCurrentBlock( "radio-input" );
		$tpl->setVariable( 'LABEL', $radio_options[0] );
		$tpl->setVariable( 'ID', $radio_options[1] );
		$tpl->setVariable( 'VALUE', $radio_options[2] );
		$tpl->parseCurrentBlock( "radio-input" );
	}

	$tpl->setCurrentBlock();
	$tpl->setVariable( "ACTION", $ns_form['action'] );
	$tpl->setVariable( "ENCODING", $ns_form['encoding'] );
	$tpl->setVariable( "TARGET", $ns_form['target'] );
	$tpl->parseCurrentBlock();

	return $tpl->get();
}

/**
 *	include_whois()
 *
 *	Includes the whois form into your index.html
 *	
 *	Usage <?php echo include_whois();?>
 *
 */
function include_whois()
{

	global $tpl;
	global $settings;

	$tpl->loadTemplatefile( 'whois.inc', true, true );
	$whois_form = $settings['WHOIS_FORM'];

	$tpl->setCurrentBlock();
	$tpl->setVariable( 'ACTION', $whois_form['action'] );
	$tpl->setVariable( 'ENCODING', $whois_form['encoding'] );
	$tpl->setVariable( 'TARGET', $whois_form['target'] );
	$tpl->parseCurrentBlock();

	return $tpl->get();
}

/**
 *	include_portscan()
 *
 *	Includes the portscan form into your index.html
 *
 *	Usage <?php echo include_portscan();?>
 *
 */
function include_portscan()
{

	global $tpl;
	global $settings;

	$tpl->loadTemplatefile( 'scan.inc', true, true );
	$scan_form = $settings['SCAN_FORM'];

	$tpl->setCurrentBlock();
	$tpl->setVariable( 'ACTION', $scan_form['action'] );
	$tpl->setVariable( 'ENCODING', $scan_form['encoding'] );
	$tpl->setVariable( 'TARGET', $scan_form['target'] );
	$tpl->parseCurrentBlock();

	return $tpl->get();
}

/**
 *	include_rangescan()
 *
 *	Includes the ranged portscan form into your index.html
 *
 *	Usage <?php echo include_rangescan();?>
 *
 */
function include_rangescan()
{

	global $tpl;
	global $settings;

	$tpl->loadTemplatefile( 'rangescan.inc', true, true );
	$scan_form = $settings['SCAN_FORM'];

	$tpl->setCurrentBlock();
	$tpl->setVariable( 'ACTION', $scan_form['action'] );
	$tpl->setVariable( 'ENCODING', $scan_form['encoding'] );
	$tpl->setVariable( 'TARGET', $scan_form['target'] );
	$tpl->setVariable( 'RANGE', $scan_form['range'] );
	$tpl->parseCurrentBlock();

	return $tpl->get();
}

/**
 *	nslookup(string $host, string $server, string $type)
 *
 *	Optional more detailed description.
 *
 *	@param $host - string - name or IP address of host about which to query
 *	@param $server - string - name or IP address of DNS server to query
 *	@param $type - string - the type of lookup to perform
 *	
 *	@return an nslookup command string built from the flags and options
 *		provided 
 */
function nslookup($host, $server, $type)
{
	global $settings;

	$query_flag = &$settings['NSLOOKUP_CMD']['query_flag'];
	$query_default = &$settings['NSLOOKUP_CMD']['query_default'];
	$query_mx = &$settings['NSLOOKUP_CMD']['query_mx'];
	$query_ns = &$settings['NSLOOKUP_CMD']['query_ns'];

	if ( strcmp($settings['bind_version'], "8") == 0 ) {
		$ns_command = &$settings['NSLOOKUP_CMD']['ns_command_8'];
	} elseif ( strcmp($settings['bind_version'], "9") == 0 ) {
		$ns_command = &$settings['NSLOOKUP_CMD']['ns_command_9'];
	}

	//set lookup type; if no type is given use the default
	if ( isset($type) ) {
		if ( strcasecmp($type, "a") == 0 ) {
			$ns_command = $ns_command.$query_flag.$query_default;
		} elseif ( strcasecmp($type, "mx") == 0 ) {
			$ns_command = $ns_command.$query_flag.$query_mx;
		} elseif ( strcasecmp($type, "ns") == 0 ) {
			$ns_command = $ns_command.$query_flag.$query_ns;
		}
	} else {
		$ns_command = $ns_command.$query_flag.$query_default;
	}

	//check that host is set, escape any special characters and append 
	//it to the command
	if ( isset($host) ) {
		$host = escapeshellarg($host);
		$ns_command = $ns_command.$host;
	} else {
		return "In function nslookup(): No host entered.";
	}

	//if server is set, escape any special characters and append it to 
	//the command
	if ( isset($server) ) {
		$server = escapeshellarg($server);
		$ns_command = $ns_command.' '.$server;
	}

	return $ns_command . " 2>&1";	// return the command we've built
}

/**
 *	ping(string $host, string $packets, string $size, string $timeout)
 *
 *	Optional more detailed description.
 *
 *	@param $host - string - name or IP address of host to ping
 *	@param $packets - string - number of packets to send
 *	@param $size - string - size of packets to send
 *	@param $timeout - string - maximum time before ping exits
 *	
 *	@return A ping command string built from the parameters which were
 *		passed and settings in the .ini file
 */
function ping($host, $count, $size, $timeout)
{
	global $settings;

	$ping_command = &$settings['PING_CMD']['ping_command'];
	$posix_type = &$settings['posix_type'];
	$count_flag = &$settings['PING_CMD']['count_flag'];
	$size_flag = &$settings['PING_CMD']['size_flag'];
	$timeout_flag = &$settings['PING_CMD']['timeout_flag'];

	//check that count is set, is a number and is within a reasonable range
	if ( isset($count) && is_numeric($count) ) {
		if ( ( max((int) $count, 100) == 100 ) && ( min((int) $count, 0) == 0 ) ) {
			$ping_command = $ping_command.$count_flag.$count;
		} else {
			return "In function ping(): Packet count entered was out of range.  Acceptable range is 0 to 100.";
		}
	} else {
		return "In function ping(): Packet count entered was not a number.";
	}

	//check that size is set, is a number and is within a reasonable range
	if ($posix_type == "linux")
	{
		if ( isset($size) && is_numeric($size) ) {
			if ( ( max((int) $size, 1024) == 1024 ) && ( min((int) $size, 32) == 32 ) ) {
				$size -= 8;
				$ping_command = $ping_command.$size_flag.$size;
			} else {
				return "In function ping(): Packet size entered was out of range.  Acceptable range is 32 to 1024.";
			}
		} else {
			return "In function ping(): Packet size entered was not a number.";
		}
	}
	elseif ($posix_type == "freebsd")
	{
	}
	
	//check that timeout is set, is a number and is within a reasonable range
	if ( isset($timeout) && is_numeric($timeout) ) {
		if ( ( max((int) $timeout, 5) == 5 ) && ( min((int) $timeout, 1) == 1 ) ) {
			$ping_command = $ping_command.$timeout_flag.$timeout;
		} else {
			return "In function ping(): Ping timeout entered was out of range.  Acceptable range is 1 to 5.";
		}
	} else {
		return "In function ping(): Timeout entered was not a number.";
	}

	//check that host is set and escape any special characters
	if ( isset($host) ) {
		$host = escapeshellarg($host);
		$ping_command = $ping_command." ".$host;
	} else {
		return "In function ping(): No host entered.";
	}

	return $ping_command . " 2>&1";
}

/**
 *	traceroute(string $host, string $hops, string $size, string $timeout, string $dodns)
 *
 *	Optional more detailed description.
 *
 *	@param $host - string - name or IP address of destination host
 *	@param $hops - string - maximum number of hops before ending trace
 *	@param $timeout - string - time to wait in seconds for each probe
 *		response
 *	@param $dodns - string - determines whether DNS lookups are performed;
 *		TRUE by default
 *	@param $size - string - size of packets to send
 *
 *	@return string - A traceroute command string built from the parameters
 *		which were passed and settings in the .ini file
 */
function traceroute($host, $hops, $size, $timeout, $dodns)
{
	global $settings;

	$trace_command = &$settings['TRACE_CMD']['trace_command'];
	$disable_dns_flag = &$settings['TRACE_CMD']['disable_dns_flag'];
	$max_hops_flag = &$settings['TRACE_CMD']['max_hops_flag'];
	$trace_timeout_flag = &$settings['TRACE_CMD']['trace_timeout_flag'];
	$trace_size_flag = &$settings['TRACE_CMD']['trace_size_flag'];
	
	//check that dodns is set and disable DNS lookups if its value is 
	//not TRUE
	if ( isset($dodns) ) {
		if ( strcasecmp($dodns, 'YES') != 0 ) {
			$trace_command = $trace_command.$disable_dns_flag;
		}
	} else {
		$trace_command = $trace_command.$disable_dns_flag;
	}

	//check that hops is set, is a number and is within a reasonable range
	if ( isset($hops) && is_numeric($hops) ) {
		if ( ( max((int) $hops, 50) == 50 ) && ( min((int) $hops, 0) == 0 ) ) {
			$trace_command = $trace_command.$max_hops_flag.$hops;
		} else {
			return "In function traceroute(): Hops entered was out of range.  Acceptable rang is 0 to 50.";
		}
	} else {
		return "In function traceroute(): Hops entered was not a number.";
	}

	//check that timeout is set, is a number and is within a reasonable range
	if ( isset($timeout) && is_numeric($timeout) ) {
		if ( ( max((int) $timeout, 5) == 5 ) && ( min((int) $timeout, 2) == 2 ) ) {
			$trace_command = $trace_command.$trace_timeout_flag.$timeout;
		} elseif ( (int) $timeout == 1 ) {
			true;
		} else {
			return "In function traceroute(): Timeout entered was out of range.  Acceptable range is 1 to 5.";
		}
	} else {
		return "In function traceroute(): Timeout entered was not a number.";
	}

	//check that host is set and escape any special characters
	if ( isset($host) ) {
		$host = escapeshellarg($host);
		$trace_command = $trace_command." ".$host;
	} else {
		return "In function traceroute(): No host entered.";
	}

	//check that size is set, is a number and is within a reasonable range
	if ( isset($size) && is_numeric($size) ) {
		if ( ( max((int) $size, 1024) == 1024 ) && ( min((int) $size, 38) == 38 ) ) {
			$trace_command = $trace_command.$trace_size_flag.$size;
		} else {
			return "In function traceroute(): Packet size entered was out of range.  Acceptable range is 38 to 1024.";
		}
	} else {
		return "In function traceroute(): Packet size entered was not a number.";
	}

	return $trace_command . " 2>&1";
}

/**
 *	whois(string $domain, string $server)
 *
 *	Optional more detailed description.
 *
 *	@param $domain - string - domain name to about which query
 *	@param $server - string - name of whois server to query
 *	
 *	@return A whois command string built from the parameters which were
 *		passed and settings in the .ini file
 */
function whois($domain, $server)
{
	require_once "Net/CheckIP.php";
	global $settings;

	$whois_command = &$settings['WHOIS_CMD']['whois_command'];
	$whois_svr_flag = &$settings['WHOIS_CMD']['whois_svr_flag'];
	$whois_command_order = explode(',', &$settings['WHOIS_CMD']['whois_command_order']);

	//check that $domain is set and escape any special characters
	//if $domain is an IP address, set $server to whois.arin.net
	if ( isset($domain) && Net_CHeckIP::check_ip($domain) ) {
		$server = 'whois.arin.net';
		$domain = escapeshellarg($domain);
	} elseif ( isset($domain) ) {
		$domain = escapeshellarg($domain);
	} else {
		return "In function whois(): No domain or IP address entered.";
	}

	//if server is set and not empty, escape any special characters and 
	//append it to the command
	if ( isset($server) && strlen($server) > 0 ) {
		$server = escapeshellarg($server);
	} else {
		$whois_svr_flag = '';
	}

	foreach ( $whois_command_order as $value ) {
		if ( !strcmp( $value, "whois_command" ) ) {
			continue;
		} elseif ( !strcmp( $value, "whois_svr_flag" ) ) {
			$whois_command = $whois_command.' '.$whois_svr_flag;
		} elseif ( !strcmp( $value, "server" ) ) {
			$whois_command = $whois_command.' '.$server;
		} elseif ( !strcmp( $value, "domain" ) ) {
			$whois_command = $whois_command.' '.$domain;
		}
	}

	return $whois_command . " 2>&1";
}

/**	
 *	scan(string $domain, int $scan1, int $scan2, int $scan3, int $scan4, int $scan5, int $scan6)
 *
 *	Optional more detailed description.
 *
 *	@param $domain - string - domain name to about which query
 *	@param $scan1::$scan6 - int - port scans to perform
 *	@return string which is basically a dump of the output of the portscan command
 */

function scan($domain, $scan1, $scan2, $scan3, $scan4, $scan5, $scan6)
{
	require_once "Net/Portscan.php";	

	// Run Portscans
	if ($scan1 == "YES"){if (Net_Portscan::checkPort($domain, 21) == NET_PORTSCAN_SERVICE_FOUND) {$scan_result[$i] = 1; $scan_port[$i] = 21;} else {$scan_result[$i] = 0; $scan_port[$i] = 21;}$i++;}
	if ($scan2 == "YES"){if (Net_Portscan::checkPort($domain, 23) == NET_PORTSCAN_SERVICE_FOUND) {$scan_result[$i] = 1; $scan_port[$i] = 23;} else {$scan_result[$i] = 0; $scan_port[$i] = 23;}$i++;}
	if ($scan3 == "YES"){if (Net_Portscan::checkPort($domain, 53) == NET_PORTSCAN_SERVICE_FOUND) {$scan_result[$i] = 1; $scan_port[$i] = 53;} else {$scan_result[$i] = 0; $scan_port[$i] = 53;}$i++;}
	if ($scan4 == "YES"){if (Net_Portscan::checkPort($domain, 80) == NET_PORTSCAN_SERVICE_FOUND) {$scan_result[$i] = 1; $scan_port[$i] = 80;} else {$scan_result[$i] = 0; $scan_port[$i] = 80;}$i++;}
	if ($scan5 == "YES"){if (Net_Portscan::checkPort($domain, 110) == NET_PORTSCAN_SERVICE_FOUND) {$scan_result[$i] = 1; $scan_port[$i] = 110;} else {$scan_result[$i] = 0; $scan_port[$i] = 110;}$i++;}
	if ($scan6 != NULL){if (Net_Portscan::checkPort($domain, $scan6) == NET_PORTSCAN_SERVICE_FOUND) {$scan_result[$i] = 1; $scan_port[$i] = $scan6;} else {$scan_result[$i] = 0; $scan_port[$i] = $scan6;}$i++;}

	// Display active ports
	for ($j == 1; $j < $i; $j++)
	{
		if ($scan_result[$j] == 1)
		{
			$result = $result."The host $domain has a service running on port $scan_port[$j] (" . Net_Portscan::getService($scan_port[$j]) . ").\n";
			$a = 1;
		}
	}

	if ($a == 1)
	{
		$result = $result."\n";
	}

	// Display non-active ports
	for ($k == 1; $k < $i; $k++)
	{
		if ($scan_result[$k] == 0)
		{
			$result = $result."The host $domain does not have a service running on port $scan_port[$k] (" . Net_Portscan::getService($scan_port[$k]) . ").\n";
		}
	}

	return $result;	
}

/**
 *	rangescan(string $domain, int $scan1, int $scan2)
 *
 *	Optional more detailed description.
 *	@param $domain - string - domain name to query with the port scan
 *	@param $scan1::$scan2 - int - port range to scan
 *
 */	

function rangescan($domain, $scan1, $scan2)
{

	$result = $result."Port scanning host $domain with the range of ports $scan1 - $scan2\n";
	$result = $result."The following ports have services running.\n\n";
	$scan_result = Net_Portscan::checkPortRange($domain, $scan1, $scan2);
	foreach ($scan_result as $port=>$element) {if ($element == NET_PORTSCAN_SERVICE_FOUND) {$result = $result."$port (" . Net_Portscan::getService($port) .") ";} else { }}	

	return $result;
}

?>

Return current item: Php Admin Tools