Facebook
From Round Pig, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 172
  1. <?php
  2.  
  3. $path = dirname(__FILE__) . '/';
  4.  
  5. $nickNames = array(
  6.     "fuck",
  7.     "noob",
  8.     "connard",
  9.     "fdp",
  10.     "pute",
  11.     "mère",
  12.     "père",
  13.     "abruti",
  14.     "débile",
  15.     "crétin",
  16.     "idiot",
  17.     "bite",
  18.     "grosse",
  19.     "fils",
  20.     "enculé",
  21.     "emeute"
  22. );
  23.  
  24. $adminID = array(
  25.     2
  26. );
  27.  
  28. $yatqa_ip="145.239.47.164"; // sunucu ip
  29. $yatqa_name="serveradmin"; // yatqa k.adı
  30. $yatqa_pw="xxx"; // Yatqa şifresi
  31. $server_id=3; // Sunucu idsi
  32. $maxgiris=3; // Maksimum giriş sayısı
  33.  
  34. $fp = fsockopen($yatqa_ip, 10011, $errno, $errstr, 0.1);
  35. stream_set_timeout($fp, 0, 100000);
  36.  
  37.  
  38.  
  39.  
  40. if($fp)
  41. {
  42.     send("login ".$yatqa_name." ".$yatqa_pw."");
  43.     send("use sid=".$server_id."");
  44.     send("clientupdate client_nickname=MyGameArea_Security");
  45.  
  46.  
  47.     // Traitement des clients connectés sur le serveur TeamSpeak
  48.     $clients = getClients();
  49.  
  50.     // Vérification des doubles connexions sur le serveur TeamSpeak (mêmes adresses IP)
  51.     checkDoubleConnections($clients);
  52.  
  53.     send("quit");
  54. }
  55.  
  56. /**
  57.  * Fonctions du programme
  58.  */
  59.  
  60. function isAlreadyScan ($credit, $timeout, $data)
  61. {
  62.     global $path;
  63.  
  64.         $rep = "alreadyScan";
  65.         $f = $path . $rep . '/ip.' . $data;
  66.  
  67.         $dir = opendir($rep);
  68.  
  69.         while ($fread = readdir($dir))
  70.         {
  71.                 if($fread != "." && $fread != "..")
  72.                 {
  73.                         if(filemtime($rep . '/' . $fread) + $timeout < time())
  74.                         {
  75.                                 unlink($rep . '/' . $fread);
  76.                         }
  77.                 }
  78.         }
  79.  
  80.         if(file_exists($f))
  81.         {
  82.                 return true;
  83.         }
  84.  
  85.     $fp = fopen($f, "w");
  86.     fputs($fp, $credit);
  87.     fclose($fp);
  88.  
  89.     return false;
  90. }
  91.  
  92. function textMessage ($i)
  93. {
  94.     return str_replace(array(" "), '\s', $i);
  95. }
  96.  
  97. function send ($l)
  98. {
  99.     global $fp;
  100.     usleep(100000);
  101.     fwrite($fp, $l . "\r\n");
  102. }
  103.  
  104.  
  105. function checkDoubleConnections ($clients)
  106. {
  107.     global $fp;
  108.  
  109.     $ipList     = array();
  110.     $clidList   = array();
  111.     $collectionList = array();
  112.     foreach ($clients as $line)
  113.     {
  114.         if(!empty($line['connection_client_ip']))
  115.         {
  116.             $ipList[]   = $line['connection_client_ip'];
  117.             $clidList[] = $line['clid'];
  118.  
  119.             $collectionList[] = array(
  120.                 "clid"      =>      $line['clid'],
  121.                 "ip"        =>      $line['connection_client_ip']
  122.             );
  123.         }
  124.     }
  125.  
  126.     foreach (array_count_values($ipList) as $ip => $count)
  127.     {
  128.         if($count > 3)
  129.         {
  130.             foreach ($collectionList as $value)
  131.             {
  132.                 if($value['ip'] == $ip)
  133.                 {
  134.                     kick($value['clid'], $ip, 'Bir ip adresi ile maximum 3 bağlantı yapılabilir. [MyGameArea Güvenlik Botu]', true);
  135.                 }
  136.             }
  137.         }
  138.     }
  139. }
  140.  
  141. function getClients ()
  142. {
  143.     global $fp, $path;
  144.  
  145.     // Traitement des clients
  146.     send("clientlist -ip -times -groups -info");
  147.  
  148.     $clientList = null;
  149.     while ($line = fgets($fp))
  150.     {
  151.             $clientList .= $line;
  152.     }
  153.  
  154.     $clientList         = strstr($clientList, "error id=0 msg=ok");
  155.     $clientList         = trim(str_replace(array('error id=0 msg=ok'), "", $clientList));
  156.     $clientsArray       = explode("|", $clientList);
  157.  
  158.     $clients = array();
  159.     foreach ($clientsArray as $line)
  160.     {
  161.         $lineArray = explode(" ", $line);
  162.  
  163.         $tableTemp = array();
  164.         foreach ($lineArray as $txt)
  165.         {
  166.             $var        = strstr($txt, '=', true);
  167.             $value      = substr(strstr($txt, '=', false), 1);
  168.  
  169.             $tableTemp[trim($var)] = trim($value);
  170.         }
  171.  
  172.         // Récupération des informations supplémentaires sur l'utilisateur
  173.         if(!empty($tableTemp['connection_client_ip']))
  174.         {
  175.             if(file_exists($path . 'alreadyScan' . '/ip.' . $tableTemp['clid'] . '.' . $tableTemp['connection_client_ip']) === FALSE)
  176.             {
  177.                 // Récupération des données sur l'utilisateur (unique ID)
  178.                 send("clientinfo clid=" . $tableTemp['clid']);
  179.  
  180.                 $infoUserList = null;
  181.                 while ($line = fgets($fp))
  182.                 {
  183.                         $infoUserList .= $line;
  184.                 }
  185.  
  186.                 $infoUserListArray = explode(" ", $infoUserList);
  187.  
  188.                 // Construction du tableau avec les informations utilisateurs
  189.                 foreach ($infoUserListArray as $txt)
  190.                 {
  191.                     $var        = strstr($txt, '=', true);
  192.                     $value      = substr(strstr($txt, '=', false), 1);
  193.  
  194.                     if($var == "client_unique_identifier")
  195.                     {
  196.                         $tableTemp[trim($var)] = trim($value);
  197.                         break;
  198.                     }
  199.                 }
  200.  
  201.                 // END
  202.             }
  203.         }
  204.  
  205.         $clients[] = $tableTemp;
  206.  
  207.         unset($tableTemp, $var, $value, $infoUserList, $infoUserListArray, $clientList);
  208.     }
  209.  
  210.     return $clients;
  211. }
  212.  
  213.  
  214.  
  215.  
  216. function kick ($clid, $ip, $reason, $onlyKick = false)
  217. {
  218.     global $fp;
  219.  
  220.     if($onlyKick === TRUE)
  221.     {
  222.         send("clientkick clid=" . $clid . " reasonid=5 reasonmsg=" . textMessage($reason));
  223.  
  224.         return 0;
  225.     }
  226.  
  227.     if(AntiFlood(3, (3600 * 24), $ip) === TRUE)
  228.     {
  229.         send("sendtextmessage targetmode=1 target=" . $clid . " msg=" . textMessage("ATTENTION : Vous avez été banni du serveur pour récidive !"));
  230.         send("banclient clid=" . $clid . " time=" . (60 * 60) . " banreason=" . textMessage($reason));
  231.     } else
  232.     {
  233.         send("sendtextmessage targetmode=1 target=" . $clid . " msg=" . textMessage("ATTENTION : Vous avez éjecté du serveur et ceci est le *Premier avertissement* !"));
  234.         send("clientkick clid=" . $clid . " reasonid=5 reasonmsg=" . textMessage($reason));
  235.     }
  236. }
  237.  
  238. ?>