EG Information

Main Index
EG Manual
Disclaimer
Legal Information
Hall of Fame
Hall of Shame
Member Rankings
Members List
Meet the Staff
Hacker's Home Page

Training Missions

Read Me First
Basic Skills
Realistic Scenarios
Cryptography
Software Cracking
Linux ELF Binary Cracking
Logical Thinking
Programming
Captcha Cracking
Patching
Steganography
Deface This Wall
/dev/null
/dev/urandom
/dev/extra

Knowledge Bank

Discussion Forums
Exploit Database New
PasteBin New
RSS Feeds RSS
Articles / Tutorials
Videos
Online EG MP3 Player Radio
Downloads
Tools

Code Resources

Submit Code
Ajax
ASM
Bash
C
CPP
Csharp
Delphi
Haskell
Java
Javascript
Jython
Lisp
mIRC
MySQL
Perl
PHP
Python
QBASIC
VisualBasic

Pimp Us Out!

Review enigmagroup.org on alexa.com

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.

Enigma Group

Enigma Group

Enigma Group

Enigma Group

 

Affiliates

hackhound.org

suck-o.com

hack.org.za

flyninja.net

 

Enigma Group's Code Bank


ircBot v0.1

By: Link-  -  Date Submitted: 2010-09-01 16:25:20

  1. <?php
  2. /*
  3. * ircBot v0.1
  4. * @author: Link-
  5. * @email: link.random@gmail.com
  6. * @license: The GNU General Public License (GPL)
  7. * @year: 2010
  8. */
  9.  
  10. ini_set('display_errors', 'on');
  11.  
  12. class botClass
  13. {
  14. // Configuration array
  15. public $config = array();
  16. var $cnnSock, $errno, $errmsg;
  17. var $dataBuffer;
  18.  
  19. /*
  20. * Constructor
  21. * param: Server name, port, bot nickname, bot channel, timeout
  22. * return: none
  23. */
  24. function __construct($server, $port = 6667, $botNick = 'Link-Bot', $botChan = '#bots', $timeOut = 30, $commandOperator = ':@', $botOwner = ':Link-')
  25. {
  26. $this->config['server'] = $server;
  27. $this->config['port'] = $port;
  28. $this->config['botNick'] = $botNick;
  29. $this->config['botChan'] = $botChan;
  30. $this->config['timeOut'] = $timeOut;
  31. $this->config['commandOperator'] = $commandOperator;
  32. $this->config['botOwner'] = $botOwner;
  33.  
  34. // Call the connect function
  35. $this->cnnSock = self::connect();
  36.  
  37. // Call the main function to listen to the server
  38. if ($this->cnnSock)
  39. self::main();
  40. }
  41.  
  42. /*
  43. * Send data function
  44. * param: IRC command, Command arguments [default: null]
  45. * return: true | false
  46. */
  47. function sendData($cmd, $cmdArgs = '')
  48. {
  49. return fwrite($this->cnnSock, $cmd . ' ' . $cmdArgs . "\r\n");
  50. }
  51.  
  52. /*
  53. * Connection establishmed function
  54. * param: None
  55. * return: socket connection
  56. */
  57. function connect()
  58. {
  59. $socket = fsockopen($this->config['server'], $this->config['port'], $this->errno, $this->errmsg, $this->config['timeOut']);
  60.  
  61. if (!$socket)
  62. return "ERROR: $this->errno - $this->errmsg \n";
  63.  
  64. echo "Connection established\r\n";
  65.  
  66. return $socket;
  67. }
  68.  
  69. /*
  70. * Connection closure function
  71. * param: none
  72. * return: none
  73. */
  74. function closeCon()
  75. {
  76. self::sendData('QUIT');
  77. fclose($this->cnnSock);
  78. die('Connection termindated.');
  79. }
  80.  
  81. /*
  82. * PING request
  83. * param: none
  84. * return: none
  85. */
  86. function sendPong()
  87. {
  88. self::sendData('PONG ' . $this->dataBuffer[1] . "\r\n");
  89. echo "PONG Request sent\r\n";
  90. }
  91.  
  92. /*
  93. * Check privilege
  94. * param: Commanding host
  95. * return: true | false
  96. * status: Temporary
  97. */
  98. function checkPrivs($commandHost)
  99. {
  100. if (!empty($commandHost))
  101. {
  102.  
  103. $commandHost = explode('!', $commandHost);
  104.  
  105. // Debugging purposes
  106. print_r($commandHost);
  107.  
  108. if ($commandHost[0] == $this->config['botOwner'])
  109. return true;
  110.  
  111. return false;
  112. }
  113.  
  114. return false;
  115. }
  116.  
  117. /*
  118. * Main function contain main loop
  119. * param: none
  120. * return: none
  121. */
  122. function main()
  123. {
  124. // Change nickname
  125. self::sendData('NICK', $this->config['botNick']);
  126. // Register connection
  127. self::sendData('USER ', $this->config['botNick'] . ' ' . $this->config['botNick'] . ' ' . $this->config['botNick'] . ' :' . $this->config['botNick'] . "\r\n");
  128. // Join Channel
  129. self::sendData('JOIN', $this->config['botChan']);
  130.  
  131. while(1)
  132. {
  133. // Get the buffer from the server
  134. $this->dataBuffer = fgets($this->cnnSock);
  135.  
  136. // Explode the buffer, limit number of array slots is 5
  137. $this->dataBuffer = explode(" ", $this->dataBuffer, 5);
  138.  
  139. print_r($this->dataBuffer);
  140.  
  141. // Deal with the Ping\Pong requests
  142. switch($this->dataBuffer[0])
  143. {
  144. case 'PING':
  145. self::sendPong();
  146. }
  147.  
  148. // Deal with bot commands
  149. if (count($this->dataBuffer) >= 4)
  150. {
  151. // Remove the CRLF from the end of the message
  152. $rawCmd = str_replace(array(chr(10), chr(13)), '', $this->dataBuffer[3]);
  153.  
  154. switch($rawCmd)
  155. {
  156. // Say stuff
  157. case $this->config['commandOperator'] . 'say':
  158. if (self::checkPrivs($this->dataBuffer[0]))
  159. {
  160. echo "Message sent! \r\n";
  161. self::sendData('PRIVMSG', $this->dataBuffer[2] . ' :' . $this->dataBuffer[4] . "\r\n");
  162. }
  163. {
  164. self::sendData('PRIVMSG', $this->dataBuffer[2] . " :You don't have enough privileges to command me! Fuck u!\r\n");
  165. }
  166.  
  167. // Join Channel
  168. case $this->config['commandOperator'] . 'join':
  169. if (self::checkPrivs($this->dataBuffer[0]))
  170. {
  171. if (!empty($this->dataBuffer[4]))
  172. {
  173. echo "Joining: " . $this->dataBuffer[4] . "\r\n";
  174. self::sendData('JOIN', $this->dataBuffer[4] . "\r\n");
  175. }
  176. {
  177. echo "Error: No channel specified!";
  178. self::sendData('PRIVMSG', $this->dataBuffer[2] . " :Where the fuck do you want me to go?! \r\n");
  179. }
  180. }
  181. {
  182. self::sendData('PRIVMSG', $this->dataBuffer[2] . " :You don't have enough privileges to command me! Fuck u!\r\n");
  183. }
  184.  
  185. // Part channel
  186. case $this->config['commandOperator'] . 'part':
  187. if (self::checkPrivs($this->dataBuffer[0]))
  188. {
  189. if (!empty($this->dataBuffer[4]))
  190. {
  191. echo "Leaving: " . $this->dataBuffer[4] . "\r\n";
  192. self::sendData('PART', $this->dataBuffer[4] . "\r\n");
  193. }
  194. {
  195. self::sendData('PART', $this->dataBuffer[2] . "\r\n");
  196. }
  197. }
  198. {
  199. self::sendData('PRIVMSG', $this->dataBuffer[2] . " :You don't have enough privileges to command me! Fuck u!\r\n");
  200. }
  201.  
  202. // Disconnect
  203. case $this->config['commandOperator'] . 'die':
  204. if (self::checkPrivs($this->dataBuffer[0]))
  205. {
  206. self::closeCon();
  207. }
  208. {
  209. self::sendData('PRIVMSG', $this->dataBuffer[2] . " :You don't have enough privileges to command me! Fuck u!\r\n");
  210. }
  211. }
  212. }
  213. }
  214. }
  215. // END main()
  216. }
  217.  
  218. $bot = new botClass('irc.enigmagroup.org');
  219. ?>
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
 
Enigma Group