I currently searching for a code/script that will allow it to check if a specific port is open, let's say 123. Found a public script on a ftp but I don't know how and what to modify in it to suit my needs. (I think this is a evil code and I want to use it as an example).
cat $1 | while read LN; do
SRV=`echo $LN | awk '{print $1}'`
php connect.php $SRV 123
done
And the file connect.php
<?php
    function S_Server($_server, $_port, $_user, $_pass) {
    if ( "$_port" == "123" ) {
            print "[+]Found $_server\r\n";
            if(!($_OutFile = fopen("iplist", "a"))) ExitF ("Cannot open the log file");
            fputs($_OutFile, "$_server $_user $_pass\n");
            fclose($_OutFile);
    }
    }
    function ExitF($errmsg) {
    print "[-]" . $errmsg . "\r\n";
    exit(0);
    }
    function CrackSMTP($server, $port, $user, $pass) {
    $socket = fsockopen($server, $port, $errno, $errstr, 2);
    if (!$socket) ExitF ("SOCKET ERROR!");
    fclose($socket);
    S_Server ($server, $port, $user, $pass);
    exit(0);
    }
    if ($argv[4]) $_PASS = $argv[4];
    if (!($_PASS)) $_PASS = "";
    if (!($argv[3])) {
    ExitF ("Usage: $argv[0] <hostname> <port> <user> [password]");
    }
    else {
    CrackSMTP($argv[1], $argv[2], $argv[3], $argv[4]);
    }
    exit(0);
    ?>
 
     
    