# -*- coding: utf-8 -*- from irc3.plugins.command import command import irc3 import os import sys import random import ipdb from random import randint from re import compile from irc3 import rfc dir_path = os.path.dirname(os.path.realpath(__file__)) KRYPTR = [] BOTNAMES = [] BOTNICKS = [] TOTAL_BOTS = 0 READY_BOTS = [] LOCK_KRYLON = 1 # 1 INTERRUPTED = 0 class KRYLON(): def __init__(self,bot,channel): self.bot = bot self.channel = channel self.KRYLON_FILE = [' .', ' ;', ' l', ' :l', ' ll', ' :$:', ' il', ' l$.', ' l$$.', ' _ .,┌-;lX$Xl-,._', ' .┌\\$$$$$$$$$$$$$$$$$$$S%┐,', ' .d$$$$$$$$$$$$$$$$$$$$$$$$$$$b,', ' d$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$b', ' <$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$,', ' :$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$7', ' .$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$K', ' j$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$b.', ' l$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$7', " $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$j\\⌂'", ' \'^^"└*%jj7$$$$$$$$$$$$$$$\\$$$j*┘²\'^`', ' ,┐. ./$$$$$$$$$$$$$$$b,``', " '²┘j$$$$$$$$$$$$$$7'", " * .┐ Y$$$$$$$$$$$7' .┌⌐ * ,", " .,┐l7' l$$$$$$$$$$7 `└*Sb, ,7 :", ' j$$$$$$$$$$Y .$', ' _┌t$$$$$$$$$$$| ;l$S/a┐. _ .,┌\\$$', " '└7$$$$$$$$$$$$: :l$$$$$$$$$$$$$$M", ' .,┌\\$$$$$$$$$$$$$$$: l$$$$$$$$$$$$$$M', ' ,_ `/$$$$$$$$$$$$$$l :$$$$$$$$$$$$$$├', " `$./┐. 7$$$$$$$$$$$$$$ ?$$$$$$$$$$$$$'", " 7$$$$> .$$$$$$$$$$$$$$b Y$$$$$$$$$$$'", " . `$$$$$ ;$$$$$$$$$$$$$$$l :$$$$$$$$$$'", " `$$$'/$$$$$$$$$$$$$$*└' J$$$$$$$$$'", " : `7$$$$$$$$$$$$a┌. j$$$$$$$$$'", ' . .┐ `$$$$$││$$$$$$$t,.┌d$$│$$$$$├/', " : .7' `$$>. `^''²┘***┘ ²'^` /$$7", " :l l `$$$b. '\\%a¬┐,┌,.-' t$├'", " d$ : `7$$$k┐.`'²²²'` .d$$/", ' $.: . . `7$$$$$a ┌ ,,┌t$$7` .', " ;;l ` \\ '$$$$$$$$$$$$$7 / +", " $$$: . . '└⌂$││jj$⌂┘' .t(,_ .", " $$$ '/┌,. _.j.$S/┐,. ,┌t$$SS$' ,d'", " $$; $$²┘ $$$$$$$$$$$$St/⌐┌,,┌aS$$$$$$$' .,s├'", " └'. . ` . `'┘/y .┐t$$$$$$$$$$$$$$$$$$$$$$$$$$|:$├+' '", " ┌#$ `' ?$$$$$$$$$$$$$$$$$$$$$$t\\$jj$ └~ ./", " $$$ $>. ?$$$$$$$$$$$$$$$$$$$$$$, _.┐t'", " $$$ , `$$$. l$$$$$$$$$$$$$$$$$$$$$$*/#┐ S$$$$7'", " $$$ l. `$$$: :$$$$$$$$$$$$$$$$$$$$$$$\\. `.$7'", " $$$: ┤; `$7 . ┤$$$$7┘²'^``^└4j$$$$$$$'. <├' ,", ' $$$: ┤$. : ` /$ `,$$$ a%S$$$$S% ?$$$$$$$( :.: _ ,_', ' $$$| l$l : . \\` `.. M$$$ $$$$"$$$$ l$$$$$$$\' l$L ,$l ,├\' . .', ' $$$| l$$; l b, \' ` :$$$ └*⌂b $⌂┘\' |$$$$"\\├ .$$$b`\\l ,Q\' d\'', " $$$l i$$$. :b `$b, ` $$$ $S%> .at$ :$$$$$. J$S$$$t: ,$├ ,d' :(", " $$$l i$$$$\\ $b,`$$b,_ °4j $'.┌ b`4$ .$$$$7 _,┐$$$$ .$$l d7' :$", " ?$$$ |$$$$$$$$$$$$$$$$t┌._ |: j$$x$$b` $$7' d$\\`$$$$$l .$$$| j$: j |'", " `?$ |$$$$$$$$$$$$$$$$$$$$$t. L ~┘└$$$$ 7' d$$$$$$$$j7' .$$$$: $$t $", " ` :$$$$$$$$$$$$$$$$┘²'``` `b b%┌s%$$$$ `'²┘└²²└j$' .d$$$$$$\\$$$$7", " :$$$$$$$$$$$$$$$$ d$$$Y t$\\`$$$$$$7²'.t$$.Y$$$$b |$ t$$$$$$$$$$$$7'", " `4j$$$$$$$$$$$$$ $$$$'J$$$b.\\jj/'.d$$$$$$:$$$$$ |$b`$$$$$$$$j7┘'", " ~└/├$$$$$$$$$ $$$$:$$$$$├t, .$j│$$$$$┤|$$$$$ l$$$$$$jS*┘'", " ~└*⌂S$$$j.`²²² `²²²²,┌/$t┌,_`'²²² '²²²²' l⌂∟*┘²'", ' $$$Q/`l$l', " $$┘'. ,┌┌", ' .┌t$$\\$$$', ' $$$$$$$t.', ' $$├`$$$$$', " $$t ljS┘'", ' j└~ .┌at', ' /t$\\`$$$', ' l$$$$$$$$', ' ├$$$$$$$$', " _'└*⌂S⌂└'"] self.__run__() def __run__(self): self.KRYLON_FILE.reverse() self.FILE_BUFFER=[] for _ in self.KRYLON_FILE: self.FILE_BUFFER.append(_) self.FILE_LINES = len(self.KRYLON_FILE) self.INIT = 0 self.STARTED = 0 self.FINISHED = 0 self.FILE_INDEX = 0 # BITWISE FILE LOCK SET self.KRYLON_FILE_LOCK = [] for _ in range(len(self.KRYLON_FILE)): self.KRYLON_FILE_LOCK.append(1) # BITWISE R/W BOT LOCK SET self.BOTS_MODE_LOCK = [] for _ in range(len(READY_BOTS)): self.BOTS_MODE_LOCK.append(zip('1','1')) # BITWISE R/W BOT LOCK UNSET R=[]; W=[]; _X=-1; _Y=-1; for _ in range(len(READY_BOTS)): _X,_Y=list(self.BOTS_MODE_LOCK[_])[0] R.append(int(_X)) W.append(int(_Y)) self.BOTS_MODE_READ=R self.BOTS_MODE_WRIT=W @irc3.plugin class Plugin(object): def __init__(self, context): self.log = context.log self.context = context self.channel = context.config.channel self._ST8 = 0 def __emoj(self,s): emote_db = '%s/emote.db' % dir_path emoj = random.choice(list(open(emote_db))) random.randint(0,1) if random.randint(0,1) == 0: emoj = "\x0304{}\x0F".format(emoj) else: emoj = "\x0303{}\x0F".format(emoj) s = s + ' ▶ ' + emoj return s def __greet(self): greet_db = '%s/greet.db' % dir_path greet = random.choice(list(open(greet_db))) return greet def __symbol(self): symbol_db = '%s/symbol.db' % dir_path symbol = random.choice(list(open(symbol_db))) return symbol def rotate(self): self.b1n+=1 if self.b1n == len(BOTNICKS): self.b1n=0 ipdb.set_trace() def spraying(self, mask, channel, **kw): PTR = KRYPTR[0] PTR.kbr = []; PTR.kbw = []; PTR.kbl = []; PTR.chn = channel for index in range(len(PTR.BOTS_MODE_READ)): PTR.kbr.append(PTR.BOTS_MODE_READ[index]) PTR.kbw.append(PTR.BOTS_MODE_WRIT[index]) PTR.kbl.append(PTR.KRYLON_FILE_LOCK[index]) PTR.fbu = PTR.FILE_BUFFER PTR.fli = PTR.FILE_LINES PTR.fin = PTR.FILE_INDEX BOTNAMES=','.join(self.context.config.botnet.keys()).split(',') PTR.bna = BOTNAMES BOTNICKS=[] for _ in BOTNAMES: BOTNICKS.append(self.context.config.botnet[_].nick) PTR.bni = BOTNICKS PTR.b1n = BOTNICKS.index(self.context.nick) PTR.int = 0 if PTR.INIT == 0: PTR._ST8 = 0 PTR.INIT = 1 print('<<<<<<> JUST INIT <>>>>>>') # test if initialized for first pass, fails on purpose PTR.STARTED = 1 PTR.FINISHED = 0 PTR.exe = 1 # set to recognize execution PTR.cyc = 0 # how many cycles within this operation, e.g. amount of bots pass through this function PTR.ops = 0 # how many completed operations, cycles reset, ops continue to count #ipdb.set_trace() for y in range(len(PTR.bni)): if not y == PTR.b1n: PTR.kbr[y] = 0 else: PTR.kbw[y] = 1 PTR.who = self.context.nick MSG=PTR.fbu.pop() PTR.what = MSG PTR.fin+=1 NEWBOT=','.join(list(self.context.config.botnet.keys())).split(',')[PTR.b1n] print(PTR.bni) print(PTR.bna) print(PTR.b1n) print(PTR.bni[PTR.b1n]) print(PTR.bna[PTR.b1n]) print("WHO:{} NEWBOT:{}".format(PTR.who,NEWBOT)) self.context.privmsg(PTR.chn,MSG) if PTR._ST8 <= 5 and PTR.int == 1: INTERRUPTED = 0 PTR.int = INTERRUPTED PTR._ST8 = 3 @irc3.event(irc3.rfc.JOIN) def welcome(self, mask, channel, **kw): if LOCK_KRYLON == 1: B0T = self.context B0TNAMES=','.join(self.context.config.botnet.keys()).split(',') B0TN1CKS=[] for _ in B0TNAMES: B0TN1CKS.append(self.context.config.botnet[_].nick) for i,B0T.nick in enumerate(B0TN1CKS): if B0TN1CKS[i] == B0T.nick: NFLAG=1 for _ in READY_BOTS: if B0T.nick == _: NFLAG=0 if NFLAG==1: READY_BOTS.append(self.context.nick) BOTCNT = len(self.context.config.botnet) if len(READY_BOTS) == BOTCNT: BOTNICKS=B0TN1CKS BOTNAMES=B0TNAMES TOTAL_BOTS = BOTCNT; BOT=self.context CHN=channel k=KRYLON(BOT,CHN) KRYPTR.append(k) self.spraying(mask,channel,**kw) @irc3.event(irc3.rfc.CONNECTED) def connected(self, **kw): if LOCK_KRYLON == 1: self.context.join(self.channel) @irc3.event(rfc.PRIVMSG, iotype="out") def krylon_event(bot, mask=None, event=None, target=None, data=None): NICK=bot.context.nick CHANNEL=bot.channel MSG="CHANNEL: {} event out: {}".format(CHANNEL,NICK) print(MSG) # ipdb.set_trace() PTR = KRYPTR[0] B0T=bot.context B1N = PTR.bni.index(B0T.nick) print("OUTPUT:{}".format(bot.context.nick)) @irc3.event(irc3.rfc.PRIVMSG, iotype="in") def on_privmsg(self, mask=None, data=None, **kw): # B0T=self.context # print(data) bot = self NICK=bot.context.nick CHANNEL=bot.channel MSG="CHANNEL: {} event out: {}".format(CHANNEL,NICK) print(MSG) # ipdb.set_trace() PTR = KRYPTR[0] B0T=bot.context B1N = PTR.bni.index(B0T.nick) print("INPUT:{}".format(bot.context.nick)) WTF=0 B0T = self.context B0TNAMES=','.join(self.context.config.botnet.keys()).split(',') B0TN1CKS=[] for _ in B0TNAMES: B0TN1CKS.append(self.context.config.botnet[_].nick) BITCH=1 for _ in B0TN1CKS: if _ == mask.nick: BITCH=666 if BITCH == 1: self.context.privmsg('#tcpdirect','dont interrupt me mofo') PTR.int = 1 PTR.FILE_BUFFER=[] for _ in PTR.KRYLON_FILE: PTR.FILE_BUFFER.append(_) PTR.fbu = PTR.FILE_BUFFER PTR.INIT = 0 PTR.fin=0 PTR.b1n=0 PTR.FINISHED = 0 self.spraying(mask,channel,**kw) return if PTR.who == mask.nick and PTR.STARTED == 1 and PTR.FINISHED == 0 and PTR.what == data and PTR.fin < PTR.fli: PTR.fin+=1 PTR.b1n+=1 if PTR.b1n == len(PTR.bni): PTR.b1n=0 PTR.who = PTR.bni[PTR.b1n] MSG=PTR.fbu.pop() PTR.what = MSG NEWBOT=','.join(list(bot.context.config.botnet.keys())).split(',')[PTR.b1n] print(NEWBOT) bot.context.config.botnet[NEWBOT].privmsg(CHANNEL,MSG) if PTR.fin == PTR.fli: sys.exit(0)