PHP单IP端口扫描器

自己写的一个很LOW的端口扫描

   <?php 
    @$Host=$_POST['Ip'];
    @$Port=$_POST['Port'];
    @$errno="";
    @$errstr="";
    if (isset($_POST['submit'])) {
        if ($Host!="" and $Port != "") {
            if (strpos($Port, '--')) {
                # code..
                $Ports = explode ('--', $Port);
                for ($i=$Ports[0]; $i <= @$Ports[1]; $i++) {
                        if (@fsockopen($Host,$i,$errno,$errstr,1)) {
                                echo "<b> $Host $i " ."open </b>";
                                echo "<br>";
                        }else{
                                echo "$Host $i " . "close";
                                echo "<br>";
                        }
                    # code...
                }
            }else{
                if (@fsockopen($Host,$Port,$errno,$errstr,1)) {
                    # code...
                    echo "<br> $Host  $Port OPEN </b>";
                }else{
                    echo "$Host  $Port COLSE";
                }

            }

            }


        }elseif (isset($_POST['Port'])) {
            $k=count($array = array(21,23,445,80,8080,3389,1433));
            for ($i=0; $i < $k; $i++) { 
            if (@fsockopen($Host,$array[$i],$errno,$errstr,1)) {
                # code...
                echo "<b>$Host   $array[$i]"."open</b>";
                echo "<br>";
            }else{
                echo "$Host   $array[$i]"."close";
                echo "<br>";        
            }

            };

        }

     ?>

     <!DOCTYPE html>
     <html>
     <head>
        <title>
            Port Scan
        </title>
     </head>
     <body>

    <form method="post" action="#">
    IP:<input type="text" name="Ip" value="">
    <br>
    Port:<input type="text" name="Port" value="80--90 or 80">
    <br>
    <input type="submit" value="Scan" name="submit">
    <input type="submit" value="often Scan Port" name="Scan">
    </form>


     </body>
     </html>

标签: none

添加新评论