Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (1)

Powered by Vanilla. Made with Bootstrap.
Port Scanner
  • undead
    Posts: 822
    That's a port scanner I found but I don't remember where I found it so credits are unknown.

    ps.php
    <?php
    error_reporting(0);

    print \"\nPort Scanner\n\n\";

    if($argc==1)
    {
    print \"Usage: ps [HOST] [PORTS] options\n\";
    print \"If you want to start a deep scan write D after the number of ports! To start a fast scan write F!\n\";
    exit;
    }

    $ip = \"\";
    $ports = \"\";
    $method = \"\";
    while(list($nr,$val)=each($argv))
    {
    if($nr>0)
    {
    $val = strtolower($val);
    if(strpos($val,'.')>-1)$ip = $val;
    else if(is_numeric($val))$ports = $val;
    else if($val == 'f' || $val== 'd')$method=$val;
    }
    }

    if($ip == \"\")
    {
    print \"Where is the host oeo?\n\";
    exit;
    }
    if($ports == \"\")
    {
    print \"Ports; Nah!\n\";
    exit;
    }
    if($method == \"\")
    {
    print \"Deep or Fast Scan?\n\";
    exit;
    }
    print \"HOST: $ip\n\";
    print \"Number of ports to scan: $ports\n\";
    if ($method == 'd') { print \"Scan: Deep\n\"; }
    if ($method == 'f') { print \"Scan: Fast\n\"; }
    print \"Please Wait...\n\n\";
    for($i=0;$i<=$ports;$i++)
    {
    if ($method == 'd') {
    $timeout = 1;
    $fp=fsockopen($ip,$i,$e,$s,$timeout);
    if($fp) { print \"Open Port: $i\n\"; fclose($fp); }
    } elseif ($method == 'f') {
    $timeout = 0.1;
    $fp=fsockopen($ip,$i,$e,$s,$timeout);
    if($fp) { print \"Open Port: $i\n\"; fclose($fp); }
    }
    }
    print \"\nFinished!\";
    ?>
  • D0WNGRADE
    Posts: 220
    Great find. Port scanners are pretty easy to make in PHP, but it's a good find none-the-less. :)
  • great find. and great share :)
  • undead
    Posts: 822
    thanks bursihido ;)
  • GameOver
    Posts: 675
    Nice find nextlive! thanks for share.
  • Orgy
    Posts: 40
    Oh interesting. A script meant for CLI PHP