krylon/5.hack.txt

255 lines
11 KiB
Plaintext

# -*- 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 = [' ┌------------------------------------------─┐', ' d"\' \' \' H A C K >> T H E >> P L A N E T \' \' \'"a', " '$r └------------------------------------------─┘ e$'", ' .a$ $a.', ' .e$$²² . ²²$$e.', ' $$4. "$s .4$$', ' `²$$$$$$$$$$sp. sP$#\'" .ps$$$$$$$$$$²`', ' ²²²$$$$ :$$$s_ o $$$$²²²', ' `²$$$$$$$$$$sp. .ps$ "s$$$$s : $$$$', ' $$$ $$$$$ ···$$$$e --──── .── |$$$$| ---─────────┘ $$$$1', ' . "$ss" ░ $$$$ ░ $$$$B$┐ ░ a$$ |$$$$\' ░░░░░ ░░ ░ $$$$0', ' .$ $$$$ $$$$ "$$ $$$ ░ °X°" $$$$', '$" ░ .eP7$²²²²²7e$$$$ee\' $$$$ "$$e.$$$ ░ .$$$²² .eP7$²²²²²7e$$$$$$$$$$7\' //', 'ss ░░ $$$$² $$$$ $$$$ 1 ╚$$$$$ ░ $$$$ $$$$² $$$$1 .', '`²²"\'.r ░░░ $$$$ ░░▓▓▓ $$$$ $$$$ O░ $$$$ $$$$ `"²$ $$$$0 ░░░ $.', ' .a$ ░░░ 0└$$7, ▀▀▀ $$$$ $$$$ 1▓▓░ $$$$ $$$$ └$$7, ░▓▓▄ $ $$$$1 ░░░ "$', '.e$$²² ░░░░1 $$$: \\s$$$$$$ $$$$ ▀▀ $$$$ $$$$ $$$: ▀▀ $ $$$$ ░░░ ss', '$$4. `"└└└=-- `$$$$ $$$$ .a$e"\' e"$$$w\' `"└└└=s// $$$$ ░░░ r."²²`', '`²$$$$$$$$$$sp. $$$$ ░ `²$$sP²²²²" `` "$ $$$$ ░░░ $a.', ' ²²²$$$$ ░░░░░░░ "└$$ ░░ ░░ ░░░░░░░ `"└$$ ²²$$e.', ' 1$$$$ ░░░░░░░░ "$ ░░░░░░ ░░░░░░░░░░░░ `$ .4$$', ' 0$$$$ ░░░░░░ e\' ░░░░ $$$$²² \'e ░░░░ " .ps$$$$$$$$$$²`', " ░ 1$$$$ ░░░░░░░ $$o.. ░░░░ $$$$ ..o$$ ░░░░ '7$$$$$$ $$$$²²²", ' $$$$ `²$$$$$ ░░ $$$$ $$$$$²` $$$$ ░░ $$$$', ' \'7$$$$$$$$e7²²²²²$7Pe. "$$$$ $$$$ ²²²$$$$e7²²²²²$7Pe. $$$$e ▄▓░ $$$$1░░░', ' $$$$ 1²$$$ $$$$ ""$ $$$$ $$$$ ²$$$ $$$$B$┐▀▀ $$$$0░░░', ' ░ $$$$ ░░░░░0 $$$$ $$$$ ░░ $ $$$$ ░ $$$$ ░░░░░ $$$$ $$$$ "$$ $$$$1░░', ' $$$$ ▀▓▓▓1 $$$$ $$$$ ▓▓░ $ $$$$ ▓░ $$$$ ░▓▓▄ ,7$$┘ $$$$ "$$e.$$$$', " \\ '7$$$$$$╗ 0.$$$$ $$$$ ▀▀ $$ $$$$ ▀ $$$$ ▀▀ :$$$ $$$$ ░ ╚$$$$$$7' //", ' $$$$ "$$. $$$" $$$$ .$$P $$$$ 1 $$$$ --=┘┘┘"` $$$$ $$$$$', ' $$$$ $$$$$$$" $$$$s$$╝ $$$$ 0 $$$$` "²²$ $$$$sss// "$$$', ' $$┘" "²²" $P╝" "e$$ 1²²$$$$ "$$$ $$┘"` $$', ' $" ` ┌─────────"───── -- - "$ ── "╚$$ ───--- ²²² ── $" ------··· `" 5m', ' : " "$', " o '"]
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
if mask.nick == 'd':
self.context.privmsg('#b0ts3x','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)