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


Simple Unix IRC Client

By: Arameus  -  Date Submitted: 2011-05-20 12:13:22

  1. #!/usr/bin/python
  2.  
  3. import socket # needed to connect to server's, send data, and receive data
  4. import re # used for formatting other user's messages to look pretty
  5. from os import fork # used to allow simultaneous input and output
  6.  
  7. class Server:
  8. commandhash = {"/list":"LIST", "/join":"JOIN", "/nick":"NICK"}
  9. openchannels = []
  10. channel = None
  11. ## This constructor does the housekeeping presumed for any irc connection and represents
  12. ## a single server. As of now this program only supports connection to one server at a time
  13. ## (and in fact, one channel as well) but this will be addressed in future versions.
  14. def __init__(self, address, protocol=6667):
  15. self.address = address # record the server address for future use
  16. self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # set up the socket
  17.  
  18. ## Get identity information needed by the server.
  19. self.realname = raw_input("REALNAME: ")
  20. self.ident = raw_input("IDENT: ")
  21. self.nick = raw_input("NICK: ")
  22.  
  23. self.sock.connect((socket.gethostbyname(address), protocol)) # connect to the server
  24. self.sock.send("USER %s %s %s :%s\r\n" % (self.ident, address, "UNIX-SERVER", self.realname)) # send identity stuff
  25. self.sock.send("NICK %s\r\n" % self.nick) # tell the server our desired nick
  26. def parseMessage(self, message):
  27. nick = message[message.index(":"):message.index("!")]
  28. message = message[message.index(":") + 1:]
  29. message = message[message.index(":"):]
  30. return "%s %s" % (nick, message)
  31. def server_response(self):
  32. response = self.sock.recv(1024)
  33. if "!" in response and ":" in response[response.index(":") + 1:]:
  34. return self.parseMessage(response)
  35. if "PING :" in response:
  36. self.sock.send(response.replace("PING", "PONG"))
  37. return 0
  38. return response
  39. def send_message(self, message):
  40. if not message:
  41. return False
  42. for i in self.commandhash:
  43. if message[:len(i)] == i:
  44. message = message.split(" ")
  45. if len(message) == 2:
  46. if message[0] == "/join":
  47. self.channel = message[1]
  48. return self.sock.send(self.commandhash[i] + " " + message[1] + "\r\n")
  49. return self.sock.send(self.commandhash[i] + "\r\n")
  50. if self.channel:
  51. message_tuple = (self.nick, self.ident, self.address, self.channel, message)
  52. return self.sock.send(":%s!%s@%s PRIVMSG %s :%s\r\n" % message_tuple)
  53. else:
  54. print "No channel selected"
  55. return False
  56. def close(self):
  57. self.sock.close()
  58. return
  59.  
  60. connection = Server(raw_input("server: "))
  61. connected = 1
  62.  
  63. pid = fork()
  64. while connected:
  65. if pid:
  66. connection.send_message(raw_input())
  67. else:
  68. response = connection.server_response()
  69. if response:
  70. print response
  71.  
  72. connection.close()
  73.  
Return to python category list

Who Visited EnigmaGroup Today?

1385 Guests, 225 Users (216 Spiders)
TheCheeseDemon, MineDweller, Pabz, lolzsec, terrorbyte, dark_void, Nightraven, cat1vo, interspirehost, lamb, tgm001, plex, Edika, rockcraft, recoveryToolbox, saraf, soufiaane, sickmind, mjneat, famous0123, Galagatron, 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, 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
 
Enigma Group