Advertisement
Shiny_

Code

Apr 20th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.11 KB | None | 0 0
  1. import sys, socket, string
  2.  
  3. servers = [ "irc.pirc.pl",
  4.             "unixstorm.pirc.pl",
  5.             "gdansk.pirc.pl",
  6.             "chommik.pirc.pl",
  7.             "insomnia.pirc.pl",
  8.             "bshellzpl.pirc.pl",
  9.             "wembley.pirc.pl",
  10.             "legowisko.pirc.pl",
  11.             "mydevil.pirc.pl",
  12.             "paris.pirc.pl",
  13.             "irc.freenode.net", ]
  14. random_server = servers[0]
  15. port = 6667
  16. channel = "#testingchannel1"
  17. nick = "Script_Bot__"
  18.  
  19. #irc = socket.socket()
  20. irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #defines the socket
  21. irc.connect((random_server, port))
  22.  
  23. irc.send(bytes("USER %s +i +w * :%s\r\n" % (nick, nick)).decode("UTF-8"))
  24. irc.send(bytes("NICK %s\r\n" % nick).decode("UTF-8"))
  25. irc.send(bytes("JOIN %s\r\n" % channel).decode("UTF-8"))
  26. irc.send(bytes("PRIVMSG %s :Hello\r\n" % channel).decode("UTF-8"))
  27.  
  28. while True:
  29.     data = irc.recv(2048).decode("UTF-8")
  30.     if(data.find("PING") != -1):
  31.         irc.send(bytes("PONG " + data.split()[1] + "\r\n").decode("UTF-8"))
  32.         irc.send(bytes("PRIVMSG %s :PING PONG\r\n" % channel).decode("UTF-8"))
  33.     print data
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement