Advertisement
Aha2Y

Untitled

Mar 8th, 2012
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2. version = '2.1.5'
  3. import sys
  4. import os
  5. import string
  6. import random  
  7. import urllib
  8. import socket
  9. import time
  10. import re
  11. import StringIO
  12. import getpass
  13. import shelve
  14. import traceback
  15. import csv
  16. import pickle
  17. from time import *
  18.  
  19. server = 'irc.rizon.net'  
  20. port = 6667                            
  21. myname = 'InfoBot'
  22. identd = 'Bot'
  23. real_name = "Python IRC Information Bot"    
  24. nickpass = 'YOthisPassIsNotcrackAbleMuhahha'
  25. channels = '#Aha2Y'
  26. version = '3.5'
  27.  
  28. irc = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
  29. irc.connect ( ( server, port) )
  30. irc.send ( 'NICK %s\r\n' % myname)
  31. irc.send ( 'USER %s %s %s :%s\r\n' % (identd, identd, identd, real_name))
  32.  
  33. # Here we make sure to process the login and stuff correctly
  34. connected = 1
  35. while True:
  36.    data = irc.recv ( 4096 )
  37.    raw = data.split()
  38.    print data
  39.    if connected == 3:
  40.       break
  41.    if data.find ( 'PING' ) != -1:
  42.       irc.send( 'PONG ' + data.split() [ 1 ] + '\r\n' )
  43.    if data.find('This nickname is registered and protected.') != -1:
  44.       identify()
  45.    if data.find('End of /MOTD command.') != -1:
  46.       perform()
  47.    def perform():
  48.       irc.send('mode %s +B\r\n' % myname)
  49.       irc.send('mode %s +B\r\n' % myname)
  50.       irc.send('mode %s +B\r\n' % myname)
  51.       irc.send('JOIN %s\r\n' % channels)
  52.       irc.send('JOIN %s\r\n' % channels)
  53.       irc.send('JOIN %s\r\n' % channels)
  54.       connected = connected + 1
  55.    def identify():
  56.       irc.send('privmsg NickServ :Identify %s\r\n' % nickpass)
  57.       irc.send('privmsg NickServ :update\r\n')
  58.       connected = connected + 1
  59.  
  60. # We are connected, lets fuck up with the messages to suit us :D
  61. message_prefix = "!"
  62.  
  63. def _processMessage(raw):
  64.    sender = raw[0][1:]
  65.    data = {"nick": sender.split("!")[0], "ident": sender.split(sender.split("!")[1].split("@")[0]),
  66.                  "host": sender.split(sender.split("!")[1].split("@")[1]), "type": raw[1], "source": raw[2],
  67.                  "command": raw[3][1:]}
  68.    if len(raw) > 3:
  69.       data["args"] = raw[3:]
  70.    return data
  71.  
  72. while True:
  73.    data = irc.recv ( 4096 )
  74.    raw = data.split()
  75.    print data
  76.    if data.find ( 'PING' ) != -1:
  77.       irc.send( 'PONG ' + data.split() [ 1 ] + '\r\n' )
  78.    if data.find(":!elitebnc") != -1:
  79.       if len(raw) != 5:      
  80.          channel = raw[2]
  81.          checksock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  82.          try:
  83.             checksock.connect(('alpdha.elitebnc.net', 1337))
  84.             checksock.shutdown(2)
  85.             alpha = 'Online!';
  86.          except:
  87.             checksock.shutdown(0)
  88.             alpha = 'Offline!';
  89.          irc.send('notice %s :Alpha: %s\r\n' % (nick, alpha))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement