mirror of
https://github.com/iio612/DEFENDER.git
synced 2026-02-13 19:24:23 +00:00
V5.3.5:
- core/irc.py : Nothing special except
a notice sent to the user that the command
is not available
- mod_clone:
When the user unload the module, the
server will unset modes of #clone channel
- mod_defender:
* adding a try block to catch errors
* adding a mode block to check if
the jail channel is not having +b mode
* ensure defender is +o in jail channel
- mod_test:
* adding some try block to catch errors
This commit is contained in:
@@ -1010,7 +1010,8 @@ class Irc:
|
||||
arg.remove(f':{self.Config.SERVICE_PREFIX}')
|
||||
if not arg[0].lower() in self.commands:
|
||||
self.Base.logs.debug(f"This command {arg[0]} is not available")
|
||||
return False
|
||||
self.sendNotice(f"This command [{self.Config.COLORS.bold}{arg[0]}{self.Config.COLORS.bold}] is not available", user_trigger)
|
||||
return None
|
||||
|
||||
cmd_to_send = convert_to_string.replace(':','')
|
||||
self.Base.log_cmd(user_trigger, cmd_to_send)
|
||||
|
||||
@@ -60,6 +60,7 @@ class Clone():
|
||||
|
||||
self.Base.db_query_channel(action='add', module_name=self.module_name, channel_name=self.Config.CLONE_CHANNEL)
|
||||
self.Irc.send2socket(f":{self.Config.SERVICE_NICKNAME} JOIN {self.Config.CLONE_CHANNEL}")
|
||||
self.Irc.send2socket(f":{self.Config.SERVICE_NICKNAME} SAMODE {self.Config.CLONE_CHANNEL} +o {self.Config.SERVICE_NICKNAME}")
|
||||
self.Irc.send2socket(f":{self.Config.SERVICE_NICKNAME} MODE {self.Config.CLONE_CHANNEL} +nts")
|
||||
self.Irc.send2socket(f":{self.Config.SERVICE_NICKNAME} MODE {self.Config.CLONE_CHANNEL} +k {self.Config.CLONE_CHANNEL_PASSWORD}")
|
||||
|
||||
@@ -126,6 +127,8 @@ class Clone():
|
||||
self.Irc.send2socket(f':{self.Config.SERVICE_NICKNAME} PRIVMSG {clone} :KILL')
|
||||
|
||||
self.Base.db_query_channel(action='del', module_name=self.module_name, channel_name=self.Config.CLONE_CHANNEL)
|
||||
self.Irc.send2socket(f":{self.Config.SERVICE_NICKNAME} MODE {self.Config.CLONE_CHANNEL} -nts")
|
||||
self.Irc.send2socket(f":{self.Config.SERVICE_NICKNAME} MODE {self.Config.CLONE_CHANNEL} -k {self.Config.CLONE_CHANNEL_PASSWORD}")
|
||||
self.Irc.send2socket(f":{self.Config.SERVICE_NICKNAME} PART {self.Config.CLONE_CHANNEL}")
|
||||
return None
|
||||
|
||||
|
||||
@@ -147,7 +147,8 @@ class Defender():
|
||||
self.Base.create_thread(func=self.thread_reputation_timer)
|
||||
|
||||
if self.ModConfig.reputation == 1:
|
||||
self.Irc.send2socket(f":{self.Config.SERVEUR_ID} SJOIN {self.Base.get_unixtime()} {self.Config.SALON_JAIL} + :{self.Config.SERVICE_ID}")
|
||||
self.Irc.send2socket(f":{self.Config.SERVEUR_ID} SJOIN {self.Base.get_unixtime()} {self.Config.SALON_JAIL} + :{self.Config.SERVICE_NICKNAME}")
|
||||
self.Irc.send2socket(f":{self.Config.SERVICE_NICKNAME} SAMODE {self.Config.SALON_JAIL} +o {self.Config.SERVICE_NICKNAME}")
|
||||
|
||||
return None
|
||||
|
||||
@@ -963,7 +964,7 @@ class Defender():
|
||||
self.Logs.error(f"Thread_cloudfilt_scan Error : {ve}")
|
||||
|
||||
def cmd(self, data: list) -> None:
|
||||
|
||||
try:
|
||||
service_id = self.Config.SERVICE_ID # Defender serveur id
|
||||
cmd = list(data).copy()
|
||||
|
||||
@@ -985,8 +986,23 @@ class Defender():
|
||||
except IndexError as ie:
|
||||
self.Logs.error(f'cmd reputation: index error: {ie}')
|
||||
|
||||
if len(cmd) < 3:
|
||||
return None
|
||||
|
||||
match cmd[2]:
|
||||
|
||||
case 'MODE':
|
||||
# ['...', ':001XSCU0Q', 'MODE', '#jail', '+b', '~security-group:unknown-users']
|
||||
channel = str(cmd[3])
|
||||
mode = str(cmd[4])
|
||||
group_to_check = str(cmd[5:])
|
||||
group_to_unban = '~security-group:unknown-users'
|
||||
|
||||
if self.Config.SALON_JAIL == channel:
|
||||
if mode == '+b' and group_to_unban in group_to_check:
|
||||
self.Irc.send2socket(f":{service_id} MODE {self.Config.SALON_JAIL} -b ~security-group:unknown-users")
|
||||
self.Irc.send2socket(f":{service_id} MODE {self.Config.SALON_JAIL} -eee ~security-group:webirc-users ~security-group:known-users ~security-group:websocket-users")
|
||||
|
||||
case 'PRIVMSG':
|
||||
cmd.pop(0)
|
||||
user_trigger = str(cmd[0]).replace(':','')
|
||||
@@ -1142,6 +1158,13 @@ class Defender():
|
||||
self.Irc.send2socket(f":{service_id} MODE {chan.name} -b {final_nickname}!*@*")
|
||||
self.reputation_delete(final_UID)
|
||||
|
||||
except KeyError as ke:
|
||||
self.Logs.error(f"{ke} / {cmd} / length {str(len(cmd))}")
|
||||
except IndexError as ie:
|
||||
self.Logs.error(f"{ie} / {cmd} / length {str(len(cmd))}")
|
||||
except Exception as err:
|
||||
self.Logs.error(f"General Error: {err}")
|
||||
|
||||
def _hcmds(self, user:str, channel: any, cmd: list, fullcmd: list = []) -> None:
|
||||
|
||||
command = str(cmd[0]).lower()
|
||||
|
||||
@@ -128,6 +128,10 @@ class Test():
|
||||
cmd = list(data).copy()
|
||||
|
||||
return None
|
||||
except KeyError as ke:
|
||||
self.Base.logs.error(f"Key Error: {ke}")
|
||||
except IndexError as ie:
|
||||
self.Base.logs.error(f"{ie} / {cmd} / length {str(len(cmd))}")
|
||||
except Exception as err:
|
||||
self.Base.logs.error(f"General Error: {err}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user