From 792cd6409005eafd677f5091d445cdc268d472b0 Mon Sep 17 00:00:00 2001 From: decoded Date: Sun, 28 Aug 2022 08:12:07 -0500 Subject: [PATCH] 2.666-4 --- .../plugins/net_hydra_plugin.py | 12 ++-- hydra_core__standalone/run.sh | 5 ++ hydra_core__standalone/stop.sh | 1 + .../plugins/net_hydra_plugin.py | 8 +-- hydra_dupe__devops/run.sh | 5 ++ hydra_dupe__devops/stop.sh | 1 + .../plugins/net_hydra_plugin.py | 65 +++++++++++-------- hydra_dupe__services/run.sh | 5 ++ hydra_dupe__services/stop.sh | 1 + 9 files changed, 68 insertions(+), 35 deletions(-) create mode 100644 hydra_core__standalone/run.sh create mode 100644 hydra_core__standalone/stop.sh create mode 100644 hydra_dupe__devops/run.sh create mode 100644 hydra_dupe__devops/stop.sh create mode 100644 hydra_dupe__services/run.sh create mode 100644 hydra_dupe__services/stop.sh diff --git a/hydra_core__standalone/plugins/net_hydra_plugin.py b/hydra_core__standalone/plugins/net_hydra_plugin.py index 1c432db..e186735 100644 --- a/hydra_core__standalone/plugins/net_hydra_plugin.py +++ b/hydra_core__standalone/plugins/net_hydra_plugin.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- ############################################################### SOF -import irc3, os from irc3.plugins.command import command from irc3.plugins.cron import cron from irc3.plugins import core +import irc3 +import os from random import randint as rint from random import shuffle from datetime import datetime @@ -36,6 +37,9 @@ class Plugin: dr1p.token=self.hydra_id(0) ####################################################################################### def hydra_id(self,mode=1): + # from datetime import datetime + # from random import randint as rint + # from random import shuffle hydra="" for i in range(7): hydra+=hex(rint(0,255))[2:].zfill(2).upper() hydra+=hex(int(datetime.now().timestamp()))[-4:].upper() @@ -145,10 +149,10 @@ class Plugin: self.bot.part(target,reason) self.bot.privmsg("maple",f"parted {target} - {reason}".lower()) if dr1p.designation=="core": - msg=f"[maple:{dr1p.keyid}] - core - maple online - purpose: {dr1p.purpose}" + msg=f"[maple:{dr1p.keyid}] - core - maple online - test purpose: {dr1p.purpose}" self.bot.privmsg(dr1p.home,msg) else: - msg=f"[hydra:{dr1p.keyid}] - dupe - hydra online - purpose: {dr1p.purpose}" + msg=f"[hydra:{dr1p.keyid}] - dupe - hydra online - test purpose: {dr1p.purpose}" self.bot.privmsg(dr1p.home,msg) if kw['event']=='PART': if dr1p.designation=="core": @@ -162,4 +166,4 @@ class Plugin: else: msg=f"[hydra:{dr1p.keyid}] -" self.bot.privmsg("maple",msg+f"quit {target} - {data}") -####################################################################################### EOF +####################################################################################### EOF \ No newline at end of file diff --git a/hydra_core__standalone/run.sh b/hydra_core__standalone/run.sh new file mode 100644 index 0000000..3101487 --- /dev/null +++ b/hydra_core__standalone/run.sh @@ -0,0 +1,5 @@ +echo '[ running hydra_core__standalone ]' +source env/bin/activate +sh -c 'echo $$>hydra_core__standalone.pid; exec irc3 maple.ini' +echo '[ hydra_core__standalone bot finished ]' +deactivate diff --git a/hydra_core__standalone/stop.sh b/hydra_core__standalone/stop.sh new file mode 100644 index 0000000..6940e72 --- /dev/null +++ b/hydra_core__standalone/stop.sh @@ -0,0 +1 @@ +pid=`cat hydra_core__standalone.pid` && kill -9 $pid diff --git a/hydra_dupe__devops/plugins/net_hydra_plugin.py b/hydra_dupe__devops/plugins/net_hydra_plugin.py index d79fb2d..e186735 100644 --- a/hydra_dupe__devops/plugins/net_hydra_plugin.py +++ b/hydra_dupe__devops/plugins/net_hydra_plugin.py @@ -33,8 +33,8 @@ class Plugin: dr1p.enforcing=False return if dr1p.designation=="core": dr1p.color="\x0304" - dr1p.keyid=hydra_id(1) - dr1p.token=hydra_id(0) + dr1p.keyid=self.hydra_id(1) + dr1p.token=self.hydra_id(0) ####################################################################################### def hydra_id(self,mode=1): # from datetime import datetime @@ -149,10 +149,10 @@ class Plugin: self.bot.part(target,reason) self.bot.privmsg("maple",f"parted {target} - {reason}".lower()) if dr1p.designation=="core": - msg=f"[maple:{dr1p.keyid}] - core - maple online - purpose: {dr1p.purpose}" + msg=f"[maple:{dr1p.keyid}] - core - maple online - test purpose: {dr1p.purpose}" self.bot.privmsg(dr1p.home,msg) else: - msg=f"[hydra:{dr1p.keyid}] - dupe - hydra online - purpose: {dr1p.purpose}" + msg=f"[hydra:{dr1p.keyid}] - dupe - hydra online - test purpose: {dr1p.purpose}" self.bot.privmsg(dr1p.home,msg) if kw['event']=='PART': if dr1p.designation=="core": diff --git a/hydra_dupe__devops/run.sh b/hydra_dupe__devops/run.sh new file mode 100644 index 0000000..4407a63 --- /dev/null +++ b/hydra_dupe__devops/run.sh @@ -0,0 +1,5 @@ +echo '[ running hydra_dupe__devops ]' +source env/bin/activate +sh -c 'echo $$>hydra_dupe__devops.pid; exec python3 bot_maple.py' +echo '[ hydra_dupe__devops bot finished ]' +deactivate diff --git a/hydra_dupe__devops/stop.sh b/hydra_dupe__devops/stop.sh new file mode 100644 index 0000000..43b1c54 --- /dev/null +++ b/hydra_dupe__devops/stop.sh @@ -0,0 +1 @@ +pid=`cat hydra_dupe__devops.pid` && kill -9 $pid diff --git a/hydra_dupe__services/plugins/net_hydra_plugin.py b/hydra_dupe__services/plugins/net_hydra_plugin.py index d1efbff..e186735 100644 --- a/hydra_dupe__services/plugins/net_hydra_plugin.py +++ b/hydra_dupe__services/plugins/net_hydra_plugin.py @@ -14,6 +14,7 @@ class dr1p: dr1p.enforcing=False dr1p.purpose="" dr1p.color="" + dr1p.keyid="" dr1p.token="" dr1p.home="" ########################################################################################### @@ -22,8 +23,6 @@ class Plugin: ####################################################################################### def __init__(self,bot): self.bot=bot - token="" - dr1p.color="" try: dr1p.purpose=os.environ['HYDRA_PURPOSE'] dr1p.designation=os.environ['HYDRA_DESIGNATION'] @@ -34,15 +33,27 @@ class Plugin: dr1p.enforcing=False return if dr1p.designation=="core": dr1p.color="\x0304" - for i in range(7): token+=hex(rint(0,255))[2:].zfill(2).upper() - token+=hex(int(datetime.now().timestamp()))[-4:].upper() - token=list(token) - shuffle(token) - dr1p.token=''.join(token) + dr1p.keyid=self.hydra_id(1) + dr1p.token=self.hydra_id(0) + ####################################################################################### + def hydra_id(self,mode=1): + # from datetime import datetime + # from random import randint as rint + # from random import shuffle + hydra="" + for i in range(7): hydra+=hex(rint(0,255))[2:].zfill(2).upper() + hydra+=hex(int(datetime.now().timestamp()))[-4:].upper() + hydra=list(hydra) + shuffle(hydra) + if mode: + hydra=''.join(hydra) + else: + hydra=''.join(hydra)[6:14] + return hydra ####################################################################################### def server_ready(self): if not dr1p.designation=='core': - self.bot.privmsg("maple",f"[hydra:{dr1p.token}] - dupe - connected") + self.bot.privmsg("maple",f"[hydra:{dr1p.keyid}] - dupe - connected") else: self.bot.privmsg("maple",f"core - connected") ####################################################################################### @@ -89,28 +100,28 @@ class Plugin: if target!=self.bot.config['nick'] and mask.nick==self.bot.nick: return if mask.nick==self.bot.nick and target==self.bot.config['nick'] and dr1p.designation=='core': if data.endswith('dupe - connected'): - _token=data.split("[hydra:")[1].split("]")[0] - _nekot=_token[::-1] - msg=f'[TOKEN:{_token}] - [NEKOT:{_nekot}] - COLOR:{rint(16,87)}' + _keyid=data.split("[hydra:")[1].split("]")[0] + _diyek=_keyid[::-1] + msg=f'[KEYID:{_keyid}] - [DIYEK:{_diyek}] - COLOR:{rint(16,87)}' self.bot.privmsg(self.bot.config['nick'],msg) if mask.nick==self.bot.nick and target==self.bot.config['nick'] and dr1p.designation=='dupe': - if not data.find('NEKOT')==-1: - _token=data.split(":")[1].split("]")[0] - if _token.lower()==dr1p.token.lower(): - if not data.find("] - [NEKOT:")==-1: - _nekot=data.split("] - [NEKOT:")[1].split("]")[0] - if _token.lower()==_nekot[::-1].lower(): + if not data.find('DIYEK')==-1: + _keyid=data.split(":")[1].split("]")[0] + if _keyid.lower()==dr1p.keyid.lower(): + if not data.find("] - [DIYEK:")==-1: + _diyek=data.split("] - [DIYEK:")[1].split("]")[0] + if _keyid.lower()==_diyek[::-1].lower(): _color=int(data.split(" - COLOR:")[1].strip()) if not dr1p.color: dr1p.color=f"\x03{str(_color)}" if dr1p.designation=='core': - msg=f"{dr1p.color}[maple:{dr1p.token}] - " + msg=f"{dr1p.color}[maple:{dr1p.keyid}] - " else: try: - msg=f"{dr1p.color}[hydra:{dr1p.token}] - " + msg=f"{dr1p.color}[hydra:{dr1p.keyid}] - " except: dr1p.color="\x0303" - msg=f"{dr1p.color}[hydra:{dr1p.token}] - " + msg=f"{dr1p.color}[hydra:{dr1p.keyid}] - " if mask.nick!=self.bot.config['nick']: if target!=dr1p.home: return if target==dr1p.home: return @@ -138,21 +149,21 @@ class Plugin: self.bot.part(target,reason) self.bot.privmsg("maple",f"parted {target} - {reason}".lower()) if dr1p.designation=="core": - msg=f"[maple:{dr1p.token}] - core - maple online - purpose: {dr1p.purpose}" + msg=f"[maple:{dr1p.keyid}] - core - maple online - test purpose: {dr1p.purpose}" self.bot.privmsg(dr1p.home,msg) else: - msg=f"[hydra:{dr1p.token}] - dupe - hydra online - purpose: {dr1p.purpose}" + msg=f"[hydra:{dr1p.keyid}] - dupe - hydra online - test purpose: {dr1p.purpose}" self.bot.privmsg(dr1p.home,msg) if kw['event']=='PART': if dr1p.designation=="core": - msg=f"[maple:{dr1p.token}] -" + msg=f"[maple:{dr1p.keyid}] -" else: - msg=f"[hydra:{dr1p.token}] -" + msg=f"[hydra:{dr1p.keyid}] -" self.bot.privmsg("maple",msg+f"parted {target} - {data}") if kw['event']=='QUIT': if dr1p.designation=="core": - msg=f"[maple:{dr1p.token}] -" + msg=f"[maple:{dr1p.keyid}] -" else: - msg=f"[hydra:{dr1p.token}] -" + msg=f"[hydra:{dr1p.keyid}] -" self.bot.privmsg("maple",msg+f"quit {target} - {data}") -####################################################################################### EOF +####################################################################################### EOF \ No newline at end of file diff --git a/hydra_dupe__services/run.sh b/hydra_dupe__services/run.sh new file mode 100644 index 0000000..b4b4b58 --- /dev/null +++ b/hydra_dupe__services/run.sh @@ -0,0 +1,5 @@ +echo '[ running hydra_dupe__services ]' +source env/bin/activate +sh -c 'echo $$>hydra_dupe__services.pid; exec python3 bot_maple.py' +echo '[ hydra_dupe__services bot finished ]' +deactivate diff --git a/hydra_dupe__services/stop.sh b/hydra_dupe__services/stop.sh new file mode 100644 index 0000000..e5cc5f2 --- /dev/null +++ b/hydra_dupe__services/stop.sh @@ -0,0 +1 @@ +pid=`cat hydra_dupe__services.pid` && kill -9 "$pid"