Sicherheit: (CCcam)InfoPHP - Scan Erweiterung

CS-Allgemeines was in die anderen Foren nicht hinein passt...
BaNaNaBeck
IPC Freak
Beiträge: 187
Registriert: So 17. Apr 2011, 14:14
Kontaktdaten:

Sicherheit: (CCcam)InfoPHP - Scan Erweiterung

Beitrag von BaNaNaBeck »

Hier mal eine geänderte server.php mit der man im infophp seine peers durch klicken auf die C-Lien scannen kann:

Code: Alles auswählen

<?php

   if (file_exists($servers_file))
      $servers_data = file ($servers_file);

   if (!isset($servers_data))
   {
      echo "<FONT COLOR=red>Server is down or updating ... Please try again later !</FONT>";
      exit;
   }

   if (file_exists($shares_file))
      $shares_data = file ($shares_file);

   if (!isset($shares_data))
   {
      echo "<FONT COLOR=red>Server is down or updating ... Please try again later !</FONT>";
      exit;
   }

   loadOnlineData();

   //___________________________________________________________________________________________________

   $index = 0;
   $lastServer = "";
   $ServerSelectat = "";
   foreach ($servers_data as $currentline)
   {
      $inceput1 = substr($currentline,0,1);
      $inceput2 = substr($currentline,1,2);

      if ($inceput1 == "|" && $inceput2 != " H")
      {
         $server = explode("|", $currentline);
         $server_Host   = trim($server[1]);
         $server_Time   = trim($server[2]);
         $server_Type   = trim($server[3]);
         $server_Ver    = trim($server[4]);
         $server_Nodeid = trim($server[5]);
         $server_Cards  = trim($server[6]);
         $server_Idents = trim($server[7]);

         if ($server_Host != "")
         {
            $index++;
            $lastServer = $server_Host;
            $servers[$lastServer]["Info"] = array ($server_Time,$server_Type,$server_Ver,$server_Nodeid,$server_Cards);

            if ($server_Host == $server_nodeDns) $ServerSelectat = $lastServer;

         }

         $servers[$lastServer]["Info"]["Idents"][] = $server_Idents;
      }
   }
   unset($servers_data);


   //___________________________________________________________________________________________________
   $total_shares["total"] = 0;
   $maxhop = 0;


   foreach ($shares_data as $currentline)
   {
      $inceput1 = substr($currentline,0,1);
      $inceput2 = substr($currentline,1,1);

      if ($inceput1 == "|" && $inceput2 != " ")
      {
         $share = explode("|", $currentline);

         $share_Host = trim($share[1]);
         $share_Type = trim($share[2]);
         $share_Caid = trim($share[3]);
         $share_System = trim($share[4]);

         $share_ProvidersList = trim($share[5]);
         if ($share_ProvidersList == "0,1,2,3,0") $share_ProvidersList= "0,1,2,3"; // pt premiere
         if ($share_ProvidersList == "") $share_ProvidersList = $str_empty;
         $share_Providers = explode(",", $share_ProvidersList);

         list($share_Hop,$share_Reshare) = explode("   ", trim($share[6]));
         $share_Nodes = explode(",", trim($share[7]));
         $share_Node = $share_Nodes[count($share_Nodes)-1];

         $share_Caid = adaug0($share_Caid,4);

         $share_Node = sterg0($share_Node);

         if ($share_Node == "")
            $share_NodeUnic = $share_Caid."|".$share_System."|".$share_ProvidersList."|".$share_Host;
         else
            $share_NodeUnic = $share_Caid."|".$share_System."|".$share_ProvidersList."|".sterg0($share_Node);

         $route = (isset($nodes))?count($nodes[$share_NodeUnic]):0;
         $servers[$share_Host][$share_NodeUnic]["total"] = $route;
         if ($route == 0) $servers[$share_Host][$share_NodeUnic]["total"] = 1;
         $servers[$share_Host][$share_NodeUnic][$route] = array ($share_Host,$share_Type,$share_Caid,$share_System,$share_ProvidersList,$share_Providers,$share_Hop,$share_Reshare,$share_Nodes,$share_Node);


         if (!isset($total_shares["total"]))                $total_shares["total"] = 0;
         if (!isset($total_shares[$share_Hop]))             $total_shares[$share_Hop] = 0;
         if (!isset($share_nodes[$share_NodeUnic]))         $share_nodes[$share_NodeUnic] = 0;
         if (!isset($share_nodes_minhop[$share_NodeUnic]))  $share_nodes_minhop[$share_NodeUnic] = 9;

         $share_nodes[$share_NodeUnic]++;
         $share_nodes_minhop[$share_NodeUnic] = min( $share_nodes_minhop[$share_NodeUnic], $share_Hop );
         $total_shares["total"]++;
         $total_shares[$share_Hop]++;

         if (!isset($host_hop[$share_Host][$share_NodeUnic][$share_Hop]))  $host_hop[$share_Host][$share_NodeUnic][$share_Hop] = 0;
         if (!isset($total_host_shares[$share_Host]["total"]))             $total_host_shares[$share_Host]["total"] = 0;
         if (!isset($total_host_shares[$share_Host][$share_Hop]))          $total_host_shares[$share_Host][$share_Hop] = 0;
         if (!isset($total_reshare[$share_Host]["total"]))                 $total_reshare[$share_Host]["total"] = 0;
         if (!isset($re[$share_Host][$share_NodeUnic][$share_Hop]))        $re[$share_Host][$share_NodeUnic][$share_Hop] = 0;
         if (!isset($re[$share_Host][$share_NodeUnic]["reshare"]))         $re[$share_Host][$share_NodeUnic]["reshare"] = 0;

         $host_hop[$share_Host][$share_NodeUnic][$share_Hop]++;
         $total_host_shares[$share_Host]["total"]++;
         $total_host_shares[$share_Host][$share_Hop]++;

         if (((int)$share_Reshare)>0)
         {
            $total_reshare[$share_Host]["total"]++;
            $re[$share_Host][$share_NodeUnic][$share_Hop] = max($re[$share_Host][$share_NodeUnic][$share_Hop],((int)$share_Reshare));
            $re[$share_Host][$share_NodeUnic]["reshare"] = max($re[$share_Host][$share_NodeUnic]["reshare"],((int)$share_Reshare));
         }
         $maxhop = max($maxhop,$share_Hop);
      }
   }

   unset($shares_data);
//___________________________________________________________________________________________________
function nodeID($NodeUnic,$Host,$Total,$Hop)
{
   global $share_nodes;
   global $share_nodes_minhop;

   $nodSh = explode("|",$NodeUnic);

   $Server = $nodSh[3];

   $Server2 = explode("_",$Server);

   $Server_Host = "";
   $Server_Host2 = "";

   $Server = nodeIdName($Server);

   $extra = $share_nodes[$NodeUnic] - $Total + 1;

   if ($Server_Host == $Host)
   {
      $ret = "<font color=Fuchsia><B>".$Server."</B></font>";
   }
   else
   if ($extra > 1)
   {
      if ($share_nodes_minhop[$NodeUnic] == $Hop)
         $ret = "<font color=brown>".$Server."</font>";
      else
         $ret = $Server;
   }
   else
   {
      $ret = "<font color=Crimson>".$Server."</font>";
   }

   if ($extra > 1)
         $ret.=" (".$extra.")";

   global $pagina;
   global $serverindex;
   $ret = linkNod($NodeUnic,$ret,"node",false);

   return $ret;
}
//___________________________________________________________________________________________________

if ($server_nodeDns != "")
   $sh_host = $server_nodeDns;
else
   $sh_host = $ServerSelectat;

if ($sh_host != "") $nodes = $servers[$sh_host];

if (isset($nodes) && count($nodes))
{
   $info_total = 0;
   if (isset($total_host_shares[$sh_host]["total"]))
      $info_total = $total_host_shares[$sh_host]["total"];

   $info_total_unic = count($nodes) - 1;

   $info_uniqueIndex = 0;
   if ($info_total!=0)
      $info_uniqueIndex = (int)($info_total_unic/$info_total *100);
   //$info_total_reshare = $total_reshare[$sh_host]["total"];
   //$info_reshareIndex = (int)($info_total_reshare/$info_total_unic *100);

   list($host_DNS, $host_PORT) = explode(":", $sh_host);

   $host_IP    = trim(getHostIP($host_DNS));
   $tara_host  = taraNameSaved($sh_host);
   $IPServer   = trim($tara_host[1]);
   $tara_code  = tara($host_IP,$sh_host);


   if ($host_IP !="" && $IPServer !="" && $host_IP != $IPServer)
   {
      loadGlobalServers();
      $globalServers[$sh_host][1] = $IPServer;
      saveGlobalServers();
   }


   if ($country_whois == true)
      $tara_nume = taraName($tara_code["tara"]);

   echo "<table border=0 cellpadding=0 cellspacing=0>";
   echo "<tr>";
   echo "<td VALIGN = \"top\">";

   format1("Server",$sh_host);

	if ($host_IP=="unknown")
   	format1("IP/Clients",$host_IP);
   else
   	format1("IP/Clients",$host_IP." / ".clientIP($host_IP,$sh_host));


   if ($country_whois == true)
   {
   	if ($tara_code["tara"]=="??")
   		 format1("Country","Unresolved IP");
   	else
      if ($tara_code["tara"]=="<>")
         format1("Country","Local Private IP");
      else
         format1("Country",$tara_code["tara"]." , ".$tara_nume);
   }
   //format1("Connected from IP",clientIP($host_IP,$sh_host));

   if ($nodes["Info"][3] != "")
      format1("NodeID", $nodes["Info"][3]);

   if ($nodes["Info"][3] != "")
      format1("Type/Ver", $nodes["Info"][1]." / ".$nodes["Info"][2] );
   else
      format1("Type", $nodes["Info"][1] );

   if ($nodes["Info"][0] != "")
   	format1("Connected",$nodes["Info"][0]);
   else
   {
   	$text_offline = "-- OFFLINE --";
		if (isset($OnlineServers[$sh_host]) && $OnlineServers[$sh_host]["time"]!="")
		{
			$last_online = $OnlineServers[$sh_host]["time"];
			$text_offline = get_formatted_timediff($last_online)." ago";
		}
   	format1("Connected","<FONT color=red>$text_offline</FONT>");
   }



   //format1("Type",$nodes["Info"][1]);
   //format1("Version",$nodes["Info"][2]);
   //format1("Shares",$info_total);

   echo "</td>";
   echo "<td VALIGN = \"top\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Note :&nbsp;&nbsp;";
   echo "</td>";
   echo "<td VALIGN = \"top\">";

   $notes_saved = "";
   $notes_save_path   = $notes_path.$host_DNS.".".$host_PORT.".note";
   if (file_exists($notes_save_path))
   {
      $fh = fopen($notes_save_path, 'r');
      $notes_saved = fread($fh, filesize($notes_save_path));
      fclose($fh);
   }
   ?>
   <FORM NAME="formular" METHOD="post" ACTION="
   <?php
   echo $pagina;
   ?>
   "><TEXTAREA CLASS="TEXTAREANORMAL" COLS="30" name="saveNotes" ID="saveNotes" ROWS="4" TABINDEX="1" value=""><?php echo $notes_saved ?></TEXTAREA>
   <DIV ALIGN = "right"><INPUT TYPE="submit" VALUE="Save" TABINDEX="2" class="savetextbutton"></DIV>
      <input type="hidden" name="nodeDns" ID="nodeDns" value="<?php echo $server_nodeDns ?>">
   </FORM>
   <?php
   echo "</td>";
   echo "</tr>";
   echo "</table>";



   // online history
   $online_saveTime = $OnlineServers["savetime"]["time"];
   $online_lastseen = $OnlineServers[$sh_host]["time"];
   $online_history  = $OnlineServers[$sh_host]["log"];
  /*
   if ($online_saveTime != $online_lastseen && $online_lastseen!="")
   {
   	$timediff = ($online_saveTime - $online_lastseen);
	   $minuteLastSave  = (int) intval($timediff / INT_MINUTE);
	   $online_history = "-".$minuteLastSave.".".$online_history;
   }
	*/

   $logtime = explode(".", $online_history);
   $history_off = 0;
   $history_on = 0;
   foreach ($logtime as $log)
   {
   	if (strstr($log,"-"))
   	{
   		$history_off = $history_off + substr($log,1);
   	}
   	else
   	{
   		$history_on = $history_on + $log;
   	}
	}

	$DIV_history_off = "";
	if ($history_off >0) $DIV_history_off = "<FONT color=red>".formatted_timediff($history_off*60)."</FONT>";

	$DIV_history_total = formatted_timediff(($history_off + $history_on)*60);

   if ($history_off >0)
   	format1("Uptime",procentColor(procentOnline($sh_host))." [ ".$DIV_history_off." / ".$DIV_history_total." ]");
   else
   	format1("Uptime",procentColor(procentOnline($sh_host))." [ ".$DIV_history_total." ]");

   if ($country_whois == true && $tara_code["tara"]!="<>")
   {
      format1("ISP Info",$tara_code["info"]);
   }
   echo "<BR>";

   ob_flush();
	flush();

	$LastPingError = "Very slow";
   $pingCount = 5;
   $pingCountOK = 0;
   $pingLast = 0;
   $pingTimeTotal = 0;

   //echo "<table border=0 cellpadding=0 cellspacing=0>";
   $ping_text_try = "";

   $stringquerry = $_SERVER['QUERY_STRING'];
   if (!strstr($stringquerry,"&checkPing=1"))
   	$stringquerry = $stringquerry."&checkPing=1";
   $ping_text_try_check = "&nbsp;<A class=\"tabel_header\" HREF=".$pagina."?".$stringquerry.">&nbsp;PING NOW&nbsp;&nbsp;</A>";

   $pingTryMax = 0;
   if ($server_checkPing != "")
   {
      for ($k = 1; $k <= $pingCount; $k++)
      {
         usleep(1000000);
         $pingTry = -1;
         $pingTry = pingDomain($host_IP,$host_PORT,3);

         if ($pingTryMax == 0)
      		  $pingTryMax = $pingTry;
         else
   		   if ($pingTryMax < $pingTry) $pingTryMax = $pingTry;

         if ($k>1) $ping_text_try = $ping_text_try." , ";
         if ($pingTry>0)
         {
            $pingCountOK++;

            $ping_text_try = $ping_text_try.$pingTry."ms";
         }
         else
         {
            $ping_text_try = $ping_text_try."<FONT color=red>--</FONT>";
            if ($pingLast==-1)
            {
               $pingTimeTotal = -1;
               break;
            }
         }


         $pingTime[] = $pingTry;
         $pingLast = $pingTry;
      }
      $ping_text_try = " : {".$ping_text_try."}";
   }

   //echo "</table>";

   $textPingCurent = "";

   if ($pingTimeTotal == 0)
   {


      $lost = $pingCount - $pingCountOK;

      $rezultatPing = $ping_text_try_check."<FONT color=gray>".$ping_text_try."</FONT>";



      if ($lost == 0)
      {
      	 for ($k = 0; $k < $pingCount; $k++)
         	  if ($pingTime[$k] >0) $pingTimeTotal = $pingTimeTotal + $pingTime[$k];

      	 $pingTimeTotal = $pingTimeTotal - $pingTryMax;
          $pingTimeFinal = (int)($pingTimeTotal/($pingCountOK-1));

      	 SavePing($sh_host,$pingTimeFinal);
      	 $textPingCurent  = " = ".$pingTimeFinal."ms ";
      }
      else
      if ($server_checkPing != "")
      	$textPingCurent  = " = NOT SAVED";

   }
   else
   if ($server_checkPing != "")
   {
  		$rezultatPing = $ping_text_try_check.": ".$LastPingError;
   }
   else
  	   $rezultatPing = $ping_text_try_check;







   //CAPA port scan

   	$port_check_txt = "&nbsp;<A class=\"tabel_header\" HREF=".$pagina."?".$_SERVER['QUERY_STRING']."&checkPort=1> &nbsp;SCAN NOW&nbsp;&nbsp;</A>";
   	$port_check = "nodeDns=".$sh_host."&checkPort=1";
   //CAPA PORT scan



   $bestPingSaved = SavedPing($sh_host);

   $textPingAverage = pingResultColor($bestPingSaved[0],1);
   $textPingBest    = pingResultColor($bestPingSaved[2],1);

   $diffPing = $bestPingSaved[0] - $bestPingSaved[2];
   $diffMargin = (int)($bestPingSaved[2] * 50/100);
   if ($diffMargin < 50) $diffMargin  = 50;

   if ($diffPing > $diffMargin ) $textPingAverage = "<FONT COLOR=red><B>! </B></FONT>".$textPingAverage;

   format1("Best ever responce time (ping) ",$textPingBest);
   format1("Average responce time (ping) ",$textPingAverage);
   format1("Current responce time (ping) ",$rezultatPing.$textPingCurent);
   echo "<br>";
   format1("SECURITY CHECK (portscan) ",$port_check_txt);


  //CAPA PORT scan
  if($_SERVER['QUERY_STRING'] == $port_check)
  {
  	echo "<br>";
  	//echo "Legend: <font color='green'><b>OPEN Port</b></font> -|- <font color='red'><b>CLOSED Port</b></font> <br><br>";
  	echo '<table border="1" cellspacing="0" cellpadding="5">';
  	echo '<tr bgcolor="#600000">';
	echo '<td width="30"><b><font color="#ffffff" >Port</font></b></td>';
	echo '<td width="40"><b><font color="#ffffff" >Status</font></b></td>';
	echo '<td><b><font color="#ffffff" >Dienstname</font></b></td></tr>';

   $host = "$host_IP";
   $sc_port = array ( $host_PORT=>"CCcam Port", 16001=>"CCcam Web", 16000=>"CCcamTelnet", 21=>"FTP", 22=>"SSH", 23=>"Telnet", 25=>"smtp", 80=>"HTTP");

   foreach($sc_port as $scanport=>$value)
    {
		$fp = @fsockopen($host,$scanport,$errno,$errstr,5);
		if($fp)
		{
			//echo "port " . $scanport . " open on " . $host . "\n <br>";

			echo "<tr bgcolor='#212121'>";
			echo "<td width=30><font color='green'><b>".$scanport . "&nbsp;&nbsp;</b></font></td>";
			echo "<td><font color='green'><b>Open</b></font></td>";
			echo "<td><font color='#ffffff'><b>".$value."</b></font></td></tr>";
			@fclose($fp);
			}
		else
		{
			//echo "port " . $scanport . " closed on " . $host . "\n  <br>";
			echo '<tr bgcolor="#212121">';
			echo "<td width=30><font color='red'><b>".$scanport . "&nbsp;&nbsp;</b></font></td>";
			echo "<td><font color='red'><b>Closed</b></font></td>";
			echo "<td><font color='#ffffff'><b>".$value."</b></font></td></tr>";
			}
		flush();
		}
		echo "<br>";
		$port_check = null;
   }
   echo "</table>";
   //CAPA ENDE


/*
   $webinterface = pingDomain($host_IP,"16001",1);

   if ($webinterface!=-1)
      format1("Webinterface default","<A class=\"tabel_header\" HREF=\"http://$host_IP:16001\" target=\"_blank\">CHECK&nbsp;</A>");
*/
   //format1("Unique",$info_total_unic,$info_total);
   //format1("Reshare",$info_total_reshare,$info_total_unic);

   $ecm_total = 0;
   $ecmOK_total = 0;
   foreach ($servers[$sh_host]["Info"]["Idents"] as $hit_data)
   {
      $hit_array = explode(" ",$hit_data);
      if ($hit_array[0] != "")
      {
         $hit_provider = explode(":",$hit_array[1]);
         $hit_exact = explode("(",$hit_array[2]);
         $hit_exact2 = explode(")",$hit_exact[1]);

         $hit_ecm = $hit_exact[0];
         $hit_ecmOK = $hit_exact2[0];

         $ecm_total = $ecm_total+$hit_ecm;
         $ecmOK_total = $ecmOK_total+$hit_ecmOK;

         $key = adaug0($hit_ecmOK,20).adaug0($hit_ecm,20).$hit_array[1];
         $ecmok_sortat[$key] = $hit_data;

      }
   }

   loadECMServers(true);
   echo "<BR>";
   $record_ECM = $ECMservers[$sh_host]["Info"]["ECM_SAVED"]["ECM"];
   $record_ECMOK = $ECMservers[$sh_host]["Info"]["ECM_SAVED"]["ECMOK"];

   if (($ecm_total == $record_ECM) && ($ecmOK_total == $record_ECMOK))
      format1("Handled ECM",$record_ECMOK,$record_ECM);
   else
   {
      if ($record_ECM !="")
         format1("Handled ECM ( saved )",$record_ECMOK,$record_ECM);

      format1("Handled ECM ( now )",$ecmOK_total,$ecm_total);
   }

   if ($ecm_total)
   {
      //echo "<BR>";
      echo "<table border=0 cellpadding=2 cellspacing=1>";
      echo "<tr>";
      echo "<th class=\"tabel_headerc\">#</th>";
      echo "<th class=\"tabel_headerc\">Type</th>";
      echo "<th class=\"tabel_header\">ECM</th>";
      echo "<th class=\"tabel_header\">OK</th>";
      echo "<th class=\"tabel_header\">CAID/Ident</th>";
      echo "</tr>";
   }

  if (isset($ecmok_sortat))
  {
   	krsort($ecmok_sortat);

	   $counthits = 0;
	   if ($ecmok_sortat)
	   foreach ($ecmok_sortat as $key => $hit_data)
	   {
	      $hit_array = explode(" ",$hit_data);
	      if ($hit_array[0] != "")
	      {
	         $counthits++;
	         $hit_provider = explode(":",$hit_array[1]);
	         $hit_exact = explode("(",$hit_array[2]);
	         $hit_exact2 = explode(")",$hit_exact[1]);

	         $hit_ecm = $hit_exact[0];
	         $hit_ecmOK = $hit_exact2[0];

	         echo "<tr>";
	         echo "<td class=\"Node_Provider\">".$counthits."</td>";
	         echo "<td class=\"tabel_hop_total1\">".$hit_array[0]."</td>";


	         echo "<td class=\"tabel_hop_total\"><FONT COLOR=white>".$hit_ecm."</FONT></td>";

	         if ($hit_ecmOK == 0)  echo "<td class=\"tabel_hop_total\"><FONT COLOR=red>".$hit_ecmOK."</FONT></td>";
	         else
	         if ($hit_ecmOK != $hit_ecm)  echo "<td class=\"tabel_hop_total\"><FONT COLOR=yellow>".$hit_ecmOK."</FONT></td>";
	         else
	            echo "<td class=\"tabel_hop_total\">".$hit_ecmOK."</td>";

	         echo "<td class=\"Node_Provider\">".Providerid($hit_provider[0],$hit_provider[1],true,"Node_Provider",false)."</td>";
	         echo "</tr>";
	      }
	   }
	}

   if ($ecm_total)
      echo "</table>";
   echo "<BR>";

   $total_nodes = 0;for($k = 0; $k <= $maxhop; $k++)
   {
      if (isset($total_host_shares[$sh_host][$k]))
         $total_nodes += $total_host_shares[$sh_host][$k];
   }

if ($total_nodes>0)
{
   format1("Nodes",$info_total_unic);
   echo "<table border=0 cellpadding=2 cellspacing=1>";
   echo "<tr>";
   echo "<th class=\"tabel_headerc\">#</th>";
   echo "<th class=\"tabel_header\">NodeID/Server (extra sources)</th>";
   echo "<th class=\"tabel_header\">Shares</th>";

   for ($k = 1; $k <= $maxhop; $k++) echo "<th class=\"tabel_headerc\">hop".$k."</th>";
   echo "<th class=\"tabel_headerc\">Reshare</th>";
   echo "<th class=\"tabel_header\">CAID/Idents</th>";
   echo "</tr>";

   //$info_total = $total_host_shares[$sh_host]["total"];
   //$info_total_unic = count($nodes) - 1;
   //$info_uniqueIndex = (int)($info_total_unic/$info_total *100);
   //$info_total_reshare = $total_reshare[$sh_host]["total"];
   //$info_reshareIndex = (int)($info_total_reshare/$info_total_unic *100);

   echo "<tr>";
   echo "<td class=\"tabel_total\"></td>";
   echo "<td class=\"tabel_total\"></td>";
   echo "<td class=\"tabel_total\">".$total_host_shares[$sh_host]["total"]."</td>";
   for ($k = 1; $k <= $maxhop; $k++) echo "<td class=\"tabel_total\">".$total_host_shares[$sh_host][$k]."</td>";
   echo "<td class=\"tabel_total\">".$total_reshare[$sh_host]["total"]."</td>";
   echo "<td class=\"tabel_total\"></td>";
   echo "</tr>";

   $i=1;

   // HOP1
   if (isset($total_shares[1]))
   foreach ($nodes as $node=>$data)
   if (!isset($host_hop[$sh_host][$node][0]) && isset($host_hop[$sh_host][$node][1]))
   {
      $nodetype = $nodes[$node][0][1];
      $caid = $nodes[$node][0][2];
      $providers = $nodes[$node][0][4];
      $nodSh = explode("|",$node);

      $total = 0;for($k = 0; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            $total += $host_hop[$sh_host][$node][$k];

      $reshare = "<FONT COLOR=red>! NO !</FONT>";if ($re[$sh_host][$node]["reshare"] >0) if ($total==1) $reshare = $re[$sh_host][$node]["reshare"]; else $reshare = "<FONT COLOR=yellow>".$re[$sh_host][$node]["reshare"]."</FONT>";

      echo "<tr>";
      echo "<td class=\"Node_Count\">".$i."</td>";

      echo "<td class=\"Node_ID_hop1\">".nodeID($node,$sh_host,$total,1)."</td>";
      echo "<td class=\"tabel_total\">".$total."</td>";

      for ($k = 1; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            echo "<td class=\"tabel_hop\">".$host_hop[$sh_host][$node][$k]."</td>";
         else
            echo "<td class=\"tabel_hop\"></td>";

      echo "<td class=\"tabel_total\">".$reshare."</td>";
      echo "<td class=\"Node_Provider\">".providerID($caid,$providers,true,"Node_Provider",false)."</td>";
      echo "</tr>";
      $i++;
   }

   // HOP2
   if (isset($total_shares[2]))
   foreach ($nodes as $node=>$data)
   if (!isset($host_hop[$sh_host][$node][0]) && !isset($host_hop[$sh_host][$node][1]) && isset($host_hop[$sh_host][$node][2]))
   {
      $nodetype = $nodes[$node][0][1];
      $caid = $nodes[$node][0][2];
      $providers = $nodes[$node][0][4];
      $nodSh = explode("|",$node);

      $total = 0;for($k = 0; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            $total += $host_hop[$sh_host][$node][$k];

      $reshare = "<FONT COLOR=red>! NO !</FONT>";if ($re[$sh_host][$node]["reshare"] >0) if ($total==1) $reshare = $re[$sh_host][$node]["reshare"]; else $reshare = "<FONT COLOR=yellow>".$re[$sh_host][$node]["reshare"]."</FONT>";

      echo "<tr>";
      if (strstr($node,"*"))
         echo "<td class=\"tabel_normal_type\">".$i."</td>";
      else
         echo "<td class=\"Node_Count\">".$i."</td>";

      echo "<td class=\"Node_ID_hop2\">".nodeID($node,$sh_host,$total,2)."</td>";
      echo "<td class=\"tabel_total\">".$total."</td>";

      for ($k = 1; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            echo "<td class=\"tabel_hop\">".$host_hop[$sh_host][$node][$k]."</td>";
         else
            echo "<td class=\"tabel_hop\"></td>";

      echo "<td class=\"tabel_total\">".$reshare."</td>";
      echo "<td class=\"Node_Provider\">".providerID($caid,$providers,true,"Node_Provider",false)."</td>";
      echo "</tr>";
      $i++;
   }

   // HOP3
   if (isset($total_shares[3]))
   foreach ($nodes as $node=>$data)
   if (!isset($host_hop[$sh_host][$node][0]) && !isset($host_hop[$sh_host][$node][1]) && !isset($host_hop[$sh_host][$node][2]) && isset($host_hop[$sh_host][$node][3]))
   {
      $nodetype = $nodes[$node][0][1];
      $caid = $nodes[$node][0][2];
      $providers = $nodes[$node][0][4];
      $nodSh = explode("|",$node);

      $total = 0;for($k = 0; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            $total += $host_hop[$sh_host][$node][$k];

      $reshare = "<FONT COLOR=red>! NO !</FONT>";if ($re[$sh_host][$node]["reshare"] >0) if ($total==1) $reshare = $re[$sh_host][$node]["reshare"]; else $reshare = "<FONT COLOR=yellow>".$re[$sh_host][$node]["reshare"]."</FONT>";

      echo "<tr>";
      if (strstr($node,"*"))
         echo "<td class=\"tabel_normal_type\">".$i."</td>";
      else
         echo "<td class=\"Node_Count\">".$i."</td>";
      echo "<td class=\"Node_ID_hop3\">".nodeID($node,$sh_host,$total,3)."</td>";
      echo "<td class=\"tabel_total\">".$total."</td>";

      for ($k = 1; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            echo "<td class=\"tabel_hop\">".$host_hop[$sh_host][$node][$k]."</td>";
         else
            echo "<td class=\"tabel_hop\"></td>";

      echo "<td class=\"tabel_total\">".$reshare."</td>";
      echo "<td class=\"Node_Provider\">".providerID($caid,$providers,true,"Node_Provider",false)."</td>";
      echo "</tr>";
      $i++;
   }


   // HOP4
   if (isset($total_shares[4]))
   foreach ($nodes as $node=>$data)
   if (!isset($host_hop[$sh_host][$node][0]) && !isset($host_hop[$sh_host][$node][1]) && !isset($host_hop[$sh_host][$node][2]) && !isset($host_hop[$sh_host][$node][3]) && isset($host_hop[$sh_host][$node][4]))
   {
      $nodetype = $nodes[$node][0][1];
      $caid = $nodes[$node][0][2];
      $providers = $nodes[$node][0][4];
      $nodSh = explode("|",$node);

      $total = 0;for($k = 0; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            $total += $host_hop[$sh_host][$node][$k];

      $reshare = "<FONT COLOR=red>! NO !</FONT>";if ($re[$sh_host][$node]["reshare"] >0) if ($total==1) $reshare = $re[$sh_host][$node]["reshare"]; else $reshare = "<FONT COLOR=yellow>".$re[$sh_host][$node]["reshare"]."</FONT>";

      echo "<tr>";
      if (strstr($node,"*"))
         echo "<td class=\"tabel_normal_type\">".$i."</td>";
      else
         echo "<td class=\"Node_Count\">".$i."</td>";
      echo "<td class=\"Node_ID_hop4\">".nodeID($node,$sh_host,$total,4)."</td>";
      echo "<td class=\"tabel_total\">".$total."</td>";

      for ($k = 1; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            echo "<td class=\"tabel_hop\">".$host_hop[$sh_host][$node][$k]."</td>";
         else
            echo "<td class=\"tabel_hop\"></td>";

      echo "<td class=\"tabel_total\">".$reshare."</td>";
      echo "<td class=\"Node_Provider\">".providerID($caid,$providers,true,"Node_Provider",false)."</td>";
      echo "</tr>";
      $i++;
   }

   // HOP5 sau mai mult
   foreach ($nodes as $node=>$data)
   if ($node != "Info")
   if (!isset($host_hop[$sh_host][$node][0]) && !isset($host_hop[$sh_host][$node][1]) && !isset($host_hop[$sh_host][$node][2]) && !isset($host_hop[$sh_host][$node][3]) && !isset($host_hop[$sh_host][$node][4]))
   {
      $nodetype = $nodes[$node][0][1];
      $caid = $nodes[$node][0][2];
      $providers = $nodes[$node][0][4];
      $nodSh = explode("|",$node);

      $total = 0;for($k = 0; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            $total += $host_hop[$sh_host][$node][$k];

      $reshare = "<FONT COLOR=red>! NO !</FONT>";if ($re[$sh_host][$node]["reshare"] >0) if ($total==1) $reshare = $re[$sh_host][$node]["reshare"]; else $reshare = "<FONT COLOR=yellow>".$re[$sh_host][$node]["reshare"]."</FONT>";

      echo "<tr>";
      if (strstr($node,"*"))
         echo "<td class=\"tabel_normal_type\">".$i."</td>";
      else
         echo "<td class=\"Node_Count\">".$i."</td>";
      echo "<td class=\"Node_ID_hop5\">".nodeID($node,$sh_host,$total,5)."</td>";
      echo "<td class=\"tabel_total\">".$total."</td>";

      for ($k = 1; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            echo "<td class=\"tabel_hop\">".$host_hop[$sh_host][$node][$k]."</td>";
         else
            echo "<td class=\"tabel_hop\"></td>";

      echo "<td class=\"tabel_total\">".$reshare."</td>";
      echo "<td class=\"Node_Provider\">".providerID($caid,$providers,true,"Node_Provider",false)."</td>";
      echo "</tr>";
      $i++;
   }

   echo "</table>";
}

}

ENDPage();
?>

Die Datei kommt nach: /var/www/ipc/infophp

//EDIT:

also wenn ich es richtig gefunden habe, dann ist der Security Check bei diesem Infophp dabei:

CCcam Info Luft4Sat

Allerdings kann ich keine Seite oder Heimat dieses Teams / Person finden. Die aktuellste Version sollte die CCcaminfo Win v.1.3.2 Luft4sat sein.

Anbei das File... PW ist: luft4sat


Edit:

22 Mb zu viel fürs Forum? ich lads bei RS hoch..


Edit 2:

https://rapidshare.com/files/4151902577 ... .1.3.2.zip
feissmaik
Entwickler Team
Beiträge: 2576
Registriert: So 17. Apr 2011, 11:39
Been thanked: 1 time
Kontaktdaten:

Re: Sicherheit: Peers prüfen

Beitrag von feissmaik »

Sieht schonmal nicht sooo schlecht aus (also schonmal danke für den post) wobei ich es dabei vermisse die zu scanneden Ports irgendwo variable einstellen zu können


was mich hierbei allerdings auch etwas stört ist die art und weise wie der jeweilige Port überprüft wird

Code: Alles auswählen

...
   $host = "$host_IP";
   $sc_port = array ( $host_PORT=>"CCcam Port", 16001=>"CCcam Web", 16000=>"CCcamTelnet", 21=>"FTP", 22=>"SSH", 23=>"Telnet", 25=>"smtp", 80=>"HTTP");

   foreach($sc_port as $scanport=>$value)
    {
      $fp = @fsockopen($host,$scanport,$errno,$errstr,5);
      if($fp)
      {
         //echo "port " . $scanport . " open on " . $host . "\n <br>";

         echo "<tr bgcolor='#212121'>";
         echo "<td width=30><font color='green'><b>".$scanport . "&nbsp;&nbsp;</b></font></td>";
         echo "<td><font color='green'><b>Open</b></font></td>";
         echo "<td><font color='#ffffff'><b>".$value."</b></font></td></tr>";
         @fclose($fp);
         }
      else
      {
         //echo "port " . $scanport . " closed on " . $host . "\n  <br>";
         echo '<tr bgcolor="#212121">';
         echo "<td width=30><font color='red'><b>".$scanport . "&nbsp;&nbsp;</b></font></td>";
         echo "<td><font color='red'><b>Closed</b></font></td>";
         echo "<td><font color='#ffffff'><b>".$value."</b></font></td></tr>";
         }
      flush();
      }
      echo "<br>";
      $port_check = null;
   }
...
da würde ich lieber nmap bevorzugen da mehr informationen
Du musst nicht kämpfen um zu siegen
feissmaik
Entwickler Team
Beiträge: 2576
Registriert: So 17. Apr 2011, 11:39
Been thanked: 1 time
Kontaktdaten:

Re: Sicherheit: Peers prüfen

Beitrag von feissmaik »

Hier eine von mir angepasste server.php für das in IPC 11.3 intregierte CCcamInfoPHP

Die Port-Beschreibungen werden in der Datei portdescriptions.php hinterlegt, sofern bekannt - diese Datei wird also zusätzlich im infophp/ Verzeichniss benötigt

Die zu scannenden Ports werden in der server.php in Zeile 3 eingestellt - $PortsToScan - später mach ich das vllt noch auswählbar bevor man auf den SCAN NOW knopp drückt, mal gucken...


..die restlichen Code-Zeilen in der server.php sind mit " // port scan " gekennzeichnet..

server.php

Code: Alles auswählen

<?php
   
   $PortsToScan="20,21,22,23,25,80,443,988,8080,9080,12000,16000,16001,16002,22000";
   $scan_timeout="3";
   
   if (file_exists($servers_file))
      $servers_data = file ($servers_file);
      
   if (!isset($servers_data))
   {
      echo "<FONT COLOR=red>Server is down or updating ... Please try again later !</FONT>";
      exit;
   }
   
   if (file_exists($shares_file))
      $shares_data = file ($shares_file);
      
   if (!isset($shares_data))
   {
      echo "<FONT COLOR=red>Server is down or updating ... Please try again later !</FONT>";
      exit;
   }  
   
   loadOnlineData();
   
   //___________________________________________________________________________________________________
   
   $index = 0;
   $lastServer = "";
   $ServerSelectat = "";
   foreach ($servers_data as $currentline)
   {
      $inceput1 = substr($currentline,0,1);
      $inceput2 = substr($currentline,1,2);
      
      if ($inceput1 == "|" && $inceput2 != " H")
      {
         $server = explode("|", $currentline);
         $server_Host   = trim($server[1]);
         $server_Time   = trim($server[2]);
         $server_Type   = trim($server[3]);
         $server_Ver    = trim($server[4]);
         $server_Nodeid = trim($server[5]);
         $server_Cards  = trim($server[6]);
         $server_Idents = trim($server[7]);
         
         if ($server_Host != "")
         {
            $index++;
            $lastServer = $server_Host;
            $servers[$lastServer]["Info"] = array ($server_Time,$server_Type,$server_Ver,$server_Nodeid,$server_Cards);  
            
            if ($server_Host == $server_nodeDns) $ServerSelectat = $lastServer;

         }
         
         $servers[$lastServer]["Info"]["Idents"][] = $server_Idents;  
      }
   }
   unset($servers_data);
   

   //___________________________________________________________________________________________________
   $total_shares["total"] = 0;
   $maxhop = 0;
   

   foreach ($shares_data as $currentline) 
   {
      $inceput1 = substr($currentline,0,1);
      $inceput2 = substr($currentline,1,1);
      
      if ($inceput1 == "|" && $inceput2 != " ")
      {
         $share = explode("|", $currentline);
         
         $share_Host = trim($share[1]);
         $share_Type = trim($share[2]);
         $share_Caid = trim($share[3]);
         $share_System = trim($share[4]);
         
         $share_ProvidersList = trim($share[5]);
         if ($share_ProvidersList == "0,1,2,3,0") $share_ProvidersList= "0,1,2,3"; // pt premiere
         if ($share_ProvidersList == "") $share_ProvidersList = $str_empty;
         $share_Providers = explode(",", $share_ProvidersList); 
         
         list($share_Hop,$share_Reshare) = explode("   ", trim($share[6]));
         $share_Nodes = explode(",", trim($share[7]));  
         $share_Node = $share_Nodes[count($share_Nodes)-1];
         
         $share_Caid = adaug0($share_Caid,4);
         
         $share_Node = sterg0($share_Node);
         
         if ($share_Node == "")
            $share_NodeUnic = $share_Caid."|".$share_System."|".$share_ProvidersList."|".$share_Host;
         else
            $share_NodeUnic = $share_Caid."|".$share_System."|".$share_ProvidersList."|".sterg0($share_Node);
         
         $route = (isset($nodes))?count($nodes[$share_NodeUnic]):0;
         $servers[$share_Host][$share_NodeUnic]["total"] = $route;
         if ($route == 0) $servers[$share_Host][$share_NodeUnic]["total"] = 1;
         $servers[$share_Host][$share_NodeUnic][$route] = array ($share_Host,$share_Type,$share_Caid,$share_System,$share_ProvidersList,$share_Providers,$share_Hop,$share_Reshare,$share_Nodes,$share_Node);  
         
         
         if (!isset($total_shares["total"]))                $total_shares["total"] = 0;
         if (!isset($total_shares[$share_Hop]))             $total_shares[$share_Hop] = 0;
         if (!isset($share_nodes[$share_NodeUnic]))         $share_nodes[$share_NodeUnic] = 0;
         if (!isset($share_nodes_minhop[$share_NodeUnic]))  $share_nodes_minhop[$share_NodeUnic] = 9;
         
         $share_nodes[$share_NodeUnic]++;
         $share_nodes_minhop[$share_NodeUnic] = min( $share_nodes_minhop[$share_NodeUnic], $share_Hop );
         $total_shares["total"]++;
         $total_shares[$share_Hop]++;
         
         if (!isset($host_hop[$share_Host][$share_NodeUnic][$share_Hop]))  $host_hop[$share_Host][$share_NodeUnic][$share_Hop] = 0;
         if (!isset($total_host_shares[$share_Host]["total"]))             $total_host_shares[$share_Host]["total"] = 0;
         if (!isset($total_host_shares[$share_Host][$share_Hop]))          $total_host_shares[$share_Host][$share_Hop] = 0;      
         if (!isset($total_reshare[$share_Host]["total"]))                 $total_reshare[$share_Host]["total"] = 0;    
         if (!isset($re[$share_Host][$share_NodeUnic][$share_Hop]))        $re[$share_Host][$share_NodeUnic][$share_Hop] = 0;
         if (!isset($re[$share_Host][$share_NodeUnic]["reshare"]))         $re[$share_Host][$share_NodeUnic]["reshare"] = 0;     
         
         $host_hop[$share_Host][$share_NodeUnic][$share_Hop]++;
         $total_host_shares[$share_Host]["total"]++;
         $total_host_shares[$share_Host][$share_Hop]++;
         
         if (((int)$share_Reshare)>0) 
         {
            $total_reshare[$share_Host]["total"]++;
            $re[$share_Host][$share_NodeUnic][$share_Hop] = max($re[$share_Host][$share_NodeUnic][$share_Hop],((int)$share_Reshare));
            $re[$share_Host][$share_NodeUnic]["reshare"] = max($re[$share_Host][$share_NodeUnic]["reshare"],((int)$share_Reshare));          
         }
         $maxhop = max($maxhop,$share_Hop);
      } 
   }
   
   unset($shares_data);
//___________________________________________________________________________________________________
function nodeID($NodeUnic,$Host,$Total,$Hop)
{
   global $share_nodes;
   global $share_nodes_minhop;
   
   $nodSh = explode("|",$NodeUnic); 
   
   $Server = $nodSh[3];
   
   $Server2 = explode("_",$Server); 
   
   $Server_Host = "";
   $Server_Host2 = "";

   $Server = nodeIdName($Server);
   
   $extra = $share_nodes[$NodeUnic] - $Total + 1;
   
   if ($Server_Host == $Host)
   {
      $ret = "<font color=Fuchsia><B>".$Server."</B></font>";
   }
   else
   if ($extra > 1)
   {
      if ($share_nodes_minhop[$NodeUnic] == $Hop)
         $ret = "<font color=brown>".$Server."</font>";
      else
         $ret = $Server;
   }
   else
   {
      $ret = "<font color=Crimson>".$Server."</font>";
   }
   
   if ($extra > 1)
         $ret.=" (".$extra.")";
         
   global $pagina;
   global $serverindex;
   $ret = linkNod($NodeUnic,$ret,"node",false);

   return $ret;
}
//___________________________________________________________________________________________________

if ($server_nodeDns != "") 
   $sh_host = $server_nodeDns;
else
   $sh_host = $ServerSelectat;
   
if ($sh_host != "") $nodes = $servers[$sh_host];

if (isset($nodes) && count($nodes))
{ 
   $info_total = 0;  
   if (isset($total_host_shares[$sh_host]["total"]))
      $info_total = $total_host_shares[$sh_host]["total"];
      
   $info_total_unic = count($nodes) - 1;
   
   $info_uniqueIndex = 0;
   if ($info_total!=0)
      $info_uniqueIndex = (int)($info_total_unic/$info_total *100);
   //$info_total_reshare = $total_reshare[$sh_host]["total"];
   //$info_reshareIndex = (int)($info_total_reshare/$info_total_unic *100);
   
   list($host_DNS, $host_PORT) = explode(":", $sh_host);
   
   $host_IP    = trim(getHostIP($host_DNS));
   $tara_host  = taraNameSaved($sh_host);
   $IPServer   = trim($tara_host[1]); 
   $tara_code  = tara($host_IP,$sh_host);


   if ($host_IP !="" && $IPServer !="" && $host_IP != $IPServer)
   {
      loadGlobalServers();
      $globalServers[$sh_host][1] = $IPServer;
      saveGlobalServers();
   }


   if ($country_whois == true) 
      $tara_nume = taraName($tara_code["tara"]);
      
   echo "<table border=0 cellpadding=0 cellspacing=0>";
   echo "<tr>";
   echo "<td VALIGN = \"top\">";

   format1("Server",$sh_host);

	if ($host_IP=="unknown")
   	format1("IP/Clients",$host_IP);
   else
   	format1("IP/Clients",$host_IP." / ".clientIP($host_IP,$sh_host));
   	
   if ($country_whois == true)
   {
   	if ($tara_code["tara"]=="??")
   		 format1("Country","Unresolved IP");
   	else
      if ($tara_code["tara"]=="<>")
         format1("Country","Local Private IP");
      else
         format1("Country",$tara_code["tara"]." , ".$tara_nume);
   }
   //format1("Connected from IP",clientIP($host_IP,$sh_host));
   
   if ($nodes["Info"][3] != "")
      format1("NodeID", $nodes["Info"][3]); 
      
   if ($nodes["Info"][3] != "")
      format1("Type/Ver", $nodes["Info"][1]." / ".$nodes["Info"][2] );
   else
      format1("Type", $nodes["Info"][1] ); 
      
   if ($nodes["Info"][0] != "")
   	format1("Connected",$nodes["Info"][0]);
   else
   {
   	$text_offline = "-- OFFLINE --";
		if (isset($OnlineServers[$sh_host]) && $OnlineServers[$sh_host]["time"]!="")
		{
			$last_online = $OnlineServers[$sh_host]["time"];
			$text_offline = get_formatted_timediff($last_online)." ago";
		}
   	format1("Connected","<FONT color=red>$text_offline</FONT>");
   }
   
     

   //format1("Type",$nodes["Info"][1]);
   //format1("Version",$nodes["Info"][2]);
   //format1("Shares",$info_total);
   
   echo "</td>";
   echo "<td VALIGN = \"top\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Note :&nbsp;&nbsp;";
   echo "</td>";
   echo "<td VALIGN = \"top\">";
   
   $notes_saved = "";
   $notes_save_path   = $notes_path.$host_DNS.".".$host_PORT.".note";   
   if (file_exists($notes_save_path)) 
   {
      $fh = fopen($notes_save_path, 'r');
      $notes_saved = fread($fh, filesize($notes_save_path));
      fclose($fh); 
   }
   ?>
   <FORM NAME="formular" METHOD="post" ACTION="
   <?php 
   echo $pagina;
   ?>
   "><TEXTAREA CLASS="TEXTAREANORMAL" COLS="30" name="saveNotes" ID="saveNotes" ROWS="4" TABINDEX="1" value=""><?php echo $notes_saved ?></TEXTAREA>
   <DIV ALIGN = "right"><INPUT TYPE="submit" VALUE="Save" TABINDEX="2" class="savetextbutton"></DIV>
      <input type="hidden" name="nodeDns" ID="nodeDns" value="<?php echo $server_nodeDns ?>">
   </FORM>
   <?php
   echo "</td>";
   echo "</tr>";
   echo "</table>";
   
   
   
   // online history
   $online_saveTime = $OnlineServers["savetime"]["time"];
   $online_lastseen = $OnlineServers[$sh_host]["time"];
   $online_history  = $OnlineServers[$sh_host]["log"];
  /* 
   if ($online_saveTime != $online_lastseen && $online_lastseen!="")
   {
   	$timediff = ($online_saveTime - $online_lastseen);
	   $minuteLastSave  = (int) intval($timediff / INT_MINUTE);
	   $online_history = "-".$minuteLastSave.".".$online_history;
   }
	*/
   
   $logtime = explode(".", $online_history);
   $history_off = 0;
   $history_on = 0;
   foreach ($logtime as $log)
   {
   	if (strstr($log,"-"))
   	{
   		$history_off = $history_off + substr($log,1);
   	}
   	else 	
   	{
   		$history_on = $history_on + $log;
   	}
	} 
	
	$DIV_history_off = "";
	if ($history_off >0) $DIV_history_off = "<FONT color=red>".formatted_timediff($history_off*60)."</FONT>";
	
	$DIV_history_total = formatted_timediff(($history_off + $history_on)*60);
   
   if ($history_off >0)
   	format1("Uptime",procentColor(procentOnline($sh_host))." [ ".$DIV_history_off." / ".$DIV_history_total." ]");
   else
   	format1("Uptime",procentColor(procentOnline($sh_host))." [ ".$DIV_history_total." ]");
   	
   echo "<BR>";
   if ($country_whois == true && $tara_code["tara"]!="<>")
   {
      format1("ISP Info",$tara_code["info"]);
   }
   
   $reverseDNS = gethostbyaddr($host_IP); 
   if ($reverseDNS != $host_IP)
   	format1("Reverse DNS",$reverseDNS);
   else
   	format1("Reverse DNS","<FONT color=red>missing</FONT>");
   

   echo "<BR>";
   
   ob_flush();
	flush();

	$LastPingError = "Very slow";
   $pingCount = 5;
   $pingCountOK = 0;
   $pingLast = 0;
   $pingTimeTotal = 0;
   
   //echo "<table border=0 cellpadding=0 cellspacing=0>";
   $ping_text_try = "";
   
   $stringquerry = $_SERVER['QUERY_STRING'];
   if (!strstr($stringquerry,"&checkPing=1")) 
   	$stringquerry = $stringquerry."&checkPing=1";
   $ping_text_try_check = "&nbsp;<A class=\"tabel_header\" HREF=".$pagina."?".$stringquerry.">&nbsp;PING NOW&nbsp;&nbsp;</A>";
   
   $pingTryMax = 0;
   if ($server_checkPing != "")
   {
      for ($k = 1; $k <= $pingCount; $k++) 
      {
         usleep(1000000);
         $pingTry = -1;
         $pingTry = pingDomain($host_IP,$host_PORT,5);
         
         if ($pingTryMax == 0)
      		  $pingTryMax = $pingTry;
         else
   		   if ($pingTryMax < $pingTry) $pingTryMax = $pingTry;

         if ($k>1) $ping_text_try = $ping_text_try." , ";
         if ($pingTry>0) 
         {
            $pingCountOK++;
            
            $ping_text_try = $ping_text_try.$pingTry."ms";
         }
         else
         {
            $ping_text_try = $ping_text_try."<FONT color=red>--</FONT>";
            if ($pingLast==-1)
            {
               $pingTimeTotal = -1;
               break;
            }
         }
   
            
         $pingTime[] = $pingTry;
         $pingLast = $pingTry; 
      }
      $ping_text_try = " : {".$ping_text_try."}";
   }
   
   //echo "</table>";
   
   $textPingCurent = "";

   if ($pingTimeTotal == 0)
   {
      
    
      $lost = $pingCount - $pingCountOK;
      
      $rezultatPing = $ping_text_try_check."<FONT color=gray>".$ping_text_try."</FONT>";
      
       
         		
      if ($lost == 0)
      {
      	 for ($k = 0; $k < $pingCount; $k++)
         	  if ($pingTime[$k] >0) $pingTimeTotal = $pingTimeTotal + $pingTime[$k];
      
      	 $pingTimeTotal = $pingTimeTotal - $pingTryMax;
          $pingTimeFinal = (int)($pingTimeTotal/($pingCountOK-1));
      
      	 SavePing($sh_host,$pingTimeFinal);
      	 $textPingCurent  = " = ".$pingTimeFinal."ms ";
      }
      else
      if ($server_checkPing != "")
      	$textPingCurent  = " = NOT SAVED";
	
   }
   else   
   if ($server_checkPing != "")
   {
  		$rezultatPing = $ping_text_try_check.": ".$LastPingError;
   }
   else
  	   $rezultatPing = $ping_text_try_check;

   $bestPingSaved = SavedPing($sh_host);
   
   $textPingAverage = pingResultColor($bestPingSaved[0],1);
   $textPingBest    = pingResultColor($bestPingSaved[2],1);
   
   $diffPing = $bestPingSaved[0] - $bestPingSaved[2];
   $diffMargin = (int)($bestPingSaved[2] * 50/100);
   if ($diffMargin < 50) $diffMargin  = 50;
   
   if ($diffPing > $diffMargin ) $textPingAverage = "<FONT COLOR=red><B>! </B></FONT>".$textPingAverage;
   
   format1("Best ever responce time (ping) ",$textPingBest);
   format1("Average responce time (ping) ",$textPingAverage);
   format1("Current responce time (ping) ",$rezultatPing.$textPingCurent);

  // port scan - START
  	$port_check_txt = "&nbsp;<A class=\"tabel_header\" HREF=".$pagina."?".$_SERVER['QUERY_STRING']."&checkPort=1>&nbsp;SCAN NOW&nbsp;&nbsp;</A>";
		$port_check = "nodeDns=".$sh_host."&checkPort=1";
		echo "<br/>";
		format1("SECURITY CHECK (portscan) ",$port_check_txt);

	if($_SERVER['QUERY_STRING'] == $port_check) {
		echo "<br>";
		//echo "Legend: <font color='green'><b>OPEN Port</b></font> -|- <font color='red'><b>CLOSED Port</b></font> <br><br>";
		echo '<table border="1" cellspacing="0" cellpadding="5">';
		echo '<tr bgcolor="#600000">';
		echo '<td width="30"><b><font color="#ffffff" >Port</font></b></td>';
		echo '<td width="40"><b><font color="#ffffff" >Status</font></b></td>';
		echo '<td><b><font color="#ffffff" >Description</font></b></td></tr>';

		include_once("portdescriptions.php");
		$portlist = explode(",",$PortsToScan);
		foreach($portlist AS $PORT) {
			$DESC = "";
			if (isset($_PortDes[$PORT])) { $DESC = $_PortDes["$PORT"]; }
			$sc_port["$PORT"] = "$DESC";
		}
		$sc_port["$host_PORT"] = "-> Peer's Server Port";

		foreach($sc_port as $scanport => $value) {
			$fp = @fsockopen($host_IP,$scanport,$errno,$errstr,$scan_timeout);
			if($fp) {
				//echo "port " . $scanport . " open on " . $host_IP . "\n <br>";
				echo "<tr bgcolor='#212121'>";
				echo "<td width=30><font color='green'><b>".$scanport . "&nbsp;&nbsp;</b></font></td>";
				echo "<td><font color='green'><b>Open</b></font></td>";
				echo "<td><font color='#ffffff'><b>".$value."</b></font></td></tr>";
				@fclose($fp);
			} else {
				//echo "port " . $scanport . " closed on " . $host_IP . "\n  <br>";
				echo '<tr bgcolor="#212121">';
				echo "<td width=30><font color='red'><b>".$scanport . "&nbsp;&nbsp;</b></font></td>";
				echo "<td><font color='red'><b>Closed</b></font></td>";
				echo "<td><font color='#ffffff'><b>".$value."</b></font></td></tr>";
			}
      flush();
		}
		echo "<br>";
		$port_check = null;
	}
	echo "</table>";
	// port scan - ENDE

   //format1("Unique",$info_total_unic,$info_total);
   //format1("Reshare",$info_total_reshare,$info_total_unic);

   $ecm_total = 0;
   $ecmOK_total = 0;
   foreach ($servers[$sh_host]["Info"]["Idents"] as $hit_data)
   {
      $hit_array = explode(" ",$hit_data);
      if ($hit_array[0] != "")
      {
         $hit_provider = explode(":",$hit_array[1]);
         $hit_exact = explode("(",$hit_array[2]);
         $hit_exact2 = explode(")",$hit_exact[1]);
         
         $hit_ecm = $hit_exact[0];
         $hit_ecmOK = $hit_exact2[0];
         
         $ecm_total = $ecm_total+$hit_ecm;
         $ecmOK_total = $ecmOK_total+$hit_ecmOK;
         
         $key = adaug0($hit_ecmOK,20).adaug0($hit_ecm,20).$hit_array[1];
         $ecmok_sortat[$key] = $hit_data;
         
      }
   }
   
   loadECMServers(true);
   echo "<BR>";   
   $record_ECM = $ECMservers[$sh_host]["Info"]["ECM_SAVED"]["ECM"];
   $record_ECMOK = $ECMservers[$sh_host]["Info"]["ECM_SAVED"]["ECMOK"];
   
   if (($ecm_total == $record_ECM) && ($ecmOK_total == $record_ECMOK))
      format1("Handled ECM",$record_ECMOK,$record_ECM);
   else
   {
      if ($record_ECM !="")
         format1("Handled ECM ( saved )",$record_ECMOK,$record_ECM);
         
      format1("Handled ECM ( now )",$ecmOK_total,$ecm_total);
   }
   
   if ($ecm_total)
   {
      //echo "<BR>"; 
      echo "<table border=0 cellpadding=2 cellspacing=1>";
      echo "<tr>";
      echo "<th class=\"tabel_headerc\">#</th>";
      echo "<th class=\"tabel_headerc\">Type</th>";
      echo "<th class=\"tabel_header\">ECM</th>";
      echo "<th class=\"tabel_header\">OK</th>";
      echo "<th class=\"tabel_header\">CAID/Ident</th>";
      echo "</tr>";
   }
   
  if (isset($ecmok_sortat))
  {
   	krsort($ecmok_sortat);
   
	   $counthits = 0;
	   if ($ecmok_sortat)
	   foreach ($ecmok_sortat as $key => $hit_data)
	   {
	      $hit_array = explode(" ",$hit_data);
	      if ($hit_array[0] != "")
	      {
	         $counthits++;
	         $hit_provider = explode(":",$hit_array[1]);
	         $hit_exact = explode("(",$hit_array[2]);
	         $hit_exact2 = explode(")",$hit_exact[1]);
	         
	         $hit_ecm = $hit_exact[0];
	         $hit_ecmOK = $hit_exact2[0];
	         
	         echo "<tr>";
	         echo "<td class=\"Node_Provider\">".$counthits."</td>";
	         echo "<td class=\"tabel_hop_total1\">".$hit_array[0]."</td>";
	         
	         
	         echo "<td class=\"tabel_hop_total\"><FONT COLOR=white>".$hit_ecm."</FONT></td>";
	         
	         if ($hit_ecmOK == 0)  echo "<td class=\"tabel_hop_total\"><FONT COLOR=red>".$hit_ecmOK."</FONT></td>";
	         else
	         if ($hit_ecmOK != $hit_ecm)  echo "<td class=\"tabel_hop_total\"><FONT COLOR=yellow>".$hit_ecmOK."</FONT></td>";
	         else
	            echo "<td class=\"tabel_hop_total\">".$hit_ecmOK."</td>";
	         
	         echo "<td class=\"Node_Provider\">".Providerid($hit_provider[0],$hit_provider[1],true,"Node_Provider",false)."</td>";
	         echo "</tr>";
	      }
	   }
	}
	
   if ($ecm_total)
      echo "</table>";
   echo "<BR>";
   
   $total_nodes = 0;for($k = 0; $k <= $maxhop; $k++)
   {
      if (isset($total_host_shares[$sh_host][$k]))
         $total_nodes += $total_host_shares[$sh_host][$k];
   }

if ($total_nodes>0)
{
   format1("Nodes",$info_total_unic);
   echo "<table border=0 cellpadding=2 cellspacing=1>";
   echo "<tr>";
   echo "<th class=\"tabel_headerc\">#</th>";
   echo "<th class=\"tabel_header\">NodeID/Server (extra sources)</th>";
   echo "<th class=\"tabel_header\">Shares</th>";

   for ($k = 1; $k <= $maxhop; $k++) echo "<th class=\"tabel_headerc\">hop".$k."</th>"; 
   echo "<th class=\"tabel_headerc\">Reshare</th>";
   echo "<th class=\"tabel_header\">CAID/Idents</th>";
   echo "</tr>";
   
   //$info_total = $total_host_shares[$sh_host]["total"];
   //$info_total_unic = count($nodes) - 1;
   //$info_uniqueIndex = (int)($info_total_unic/$info_total *100);
   //$info_total_reshare = $total_reshare[$sh_host]["total"];
   //$info_reshareIndex = (int)($info_total_reshare/$info_total_unic *100);
   
   echo "<tr>";
   echo "<td class=\"tabel_total\"></td>";
   echo "<td class=\"tabel_total\"></td>";
   echo "<td class=\"tabel_total\">".$total_host_shares[$sh_host]["total"]."</td>";
   for ($k = 1; $k <= $maxhop; $k++) echo "<td class=\"tabel_total\">".$total_host_shares[$sh_host][$k]."</td>"; 
   echo "<td class=\"tabel_total\">".$total_reshare[$sh_host]["total"]."</td>";
   echo "<td class=\"tabel_total\"></td>";
   echo "</tr>";
   
   $i=1;
   
   // HOP1
   if (isset($total_shares[1]))
   foreach ($nodes as $node=>$data) 
   if (!isset($host_hop[$sh_host][$node][0]) && isset($host_hop[$sh_host][$node][1]))
   {
      $nodetype = $nodes[$node][0][1];
      $caid = $nodes[$node][0][2];
      $providers = $nodes[$node][0][4];
      $nodSh = explode("|",$node);  
      
      $total = 0;for($k = 0; $k <= $maxhop; $k++) 
         if (isset($host_hop[$sh_host][$node][$k]))
            $total += $host_hop[$sh_host][$node][$k];
      
      $reshare = "<FONT COLOR=red>! NO !</FONT>";if ($re[$sh_host][$node]["reshare"] >0) if ($total==1) $reshare = $re[$sh_host][$node]["reshare"]; else $reshare = "<FONT COLOR=yellow>".$re[$sh_host][$node]["reshare"]."</FONT>";

      echo "<tr>";
      echo "<td class=\"Node_Count\">".$i."</td>";
         
      echo "<td class=\"Node_ID_hop1\">".nodeID($node,$sh_host,$total,1)."</td>";
      echo "<td class=\"tabel_total\">".$total."</td>";

      for ($k = 1; $k <= $maxhop; $k++) 
         if (isset($host_hop[$sh_host][$node][$k]))
            echo "<td class=\"tabel_hop\">".$host_hop[$sh_host][$node][$k]."</td>";
         else
            echo "<td class=\"tabel_hop\"></td>";
      
      echo "<td class=\"tabel_total\">".$reshare."</td>";
      echo "<td class=\"Node_Provider\">".providerID($caid,$providers,true,"Node_Provider",false)."</td>";
      echo "</tr>";
      $i++;
   }
   
   // HOP2
   if (isset($total_shares[2]))
   foreach ($nodes as $node=>$data) 
   if (!isset($host_hop[$sh_host][$node][0]) && !isset($host_hop[$sh_host][$node][1]) && isset($host_hop[$sh_host][$node][2]))
   {
      $nodetype = $nodes[$node][0][1];
      $caid = $nodes[$node][0][2];
      $providers = $nodes[$node][0][4];
      $nodSh = explode("|",$node);  
         
      $total = 0;for($k = 0; $k <= $maxhop; $k++) 
         if (isset($host_hop[$sh_host][$node][$k]))
            $total += $host_hop[$sh_host][$node][$k];
            
      $reshare = "<FONT COLOR=red>! NO !</FONT>";if ($re[$sh_host][$node]["reshare"] >0) if ($total==1) $reshare = $re[$sh_host][$node]["reshare"]; else $reshare = "<FONT COLOR=yellow>".$re[$sh_host][$node]["reshare"]."</FONT>";
      
      echo "<tr>";
      if (strstr($node,"*"))
         echo "<td class=\"tabel_normal_type\">".$i."</td>";
      else
         echo "<td class=\"Node_Count\">".$i."</td>";
         
      echo "<td class=\"Node_ID_hop2\">".nodeID($node,$sh_host,$total,2)."</td>";
      echo "<td class=\"tabel_total\">".$total."</td>";

      for ($k = 1; $k <= $maxhop; $k++) 
         if (isset($host_hop[$sh_host][$node][$k]))
            echo "<td class=\"tabel_hop\">".$host_hop[$sh_host][$node][$k]."</td>";
         else
            echo "<td class=\"tabel_hop\"></td>";
            
      echo "<td class=\"tabel_total\">".$reshare."</td>";
      echo "<td class=\"Node_Provider\">".providerID($caid,$providers,true,"Node_Provider",false)."</td>";
      echo "</tr>";
      $i++;
   }
   
   // HOP3
   if (isset($total_shares[3]))
   foreach ($nodes as $node=>$data) 
   if (!isset($host_hop[$sh_host][$node][0]) && !isset($host_hop[$sh_host][$node][1]) && !isset($host_hop[$sh_host][$node][2]) && isset($host_hop[$sh_host][$node][3]))
   {
      $nodetype = $nodes[$node][0][1];
      $caid = $nodes[$node][0][2];
      $providers = $nodes[$node][0][4];
      $nodSh = explode("|",$node);
      
      $total = 0;for($k = 0; $k <= $maxhop; $k++) 
         if (isset($host_hop[$sh_host][$node][$k]))
            $total += $host_hop[$sh_host][$node][$k];
            
      $reshare = "<FONT COLOR=red>! NO !</FONT>";if ($re[$sh_host][$node]["reshare"] >0) if ($total==1) $reshare = $re[$sh_host][$node]["reshare"]; else $reshare = "<FONT COLOR=yellow>".$re[$sh_host][$node]["reshare"]."</FONT>";

      echo "<tr>";
      if (strstr($node,"*"))
         echo "<td class=\"tabel_normal_type\">".$i."</td>";
      else
         echo "<td class=\"Node_Count\">".$i."</td>";
      echo "<td class=\"Node_ID_hop3\">".nodeID($node,$sh_host,$total,3)."</td>";
      echo "<td class=\"tabel_total\">".$total."</td>";

      for ($k = 1; $k <= $maxhop; $k++) 
         if (isset($host_hop[$sh_host][$node][$k]))
            echo "<td class=\"tabel_hop\">".$host_hop[$sh_host][$node][$k]."</td>";
         else
            echo "<td class=\"tabel_hop\"></td>";
            
      echo "<td class=\"tabel_total\">".$reshare."</td>";
      echo "<td class=\"Node_Provider\">".providerID($caid,$providers,true,"Node_Provider",false)."</td>";
      echo "</tr>";
      $i++;
   }
   
   
   // HOP4
   if (isset($total_shares[4]))
   foreach ($nodes as $node=>$data) 
   if (!isset($host_hop[$sh_host][$node][0]) && !isset($host_hop[$sh_host][$node][1]) && !isset($host_hop[$sh_host][$node][2]) && !isset($host_hop[$sh_host][$node][3]) && isset($host_hop[$sh_host][$node][4]))
   {
      $nodetype = $nodes[$node][0][1];
      $caid = $nodes[$node][0][2];
      $providers = $nodes[$node][0][4];
      $nodSh = explode("|",$node);
      
      $total = 0;for($k = 0; $k <= $maxhop; $k++) 
         if (isset($host_hop[$sh_host][$node][$k]))
            $total += $host_hop[$sh_host][$node][$k];
            
      $reshare = "<FONT COLOR=red>! NO !</FONT>";if ($re[$sh_host][$node]["reshare"] >0) if ($total==1) $reshare = $re[$sh_host][$node]["reshare"]; else $reshare = "<FONT COLOR=yellow>".$re[$sh_host][$node]["reshare"]."</FONT>";

      echo "<tr>";
      if (strstr($node,"*"))
         echo "<td class=\"tabel_normal_type\">".$i."</td>";
      else
         echo "<td class=\"Node_Count\">".$i."</td>";
      echo "<td class=\"Node_ID_hop4\">".nodeID($node,$sh_host,$total,4)."</td>";
      echo "<td class=\"tabel_total\">".$total."</td>";

      for ($k = 1; $k <= $maxhop; $k++) 
         if (isset($host_hop[$sh_host][$node][$k]))
            echo "<td class=\"tabel_hop\">".$host_hop[$sh_host][$node][$k]."</td>";
         else
            echo "<td class=\"tabel_hop\"></td>";
            
      echo "<td class=\"tabel_total\">".$reshare."</td>";
      echo "<td class=\"Node_Provider\">".providerID($caid,$providers,true,"Node_Provider",false)."</td>";
      echo "</tr>";
      $i++;
   }
   
   // HOP5 sau mai mult
   foreach ($nodes as $node=>$data) 
   if ($node != "Info")
   if (!isset($host_hop[$sh_host][$node][0]) && !isset($host_hop[$sh_host][$node][1]) && !isset($host_hop[$sh_host][$node][2]) && !isset($host_hop[$sh_host][$node][3]) && !isset($host_hop[$sh_host][$node][4]))
   {
      $nodetype = $nodes[$node][0][1];
      $caid = $nodes[$node][0][2];
      $providers = $nodes[$node][0][4];
      $nodSh = explode("|",$node);
      
      $total = 0;for($k = 0; $k <= $maxhop; $k++) 
         if (isset($host_hop[$sh_host][$node][$k]))
            $total += $host_hop[$sh_host][$node][$k];
            
      $reshare = "<FONT COLOR=red>! NO !</FONT>";if ($re[$sh_host][$node]["reshare"] >0) if ($total==1) $reshare = $re[$sh_host][$node]["reshare"]; else $reshare = "<FONT COLOR=yellow>".$re[$sh_host][$node]["reshare"]."</FONT>";

      echo "<tr>";
      if (strstr($node,"*"))
         echo "<td class=\"tabel_normal_type\">".$i."</td>";
      else
         echo "<td class=\"Node_Count\">".$i."</td>";
      echo "<td class=\"Node_ID_hop5\">".nodeID($node,$sh_host,$total,5)."</td>";
      echo "<td class=\"tabel_total\">".$total."</td>";

      for ($k = 1; $k <= $maxhop; $k++) 
         if (isset($host_hop[$sh_host][$node][$k]))
            echo "<td class=\"tabel_hop\">".$host_hop[$sh_host][$node][$k]."</td>";
         else
            echo "<td class=\"tabel_hop\"></td>";
            
      echo "<td class=\"tabel_total\">".$reshare."</td>";
      echo "<td class=\"Node_Provider\">".providerID($caid,$providers,true,"Node_Provider",false)."</td>";
      echo "</tr>";
      $i++;
   }
   
   echo "</table>";
}

}

ENDPage();
?>
portdescriptions.php

Code: Alles auswählen

<?php

// Ports Description list

$_PortDes['20']="FTP-Server (data)";
$_PortDes['21']="FTP-Server (control)";
$_PortDes['22']="SSH-Server";
$_PortDes['23']="Telnet-Server";
$_PortDes['25']="SMTP-Server (mail)";
$_PortDes['37']="Time";
$_PortDes['53']="DNS-Server";
$_PortDes['69']="TFTP";
$_PortDes['79']="Finger";
$_PortDes['80']="Web-Server";
$_PortDes['88']=" moegliches Router-Interface";
$_PortDes['106']="POP3PW";
$_PortDes['110']="POP3-Server (mail)";
$_PortDes['111']="rpcbind";
$_PortDes['113']="ident";
$_PortDes['123']="NTP";
$_PortDes['135']="RPC-Dienst<br> Hohes RPC/DCOM-Wurm W32.Blaster Risiko";
$_PortDes['137']="netbios-ns";
$_PortDes['138']="netbios-dgm";
$_PortDes['139']="SMB-Server<br> Hier liegt offensichtlich ein hohes Risiko vor<br> Dieser Port wird fuer Windows Freigaben verwendet, solltest du diesen Port unabsichtlich offen haben entferne die Microsoft Freigabe Bindungen vom PPP Adapter!";
$_PortDes['143']="IMAP";
$_PortDes['389']="LDAP";
$_PortDes['443']="Web-Server (ssl)";
$_PortDes['445']="SMB-Server<br> Sasser Wurm Risiko";
$_PortDes['465']="SMTPS";
$_PortDes['513']="Rlogin";
$_PortDes['554']="RTSP";
$_PortDes['587']="Submission";
$_PortDes['631']="IPP";
$_PortDes['902']="VMware";
$_PortDes['990']="SFTP";
$_PortDes['1080']="Socks - moeglicher Bugbear.b/Tanatos Virus";
$_PortDes['1214']="Kazaa";
$_PortDes['1243']=" moeglicher Trojaner";
$_PortDes['1352']="Domino";
$_PortDes['1433']="MSSQL";
$_PortDes['1494']="Citrix";
$_PortDes['1503']="Netmeeting T.120";
$_PortDes['1720']="Netmeeting H.323";
$_PortDes['1731']="Netmeeting H.323 AudioCall";
$_PortDes['1723']="VPN/PPTP";
$_PortDes['1999']=" moeglicher Trojaner";
$_PortDes['2705']="ShareDirect P2P";
$_PortDes['3306']="MySQL-Server";
$_PortDes['3127']=" moeglicher MyDoom-Wurm";
$_PortDes['3128']="SQUID Proxy Cache (Trojan)";
$_PortDes['3389']="Terminal-Server (RDP)";
$_PortDes['3689']="Apple iTunes music sharing";
$_PortDes['3724']="World of Warcraft";
$_PortDes['4020']="GlobalChat";
$_PortDes['4662']="eDonkey Net";
$_PortDes['4711']="Webinterface von eMule";
$_PortDes['4899']="radim";
$_PortDes['5000']="Yahoo Messenger voice chat<br> moeglicher Sasser Clone";
$_PortDes['5001']="Yahoo Messenger voice chat";
$_PortDes['5050']="Yahoo Messenger";
$_PortDes['5060']="SIP";
$_PortDes['5100']="Yahoo Webcam";
$_PortDes['5190']="AOL AIM";
$_PortDes['5500']="P2P File Sharing";
$_PortDes['5501']="P2P File Sharing";
$_PortDes['5502']="P2P File Sharing";
$_PortDes['5503']="P2P File Sharing";
$_PortDes['5631']="PCAnywhere";
$_PortDes['5800']="VNC-Server";
$_PortDes['5900']="VNC-Java-Viewer";
$_PortDes['6776']=" moeglicher Trojaner";
$_PortDes['6881']="BitTorrent";
$_PortDes['6969']="BitTorrent";
$_PortDes['7070']="realserver";
$_PortDes['7789']=" moeglicher Trojaner";
$_PortDes['8000']="HTTP-Proxy";
$_PortDes['8001']="HTTP-Proxy";
$_PortDes['8009']="Apache JServ Tomcat";
$_PortDes['8038']="P2P";
$_PortDes['8080']="Web- oder Proxyserver, Webinterface von einem Router moeglich";
$_PortDes['8118']="TOR";
$_PortDes['9080']="Camd3 Web Interface";
$_PortDes['9090']="zeus-admin";
$_PortDes['9898']="MonkeyCom (Trojan)";
$_PortDes['12000']="CCcam-Server";
$_PortDes['10168']="WORM_LOVGATE.C (als Winppcsrv.e, Syshelp.exe, Winrcp.exe, WinGate.exe, Repcsrv.exe)";
$_PortDes['12345']=" moeglicher Trojaner";
$_PortDes['16000']="CCcam-Telnet";
$_PortDes['16001']="CCcam Web Interface";
$_PortDes['16002']="OScam Web Interface";
$_PortDes['22000']="OScam newcamd";
$_PortDes['26000']="Quake";
$_PortDes['28800']="MSN";
$_PortDes['29100']="MSN";
$_PortDes['31337']=" moeglicher Trojaner";
$_PortDes['54320']=" moeglicher Trojaner";
$_PortDes['54321']=" moeglicher Trojaner";
#$_PortDes['']="";

?>
Das sieht dann ungefähr so aus:
_portscan.png
_portscan.png (39.78 KiB) 3518 mal betrachtet
Du musst nicht kämpfen um zu siegen
feissmaik
Entwickler Team
Beiträge: 2576
Registriert: So 17. Apr 2011, 11:39
Been thanked: 1 time
Kontaktdaten:

Re: Sicherheit: Peers prüfen

Beitrag von feissmaik »

...hab die port scan funktion in der server.php noch etwas optimiert sowie $scan_timeout eingefügt und von 5 auf 3 gestellt...

den response mit auszuwerten bzw auszugeben ist hierbei leider nicht allzu sinnvoll da es das ganze extrem ausbremst

die portdescriptions.php hab ich vorhin nur notdürftig zusammengewürfelt - kann sein das einige Beschreibungen falsch oder veraltet sind; da hab ich jetzt nicht allzusehr drauf geachtet zumal es über 48000 bekannte Ports gäbe :?
Du musst nicht kämpfen um zu siegen
gollumA
IPC Freak
Beiträge: 152
Registriert: Di 26. Apr 2011, 18:10
Kontaktdaten:

Re: Sicherheit: Peers prüfen

Beitrag von gollumA »

ich sag mal

HAMMER ARBEIT
feissmaik
Entwickler Team
Beiträge: 2576
Registriert: So 17. Apr 2011, 11:39
Been thanked: 1 time
Kontaktdaten:

Re: Sicherheit: Peers prüfen

Beitrag von feissmaik »

...soo, denke das sollte nun passen... oder? 8-)
_p.png
_p.png (37.38 KiB) 3573 mal betrachtet
Man muss halt ein bischen mit der Maus über dem SCAN NOW knopp verweilen bevor das Tooltip aufpopt (absichtlich), man kann aber auch einfach trotzdem auf SCAN NOW klicken...

In diese Auswahl kommen alle Ports die in der portdescriptions.php Datei hinterlegt sind, aber maximal 10 nebeneinander ($MAXLINES)

$_defaultPortsToScan sind die Ports, die bei der Auswahl bereits vorangewählt sein sollen

Zusätzlich wird hierfür auch noch das Java Script wz_tooltip.js im infophp/ Verzeichniss benötigt (siehe Anhang)

server.php

Code: Alles auswählen

<?php
// v0.51

   $PortsToScan="20,21,22,23,25,80,443,988,8080,9080,12000,16000,16001,16002,22000";
   $scan_timeout="3";
   //$_defaultPortsToScan="22,23,80,12000";
   $_defaultPortsToScan=$PortsToScan;
   
   if (file_exists($servers_file))
      $servers_data = file ($servers_file);
     
   if (!isset($servers_data))
   {
      echo "<FONT COLOR=red>Server is down or updating ... Please try again later !</FONT>";
      exit;
   }
   
   if (file_exists($shares_file))
      $shares_data = file ($shares_file);
     
   if (!isset($shares_data))
   {
      echo "<FONT COLOR=red>Server is down or updating ... Please try again later !</FONT>";
      exit;
   } 
   
   loadOnlineData();
   
   //___________________________________________________________________________________________________
   
   $index = 0;
   $lastServer = "";
   $ServerSelectat = "";
   foreach ($servers_data as $currentline)
   {
      $inceput1 = substr($currentline,0,1);
      $inceput2 = substr($currentline,1,2);
     
      if ($inceput1 == "|" && $inceput2 != " H")
      {
         $server = explode("|", $currentline);
         $server_Host   = trim($server[1]);
         $server_Time   = trim($server[2]);
         $server_Type   = trim($server[3]);
         $server_Ver    = trim($server[4]);
         $server_Nodeid = trim($server[5]);
         $server_Cards  = trim($server[6]);
         $server_Idents = trim($server[7]);
         
         if ($server_Host != "")
         {
            $index++;
            $lastServer = $server_Host;
            $servers[$lastServer]["Info"] = array ($server_Time,$server_Type,$server_Ver,$server_Nodeid,$server_Cards); 
           
            if ($server_Host == $server_nodeDns) $ServerSelectat = $lastServer;

         }
         
         $servers[$lastServer]["Info"]["Idents"][] = $server_Idents; 
      }
   }
   unset($servers_data);
   

   //___________________________________________________________________________________________________
   $total_shares["total"] = 0;
   $maxhop = 0;
   

   foreach ($shares_data as $currentline)
   {
      $inceput1 = substr($currentline,0,1);
      $inceput2 = substr($currentline,1,1);
     
      if ($inceput1 == "|" && $inceput2 != " ")
      {
         $share = explode("|", $currentline);
         
         $share_Host = trim($share[1]);
         $share_Type = trim($share[2]);
         $share_Caid = trim($share[3]);
         $share_System = trim($share[4]);
         
         $share_ProvidersList = trim($share[5]);
         if ($share_ProvidersList == "0,1,2,3,0") $share_ProvidersList= "0,1,2,3"; // pt premiere
         if ($share_ProvidersList == "") $share_ProvidersList = $str_empty;
         $share_Providers = explode(",", $share_ProvidersList);
         
         list($share_Hop,$share_Reshare) = explode("   ", trim($share[6]));
         $share_Nodes = explode(",", trim($share[7])); 
         $share_Node = $share_Nodes[count($share_Nodes)-1];
         
         $share_Caid = adaug0($share_Caid,4);
         
         $share_Node = sterg0($share_Node);
         
         if ($share_Node == "")
            $share_NodeUnic = $share_Caid."|".$share_System."|".$share_ProvidersList."|".$share_Host;
         else
            $share_NodeUnic = $share_Caid."|".$share_System."|".$share_ProvidersList."|".sterg0($share_Node);
         
         $route = (isset($nodes))?count($nodes[$share_NodeUnic]):0;
         $servers[$share_Host][$share_NodeUnic]["total"] = $route;
         if ($route == 0) $servers[$share_Host][$share_NodeUnic]["total"] = 1;
         $servers[$share_Host][$share_NodeUnic][$route] = array ($share_Host,$share_Type,$share_Caid,$share_System,$share_ProvidersList,$share_Providers,$share_Hop,$share_Reshare,$share_Nodes,$share_Node); 
         
         
         if (!isset($total_shares["total"]))                $total_shares["total"] = 0;
         if (!isset($total_shares[$share_Hop]))             $total_shares[$share_Hop] = 0;
         if (!isset($share_nodes[$share_NodeUnic]))         $share_nodes[$share_NodeUnic] = 0;
         if (!isset($share_nodes_minhop[$share_NodeUnic]))  $share_nodes_minhop[$share_NodeUnic] = 9;
         
         $share_nodes[$share_NodeUnic]++;
         $share_nodes_minhop[$share_NodeUnic] = min( $share_nodes_minhop[$share_NodeUnic], $share_Hop );
         $total_shares["total"]++;
         $total_shares[$share_Hop]++;
         
         if (!isset($host_hop[$share_Host][$share_NodeUnic][$share_Hop]))  $host_hop[$share_Host][$share_NodeUnic][$share_Hop] = 0;
         if (!isset($total_host_shares[$share_Host]["total"]))             $total_host_shares[$share_Host]["total"] = 0;
         if (!isset($total_host_shares[$share_Host][$share_Hop]))          $total_host_shares[$share_Host][$share_Hop] = 0;     
         if (!isset($total_reshare[$share_Host]["total"]))                 $total_reshare[$share_Host]["total"] = 0;   
         if (!isset($re[$share_Host][$share_NodeUnic][$share_Hop]))        $re[$share_Host][$share_NodeUnic][$share_Hop] = 0;
         if (!isset($re[$share_Host][$share_NodeUnic]["reshare"]))         $re[$share_Host][$share_NodeUnic]["reshare"] = 0;     
         
         $host_hop[$share_Host][$share_NodeUnic][$share_Hop]++;
         $total_host_shares[$share_Host]["total"]++;
         $total_host_shares[$share_Host][$share_Hop]++;
         
         if (((int)$share_Reshare)>0)
         {
            $total_reshare[$share_Host]["total"]++;
            $re[$share_Host][$share_NodeUnic][$share_Hop] = max($re[$share_Host][$share_NodeUnic][$share_Hop],((int)$share_Reshare));
            $re[$share_Host][$share_NodeUnic]["reshare"] = max($re[$share_Host][$share_NodeUnic]["reshare"],((int)$share_Reshare));         
         }
         $maxhop = max($maxhop,$share_Hop);
      }
   }
   
   unset($shares_data);
//___________________________________________________________________________________________________
function nodeID($NodeUnic,$Host,$Total,$Hop)
{
   global $share_nodes;
   global $share_nodes_minhop;
   
   $nodSh = explode("|",$NodeUnic);
   
   $Server = $nodSh[3];
   
   $Server2 = explode("_",$Server);
   
   $Server_Host = "";
   $Server_Host2 = "";

   $Server = nodeIdName($Server);
   
   $extra = $share_nodes[$NodeUnic] - $Total + 1;
   
   if ($Server_Host == $Host)
   {
      $ret = "<font color=Fuchsia><B>".$Server."</B></font>";
   }
   else
   if ($extra > 1)
   {
      if ($share_nodes_minhop[$NodeUnic] == $Hop)
         $ret = "<font color=brown>".$Server."</font>";
      else
         $ret = $Server;
   }
   else
   {
      $ret = "<font color=Crimson>".$Server."</font>";
   }
   
   if ($extra > 1)
         $ret.=" (".$extra.")";
         
   global $pagina;
   global $serverindex;
   $ret = linkNod($NodeUnic,$ret,"node",false);

   return $ret;
}
//___________________________________________________________________________________________________

if ($server_nodeDns != "")
   $sh_host = $server_nodeDns;
else
   $sh_host = $ServerSelectat;
   
if ($sh_host != "") $nodes = $servers[$sh_host];

if (isset($nodes) && count($nodes))
{
   $info_total = 0; 
   if (isset($total_host_shares[$sh_host]["total"]))
      $info_total = $total_host_shares[$sh_host]["total"];
     
   $info_total_unic = count($nodes) - 1;
   
   $info_uniqueIndex = 0;
   if ($info_total!=0)
      $info_uniqueIndex = (int)($info_total_unic/$info_total *100);
   //$info_total_reshare = $total_reshare[$sh_host]["total"];
   //$info_reshareIndex = (int)($info_total_reshare/$info_total_unic *100);
   
   list($host_DNS, $host_PORT) = explode(":", $sh_host);
   
   $host_IP    = trim(getHostIP($host_DNS));
   $tara_host  = taraNameSaved($sh_host);
   $IPServer   = trim($tara_host[1]);
   $tara_code  = tara($host_IP,$sh_host);


   if ($host_IP !="" && $IPServer !="" && $host_IP != $IPServer)
   {
      loadGlobalServers();
      $globalServers[$sh_host][1] = $IPServer;
      saveGlobalServers();
   }


   if ($country_whois == true)
      $tara_nume = taraName($tara_code["tara"]);
     
   echo "<table border=0 cellpadding=0 cellspacing=0>";
   echo "<tr>";
   echo "<td VALIGN = \"top\">";

   format1("Server",$sh_host);

   if ($host_IP=="unknown")
      format1("IP/Clients",$host_IP);
   else
      format1("IP/Clients",$host_IP." / ".clientIP($host_IP,$sh_host));
      
   if ($country_whois == true)
   {
      if ($tara_code["tara"]=="??")
          format1("Country","Unresolved IP");
      else
      if ($tara_code["tara"]=="<>")
         format1("Country","Local Private IP");
      else
         format1("Country",$tara_code["tara"]." , ".$tara_nume);
   }
   //format1("Connected from IP",clientIP($host_IP,$sh_host));
   
   if ($nodes["Info"][3] != "")
      format1("NodeID", $nodes["Info"][3]);
     
   if ($nodes["Info"][3] != "")
      format1("Type/Ver", $nodes["Info"][1]." / ".$nodes["Info"][2] );
   else
      format1("Type", $nodes["Info"][1] );
     
   if ($nodes["Info"][0] != "")
      format1("Connected",$nodes["Info"][0]);
   else
   {
      $text_offline = "-- OFFLINE --";
      if (isset($OnlineServers[$sh_host]) && $OnlineServers[$sh_host]["time"]!="")
      {
         $last_online = $OnlineServers[$sh_host]["time"];
         $text_offline = get_formatted_timediff($last_online)." ago";
      }
      format1("Connected","<FONT color=red>$text_offline</FONT>");
   }
   
     

   //format1("Type",$nodes["Info"][1]);
   //format1("Version",$nodes["Info"][2]);
   //format1("Shares",$info_total);
   
   echo "</td>";
   echo "<td VALIGN = \"top\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Note :&nbsp;&nbsp;";
   echo "</td>";
   echo "<td VALIGN = \"top\">";
   
   $notes_saved = "";
   $notes_save_path   = $notes_path.$host_DNS.".".$host_PORT.".note";   
   if (file_exists($notes_save_path))
   {
      $fh = fopen($notes_save_path, 'r');
      $notes_saved = fread($fh, filesize($notes_save_path));
      fclose($fh);
   }
   ?>
   <FORM NAME="formular" METHOD="post" ACTION="
   <?php
   echo $pagina;
   ?>
   "><TEXTAREA CLASS="TEXTAREANORMAL" COLS="30" name="saveNotes" ID="saveNotes" ROWS="4" TABINDEX="1" value=""><?php echo $notes_saved ?></TEXTAREA>
   <DIV ALIGN = "right"><INPUT TYPE="submit" VALUE="Save" TABINDEX="2" class="savetextbutton"></DIV>
      <input type="hidden" name="nodeDns" ID="nodeDns" value="<?php echo $server_nodeDns ?>">
   </FORM>
   <?php
   echo "</td>";
   echo "</tr>";
   echo "</table>";
   
   
   
   // online history
   $online_saveTime = $OnlineServers["savetime"]["time"];
   $online_lastseen = $OnlineServers[$sh_host]["time"];
   $online_history  = $OnlineServers[$sh_host]["log"];
  /*
   if ($online_saveTime != $online_lastseen && $online_lastseen!="")
   {
      $timediff = ($online_saveTime - $online_lastseen);
      $minuteLastSave  = (int) intval($timediff / INT_MINUTE);
      $online_history = "-".$minuteLastSave.".".$online_history;
   }
   */
   
   $logtime = explode(".", $online_history);
   $history_off = 0;
   $history_on = 0;
   foreach ($logtime as $log)
   {
      if (strstr($log,"-"))
      {
         $history_off = $history_off + substr($log,1);
      }
      else    
      {
         $history_on = $history_on + $log;
      }
   }
   
   $DIV_history_off = "";
   if ($history_off >0) $DIV_history_off = "<FONT color=red>".formatted_timediff($history_off*60)."</FONT>";
   
   $DIV_history_total = formatted_timediff(($history_off + $history_on)*60);
   
   if ($history_off >0)
      format1("Uptime",procentColor(procentOnline($sh_host))." [ ".$DIV_history_off." / ".$DIV_history_total." ]");
   else
      format1("Uptime",procentColor(procentOnline($sh_host))." [ ".$DIV_history_total." ]");
      
   echo "<BR>";
   if ($country_whois == true && $tara_code["tara"]!="<>")
   {
      format1("ISP Info",$tara_code["info"]);
   }
   
   $reverseDNS = gethostbyaddr($host_IP);
   if ($reverseDNS != $host_IP)
      format1("Reverse DNS",$reverseDNS);
   else
      format1("Reverse DNS","<FONT color=red>missing</FONT>");
   

   echo "<BR>";
   
   ob_flush();
   flush();

   $LastPingError = "Very slow";
   $pingCount = 5;
   $pingCountOK = 0;
   $pingLast = 0;
   $pingTimeTotal = 0;
   
   //echo "<table border=0 cellpadding=0 cellspacing=0>";
   $ping_text_try = "";
   
   $stringquerry = $_SERVER['QUERY_STRING'];
   if (!strstr($stringquerry,"&checkPing=1"))
      $stringquerry = $stringquerry."&checkPing=1";
   $ping_text_try_check = "&nbsp;<A class=\"tabel_header\" HREF=".$pagina."?".$stringquerry.">&nbsp;PING NOW&nbsp;&nbsp;</A>";
   
   $pingTryMax = 0;
   if ($server_checkPing != "")
   {
      for ($k = 1; $k <= $pingCount; $k++)
      {
         usleep(1000000);
         $pingTry = -1;
         $pingTry = pingDomain($host_IP,$host_PORT,5);
         
         if ($pingTryMax == 0)
              $pingTryMax = $pingTry;
         else
            if ($pingTryMax < $pingTry) $pingTryMax = $pingTry;

         if ($k>1) $ping_text_try = $ping_text_try." , ";
         if ($pingTry>0)
         {
            $pingCountOK++;
           
            $ping_text_try = $ping_text_try.$pingTry."ms";
         }
         else
         {
            $ping_text_try = $ping_text_try."<FONT color=red>--</FONT>";
            if ($pingLast==-1)
            {
               $pingTimeTotal = -1;
               break;
            }
         }
   
           
         $pingTime[] = $pingTry;
         $pingLast = $pingTry;
      }
      $ping_text_try = " : {".$ping_text_try."}";
   }
   
   //echo "</table>";
   
   $textPingCurent = "";

   if ($pingTimeTotal == 0)
   {
     
   
      $lost = $pingCount - $pingCountOK;
     
      $rezultatPing = $ping_text_try_check."<FONT color=gray>".$ping_text_try."</FONT>";
     
       
               
      if ($lost == 0)
      {
          for ($k = 0; $k < $pingCount; $k++)
              if ($pingTime[$k] >0) $pingTimeTotal = $pingTimeTotal + $pingTime[$k];
     
          $pingTimeTotal = $pingTimeTotal - $pingTryMax;
          $pingTimeFinal = (int)($pingTimeTotal/($pingCountOK-1));
     
          SavePing($sh_host,$pingTimeFinal);
          $textPingCurent  = " = ".$pingTimeFinal."ms ";
      }
      else
      if ($server_checkPing != "")
         $textPingCurent  = " = NOT SAVED";
   
   }
   else   
   if ($server_checkPing != "")
   {
        $rezultatPing = $ping_text_try_check.": ".$LastPingError;
   }
   else
        $rezultatPing = $ping_text_try_check;

   $bestPingSaved = SavedPing($sh_host);
   
   $textPingAverage = pingResultColor($bestPingSaved[0],1);
   $textPingBest    = pingResultColor($bestPingSaved[2],1);
   
   $diffPing = $bestPingSaved[0] - $bestPingSaved[2];
   $diffMargin = (int)($bestPingSaved[2] * 50/100);
   if ($diffMargin < 50) $diffMargin  = 50;
   
   if ($diffPing > $diffMargin ) $textPingAverage = "<FONT COLOR=red><B>! </B></FONT>".$textPingAverage;
   
   format1("Best ever responce time (ping) ",$textPingBest);
   format1("Average responce time (ping) ",$textPingAverage);
   format1("Current responce time (ping) ",$rezultatPing.$textPingCurent);

  // port scan - START
  include_once("portdescriptions.php");
  echo "\n<script type=\"text/javascript\" src=\"wz_tooltip.js\"></script>\n";

  function CreatePortSelectForm() {
    global $pagina, $_defaultPortsToScan, $_PortDes;
    $MAXLINES="10";
    $C="<form name="PortsForm" action="".$pagina."?".$_SERVER['QUERY_STRING']."&checkPort=1" method="POST">";
    $C.="<p align="right"><input type="submit" value="ScanPorts" name="PortsForm"/></p>";
    $C.="Enter own Ports to scan: <input type="text" name="ScanOwnPorts" size="20" maxlength="200">&nbsp;(seperated with , eg: 22,80)</input></p>";
    $C.="<table border="0" cellspacing="1" cellpadding="1">";
    $count=0;
    foreach($_PortDes AS $PORT => $DESC) {
      $Defp=0;
      if (isset($_defaultPortsToScan)) {
        $DefPorts=explode(",",$_defaultPortsToScan);
      	foreach($DefPorts AS $defport) { if ($defport === "$PORT") { $Defp=1; } }
      }
      if ($count === 0) { $C.="<tr bgcolor="#212121">"; }
      if ($Defp === 1) {
      	$C.="<td><font color="#ffffff">";
        $C.="<input type="checkbox" name="ScanPorts[]" value="".$PORT."" checked>".$PORT."</input>";
        $C.="</font></td>";
      } else {
      	$C.="<td><font color="#ffffff">";
        $C.="<input type="checkbox" name="ScanPorts[]" value="".$PORT."">".$PORT."</input>";
        $C.="</font></td>";
      }
      $count++;
      if ($count == $MAXLINES) { $C.="</tr>"; $count=0; }
    }
    $C.="</tr>";
    $C.="</table></form>";
    return $C;
  }

   $PORTSFORM=CreatePortSelectForm();
   $Jargs="CLOSEBTN,true,STICKY,true,FOLLOWMOUSE,false,DELAY,1000,EXCLUSIVE,true";
   $JAVA='onmouseover="Tip(\''.$PORTSFORM.'\',TITLE,\'Select Ports to Scan..\','.$Jargs.')" onmouseout="UnTip()"';

   $port_check_txt = "&nbsp;<A class=\"tabel_header\" HREF=\"".$pagina."?".$_SERVER['QUERY_STRING']."&checkPort=1\" ".$JAVA.">&nbsp;SCAN NOW&nbsp;&nbsp;</A>";
   $port_check = "nodeDns=".$sh_host."&checkPort=1";
   echo "<br>";
   format1("SECURITY CHECK (portscan) ",$port_check_txt);

   if($_SERVER['QUERY_STRING'] == $port_check) {
      echo "<br>";
      echo '<table border="1" cellspacing="0" cellpadding="5">';
      echo '<tr bgcolor="#600000">';
      echo '<td width="52"><b><font color="#ffffff" >Port</font></b></td>';
      echo '<td width="40"><b><font color="#ffffff" >Status</font></b></td>';
      echo '<td><b><font color="#ffffff" >Description</font></b></td></tr>';

      $portlist = explode(",",$PortsToScan);
      if (isset($_POST['ScanPorts']) AND !empty($_POST['ScanPorts'])) {
        $portlist = $_POST['ScanPorts'];
      }
      if (isset($_POST['ScanOwnPorts']) AND !empty($_POST['ScanOwnPorts'])) {      
        $portlist = explode(",",$_POST['ScanOwnPorts']);
      }
      foreach($portlist AS $PORT) {
         $DESC = "";
         if (isset($_PortDes[$PORT])) { $DESC = $_PortDes["$PORT"]; }
         $sc_port["$PORT"] = "$DESC";
      }
      $sc_port["$host_PORT"] = "-> Peer's Server Port";

      foreach($sc_port as $scanport => $desc) {
         $fp = @fsockopen($host_IP,$scanport,$errno,$errstr,$scan_timeout);
         if($fp) {
            echo "<tr bgcolor='#212121'>";
            echo "<td align='right'><font color='green'><b>".$scanport." &nbsp;</b></font></td>";
            echo "<td><font color='green'><b>Open</b></font></td>";
            echo "<td><font color='#ffffff'><b>".$desc."</b></font></td></tr>";
            @fclose($fp);
         } else {
            echo '<tr bgcolor="#212121">';
            echo "<td align='right'><font color='red'><b>".$scanport." &nbsp;</b></font></td>";
            echo "<td><font color='red'><b>Closed</b></font></td>";
            echo "<td><font color='#ffffff'>".$desc."</font></td></tr>";
         }
      flush();
      }
      echo "<br>";
      $port_check = null;
   }
   echo "</table>";
   // port scan - ENDE

   //format1("Unique",$info_total_unic,$info_total);
   //format1("Reshare",$info_total_reshare,$info_total_unic);

   $ecm_total = 0;
   $ecmOK_total = 0;
   foreach ($servers[$sh_host]["Info"]["Idents"] as $hit_data)
   {
      $hit_array = explode(" ",$hit_data);
      if ($hit_array[0] != "")
      {
         $hit_provider = explode(":",$hit_array[1]);
         $hit_exact = explode("(",$hit_array[2]);
         $hit_exact2 = explode(")",$hit_exact[1]);
         
         $hit_ecm = $hit_exact[0];
         $hit_ecmOK = $hit_exact2[0];
         
         $ecm_total = $ecm_total+$hit_ecm;
         $ecmOK_total = $ecmOK_total+$hit_ecmOK;
         
         $key = adaug0($hit_ecmOK,20).adaug0($hit_ecm,20).$hit_array[1];
         $ecmok_sortat[$key] = $hit_data;
         
      }
   }
   
   loadECMServers(true);
   echo "<BR>";   
   $record_ECM = $ECMservers[$sh_host]["Info"]["ECM_SAVED"]["ECM"];
   $record_ECMOK = $ECMservers[$sh_host]["Info"]["ECM_SAVED"]["ECMOK"];
   
   if (($ecm_total == $record_ECM) && ($ecmOK_total == $record_ECMOK))
      format1("Handled ECM",$record_ECMOK,$record_ECM);
   else
   {
      if ($record_ECM !="")
         format1("Handled ECM ( saved )",$record_ECMOK,$record_ECM);
         
      format1("Handled ECM ( now )",$ecmOK_total,$ecm_total);
   }
   
   if ($ecm_total)
   {
      //echo "<BR>";
      echo "<table border=0 cellpadding=2 cellspacing=1>";
      echo "<tr>";
      echo "<th class=\"tabel_headerc\">#</th>";
      echo "<th class=\"tabel_headerc\">Type</th>";
      echo "<th class=\"tabel_header\">ECM</th>";
      echo "<th class=\"tabel_header\">OK</th>";
      echo "<th class=\"tabel_header\">CAID/Ident</th>";
      echo "</tr>";
   }
   
  if (isset($ecmok_sortat))
  {
      krsort($ecmok_sortat);
   
      $counthits = 0;
      if ($ecmok_sortat)
      foreach ($ecmok_sortat as $key => $hit_data)
      {
         $hit_array = explode(" ",$hit_data);
         if ($hit_array[0] != "")
         {
            $counthits++;
            $hit_provider = explode(":",$hit_array[1]);
            $hit_exact = explode("(",$hit_array[2]);
            $hit_exact2 = explode(")",$hit_exact[1]);
            
            $hit_ecm = $hit_exact[0];
            $hit_ecmOK = $hit_exact2[0];
            
            echo "<tr>";
            echo "<td class=\"Node_Provider\">".$counthits."</td>";
            echo "<td class=\"tabel_hop_total1\">".$hit_array[0]."</td>";
            
            
            echo "<td class=\"tabel_hop_total\"><FONT COLOR=white>".$hit_ecm."</FONT></td>";
            
            if ($hit_ecmOK == 0)  echo "<td class=\"tabel_hop_total\"><FONT COLOR=red>".$hit_ecmOK."</FONT></td>";
            else
            if ($hit_ecmOK != $hit_ecm)  echo "<td class=\"tabel_hop_total\"><FONT COLOR=yellow>".$hit_ecmOK."</FONT></td>";
            else
               echo "<td class=\"tabel_hop_total\">".$hit_ecmOK."</td>";
            
            echo "<td class=\"Node_Provider\">".Providerid($hit_provider[0],$hit_provider[1],true,"Node_Provider",false)."</td>";
            echo "</tr>";
         }
      }
   }
   
   if ($ecm_total)
      echo "</table>";
   echo "<BR>";
   
   $total_nodes = 0;for($k = 0; $k <= $maxhop; $k++)
   {
      if (isset($total_host_shares[$sh_host][$k]))
         $total_nodes += $total_host_shares[$sh_host][$k];
   }

if ($total_nodes>0)
{
   format1("Nodes",$info_total_unic);
   echo "<table border=0 cellpadding=2 cellspacing=1>";
   echo "<tr>";
   echo "<th class=\"tabel_headerc\">#</th>";
   echo "<th class=\"tabel_header\">NodeID/Server (extra sources)</th>";
   echo "<th class=\"tabel_header\">Shares</th>";

   for ($k = 1; $k <= $maxhop; $k++) echo "<th class=\"tabel_headerc\">hop".$k."</th>";
   echo "<th class=\"tabel_headerc\">Reshare</th>";
   echo "<th class=\"tabel_header\">CAID/Idents</th>";
   echo "</tr>";
   
   //$info_total = $total_host_shares[$sh_host]["total"];
   //$info_total_unic = count($nodes) - 1;
   //$info_uniqueIndex = (int)($info_total_unic/$info_total *100);
   //$info_total_reshare = $total_reshare[$sh_host]["total"];
   //$info_reshareIndex = (int)($info_total_reshare/$info_total_unic *100);
   
   echo "<tr>";
   echo "<td class=\"tabel_total\"></td>";
   echo "<td class=\"tabel_total\"></td>";
   echo "<td class=\"tabel_total\">".$total_host_shares[$sh_host]["total"]."</td>";
   for ($k = 1; $k <= $maxhop; $k++) echo "<td class=\"tabel_total\">".$total_host_shares[$sh_host][$k]."</td>";
   echo "<td class=\"tabel_total\">".$total_reshare[$sh_host]["total"]."</td>";
   echo "<td class=\"tabel_total\"></td>";
   echo "</tr>";
   
   $i=1;
   
   // HOP1
   if (isset($total_shares[1]))
   foreach ($nodes as $node=>$data)
   if (!isset($host_hop[$sh_host][$node][0]) && isset($host_hop[$sh_host][$node][1]))
   {
      $nodetype = $nodes[$node][0][1];
      $caid = $nodes[$node][0][2];
      $providers = $nodes[$node][0][4];
      $nodSh = explode("|",$node); 
     
      $total = 0;for($k = 0; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            $total += $host_hop[$sh_host][$node][$k];
     
      $reshare = "<FONT COLOR=red>! NO !</FONT>";if ($re[$sh_host][$node]["reshare"] >0) if ($total==1) $reshare = $re[$sh_host][$node]["reshare"]; else $reshare = "<FONT COLOR=yellow>".$re[$sh_host][$node]["reshare"]."</FONT>";

      echo "<tr>";
      echo "<td class=\"Node_Count\">".$i."</td>";
         
      echo "<td class=\"Node_ID_hop1\">".nodeID($node,$sh_host,$total,1)."</td>";
      echo "<td class=\"tabel_total\">".$total."</td>";

      for ($k = 1; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            echo "<td class=\"tabel_hop\">".$host_hop[$sh_host][$node][$k]."</td>";
         else
            echo "<td class=\"tabel_hop\"></td>";
     
      echo "<td class=\"tabel_total\">".$reshare."</td>";
      echo "<td class=\"Node_Provider\">".providerID($caid,$providers,true,"Node_Provider",false)."</td>";
      echo "</tr>";
      $i++;
   }
   
   // HOP2
   if (isset($total_shares[2]))
   foreach ($nodes as $node=>$data)
   if (!isset($host_hop[$sh_host][$node][0]) && !isset($host_hop[$sh_host][$node][1]) && isset($host_hop[$sh_host][$node][2]))
   {
      $nodetype = $nodes[$node][0][1];
      $caid = $nodes[$node][0][2];
      $providers = $nodes[$node][0][4];
      $nodSh = explode("|",$node); 
         
      $total = 0;for($k = 0; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            $total += $host_hop[$sh_host][$node][$k];
           
      $reshare = "<FONT COLOR=red>! NO !</FONT>";if ($re[$sh_host][$node]["reshare"] >0) if ($total==1) $reshare = $re[$sh_host][$node]["reshare"]; else $reshare = "<FONT COLOR=yellow>".$re[$sh_host][$node]["reshare"]."</FONT>";
     
      echo "<tr>";
      if (strstr($node,"*"))
         echo "<td class=\"tabel_normal_type\">".$i."</td>";
      else
         echo "<td class=\"Node_Count\">".$i."</td>";
         
      echo "<td class=\"Node_ID_hop2\">".nodeID($node,$sh_host,$total,2)."</td>";
      echo "<td class=\"tabel_total\">".$total."</td>";

      for ($k = 1; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            echo "<td class=\"tabel_hop\">".$host_hop[$sh_host][$node][$k]."</td>";
         else
            echo "<td class=\"tabel_hop\"></td>";
           
      echo "<td class=\"tabel_total\">".$reshare."</td>";
      echo "<td class=\"Node_Provider\">".providerID($caid,$providers,true,"Node_Provider",false)."</td>";
      echo "</tr>";
      $i++;
   }
   
   // HOP3
   if (isset($total_shares[3]))
   foreach ($nodes as $node=>$data)
   if (!isset($host_hop[$sh_host][$node][0]) && !isset($host_hop[$sh_host][$node][1]) && !isset($host_hop[$sh_host][$node][2]) && isset($host_hop[$sh_host][$node][3]))
   {
      $nodetype = $nodes[$node][0][1];
      $caid = $nodes[$node][0][2];
      $providers = $nodes[$node][0][4];
      $nodSh = explode("|",$node);
     
      $total = 0;for($k = 0; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            $total += $host_hop[$sh_host][$node][$k];
           
      $reshare = "<FONT COLOR=red>! NO !</FONT>";if ($re[$sh_host][$node]["reshare"] >0) if ($total==1) $reshare = $re[$sh_host][$node]["reshare"]; else $reshare = "<FONT COLOR=yellow>".$re[$sh_host][$node]["reshare"]."</FONT>";

      echo "<tr>";
      if (strstr($node,"*"))
         echo "<td class=\"tabel_normal_type\">".$i."</td>";
      else
         echo "<td class=\"Node_Count\">".$i."</td>";
      echo "<td class=\"Node_ID_hop3\">".nodeID($node,$sh_host,$total,3)."</td>";
      echo "<td class=\"tabel_total\">".$total."</td>";

      for ($k = 1; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            echo "<td class=\"tabel_hop\">".$host_hop[$sh_host][$node][$k]."</td>";
         else
            echo "<td class=\"tabel_hop\"></td>";
           
      echo "<td class=\"tabel_total\">".$reshare."</td>";
      echo "<td class=\"Node_Provider\">".providerID($caid,$providers,true,"Node_Provider",false)."</td>";
      echo "</tr>";
      $i++;
   }
   
   
   // HOP4
   if (isset($total_shares[4]))
   foreach ($nodes as $node=>$data)
   if (!isset($host_hop[$sh_host][$node][0]) && !isset($host_hop[$sh_host][$node][1]) && !isset($host_hop[$sh_host][$node][2]) && !isset($host_hop[$sh_host][$node][3]) && isset($host_hop[$sh_host][$node][4]))
   {
      $nodetype = $nodes[$node][0][1];
      $caid = $nodes[$node][0][2];
      $providers = $nodes[$node][0][4];
      $nodSh = explode("|",$node);
     
      $total = 0;for($k = 0; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            $total += $host_hop[$sh_host][$node][$k];
           
      $reshare = "<FONT COLOR=red>! NO !</FONT>";if ($re[$sh_host][$node]["reshare"] >0) if ($total==1) $reshare = $re[$sh_host][$node]["reshare"]; else $reshare = "<FONT COLOR=yellow>".$re[$sh_host][$node]["reshare"]."</FONT>";

      echo "<tr>";
      if (strstr($node,"*"))
         echo "<td class=\"tabel_normal_type\">".$i."</td>";
      else
         echo "<td class=\"Node_Count\">".$i."</td>";
      echo "<td class=\"Node_ID_hop4\">".nodeID($node,$sh_host,$total,4)."</td>";
      echo "<td class=\"tabel_total\">".$total."</td>";

      for ($k = 1; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            echo "<td class=\"tabel_hop\">".$host_hop[$sh_host][$node][$k]."</td>";
         else
            echo "<td class=\"tabel_hop\"></td>";
           
      echo "<td class=\"tabel_total\">".$reshare."</td>";
      echo "<td class=\"Node_Provider\">".providerID($caid,$providers,true,"Node_Provider",false)."</td>";
      echo "</tr>";
      $i++;
   }
   
   // HOP5 sau mai mult
   foreach ($nodes as $node=>$data)
   if ($node != "Info")
   if (!isset($host_hop[$sh_host][$node][0]) && !isset($host_hop[$sh_host][$node][1]) && !isset($host_hop[$sh_host][$node][2]) && !isset($host_hop[$sh_host][$node][3]) && !isset($host_hop[$sh_host][$node][4]))
   {
      $nodetype = $nodes[$node][0][1];
      $caid = $nodes[$node][0][2];
      $providers = $nodes[$node][0][4];
      $nodSh = explode("|",$node);
     
      $total = 0;for($k = 0; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            $total += $host_hop[$sh_host][$node][$k];
           
      $reshare = "<FONT COLOR=red>! NO !</FONT>";if ($re[$sh_host][$node]["reshare"] >0) if ($total==1) $reshare = $re[$sh_host][$node]["reshare"]; else $reshare = "<FONT COLOR=yellow>".$re[$sh_host][$node]["reshare"]."</FONT>";

      echo "<tr>";
      if (strstr($node,"*"))
         echo "<td class=\"tabel_normal_type\">".$i."</td>";
      else
         echo "<td class=\"Node_Count\">".$i."</td>";
      echo "<td class=\"Node_ID_hop5\">".nodeID($node,$sh_host,$total,5)."</td>";
      echo "<td class=\"tabel_total\">".$total."</td>";

      for ($k = 1; $k <= $maxhop; $k++)
         if (isset($host_hop[$sh_host][$node][$k]))
            echo "<td class=\"tabel_hop\">".$host_hop[$sh_host][$node][$k]."</td>";
         else
            echo "<td class=\"tabel_hop\"></td>";
           
      echo "<td class=\"tabel_total\">".$reshare."</td>";
      echo "<td class=\"Node_Provider\">".providerID($caid,$providers,true,"Node_Provider",false)."</td>";
      echo "</tr>";
      $i++;
   }
   
   echo "</table>";
}

}

ENDPage();
?>

/EDIT: server.php aktualisiert von v0.5 auf v0.51 -> kleine optische Fehler behoben...

jmd noch weitere Verbesserungsvorschläge? ;)
Dateianhänge

[Die Dateierweiterung php wurde deaktiviert und kann nicht länger angezeigt werden.]

[Die Dateierweiterung php wurde deaktiviert und kann nicht länger angezeigt werden.]

wz_tooltip.js
muss in -> /var/www/ipc/infophp/
(35.69 KiB) 140-mal heruntergeladen
Du musst nicht kämpfen um zu siegen
ysimmerath
IPC Interessierter
Beiträge: 101
Registriert: Di 19. Apr 2011, 17:08
Kontaktdaten:

Re: Sicherheit: Peers prüfen

Beitrag von ysimmerath »

very nice ohne Problem getestet
jmd noch weitere Verbesserungsvorschläge? ;)
vielleicht auch mit Standartpasswort Scannen

Code: Alles auswählen

root / dreambox
root /
root / cccam
root /dbox2
root / vuduo
root / relook
root / root
root / admin
feissmaik
Entwickler Team
Beiträge: 2576
Registriert: So 17. Apr 2011, 11:39
Been thanked: 1 time
Kontaktdaten:

Re: Sicherheit: Peers prüfen

Beitrag von feissmaik »

Naaajaaa... Das käme dann aber schon einer Bruteforce-attake mit Wordlist gleich, wenn man verschiedene logins+pwds zu den jeweiligen offenen Ports durchtesten lässt; vorallem wenn du "root" als login auflistest

sowas will ich aber nicht unterstützen - das hat dann nämlich nichts mehr mit einem SECURITY CHECK (portscan) zu tun!

Es sollte ausreichen wenn jmd Standard-Ports offen hat um Handlungsbedarf zu sehen - wer tatsächlich interesse daran hat in fremde systeme einzudringen kann das dann auch manuell sofern port offen denn genau da liegt ja die Gefahr die es hiermit abzuwenden gilt!
sowas möchte ich aber wie gesagt nicht anbieten
Du musst nicht kämpfen um zu siegen
ysimmerath
IPC Interessierter
Beiträge: 101
Registriert: Di 19. Apr 2011, 17:08
Kontaktdaten:

Sicherheit: Peers prüfen

Beitrag von ysimmerath »

Schade Meister es wäre sehr praktisch gewesen


Sent from my iPhone using Tapatalk
feissmaik
Entwickler Team
Beiträge: 2576
Registriert: So 17. Apr 2011, 11:39
Been thanked: 1 time
Kontaktdaten:

Re: Sicherheit: Peers prüfen

Beitrag von feissmaik »

...ich werde keine hackertools anbieten nur weil das für noobs praktisch wär....
Du musst nicht kämpfen um zu siegen
Antworten

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast