EG Information
Training Missions
Knowledge Bank
Pimp Us Out!
Has Enigma Group Helped You? Then Help Us By Advertising For Us. Place One Of The Following Images On Your Site And Create A Link Back To Enigma Group.
|
| |
Affiliates
|
|
Enigma Group's Code Bank
ircBot v0.1By: Link- - Date Submitted: 2010-09-01 16:25:20 <?php /* * ircBot v0.1 * @author: Link- * @email: link.random@gmail.com * @license: The GNU General Public License (GPL) * @year: 2010 */ class botClass { // Configuration array public $config = array(); var $cnnSock, $errno, $errmsg; var $dataBuffer; /* * Constructor * param: Server name, port, bot nickname, bot channel, timeout * return: none */ function __construct($server, $port = 6667, $botNick = 'Link-Bot', $botChan = '#bots', $timeOut = 30, $commandOperator = ':@', $botOwner = ':Link-') { $this->config['server'] = $server; $this->config['port'] = $port; $this->config['botNick'] = $botNick; $this->config['botChan'] = $botChan; $this->config['timeOut'] = $timeOut; $this->config['commandOperator'] = $commandOperator; $this->config['botOwner'] = $botOwner; // Call the connect function $this->cnnSock = self::connect(); // Call the main function to listen to the server self::main(); } /* * Send data function * param: IRC command, Command arguments [default: null] * return: true | false */ function sendData($cmd, $cmdArgs = '') { return fwrite($this->cnnSock, $cmd . ' ' . $cmdArgs . "\r\n"); } /* * Connection establishmed function * param: None * return: socket connection */ function connect() { $socket = fsockopen($this->config['server'], $this->config['port'], $this->errno, $this->errmsg, $this->config['timeOut']); return "ERROR: $this->errno - $this->errmsg \n"; echo "Connection established\r\n"; } /* * Connection closure function * param: none * return: none */ function closeCon() { self::sendData('QUIT'); die('Connection termindated.'); } /* * PING request * param: none * return: none */ function sendPong() { self::sendData('PONG ' . $this->dataBuffer[1] . "\r\n"); echo "PONG Request sent\r\n"; } /* * Check privilege * param: Commanding host * return: true | false * status: Temporary */ function checkPrivs($commandHost) { { $commandHost = explode('!', $commandHost); // Debugging purposes if ($commandHost[0] == $this->config['botOwner']) } } /* * Main function contain main loop * param: none * return: none */ function main() { // Change nickname self::sendData('NICK', $this->config['botNick']); // Register connection self::sendData('USER ', $this->config['botNick'] . ' ' . $this->config['botNick'] . ' ' . $this->config['botNick'] . ' :' . $this->config['botNick'] . "\r\n"); // Join Channel self::sendData('JOIN', $this->config['botChan']); { // Get the buffer from the server $this->dataBuffer = fgets($this->cnnSock); // Explode the buffer, limit number of array slots is 5 $this->dataBuffer = explode(" ", $this->dataBuffer, 5); // Deal with the Ping\Pong requests { self::sendPong(); } // Deal with bot commands { // Remove the CRLF from the end of the message { // Say stuff case $this->config['commandOperator'] . 'say': if (self ::checkPrivs($this->dataBuffer[0])) { echo "Message sent! \r\n"; self::sendData('PRIVMSG', $this->dataBuffer[2] . ' :' . $this->dataBuffer[4] . "\r\n"); } { self::sendData('PRIVMSG', $this->dataBuffer[2] . " :You don't have enough privileges to command me! Fuck u!\r\n"); } // Join Channel case $this->config['commandOperator'] . 'join': if (self ::checkPrivs($this->dataBuffer[0])) { { echo "Joining: " . $this->dataBuffer[4] . "\r\n"; self::sendData('JOIN', $this->dataBuffer[4] . "\r\n"); } { echo "Error: No channel specified!"; self::sendData('PRIVMSG', $this->dataBuffer[2] . " :Where the fuck do you want me to go?! \r\n"); } } { self::sendData('PRIVMSG', $this->dataBuffer[2] . " :You don't have enough privileges to command me! Fuck u!\r\n"); } // Part channel case $this->config['commandOperator'] . 'part': if (self ::checkPrivs($this->dataBuffer[0])) { { echo "Leaving: " . $this->dataBuffer[4] . "\r\n"; self::sendData('PART', $this->dataBuffer[4] . "\r\n"); } { self::sendData('PART', $this->dataBuffer[2] . "\r\n"); } } { self::sendData('PRIVMSG', $this->dataBuffer[2] . " :You don't have enough privileges to command me! Fuck u!\r\n"); } // Disconnect case $this->config['commandOperator'] . 'die': if (self ::checkPrivs($this->dataBuffer[0])) { self::closeCon(); } { self::sendData('PRIVMSG', $this->dataBuffer[2] . " :You don't have enough privileges to command me! Fuck u!\r\n"); } } } } } // END main() } $bot = new botClass('irc.enigmagroup.org'); ?>
|
| Return to
php category list |
|
|
Who Visited EnigmaGroup Today?
1388 Guests, 226 Users (217 Spiders)
Nightraven, lolzsec, interspirehost, lamb, cat1vo, Pabz, tgm001, plex, Edika, TheCheeseDemon, rockcraft, recoveryToolbox, saraf, soufiaane, sickmind, mjneat, famous0123, Galagatron, dark_void, CJ_Omaha, junaid_junaid59, JohnJohnJohn, ssmaslov, psychomarine, Dregoon, Patrickk, Aska, Beat_Slayer, M0rdak, Ausome1, Imre, Vreality2007, mmndglxuwn, m0rt, unholyblood, iterrumzz, VurbTrurb, Mayonoula, MAMWOURBROR, mutabor, gobinda, cossyDrybrich, Razin, zaCruBumas8, hunja, johny34, pantoufle, bagy, arctica, hackarchives, UsedDeteKef, Peculator, Fadhilat606, TheTrueMonarch, Pascall01, hackaday, Tjm, arndevil, flairvelocity, lol, alphbond, kdivanov, elizbethallis6, Rik, bn11, BorgBot, SHASHANK101hello, 4poc4lyptic, ksajxai, nbmorri1, electro-technic, شمالي عرعر, AutobotPrime, Underleaf, The End, tomtombomb, killobyte, snowgirlx, so_saucey, zerolife, Althor, Cramps, Hekser, Hyperborn, cyber-guard, jhgrunn, cobra, Partisan, MAZI_, cyborg, GenbreedX, moel77, cliptoX, pwnpwnlolz, letshavepie, Mrwormz, yshiau, mirmo, roozyoppomo, soft_devil, cls777, scoobywan, Reiversed, joshua, st3alth, Afrika, PaiffDryday, venter, Anthony12796, sh3llcod3, 8FIGURE, Rannim, Evil1, maloaboy, BACanON, SlayingDragons, Repuhlsive, IvanDimitriev, 1RiB, mzungudo, Micro_Geek, iMaxx, aciboummamymn, k0unterkulcher, somebody777, m14m16, GoododotAlcob, negasora, Rastii, UninueMem, Swifsolja, ad.conquest, ngolatkar, Infinity8, Jigoku, thesupervisor, p0is0n5ting, kernel_mod, AKL, GothicLogic, themastersinner, dnatrixene135, ChewBigRed, kalak55, sejem, cve916, pollolololo, triecturn, Violatedsmurf, Ops, jmp, xsiemich, generalisimo, strudels, ga3ttpom, KingOfBritains, epoch_qwert, suten, FriskyKat, Ryuske, Adonis Achilles, ubqbcdzzhf, 3vil, US£RNAM£, Weindittewcon, Batesheelocot, GSmyrlis, MaxMeier, Elite.America, rabbidmind, Psiber_Syn, phoenix22, imittyerrotte, peewster, cyberturtle, ctb, dexgeda, sdw, Pizza, White_widdow, devarian, finesse, Nature112091777, Danc7171, Alphadragon, Estadagause, 53QR10U5, Xargos, Alkomage, hardlock, Barry Gonzoles, MineDweller, Gkjt, N4g4c3N, [I]nfectedbug, wimsteege, aqr5zdcw, xin214, Bugshuppy, SnoopSky, Hessesian, voodooKobra, sKcarr, IROverRated, W1F1G3NJU75U, Baddy, ziadmosaan, gamble86, realzs, CruelDemon, Shinju, aVoid, aquiredanonymity, kukumumu, web_request, callmeneon, KissMyDAFFODIL, Feld Grau, Abhinav2107, prabhataditya, mbuyiselo, shumer, phenom216, princennamdi, huskyboiza, ninety-nine |
| |
|
|
|
|
|