Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $rstart = (isset($_POST['rstart']) and is_numeric($_POST['rstart']) and $_POST['rstart'] >= 1) ? $_POST['rstart'] : 1 ;
- $rend = (isset($_POST['rend']) and is_numeric($_POST['rend']) and $_POST['rend'] > 1) ? $_POST['rend'] : 999999 ;
- echo("<script type=\"text/javascript\">");
- echo("function Show(SelectValue){");
- echo("document.getElementById('RangeDiv').style.display=\"none\";");
- echo("document.getElementById('SpecificDiv').style.display=\"none\";");
- echo("if(SelectValue == \"range\")");
- echo("document.getElementById('RangeDiv').style.display=\"inline\";");
- echo("if(SelectValue == \"specific\")");
- echo("document.getElementById('SpecificDiv').style.display=\"inline\";");
- echo("}</script>");
- echo("<span class=\"PageTitle\">Open Ports Scanner</span><br /><br />");
- echo('<form method="post">');
- echo('<u>Ports:</u><br /><br />');
- echo('<select id="port" name="port" onchange="javascript:Show(this.value);">');
- echo('<option value="automatic">Automatic - All Ports</option>');
- echo('<option value="range">Range of Ports</option>');
- echo('<option value="specific">Specific Ports</option>');
- echo('</select><br /><br />');
- echo('<div id="RangeDiv" style="display:none;">From: <input type="text" id="rstart" name="rstart" value="'.$rstart.'" /> To: <input type="text" id="rend" name="rend" value="'.$rend.'" /><br /><br /></div>');
- echo('<div id="SpecificDiv" style="display:none;"><textarea rows="5" cols="50" id="specific" name="specific" />'.@htmlspecialchars($_POST['specific']).'</textarea><br />Use space (not new line!) to separate between the ports.<br /><br /></div>');
- echo('<input type="submit" id="submit" name="submit" value="Scan" />');
- echo('</form>');
- if(isset($_POST['submit'])){
- $first = "yes";
- echo("<br /><br /><u>Results</u>:<br />\n");
- if($_POST['port'] == "range"){
- if($rend > $rstart){
- for($i=$rstart;$i<$rend;$i++){
- if(@fsockopen($_SERVER['SERVER_ADDR'],$i) == TRUE){
- if($first == "no")
- echo(", ");
- echo $i;
- $first = "no";
- }
- }
- echo(".");
- }
- else{
- echo("Range start number can't be bigger than the end number.");
- }
- }
- else if($_POST['port'] == "specific"){
- $list = explode(" ",$_POST['specific']);
- foreach($list as $i){
- if(is_numeric($i)){
- if(@fsockopen($_SERVER['SERVER_ADDR'],$i) == TRUE){
- if($first == "no")
- echo(", ");
- echo $i;
- $first = "no";
- }
- }
- }
- echo(".");
- }
- else{
- for($i=0;$i>=0;$i++){
- if(@fsockopen($_SERVER['SERVER_ADDR'],$i) == TRUE){
- if($first == "no")
- echo(", ");
- echo $i;
- $first = "no";
- }
- }
- echo(".");
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement