From:             laudanp at yahoo dot com
Operating system: Redhat 7.3
PHP version:      4CVS-2003-07-23 (stable)
PHP Bug Type:     Sockets related
Bug description:  Warning: fsockopen() [function.fsockopen]: php_hostconnect: connect 
failed

Description:
------------
Please reference: http://bugs.php.net/bug.php?id=21653, as it is the same
for this bug report.  I was asked to file a new one.  The CVS codebase I'm
using is: php4-STABLE-200307031530.tar.gz.  The following line is where
the error occurs in my script:

$handle = fsockopen($this-> targetIP, $index, $errno, $errstr, $this->
timeout);


You may see the script in action here:

http://www.computercops.biz/modules.php?name=TCP_Scanner

or

http://www.computercops.biz/modules.php?name=Trojan_TCP_Scan

I obtain that fsockopen error.

It was stated by wez in the above referenced bug report that he removed a
duplicate error message.  I grabbed the latest cvs after that and it still
wasn't working.

Below is the code that I include in a parent PHP script.  Its the "core"
though.

Reproduce code:
---------------
<?php
# COPYRIGHT PAUL LAUDANSKI / COMPUTERCOPS.BIZ

        $trojans = array("21" => "Nerte 7.8.1",
                    "23" => "TruvaAti 1.2 beta"
        );
        flush();
        while (list ($portno, $descno) = each ($trojans)) {
                flush();
                $fp = fsockopen($REMOTE_ADDR, $portno, $errno, $errstr,
1);
                if(!$fp) {
                        echo "Connection Refused: ";
                        echo "Port $portno used by $descno.";
                        echo "<BR>";
                } else {
                        echo "<FONT COLOR=red><B>ESTABLISHED
CONNECTION</b>: ";
                        echo "Possible $descno Trojan found on port
$portno.</FONT>";
                        echo "<BR>";
                        $start = time();
                        socket_set_timeout($fp, 5);
                        $ccspstrNumberFound++;
                        fclose($fp);
                }
        }
?>

Expected result:
----------------
Starting Trojan TCP Scan ...
Connection Refused: Port 21 used by Nerte 7.8.1.
Connection Refused: Port 23 used by TruvaAti 1.2 beta.

etc...



Actual result:
--------------
Starting Trojan TCP Scan ...

Warning: fsockopen(): unable to connect to xxx.xxx.xxx.xxx:21 in
/www/computercops/modules/Trojan_TCP_Scan/ccspTrojans.php on line 137
Connection Refused: Port 21 used by Nerte 7.8.1.

Warning: fsockopen(): unable to connect to xxx.xxx.xxx.xxx:23 in
/www/computercops/modules/Trojan_TCP_Scan/ccspTrojans.php on line 137
Connection Refused: Port 23 used by TruvaAti 1.2 beta.

etc...

-- 
Edit bug report at http://bugs.php.net/?id=24785&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=24785&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=24785&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=24785&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24785&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24785&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24785&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24785&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24785&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24785&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24785&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24785&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24785&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24785&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24785&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24785&r=gnused

Reply via email to