update
This commit is contained in:
parent
23c3069eb5
commit
399d23d6cc
0
storage/bot/databases/maple_db.sqlite
Normal file
0
storage/bot/databases/maple_db.sqlite
Normal file
66
storage/bot/plugins/auth_nickserv_plugin.py
Normal file
66
storage/bot/plugins/auth_nickserv_plugin.py
Normal file
@ -0,0 +1,66 @@
|
||||
# -*- coding: utf-8 -*- ############################################################### SOF
|
||||
###########################################################################################
|
||||
|
||||
???AUTHNICKSERV???
|
||||
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
|
||||
#########################
|
||||
if SERVICES_AUTHNICKSERV:
|
||||
#########################
|
||||
|
||||
from irc3.plugins.cron import cron
|
||||
import irc3, os, sys
|
||||
from plugins.tool_colors_plugin import colorform as print
|
||||
|
||||
###################################################################################
|
||||
###################################################################################
|
||||
|
||||
def getenv(s):
|
||||
try:
|
||||
s = os.environ[s]
|
||||
return s
|
||||
except:
|
||||
error_type="environmental variable error"
|
||||
error_reason=f"exported {s} not found"
|
||||
print(f"{error_type}: {error_reason}")
|
||||
sys.exit(1)
|
||||
|
||||
###########################################################################
|
||||
###########################################################################
|
||||
|
||||
NICKSERV_USERNAME=getenv('NICKSERV_USERNAME')
|
||||
NICKSERV_PASSWORD=getenv('NICKSERV_PASSWORD')
|
||||
|
||||
###########################################################################
|
||||
###########################################################################
|
||||
|
||||
@irc3.plugin
|
||||
class Plugin:
|
||||
|
||||
###########################################################################
|
||||
###########################################################################
|
||||
|
||||
def __init__(self,bot):
|
||||
self.bot=bot
|
||||
|
||||
###########################################################################
|
||||
###########################################################################
|
||||
|
||||
@irc3.event(irc3.rfc.CONNECTED)
|
||||
def connected(self, **kw):
|
||||
MSG=f"identify {NICKSERV_USERNAME} {NICKSERV_PASSWORD}"
|
||||
self.bot.privmsg('NICKSERV',MSG)
|
||||
|
||||
###################################################################################
|
||||
###################################################################################
|
||||
|
||||
@cron('*/1 * * * *')
|
||||
def cron_auth(bot):
|
||||
if not bot.nick==bot.original_nick:
|
||||
MSG=f"identify {NICKSERV_USERNAME} {NICKSERV_PASSWORD}"
|
||||
bot.privmsg('NICKSERV',MSG)
|
||||
|
||||
###########################################################################################
|
||||
####################################################################################### EOF
|
@ -1,57 +0,0 @@
|
||||
# -*- coding: utf-8 -*- ############################################################### SOF
|
||||
###########################################################################################
|
||||
|
||||
from irc3.plugins.cron import cron
|
||||
import irc3, os, sys
|
||||
from plugins.tool_colors_plugin import colorform as print
|
||||
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
|
||||
def getenv(s):
|
||||
try:
|
||||
s = os.environ[s]
|
||||
return s
|
||||
except:
|
||||
error_type="environmental variable error"
|
||||
error_reason=f"exported {s} not found"
|
||||
print(f"{error_type}: {error_reason}")
|
||||
sys.exit(1)
|
||||
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
|
||||
NICKSERV_USERNAME=getenv('NICKSERV_USERNAME')
|
||||
NICKSERV_PASSWORD=getenv('NICKSERV_PASSWORD')
|
||||
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
|
||||
@irc3.plugin
|
||||
class Plugin:
|
||||
|
||||
#######################################################################################
|
||||
#######################################################################################
|
||||
|
||||
def __init__(self,bot):
|
||||
self.bot=bot
|
||||
|
||||
#######################################################################################
|
||||
#######################################################################################
|
||||
|
||||
@irc3.event(irc3.rfc.CONNECTED)
|
||||
def connected(self, **kw):
|
||||
MSG=f"identify {NICKSERV_USERNAME} {NICKSERV_PASSWORD}"
|
||||
self.bot.privmsg('NICKSERV',MSG)
|
||||
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
|
||||
@cron('*/1 * * * *')
|
||||
def cron_auth(bot):
|
||||
if not bot.nick==bot.original_nick:
|
||||
MSG=f"identify {NICKSERV_USERNAME} {NICKSERV_PASSWORD}"
|
||||
bot.privmsg('NICKSERV',MSG)
|
||||
|
||||
###########################################################################################
|
||||
####################################################################################### EOF
|
117
storage/bot/plugins/auth_sasl_plugin.py
Normal file
117
storage/bot/plugins/auth_sasl_plugin.py
Normal file
@ -0,0 +1,117 @@
|
||||
# -*- coding: utf-8 -*- ############################################################### SOF
|
||||
###########################################################################################
|
||||
|
||||
???AUTHSASL???
|
||||
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
|
||||
#####################
|
||||
if SERVICES_AUTHSASL:
|
||||
#####################
|
||||
|
||||
import irc3,os,sys,base64
|
||||
from plugins.tool_colors_plugin import colorform as print
|
||||
|
||||
#######################################################################################
|
||||
#######################################################################################
|
||||
|
||||
def getenv(s):
|
||||
try:
|
||||
s = os.environ[s]
|
||||
return s
|
||||
except:
|
||||
error_type="environmental variable error"
|
||||
error_reason=f"exported {s} not found"
|
||||
print(f"{error_type}: {error_reason}")
|
||||
sys.exit(1)
|
||||
|
||||
#######################################################################################
|
||||
#######################################################################################
|
||||
|
||||
BOT_SASL_USERNAME=getenv('BOT_SASL_USERNAME')
|
||||
BOT_SASL_PASSWORD=getenv('BOT_SASL_PASSWORD')
|
||||
|
||||
#######################################################################################
|
||||
#######################################################################################
|
||||
|
||||
@irc3.plugin
|
||||
class DR1PSASL:
|
||||
|
||||
###################################################################################
|
||||
###################################################################################
|
||||
|
||||
def __init__(self, bot):
|
||||
print('<<< _sasl_custom_plugin >>> [ custom sasl initiated ]')
|
||||
self.bot=bot
|
||||
self.auth=(f'{BOT_SASL_USERNAME}\0{BOT_SASL_USERNAME}\0{BOT_SASL_PASSWORD}')
|
||||
self.auth=base64.encodebytes(self.auth.encode('utf8'))
|
||||
self.auth=self.auth.decode('utf8').rstrip('\n')
|
||||
self.events = [
|
||||
irc3.event(r'^:\S+ CAP \S+ LS :(?P<data>.*)', self.cap_ls),
|
||||
irc3.event(r'^:\S+ CAP \S+ ACK sasl', self.cap_ack),
|
||||
irc3.event(r'AUTHENTICATE +', self.authenticate),
|
||||
irc3.event(r'^:\S+ 903 \S+ :Authentication successful',self.cap_end),
|
||||
]
|
||||
|
||||
###################################################################################
|
||||
###################################################################################
|
||||
|
||||
@classmethod
|
||||
def reload(cls, old):
|
||||
return cls(old.bot)
|
||||
|
||||
###################################################################################
|
||||
###################################################################################
|
||||
|
||||
def before_reload(self):
|
||||
pass
|
||||
|
||||
###################################################################################
|
||||
###################################################################################
|
||||
|
||||
def after_reload(self):
|
||||
pass
|
||||
|
||||
###################################################################################
|
||||
###################################################################################
|
||||
|
||||
def connection_ready(self, *args, **kwargs):
|
||||
print('<<< _sasl_custom_plugin >>> [ CAP LS ]')
|
||||
self.bot.send('CAP LS\r\n')
|
||||
self.bot.attach_events(*self.events)
|
||||
|
||||
###################################################################################
|
||||
###################################################################################
|
||||
|
||||
def cap_ls(self, data=None, **kwargs):
|
||||
print('<<< _sasl_custom_plugin >>> [ CAP REQ :sasl ]')
|
||||
if 'sasl' in data.lower():
|
||||
self.bot.send_line('CAP REQ :sasl')
|
||||
else:
|
||||
self.cap_end()
|
||||
|
||||
###################################################################################
|
||||
###################################################################################
|
||||
|
||||
def cap_ack(self, **kwargs):
|
||||
print('<<< _sasl_custom_plugin >>> [ AUTHENTICATE PLAIN ]')
|
||||
self.bot.send_line('AUTHENTICATE PLAIN')
|
||||
|
||||
###################################################################################
|
||||
###################################################################################
|
||||
|
||||
def authenticate(self, **kwargs):
|
||||
print(f'<<< _sasl_custom_plugin >>> [ AUTHENTICATE <CENSORED> ]')
|
||||
self.bot.send_line(f'AUTHENTICATE {self.auth}\n')
|
||||
|
||||
###################################################################################
|
||||
###################################################################################
|
||||
|
||||
def cap_end(self, **kwargs):
|
||||
print('<<< _sasl_custom_plugin >>> [ CAP END ]')
|
||||
self.bot.send_line('CAP END\r\n')
|
||||
self.bot.detach_events(*self.events)
|
||||
|
||||
###########################################################################################
|
||||
####################################################################################### EOF
|
@ -1,108 +0,0 @@
|
||||
# -*- coding: utf-8 -*- ############################################################### SOF
|
||||
###########################################################################################
|
||||
|
||||
import irc3,os,sys,base64
|
||||
from plugins.tool_colors_plugin import colorform as print
|
||||
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
|
||||
def getenv(s):
|
||||
try:
|
||||
s = os.environ[s]
|
||||
return s
|
||||
except:
|
||||
error_type="environmental variable error"
|
||||
error_reason=f"exported {s} not found"
|
||||
print(f"{error_type}: {error_reason}")
|
||||
sys.exit(1)
|
||||
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
|
||||
BOT_SASL_USERNAME=getenv('BOT_SASL_USERNAME')
|
||||
BOT_SASL_PASSWORD=getenv('BOT_SASL_PASSWORD')
|
||||
|
||||
###########################################################################################
|
||||
###########################################################################################
|
||||
|
||||
@irc3.plugin
|
||||
class DR1PSASL:
|
||||
|
||||
#######################################################################################
|
||||
#######################################################################################
|
||||
|
||||
def __init__(self, bot):
|
||||
print('<<< _sasl_custom_plugin >>> [ custom sasl initiated ]')
|
||||
self.bot=bot
|
||||
self.auth=(f'{BOT_SASL_USERNAME}\0{BOT_SASL_USERNAME}\0{BOT_SASL_PASSWORD}')
|
||||
self.auth=base64.encodebytes(self.auth.encode('utf8'))
|
||||
self.auth=self.auth.decode('utf8').rstrip('\n')
|
||||
self.events = [
|
||||
irc3.event(r'^:\S+ CAP \S+ LS :(?P<data>.*)', self.cap_ls),
|
||||
irc3.event(r'^:\S+ CAP \S+ ACK sasl', self.cap_ack),
|
||||
irc3.event(r'AUTHENTICATE +', self.authenticate),
|
||||
irc3.event(r'^:\S+ 903 \S+ :Authentication successful',self.cap_end),
|
||||
]
|
||||
|
||||
#######################################################################################
|
||||
#######################################################################################
|
||||
|
||||
@classmethod
|
||||
def reload(cls, old):
|
||||
return cls(old.bot)
|
||||
|
||||
#######################################################################################
|
||||
#######################################################################################
|
||||
|
||||
def before_reload(self):
|
||||
pass
|
||||
|
||||
#######################################################################################
|
||||
#######################################################################################
|
||||
|
||||
def after_reload(self):
|
||||
pass
|
||||
|
||||
#######################################################################################
|
||||
#######################################################################################
|
||||
|
||||
def connection_ready(self, *args, **kwargs):
|
||||
print('<<< _sasl_custom_plugin >>> [ CAP LS ]')
|
||||
self.bot.send('CAP LS\r\n')
|
||||
self.bot.attach_events(*self.events)
|
||||
|
||||
#######################################################################################
|
||||
#######################################################################################
|
||||
|
||||
def cap_ls(self, data=None, **kwargs):
|
||||
print('<<< _sasl_custom_plugin >>> [ CAP REQ :sasl ]')
|
||||
if 'sasl' in data.lower():
|
||||
self.bot.send_line('CAP REQ :sasl')
|
||||
else:
|
||||
self.cap_end()
|
||||
|
||||
#######################################################################################
|
||||
#######################################################################################
|
||||
|
||||
def cap_ack(self, **kwargs):
|
||||
print('<<< _sasl_custom_plugin >>> [ AUTHENTICATE PLAIN ]')
|
||||
self.bot.send_line('AUTHENTICATE PLAIN')
|
||||
|
||||
#######################################################################################
|
||||
#######################################################################################
|
||||
|
||||
def authenticate(self, **kwargs):
|
||||
print(f'<<< _sasl_custom_plugin >>> [ AUTHENTICATE <CENSORED> ]')
|
||||
self.bot.send_line(f'AUTHENTICATE {self.auth}\n')
|
||||
|
||||
#######################################################################################
|
||||
#######################################################################################
|
||||
|
||||
def cap_end(self, **kwargs):
|
||||
print('<<< _sasl_custom_plugin >>> [ CAP END ]')
|
||||
self.bot.send_line('CAP END\r\n')
|
||||
self.bot.detach_events(*self.events)
|
||||
|
||||
###########################################################################################
|
||||
####################################################################################### EOF
|
@ -84,7 +84,10 @@ def colorform(data):
|
||||
msg+=f'{rgb(b=255)} - '
|
||||
msg+=f'{rgb(g=128,b=128,r=128)}{data}'
|
||||
else:
|
||||
caller=str(self).split(f'<{__name__}.')[1].split()[0]
|
||||
try:
|
||||
caller=str(self).split(f'<{__name__}.')[1].split()[0]
|
||||
except:
|
||||
caller=str(self).split(f'<{__name__}.')[0]
|
||||
if not self_name and the_caller=="<module>":
|
||||
if codeobj.co_filename==PATHFILENAME:
|
||||
msg+=f'{rgb(r=255)}[ {rgb(r=255,b=255)}{__name__}.{caller}.{the_function} {rgb(r=255)}]'
|
||||
|
1
storage/bot/status/status_id
Normal file
1
storage/bot/status/status_id
Normal file
@ -0,0 +1 @@
|
||||
default
|
@ -3,7 +3,8 @@
|
||||
irc3.plugins.command
|
||||
plugins.storage_plugin
|
||||
plugins.fifo_plugin
|
||||
plugins.sasl_custom_plugin
|
||||
plugins.auth_sasl_plugin
|
||||
plugins.auth_nickserv_plugin
|
||||
plugins.net_hydra_plugin
|
||||
plugins.tool_colors_plugin
|
||||
plugins.tool_log_plugin
|
||||
|
@ -9,7 +9,8 @@
|
||||
plugins.tool_dims_plugin
|
||||
plugins.tool_guds_plugin
|
||||
plugins.tool_bus_plugin
|
||||
plugins.sasl_custom_plugin
|
||||
plugins.auth_sasl_plugin
|
||||
plugins.auth_nickserv_plugin
|
||||
plugins.net_irc_plugin
|
||||
plugins.net_matrix_plugin
|
||||
plugins.net_discord_plugin
|
||||
|
@ -9,7 +9,8 @@
|
||||
plugins.tool_dims_plugin
|
||||
plugins.tool_guds_plugin
|
||||
plugins.tool_bus_plugin
|
||||
plugins.sasl_custom_plugin
|
||||
plugins.auth_sasl_plugin
|
||||
plugins.auth_nickserv_plugin
|
||||
plugins.net_hydra_plugin
|
||||
plugins.net_irc_plugin
|
||||
plugins.cmd_irc_plugin
|
||||
@ -48,4 +49,4 @@
|
||||
# plugins.whoami_plugin
|
||||
# plugins.joke_plugin
|
||||
# plugins.maple_plugin
|
||||
# plugins.openai_plugin
|
||||
# plugins.openai_plugin
|
||||
|
@ -9,7 +9,8 @@
|
||||
plugins.tool_dims_plugin
|
||||
plugins.tool_guds_plugin
|
||||
plugins.tool_bus_plugin
|
||||
plugins.sasl_custom_plugin
|
||||
plugins.auth_sasl_plugin
|
||||
plugins.auth_nickserv_plugin
|
||||
plugins.net_hydra_plugin
|
||||
plugins.net_irc_plugin
|
||||
plugins.net_matrix_plugin
|
||||
|
Loading…
Reference in New Issue
Block a user