Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php // stealth rocks because it's quizler's birthday
- // note that i quietly hid all of my backdoors :><:
- function send($t, $m = 0, $chan = FALSE) {
- global $socket;
- if($chan === FALSE) $chan = $GLOBALS['channel'];
- switch($m) {
- case 2: $t = chr(1)."ACTION ".$t.chr(1);
- case 1: $t = "PRIVMSG $chan :".$t;
- case 0: fputs($socket, $t."\r\n"); break;
- default: throw new Exception("send() error.");
- }
- echo $t."\r\n";
- }
- $network = 'example.com';
- $netport = 6667;
- $stealth = FALSE;
- $channel = '#channel';
- $ircnick = 'Pointed_stones';
- $ircuser = 'ofAWESOME';
- $privs = array('user@host');
- if(($destfile = parse_ini_file('.\\stealthrock.ini')) !== FALSE) {
- if(isset($destfile['network'])) $network = $destfile['network'];
- if(isset($destfile['port'])) $netport = $destfile['port'];
- if(isset($destfile['nick'])) $ircnick = $destfile['nick'];
- if(isset($destfile['username'])) $ircuser = $destfile['username'];
- if(isset($destfile['channel'])) $channel = $destfile['channel'];
- if(isset($destfile['owner'])) {
- if(is_array($destfile['owner'])) $privs = $destfile['owner'];
- else $privs = array($destfile['owner']);
- }
- }
- try {
- if(($socket = fsockopen($network, $netport, $neterr1, $neterr2, 30)) == FALSE) throw new Exception("Could not connect to server.");
- send("NICK $ircnick");
- send("USER $ircuser 8 olo :Stealth Rock");
- $theindex = 0;
- while(TRUE) {
- while($text = fgets($socket)) {
- if(!$text) {
- if($theindex > 3) throw new Exception("Timed out.");
- ++$theindex;
- }
- $theindex = 0;
- echo $text;
- $word = explode(' ', rtrim($text, "\r\n"));
- if($word[0] == 'PING') {
- send("PONG ".$word[1]);
- continue;
- }
- $unick = substr($word[0], 1, strpos($word[0], '!') - 1);
- $uhost = substr($word[0], strpos($word[0], '!') + 1);
- if($word[2] == 'Pointed_stones') $udest = $unick;
- else $udest = $word[2];
- if(in_array($uhost, $privs)) $upower = TRUE;
- else $upower = FALSE;
- if($word[1] == '001') {
- send("MODE Pointed_stones +B");
- send("JOIN $channel");
- }
- elseif($word[1] == '433') throw new Exception("Nickname in use.");
- elseif($word[1] == 'JOIN' && $stealth) {
- sleep(2);
- send("dug into $unick"."!", 2);
- send("MODE $channel -ohv $unick $unick $unick");
- }
- elseif($word[1] == 'PRIVMSG') {
- if(strtolower(substr(implode(' ', array_slice($word, 3)), 2, 24)) == "action used stealth rock" && !$stealth && $udest[0] == '#') {
- $stealth = TRUE;
- send("float in the air around the opponent's team!", 2);
- }
- elseif((strtolower(substr(implode(' ', array_slice($word, 3)), 2, 22)) == "action used rapid spin" ||
- strtolower(substr(implode(' ', array_slice($word, 3)), 2, 17)) == "action used defog") && $stealth && $udest[0] == '#') {
- $stealth = FALSE;
- send("around your team disappeared!", 2);
- }
- elseif($word[3] == ":!sr") {
- if($upower) {
- switch(strtolower($word[4])) {
- case 'raw':
- if(strtolower($word[5]) != 'quit') send(implode(' ', array_slice($word, 5)));
- break;
- case 'quit':
- if(isset($word[5])) send("QUIT :".implode(' ', array_slice($word, 5)));
- else send("QUIT :Manual shutdown.");
- case 'die':
- if(isset($word[5])) throw new Exception("Manual shutdown requested.\r\n-> MSG: ".implode(' ', arrayslice($word, 5)));
- else throw new Exception("Manual shutdown requested.");
- break;
- case 'say':
- if(@$word[5][0] == '#') send(implode(' ', array_slice($word, 6)), 1, $word[5]);
- else send(implode(' ', array_slice($word, 5)), 1, $udest);
- break;
- case 'act':
- if(@$word[5][0] == '#') send(implode(' ', array_slice($word, 6)), 2, $word[5]);
- else send(implode(' ', array_slice($word, 5)), 2, $udest);
- break;
- }
- } //if upower
- } //elif !sr
- } //elif privmsg
- } //while fgets
- } //while true
- } catch (Exception $e) {
- die("\r\nYou whited out...\r\n-> ".$e->getMessage()."\r\n");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment