Advertisement
jackdharma1994

Untitled

Mar 20th, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.77 KB | None | 0 0
  1. <?php
  2. // conf
  3. set_time_limit(0);
  4. ini_set('display_errors', 'on');
  5. // dati
  6.  
  7. // indicate qui il dyndns dove il bot deve connettersi
  8. $host = "SERVER";
  9. // qui la porta (quella di default � la 6667)
  10. $port="6667";
  11. $nick="Dharma";
  12. $ident="Dharma";
  13.  
  14. // qui il canale
  15. $chan="#CHAN";
  16. $readbuffer="";
  17. $realname = "Dharma";
  18. $fp = fsockopen($host, $port, $erno, $errstr, 30);
  19. $loggo  =  fopen('log.txt',  'a');
  20. $nbest = rand(1, 15);
  21.  
  22.  
  23. // join
  24.  
  25. if (!$fp)
  26. {
  27.     echo $errstr." (".$errno.")<br />\n";
  28. }
  29. else
  30. {
  31.         //INVIO DATI INIZIALI
  32.         fwrite($fp, "PASS sticazzi\r\n");
  33.         fwrite($fp, "NICK ".$nick."\r\n");
  34.         fwrite($fp, "USER dharma 9 * : dharma dharma\r\n");
  35.    
  36.        
  37.         //CICLO PRINCIPALE - BOTTA & RISPOSTA
  38.         while (!feof($fp))
  39.         {
  40.                 $line =  fgets($fp, 128);
  41.         fwrite($loggo,  $line."\r\n");
  42.                
  43.                 //ESPLODO LA LINEA SEPARANDO LE PAROLE IN BASE AGLI SPAZI
  44.                 $parole = explode(" ", $line);
  45.                
  46.                
  47.                 //SE LA PRIMA PAROLA E' PING RISPONDO CON PONG
  48.                 if ( $parole[0] == "PING" )
  49.                 {
  50.                         fwrite($fp, "PONG ".$parole[1]."\r\n");
  51.                 }
  52.                
  53.                 if ( $parole[1] == "001" )
  54.                 {
  55.                         fwrite($fp, "JOIN ".$chan."\r\n");
  56.                         fwrite($fp, "PRIVMSG ".$chan." :7Namaste!\r\n");
  57.                 }
  58.                
  59.                
  60.                 //ALTRE RISPOSTE
  61.                
  62.                 // Admin
  63.                 if (eregi("!oop ", $line))
  64.                 {
  65.                         $exline = explode(":", $line);
  66.             $exline = str_replace("!oop", "", $exline);
  67.                         fwrite($fp, "MODE ".$chan." +o ".$exline[2]." \n" );
  68.                 }
  69.                 if (eregi("!dop", $line))
  70.                 {
  71.                         $exline = explode(":", $line);
  72.             $exline = str_replace("!dop","", $exline);
  73.                         fwrite($fp, "MODE ".$chan." -o ".$exline[2]." \n" );
  74.                 }
  75.                 if (eregi("!ban", $line))
  76.                 {
  77.                         $exline = explode(":", $line);
  78.             $exline = str_replace("!ban", "", $exline);
  79.                         fwrite($fp, "MODE ".$chan." +b ".$exline[2]." \n" );
  80.                 }
  81.                 if (eregi("!-ban", $line))
  82.                 {
  83.                         $exline = explode(":", $line);
  84.             $exline = str_replace("-b", "", $exline);
  85.                         fwrite($fp, "MODE ".$chan." -b ".$exline[2]." \n" );
  86.                 }
  87.                 if (eregi("!vo", $line))
  88.                 {
  89.                         $exline = explode(":", $line);
  90.             $exline = str_replace("!vo", "", $exline);
  91.                         fwrite($fp, "MODE ".$chan." +v ".$exline[2]." \n" );
  92.                 }
  93.                 if (eregi("!-vo", $line))
  94.                 {
  95.                         $exline = explode(":", $line);
  96.             $exline = str_replace("!-vo", "", $exline);
  97.                         fwrite($fp, "MODE ".$chan." -v ".$exline[2]." \n" );
  98.                 }
  99.                 if (eregi("!k", $line))
  100.                 {
  101.                         $exline = explode(":", $line);
  102.             $exline = str_replace("!k", "", $exline);
  103.                         fwrite($fp, "KICK ".$chan." ".$exline[2]." :".$exline[2]." \n" );
  104.                 }
  105.                 // risposte publiche
  106.                 if (eregi("!md5", $line))
  107.                 {
  108.                         $exline = explode(":", $line);
  109.             $exline = str_replace("!md5", "", $exline);
  110.                         $md5 = md5($exline[2]);
  111.                         fwrite($fp, "PRIVMSG ".$chan." : >> ".$md5."\r\n");
  112.                 }
  113.                 if (eregi("!b64", $line))
  114.                 {
  115.                         $exline = explode(":", $line);
  116.             $exline = str_replace("!b64", "", $exline);
  117.                         $b64 = base64_encode($exline[2]);
  118.                         fwrite($fp, "PRIVMSG ".$chan." : ".$b64."\r\n");
  119.                 }
  120.                 if (eregi("!decb64", $line))
  121.                 {
  122.                         $exline = explode(":", $line);
  123.             $exline = str_replace("!decb64", "", $exline);
  124.                         $bd64 = base64_decode($exline[2]);
  125.                         fwrite($fp, "PRIVMSG ".$chan." : ".$bd64."\r\n");
  126.                 }
  127.                 if (eregi("!bestemmia", $line))
  128.                 {
  129.                         fwrite($fp, "PRIVMSG ".$chan." : 7".$bestemmie[rand (0,15)]."\r\n");
  130.                 }
  131.                
  132.                 if (eregi("ciao", $line))
  133.                 {
  134.                 $line2 = ("!".$line."");
  135.                     $exline = explode("!", $line2);
  136.                         $exline = str_replace(":", "", $exline);
  137.                         fwrite($fp, "PRIVMSG ".$chan." : ciao ".$exline[1]." :) \r\n");
  138.                 }
  139.                 if (eregi("!killme", $line))
  140.                 {
  141.                         exit();
  142.                 }
  143.                 if (eregi("!vez", $line))
  144.                 {
  145.                         fwrite($fp, "PRIVMSG ".$chan." : 7 2.0 ~ Coded by Mr.JacK ~ www.kingpc.it \r\n");
  146.                 }
  147.                
  148.                 if (eregi("!help", $line))
  149.                 {
  150.                 $line2 = ("!".$line."");
  151.                 $exline = explode("!", $line2);
  152.                 $exline = str_replace(":", "", $exline);
  153.                 fwrite($fp, "PRIVMSG ".$chan." :".$exline[1].", i comandi ti sono stati inviati in pvt :) \r\n");
  154.                 fwrite($fp, "PRIVMSG ".$exline[1]." :7 !killme {Il bot v� a farsi fottere}\n");
  155.                 fwrite($fp, "PRIVMSG ".$exline[1]." :7!vez {versione corrente del bot}\n");
  156.                 fwrite($fp, "PRIVMSG ".$exline[1]." :7!oop  {nick} (operator) \n");
  157.                 fwrite($fp, "PRIVMSG ".$exline[1]." :7!dop  {nick} \r\n");
  158.                 fwrite($fp, "PRIVMSG ".$exline[1]." :7!vo {nick} (voice) \r\n");
  159.                 fwrite($fp, "PRIVMSG ".$exline[1]." :7!-vo  {nick} (devoice) \r\n");
  160.                 fwrite($fp, "PRIVMSG ".$exline[1]." :7!md5 {parola} \r\n");
  161.                 fwrite($fp, "PRIVMSG ".$exline[1]." :7!k {nick} (kick) \r\n");
  162.                 fwrite($fp, "PRIVMSG ".$exline[1]." :7!ban  {nick} (ban) \r\n");
  163.                 fwrite($fp, "PRIVMSG ".$exline[1]." :7!-ban  {nick} (- ban) \r\n");
  164.                 fwrite($fp, "PRIVMSG ".$exline[1]." :7!b64 {parola} (calcola il valore base64) \r\n");
  165.                 fwrite($fp, "PRIVMSG ".$exline[1]." :7!decb64 {parola} (decodifica stringhe in base64) \r\n");
  166.  
  167.                 }
  168.  
  169.                 echo $line."\n";
  170.                
  171.                
  172.     }
  173.     fclose($fp);
  174. }
  175. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement