PHP Classes

File: scan.php

Recommend this page to a friend!
  Classes of ben   Portscan   scan.php   Download  
File: scan.php
Role: Example script
Content type: text/plain
Description: executor of class
Class: Portscan
Check whether given TCP ports are opened
Author: By
Last change: for some reason completely wrong file
Date: 17 years ago
Size: 3,715 bytes
 

Contents

Class file image Download
<?php
   
/*
    Date: 9-05-2006 15:57
    Author: B.Heesen (b.heesen@dbds.nl)
    Version: 0.2b
    © Cpyright 2006 De Bron Digital Solutions (http://www.dbds.nl)
    */


error_reporting(0);
set_time_limit(900);

function
Scan(){
    require (
'class.progressbar.php');
   
$prb = new ProgressBar(); // create new ProgressBar
   
$prb->pedding = 2; // Bar Pedding
   
$prb->brd_color = "#404040 #dfdfdf #dfdfdf #404040"; // Bar Border Color
   
$prb->setFrame(); // set ProgressBar Frame
   
$prb->max = 20;
   
$prb->frame['left'] = 300; // Frame position from left
   
$prb->frame['top'] = 15; // Frame position from top
   
$prb->addLabel('text','txt1','Please wait ...'); // add Text as Label 'txt1' and value 'Please wait'
   
$prb->addLabel('percent','pct1'); // add Percent as Label 'pct1'
   
$prb->addButton('btn1','Restart',$_SERVER['PHP_SELF'].'?restart=1'); // add Button as Label 'btn1' and action '?restart=1'
   
$prb->show(); // show the ProgressBar

   
require("class.scan.php");
   
$scan = new Scan($_SERVER['REMOTE_ADDR'], 2);
    include(
"scanarrays.php");

    echo
"<!-- Simple Scan Start -->";
    echo
SS_PERFORM."<br><div class='IP'>".$scan->ip."</div><br>";
    echo
SS_TIME;
    for(
$j=0 ; $j<=20 ; $j++)
    {
       
$i = $pscan[$j][1];
       
$scan->portinfo($i);
        echo
"<div id=scan>";
        if((
$scan->porterror == "110") OR ($scan->porterror == "111") OR ($scan->porterror == "113")){
            echo
$scan->port.", Closed, ".round($scan->actualtime,3)."s , <span class=troj>".$pscan[$j][0]."</span>";
            if(
$scan->porterror == "110"){
                echo
"<br><b><small>".str_replace("Connection timed out (110)","", $scan->portresponse)."</small></b>";
            };
        }else{
            echo
$scan->port.", ".$scan->portresponse.", ".round($scan->actualtime,3)."s , <span class=troj>".$pscan[$j][0]."</span>";
        }
       
//echo $scan->portresponse;
       
echo "</div>";
       
$prb->moveStep($j);
        for (
$k=0; $k<100000; $k++) {$l = $k;}
            continue;

    }
    echo
SS_NUMBER.$scan->numports."<br>";
    echo
SS_OPEN.$scan->openports."<br>";
    echo
SS_TOTAL_TIME.round($scan->totaltime,2)." sec.<br>";
    echo
"<!-- Simple Scan End -->";
    echo
"<hr />";
   
}
function
trojanScan(){
    require (
'class.progressbar.php');
   
$prb2 = new ProgressBar(); // create new ProgressBar
   
$prb2->pedding = 2; // Bar Pedding
   
$prb2->brd_color = "#404040 #dfdfdf #dfdfdf #404040"; // Bar Border Color
   
$prb2->setFrame(); // set ProgressBar Frame
   
$prb2->max = 170;
   
$prb2->frame['left'] = 300; // Frame position from left
   
$prb2->frame['top'] = 15; // Frame position from top
   
$prb2->addLabel('text','txt1','Please wait ...'); // add Text as Label 'txt1' and value 'Please wait'
   
$prb2->addLabel('percent','pct1'); // add Percent as Label 'pct1'
   
$prb2->addButton('btn1','Restart',$_SERVER['PHP_SELF'].'?restart=1'); // add Button as Label 'btn1' and action '?restart=1'
   
$prb2->show(); // show the ProgressBar

   
require("class.scan.php");
   
$scan = new Scan($_SERVER['REMOTE_ADDR'], 2);
    include(
"scanarrays.php");

    echo
"<!-- Trojan Scan Start -->";
    echo
TS_PERFORM."<br><div class='IP'>".$scan->ip."</div><br>";
    echo
TS_TIME;
    for(
$k=0; $k<=170; $k++)
    {
        
$l = $TrojanScan[$k][0];
       
$scan->portinfo($l);
        if((
$scan->porterror == "110") OR ($scan->porterror == "111") OR ($scan->porterror == "113")){
           
        }else {
            echo
$scan->port.", ";
            echo
$scan->portresponse.", ".round($scan->actualtime,3)."s , <span class=troj>".$TrojanScan[$k][1]."</span>";
        }
   
$prb2->moveStep($k);
    for (
$l=0; $l<100000; $l++) {$m = $l;}
        continue;
    }
    echo
"<hr>";
    echo
TS_NUMBER.$scan->numports."<br>";
    echo
TS_OPEN.$scan->openports."<br>";
    echo
TS_TOTAL_TIME.round($scan->totaltime,2)." sec.<br>";
    echo
"<!-- Trojan Scan End -->";
}

?>