Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* Converted to package2.xml

* Implemented Feature Request #14432: Improve PHPCS results. 
  (Patch by Daniel O'Connor.)


git-svn-id: http://svn.php.net/repository/pear/packages/Net_Portscan/trunk@292446 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit c1e26ca561c7e59da3d331b07355dcdfcb501951 1 parent 6ff926c
@mj mj authored
Showing with 115 additions and 96 deletions.
  1. +47 −35 Portscan.php
  2. +68 −61 package.xml
View
82 Portscan.php
@@ -1,23 +1,26 @@
<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.0 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Martin Jansen <mj@php.net> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
+/**
+ * PHP 4
+ *
+ * Copyright (c) 1997-2003 The PHP Group
+ *
+ * This source file is subject to version 2.0 of the PHP license,
+ * that is bundled with this package in the file LICENSE, and is
+ * available at through the world-wide-web at
+ * http://www.php.net/license/2_02.txt.
+ * If you did not receive a copy of the PHP license and are unable to
+ * obtain it through the world-wide-web, please send a note to
+ * license@php.net so we can mail you a copy immediately.
+ *
+ * Authors: Martin Jansen <mj@php.net>
+ *
+ * @category Net
+ * @package Net_Portscan
+ * @author Martin Jansen <mj@php.net>
+ * @license PHP 2.02 <http://www.php.net/license/2_02.txt>
+ * @version CVS: $Id$
+ * @link http://pear.php.net/net_portscan
+ */
define("NET_PORTSCAN_SERVICE_FOUND", true);
define("NET_PORTSCAN_NO_SERVICE", false);
@@ -29,10 +32,11 @@
* that are connected to the internet. See README for more
* information on how to use it.
*
- * @author Martin Jansen <mj@php.net>
- * @package Net_Portscan
* @category Net
- * @version $Revision$
+ * @package Net_Portscan
+ * @author Martin Jansen <mj@php.net>
+ * @license PHP 2.02 <http://www.php.net/license/2_02.txt>
+ * @link http://pear.php.net/net_portscan
*/
class Net_Portscan
{
@@ -46,10 +50,12 @@ class Net_Portscan
* established, there is a service listening on the port.
* If the connection fails, there is no service.
*
+ * @param string $host Hostname
+ * @param integer $port Portnumber
+ * @param integer $timeout Timeout for socket connection in seconds
+ * (default is 30).
+ *
* @access public
- * @param string Hostname
- * @param integer Portnumber
- * @param integer Timeout for socket connection in seconds (default is 30).
* @return string
*/
function checkPort($host, $port, $timeout = 30)
@@ -73,11 +79,14 @@ function checkPort($host, $port, $timeout = 30)
* This function can scan a range of ports (from $minPort
* to $maxPort) on the machine $host for running services.
*
+ * @param string $host Hostname
+ * @param integer $minPort Lowest port
+ * @param integer $maxPort Highest port
+ * @param integer $timeout Timeout for socket connection in seconds
+ * (default is 30).
+ *
* @access public
- * @param string Hostname
- * @param integer Lowest port
- * @param integer Highest port
- * @param integer Timeout for socket connection in seconds (default is 30).
+ *
* @return array Associative array containing the result
*/
function checkPortRange($host, $minPort, $maxPort, $timeout = 30)
@@ -91,13 +100,15 @@ function checkPortRange($host, $minPort, $maxPort, $timeout = 30)
// }}}
// {{{ getService()
-
+
/**
* Get name of the service that is listening on a certain port.
*
+ * @param integer $port Portnumber
+ * @param string $protocol Protocol (Is either tcp or udp. Default is tcp.)
+ *
* @access public
- * @param integer Portnumber
- * @param string Protocol (Is either tcp or udp. Default is tcp.)
+ *
* @return string Name of the Internet service associated with $service
*/
function getService($port, $protocol = "tcp")
@@ -111,9 +122,11 @@ function getService($port, $protocol = "tcp")
/**
* Get port that a certain service uses.
*
+ * @param string $service Name of the service
+ * @param string $protocol Protocol (Is either tcp or udp. Default is tcp.)
+ *
* @access public
- * @param string Name of the service
- * @param string Protocol (Is either tcp or udp. Default is tcp.)
+ *
* @return integer Internet port which corresponds to $service
*/
function getPort($service, $protocol = "tcp")
@@ -123,4 +136,3 @@ function getPort($service, $protocol = "tcp")
// }}}
}
-?>
View
129 package.xml
@@ -1,79 +1,86 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0">
-<!-- do not use the "Type" attribute here, that one is only for
- generated package.xml files -->
-<package version="1.0">
+<?xml version="1.0" encoding="UTF-8"?>
+<package packagerversion="1.9.0" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+http://pear.php.net/dtd/tasks-1.0.xsd
+http://pear.php.net/dtd/package-2.0
+http://pear.php.net/dtd/package-2.0.xsd">
<name>Net_Portscan</name>
+ <channel>pear.php.net</channel>
<summary>Portscanner utilities.</summary>
- <description>
-The Net_Portscan package allows one to perform basic portscanning
+ <description>The Net_Portscan package allows one to perform basic portscanning
functions with PHP. It supports checking an individual port or
-checking a whole range of ports on a machine.
+checking a whole range of ports on a machine.
</description>
+ <lead>
+ <name>Martin Jansen</name>
+ <user>MJ</user>
+ <email>mj@php.net</email>
+ <active>yes</active>
+ </lead>
+ <date>YYYY-MM-DD</date>
+ <time>HH:II:SS</time>
+ <version>
+ <release>1.0.3</release>
+ <api>1.0.3</api>
+ </version>
+ <stability>
+ <release>stable</release>
+ <api>stable</api>
+ </stability>
<license>PHP 2.02</license>
- <maintainers>
- <maintainer>
- <user>MJ</user>
- <name>Martin Jansen</name>
- <email>mj@php.net</email>
- <role>lead</role>
- </maintainer>
- </maintainers>
-
- <release>
- <version>1.0.2</version>
- <date>2003-04-22</date>
- <state>stable</state>
- <notes>
-This version now closes socket connections immediately after having
-opened them, instead of waiting for PHP to do this at the end of the
-script execution. (#23161)
- </notes>
- <filelist>
- <dir name="/" baseinstalldir="Net">
- <file role="php" name="Portscan.php" />
- <file role="doc" name="README.portscan" />
- <dir name="tests">
- <file role="php" name="01-portscan.php" />
- </dir>
- </dir>
- </filelist>
- </release>
-
+ <notes>
+* Implemented Feature Request #14432: Improve PHPCS results. (Patch by Daniel O'Connor.)
+ </notes>
+ <contents>
+ <dir name="/">
+ <dir name="tests">
+ <file baseinstalldir="Net" name="01-portscan.php" role="php" />
+ </dir> <!-- //tests -->
+ <file baseinstalldir="Net" name="Portscan.php" role="php" />
+ <file baseinstalldir="Net" name="README.portscan" role="doc" />
+ </dir> <!-- / -->
+ </contents>
+ <dependencies>
+ <required>
+ <php>
+ <min>4.0.0</min>
+ </php>
+ <pearinstaller>
+ <min>1.4.0b1</min>
+ </pearinstaller>
+ </required>
+ </dependencies>
+ <phprelease />
<changelog>
<release>
- <version>1.0.1</version>
+ <version>
+ <release>1.0.1</release>
+ <api>1.0.1</api>
+ </version>
+ <stability>
+ <release>stable</release>
+ <api>stable</api>
+ </stability>
<date>2002-04-09</date>
- <state>stable</state>
+ <license>PHP 2.02</license>
<notes>
This is a maintenance release to reflect some updates to the directory
structure.
</notes>
- <filelist>
- <dir name="/" baseinstalldir="Net">
- <file role="php" name="Portscan.php" />
- <file role="doc" name="README.portscan" />
- <dir name="tests">
- <file role="php" name="01-portscan.php" />
- </dir>
- </dir>
- </filelist>
</release>
-
<release>
- <version>1.0</version>
+ <version>
+ <release>1.0</release>
+ <api>1.0</api>
+ </version>
+ <stability>
+ <release>stable</release>
+ <api>stable</api>
+ </stability>
<date>2001-11-15</date>
- <state>stable</state>
- <notes>This is the first stable release.</notes>
-
- <filelist>
- <dir name="/" baseinstalldir="Net">
- <file role="php" name="Portscan.php" />
- <file role="php" name="test.php" />
- <file role="doc" name="README" />
- </dir>
- </filelist>
+ <license>PHP 2.02</license>
+ <notes>
+This is the first stable release.
+ </notes>
</release>
</changelog>
-
</package>
Please sign in to comment.
Something went wrong with that request. Please try again.