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
Smiple BotBy: NotMyOwn - Date Submitted: 2008-09-12 00:49:42 <?php /* * Written By: NotMyOwn * Email: admin@unrealcomps.org * * This is for Enigma Group and is ment soley for learning. This bot is in no way advanced, but it is a good learning ground. * Note: \\n is basically the same as a human hitting enter and makes it so the command runs, this is ONLY for Linux,for it * to work on Windows, you must use \\r\\n */ //Main variables $host = "unrealcomps.org"; $port = 6667; $nick = "MyBot"; $chan = "#test"; $readbuffer = ""; //Open the socket to the IRC Host $irc = fsockopen($host, $port, $errno, $errstr, 30); //Checks to see if the connection was made and there were no problems { /*fputs is how you write data to the server, it is basically how you make the bot type Bots don't act exactly like a real person and when start a command you must remember it is typing in the main server window, and not the channel window Commands are capitalized and not used like you would with a client, because when you type /nick in a client it turns out as NICK in the main code*/ //Since you aren't using a client that does ths automatically, we must define it all. //This sets the nickname of the bot ^see variables above to change the nickname^ fputs($irc, "NICK " . $nick . "\\n"); //This sets the whois of the bot, since this is a simple bot, it will all just be the nickname repatedly fputs($irc, "USER " . $nick . " " . $nick . " " . $nick . " :" . $nick . "\\n"); //This is the command to join the channel, see above to change the channel fputs($irc, "JOIN :" . $chan . "\\n"); //This is how you talk on the channel, PRIVMSG is basically like PMing a user on IRC only it is //PMing the whole channel because we are on the main server window, and not the channel fputs($irc, "PRIVMSG " . $chan . " :" . $nick . " is now online\\n"); //This will keep the bot running because while in this loop you can never read feof (end-of-file) { //fgets is the opisite of fputs, it gets what as already been displayed on the server $line = fgets($irc, 128); //This echos out the $line so we can see what the server has said //This parses $line into an array so we can select certain vlaues from it (for the commands) and using a space as the dilimeter //which is where it will make a new value, so like this: $text = "this is a sentance"; $text = exploit(" ", $text); print_r($text); //which will display something like this: array('this', 'is', 'a', 'sentance'); //This will mainly be used to keep the bot from timing out, see below for usage //This will in general be the main text a user says $command = trim($line[3]); //Uncomment the below to for debugging and figuring out how long the array is and what $line[#] you should use //print_r($line); //Checks to see if the server has pinged us for a timeout { //If it has, says pong to the server, $line[1] is the server name, because the way pong works is: /pong irc.server.net fputs($irc, "PONG " . $line[1] . "\\n"); } //This is how to do a basic command, note: the : is required because if you type something it shows up as :My test on the main code //What is inside the "" is what the command will be, so to use this command, you would type "!quit" without quotes into IRC from a client { //Like I said before, this just basically types things into the channel, this notifys us that the bot has quit fputs($irc, "PRIVMSG " . $chan . " :Connection Closed\\n"); ///Closes the connection to the server/host //Ends the php code so it doesn't just keep running forever if you ran it from command line } } //Closes the connection to the server/host //Ends the php code so it doesn't just keep running forever if you ran it from command line } { //If there was an error opening the socket, displays the error and the error number echo "Error: " . $errstr . " | #(" . $errno . ")<br />\\n"; }
|
| Return to
php category list |
|
|
Who Visited EnigmaGroup Today?
1572 Guests, 269 Users (180 Spiders)
TheHarrisonW, trueorfalse, Hessesian, Vreality2007, whisperer, strudels, advenlydent, Obop, zach, blackknight911, ddxc, suetekh, Vengeance987, m0rt, 2345, whoami, electro-technic, riesenjoe, Bumpadjuppy, IvanDimitriev, Distorted, nmobin27, RomeoG, timetrust, 2142, 3ntr0py, BillTuer, advilapyday, lotato, Rex_Mundi, hkevin, lonely.connection, CloverCipher, vnd, aurena, rospark, valy1177, Blavatsky, learning, st3alth, Partisan, hackaday, K0gller, fitz, DrOptix, Jayjay, JohnMalkovitzch, psychomarine, Vspectrum, San Marino, TinCardinal, brunoriversyhn, code-g, yshiau, Psiber_Syn, Klosse, Seasharp, obencefoozy, SlayingDragons, Link-, tinuigimeni, jasonbourne, Fred, GothicLogic, somebody777, Meonkzt, CJ_Omaha, jearrorne, cls777, unsugsNashy, Balksnuntails, Sir D. Naut, batsbargy, Rik, Macabre, ellisp, Nightraven, Iccyx, Repuhlsive, vipervince2002, Janomatrix, lol, veceattainc, techno, Exclaw, limited, Nikhil, evjfvir967nj, Mod777, dark_void, nermtode, Tjm, bjy1997, hecky, saraf, elprof, damoniceht, trik, jordan86, SnoopSky, dan_movie, OnetInsolefon, darkfire1515, seojlhmyrhwh, Thoplehap, MaxMeier, 1028rajeev, Abhinav2107, autotuneuser, alexelixir, Tauya, Jozinbrejl, kernel_mod, quolc, anandoump, vladavlada, Taicadine, AnnaNoult, GreenTiger, baripadatimes, Ewing, Blackbeard, thepuppeteer, BON-SELE, hak4r, Unotohumsmush, NIGHTWOLF, m4f10, avacraft, becool, thecoder, n01se, alpha1, saki, ObesseJew, ActictGlync, sajan, unicornrainbow, Domihoolbob, matt.14, max66, SnowFury, Spud101, myfabregas, Ausome1, kajman121, Frudopvia, ideveloper6, OLOLO, Bugshuppy, lamb, VagWirura, LialiTiTviors, Ordeptpen, scifics, Pozycj-Z21, Gkjt, interPuscruse, aaftab, TheCheeseDemon, blackcyxx21, jollyjimbo, N4g4c3N, rineDriekly, Rap70r, Xargos, flarornEral, ovetz13, sonu sahu, Breezy, emitleBen, Hackpad, JWTSR, nicyun, kaizo, itevainee, luke460, AverageJoe, zeratu92, litbk, Mr.Pickle, mannavard1611, LoopyLion, NexusVos, mtroscheck, burberrybagsjr, nikedunksxm, xordux, jeho, Lonewolf034, Dragonite, nhorton, Reloaded, Odile, Kaptain_k1rk, Teefelltugh, grizzly, posthuman01, jakesboy2, pwnpwnlolz, Sabo, Lakhoamnmek, Røgue, dot_Cipher, mori, snickerless1, cart1m, Xendz, KELATALFTUS, hubris, Afrika, welepocourl, carpinteyrofbt, ReottphoffBom, Reahastegah, pumashoesld, pdanielt, dmac006, DnA-Ender, Red Fox, couptupleakb, ryanjcrook, iMaxx, sh3llcod3, TimHortons, EmilaHapsaums, Feld Grau, burgeoningneophyte, Maroonhat, CookieAu, tinkansinar, Mitodina, timberlandoutletlufc, zsefvy, guccioutletox, AlexDiru, AbercrombieFitchhl, Ryuske, r0z4, slchill, kalak55, Ph4Kt480ii, beefarn, Jigoku, WrossyJes, pollolololo, ZepSung, Fragility, jell0, C9019, Othrguy, Noticon, KIKNWING, llasarus, mdubz, leah027, iellswo, MAZI_, Estilaamoli, subtentar, Trollorful, no, nas0151, Traybo, howisthechicken, thethird3y3, Somethingclever, marplusz, MSI52 |
| |
|
|
|
|
|