| <?php |
| |
| //~ For Copyrights see the bottom |
| |
| ?> |
| |
| <?php |
| |
| $script = "index.php"; |
| |
| |
| |
| echo<<<HEAD |
| |
| <html> |
| |
| <head> |
| |
| <title>thetrojan01-labs Port Scanner v1.0</title> |
| |
| </head> |
| |
| <body onload="document.frmScanner.host.focus()" bgcolor="#000000" topmargin="0" marginwidth="0" marginheight="0"> |
| |
| |
| |
| <!--Copied--> |
| |
| |
| |
| <table border="1" width="100%" cellspacing="0" cellpadding="2"> |
| |
| <tr> |
| |
| <td bgcolor="blue"><!--bgcolor="#000080"--><font face="Verdana" size="2" color="#FFFFFF"><b>thetrojan01-labs Port Scanner 1.0 </b></font></td> |
| |
| <td bgcolor="#CABFA5" bordercolor="#000080" align="center"> <!--bgcolor="#C2BFA5"--> |
| |
| <b><a href="javascript:window.close();" style="text-decoration:none"><font color="red" size="3">X</a></font></b></td> |
| |
| </tr> |
| |
| <tr> |
| |
| <td colspan="2" bgcolor="yellow"><!--bgcolor="#C2BFA5"--><font color="blue" face="Verdana" size="2"> |
| |
| <i>To see copyrights, scroll down. thetrojan01's email: thetrojan01@inbox.com</i> |
| |
| </font></td> |
| |
| </tr> |
| |
| </table> |
| |
| <font color="#C0C0C0" size="3"> |
| |
| |
| |
| <!--END--> |
| |
| |
| |
| <h3>Port Scanner by thetrojan01-labs!</h3> |
| |
| |
| |
| <form name="frmScanner" method="GET" action="index.php"> |
| |
| <b> |
| |
| Host Name or IP: <input type="text" name="host"><br> |
| |
| Starting Port: <input type="text" name="start"><br> |
| |
| Ending Port: <input type="text" name="end"><br> |
| |
| Timeout:<input type="text" name="timeout"></b> (leave empty for 0.5)<br> |
| |
| <font color="red"><b>NOTE:</b></font>When writing numbers, use '<b>.</b>' and <font color="red"><b>*NOT*</b></font></b> '<b>,</b>' ! For example, 1/10=0<b>.</b>1</b> |
| |
| <br> |
| |
| <input type="radio" name="protocol" value="tcp" checked> TCP |
| |
| <br> |
| |
| <input type="radio" name="protocol" value="udp"> UDP |
| |
| <br> |
| |
| <input type="radio" name="protocol" value="both"> Both (tcp & ip) |
| |
| |
| |
| <br><input type="submit" value="scan!"><input type="reset" value="reset!"> <a href="$script" style="text-decoration:none"><font color="yellow" size="3">..:::<b>Clear The Results</b>:::..</a></font> |
| |
| </form> |
| |
| HEAD |
| |
| ?> |
| |
| |
| |
| |
| |
| <?php |
| |
| //for the classic mode: |
| |
| //begin SCANNER |
| |
| //Now get the form input: |
| |
| $host = $_REQUEST['host']; |
| |
| $start = $_REQUEST['start']; |
| |
| $end = $_REQUEST['end']; |
| |
| $protocol= $_REQUEST['protocol']; |
| |
| |
| |
| |
| |
| //start scanning only if parameters are given: |
| |
| if($host && $start && $end >= $start && $protocol) |
| |
| { |
| |
| if($end > $start) $range = "$start - $end"; |
| |
| else $range = "$start"; |
| |
| |
| |
| echo "<br><b>Wait Untill our script scans the host...</b><br><br><code>"; |
| |
| echo "<br><br><i>Port Scaning results for<br>host: $host<br>port range: $range</i><br><br>"; |
| |
| |
| |
| if($_GET['timeout']){ $timeout=$_GET['timeout'];} else {$timeout=0.5;} |
| |
| for($port = $start; $port <= $end; $port++) |
| |
| { |
| |
| $fp = @fsockopen("$host", $port, $errno, $errstr, $timeout); |
| |
| @fclose($fp); |
| |
| //ToDO: Add protocol choosing: tcp udp or both |
| |
| //ToDO: If(both) {getsrvbyport($port, "tcp");getsrvbyport($port, "udp");} |
| |
| // else{getsrvbyport($port, "$protocol");} |
| |
| if("$protocol" != "both"){ |
| |
| $service = getservbyport($port, "$protocol"); |
| |
| if($service) $service = "(<b>$protocol</b>) " . $service; |
| |
| |
| |
| } |
| |
| else { |
| |
| if(getservbyport($port, "tcp")){ |
| |
| $service = "(<b>tcp</b>) ". getservbyport($port, "tcp") ;} |
| |
| if($service && getservbyport($port, "udp")){ |
| |
| $service = $service . "</b> and (<b>udp</b>) ". getservbyport($port, "udp");} |
| |
| else if(!service && getservbyport($port, "udp")){ |
| |
| $service = getservbyport($port, "udp");} |
| |
| } |
| |
| echo "Port: <b>$port</b> "; |
| |
| if($service) |
| |
| echo"is commonly used for: <b>$service</b> and it "; |
| |
| echo "was: "; |
| |
| |
| |
| if ($fp) |
| |
| { |
| |
| echo "<font color=\"green\"><b>OPEN</b></font><br>"; |
| |
| } |
| |
| else |
| |
| { |
| |
| echo "<font color=\"red\"><b>CLOSED</b></font><br>"; |
| |
| } |
| |
| } |
| |
| //end SCANNER*/ |
| |
| } |
| |
| else { |
| |
| if($end < $start){ |
| |
| echo '<br><br><table border="1" width="45%" cellspacing="0" cellpadding="2"> <tr><td><font color="#C0C0C0" size="3"><code>You know, real humans understand that the begining is before the end.<br>'; |
| |
| echo 'Please, specify the range of the Port Scanning again.</code></font></td></tr></table>'; |
| |
| } |
| |
| } |
| |
| ?> |
| |
| |
| |
| <?php |
| |
| echo ' <br><br><table border="1" width="100%" cellspacing="0" cellpadding="2"><tr> |
| |
| <td bgcolor="blue"><!--bgcolor="#000080"--><font face="Verdana" size="2" color="#FFFFFF"><i><b>Copyright (C) 2008, Lucas Xanthos</b><a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/gr/"><br><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc/3.0/gr/80x15.png"/></a><span xmlns:dc="http://purl.org/dc/elements/1.1/" property="dc:title">thetrojan01-labs Port Scanner</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/gr/">Creative Commons Attribution-Noncommercial 3.0 ÅëëÜäá License</a>.</i></font></td></table>'; |
| |
| ?> |