2.fh.txt 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. # -*- coding: utf-8 -*-
  2. from irc3.plugins.command import command
  3. import irc3
  4. import os
  5. import sys
  6. import random
  7. import ipdb
  8. from random import randint
  9. from re import compile
  10. from irc3 import rfc
  11. dir_path = os.path.dirname(os.path.realpath(__file__))
  12. KRYPTR = []
  13. BOTNAMES = []
  14. BOTNICKS = []
  15. TOTAL_BOTS = 0
  16. READY_BOTS = []
  17. LOCK_KRYLON = 1 # 1
  18. INTERRUPTED = 0
  19. class KRYLON():
  20. def __init__(self,bot,channel):
  21. self.bot = bot
  22. self.channel = channel
  23. self.KRYLON_FILE = ['░█████╗░███╗░░██╗██╗░░░░░██╗███╗░░██╗███████╗', '██╔══██╗████╗░██║██║░░░░░██║████╗░██║██╔════╝', '██║░░██║██╔██╗██║██║░░░░░██║██╔██╗██║█████╗░░', '██║░░██║██║╚████║██║░░░░░██║██║╚████║██╔══╝░░', '╚█████╔╝██║░╚███║███████╗██║██║░╚███║███████╗', '░╚════╝░╚═╝░░╚══╝╚══════╝╚═╝╚═╝░░╚══╝╚══════╝', 'mcjonestown frickhole jonestown', 'mcjonestown frickhole jonestown', 'mcjonestown frickhole jonestown', 'mcjonestown frickhole jonestown', 'jones are jones and jones our sound', 'hole does fuck and jones in town', 'yeah im d and when i re i re as fuck re tard', 't c p direct for re and we as fuck re tard', 'mcchopchopchopchopchopchopchopchopchopchopchopchopjones', 'mcchopchopchopchopchopchopchopchopchopchopchopchoptown', 't c p direct for re and we as fuck re tard', 'yeah im d and when i re i re as fuck re tard', 'mcchopchopchopchopchopchopchopchopchopchopchopchopjones', 'mcchopchopchopchopchopchopchopchopchopchopchopchoptown', 'jones are jones and jones our sound', 'hole does fuck and jones in town', 'mcjonestown frickhole jonestown', 'mcjonestown frickhole jonestown', 'mcjonestown frickhole jonestown', 'mcjonestown frickhole jonestown', 'faded', 'hol up', 'we dem bois', 'hol up', 'we dem bois', 'hol up hol up hol up', "hoed up like like a farmer plow'n field", 'i knighted so hard queen riding my shield', 'simp-gimp- talking like a pimp.', 'jones- town- fucking pay your rent', 'tent- spent- gonzo dick be bent.', 'jones- town- trilln fuck the fent', '░█████╗░███╗░░██╗██╗░░░░░██╗███╗░░██╗███████╗', '██╔══██╗████╗░██║██║░░░░░██║████╗░██║██╔════╝', '██║░░██║██╔██╗██║██║░░░░░██║██╔██╗██║█████╗░░', '██║░░██║██║╚████║██║░░░░░██║██║╚████║██╔══╝░░', '╚█████╔╝██║░╚███║███████╗██║██║░╚███║███████╗', '░╚════╝░╚═╝░░╚══╝╚══════╝╚═╝╚═╝░░╚══╝╚══════╝']
  24. self.__run__()
  25. def __run__(self):
  26. self.KRYLON_FILE.reverse()
  27. self.FILE_BUFFER=[]
  28. for _ in self.KRYLON_FILE:
  29. self.FILE_BUFFER.append(_)
  30. self.FILE_LINES = len(self.KRYLON_FILE)
  31. self.INIT = 0
  32. self.STARTED = 0
  33. self.FINISHED = 0
  34. self.FILE_INDEX = 0
  35. # BITWISE FILE LOCK SET
  36. self.KRYLON_FILE_LOCK = []
  37. for _ in range(len(self.KRYLON_FILE)):
  38. self.KRYLON_FILE_LOCK.append(1)
  39. # BITWISE R/W BOT LOCK SET
  40. self.BOTS_MODE_LOCK = []
  41. for _ in range(len(READY_BOTS)):
  42. self.BOTS_MODE_LOCK.append(zip('1','1'))
  43. # BITWISE R/W BOT LOCK UNSET
  44. R=[]; W=[]; _X=-1; _Y=-1;
  45. for _ in range(len(READY_BOTS)):
  46. _X,_Y=list(self.BOTS_MODE_LOCK[_])[0]
  47. R.append(int(_X))
  48. W.append(int(_Y))
  49. self.BOTS_MODE_READ=R
  50. self.BOTS_MODE_WRIT=W
  51. @irc3.plugin
  52. class Plugin(object):
  53. def __init__(self, context):
  54. self.log = context.log
  55. self.context = context
  56. self.channel = context.config.channel
  57. self._ST8 = 0
  58. def __emoj(self,s):
  59. emote_db = '%s/emote.db' % dir_path
  60. emoj = random.choice(list(open(emote_db)))
  61. random.randint(0,1)
  62. if random.randint(0,1) == 0:
  63. emoj = "\x0304{}\x0F".format(emoj)
  64. else:
  65. emoj = "\x0303{}\x0F".format(emoj)
  66. s = s + ' ▶ ' + emoj
  67. return s
  68. def __greet(self):
  69. greet_db = '%s/greet.db' % dir_path
  70. greet = random.choice(list(open(greet_db)))
  71. return greet
  72. def __symbol(self):
  73. symbol_db = '%s/symbol.db' % dir_path
  74. symbol = random.choice(list(open(symbol_db)))
  75. return symbol
  76. def rotate(self):
  77. self.b1n+=1
  78. if self.b1n == len(BOTNICKS):
  79. self.b1n=0
  80. ipdb.set_trace()
  81. def spraying(self, mask, channel, **kw):
  82. PTR = KRYPTR[0]
  83. PTR.kbr = []; PTR.kbw = []; PTR.kbl = [];
  84. PTR.chn = channel
  85. for index in range(len(PTR.BOTS_MODE_READ)):
  86. PTR.kbr.append(PTR.BOTS_MODE_READ[index])
  87. PTR.kbw.append(PTR.BOTS_MODE_WRIT[index])
  88. PTR.kbl.append(PTR.KRYLON_FILE_LOCK[index])
  89. PTR.fbu = PTR.FILE_BUFFER
  90. PTR.fli = PTR.FILE_LINES
  91. PTR.fin = PTR.FILE_INDEX
  92. BOTNAMES=','.join(self.context.config.botnet.keys()).split(',')
  93. PTR.bna = BOTNAMES
  94. BOTNICKS=[]
  95. for _ in BOTNAMES:
  96. BOTNICKS.append(self.context.config.botnet[_].nick)
  97. PTR.bni = BOTNICKS
  98. PTR.b1n = BOTNICKS.index(self.context.nick)
  99. PTR.int = 0
  100. if PTR.INIT == 0:
  101. PTR._ST8 = 0
  102. PTR.INIT = 1
  103. print('<<<<<<> JUST INIT <>>>>>>') # test if initialized for first pass, fails on purpose
  104. PTR.STARTED = 1
  105. PTR.FINISHED = 0
  106. PTR.exe = 1 # set to recognize execution
  107. PTR.cyc = 0 # how many cycles within this operation, e.g. amount of bots pass through this function
  108. PTR.ops = 0 # how many completed operations, cycles reset, ops continue to count
  109. #ipdb.set_trace()
  110. for y in range(len(PTR.bni)):
  111. if not y == PTR.b1n:
  112. PTR.kbr[y] = 0
  113. else:
  114. PTR.kbw[y] = 1
  115. PTR.who = self.context.nick
  116. MSG=PTR.fbu.pop()
  117. PTR.what = MSG
  118. PTR.fin+=1
  119. NEWBOT=','.join(list(self.context.config.botnet.keys())).split(',')[PTR.b1n]
  120. print(PTR.bni)
  121. print(PTR.bna)
  122. print(PTR.b1n)
  123. print(PTR.bni[PTR.b1n])
  124. print(PTR.bna[PTR.b1n])
  125. print("WHO:{} NEWBOT:{}".format(PTR.who,NEWBOT))
  126. self.context.privmsg(PTR.chn,MSG)
  127. if PTR._ST8 <= 5 and PTR.int == 1:
  128. INTERRUPTED = 0
  129. PTR.int = INTERRUPTED
  130. PTR._ST8 = 3
  131. @irc3.event(irc3.rfc.JOIN)
  132. def welcome(self, mask, channel, **kw):
  133. if LOCK_KRYLON == 1:
  134. B0T = self.context
  135. B0TNAMES=','.join(self.context.config.botnet.keys()).split(',')
  136. B0TN1CKS=[]
  137. for _ in B0TNAMES:
  138. B0TN1CKS.append(self.context.config.botnet[_].nick)
  139. for i,B0T.nick in enumerate(B0TN1CKS):
  140. if B0TN1CKS[i] == B0T.nick:
  141. NFLAG=1
  142. for _ in READY_BOTS:
  143. if B0T.nick == _:
  144. NFLAG=0
  145. if NFLAG==1:
  146. READY_BOTS.append(self.context.nick)
  147. BOTCNT = len(self.context.config.botnet)
  148. if len(READY_BOTS) == BOTCNT:
  149. BOTNICKS=B0TN1CKS
  150. BOTNAMES=B0TNAMES
  151. TOTAL_BOTS = BOTCNT;
  152. BOT=self.context
  153. CHN=channel
  154. k=KRYLON(BOT,CHN)
  155. KRYPTR.append(k)
  156. self.spraying(mask,channel,**kw)
  157. @irc3.event(irc3.rfc.CONNECTED)
  158. def connected(self, **kw):
  159. if LOCK_KRYLON == 1:
  160. self.context.join(self.channel)
  161. @irc3.event(rfc.PRIVMSG, iotype="out")
  162. def krylon_event(bot, mask=None, event=None, target=None, data=None):
  163. NICK=bot.context.nick
  164. CHANNEL=bot.channel
  165. MSG="CHANNEL: {} event out: {}".format(CHANNEL,NICK)
  166. print(MSG)
  167. # ipdb.set_trace()
  168. PTR = KRYPTR[0]
  169. B0T=bot.context
  170. B1N = PTR.bni.index(B0T.nick)
  171. print("OUTPUT:{}".format(bot.context.nick))
  172. @irc3.event(irc3.rfc.PRIVMSG, iotype="in")
  173. def on_privmsg(self, mask=None, data=None, **kw):
  174. # B0T=self.context
  175. # print(data)
  176. bot = self
  177. NICK=bot.context.nick
  178. CHANNEL=bot.channel
  179. MSG="CHANNEL: {} event out: {}".format(CHANNEL,NICK)
  180. print(MSG)
  181. # ipdb.set_trace()
  182. PTR = KRYPTR[0]
  183. B0T=bot.context
  184. B1N = PTR.bni.index(B0T.nick)
  185. print("INPUT:{}".format(bot.context.nick))
  186. WTF=0
  187. if mask.nick == 'd':
  188. self.context.privmsg('#b0ts3x','dont interrupt me mofo')
  189. PTR.int = 1
  190. PTR.FILE_BUFFER=[]
  191. for _ in PTR.KRYLON_FILE:
  192. PTR.FILE_BUFFER.append(_)
  193. PTR.fbu = PTR.FILE_BUFFER
  194. PTR.INIT = 0
  195. PTR.fin=0
  196. PTR.b1n=0
  197. PTR.FINISHED = 0
  198. self.spraying(mask,channel,**kw)
  199. return
  200. if PTR.who == mask.nick and PTR.STARTED == 1 and PTR.FINISHED == 0 and PTR.what == data and PTR.fin < PTR.fli:
  201. PTR.fin+=1
  202. PTR.b1n+=1
  203. if PTR.b1n == len(PTR.bni):
  204. PTR.b1n=0
  205. PTR.who = PTR.bni[PTR.b1n]
  206. MSG=PTR.fbu.pop()
  207. PTR.what = MSG
  208. NEWBOT=','.join(list(bot.context.config.botnet.keys())).split(',')[PTR.b1n]
  209. print(NEWBOT)
  210. bot.context.config.botnet[NEWBOT].privmsg(CHANNEL,MSG)
  211. if PTR.fin == PTR.fli:
  212. sys.exit(0)