mirror of
https://github.com/iio612/DEFENDER.git
synced 2026-02-13 19:24:23 +00:00
Fix Channel update, adding group-security
core/Model.py:
- Adding a new method => delete_user_from_all_channel
mods/mod_defender.py:
- adding 2 options => reputation_score_after_release and reputation_sg (for security-group)
- moving show_users command to Irc.py
- Reputation:
- delete user from all channels when the user is killed
- now when the reputation is updated by an IRCop the service will not trigger the ip scan, and it will update the reputation
- The reputation DB is now filled out by the User Object
- When a suspect user decide to join a new channel, the service will force the user to quit this channel
- When the suspect change his nickname the service will not unban and ban again the user except if the ban_all_chan option is activated
- After the release, the reputation is changed by the reputation_score_after_release instead of reputation_seuil + 1
- When the reputation is activated, the service will put +b sg: unknow-users and +e: other groups
- adding score after release and security-group dynamic command. the user will be able to activate them
core/irc.py:
- Adding some exceptions to catch erros when user want to load a module
- reputation update.
- When a user quit, the service will delete the user from all channels
- Fix the Channel Object, when a security group this will create errors in the UIDs in the channel Object
- adding show_admins command
This commit is contained in:
@@ -275,9 +275,19 @@ class Channel:
|
|||||||
@dataclass
|
@dataclass
|
||||||
class ChannelModel:
|
class ChannelModel:
|
||||||
name: str
|
name: str
|
||||||
|
"""### Channel name
|
||||||
|
It include the #"""
|
||||||
uids: list
|
uids: list
|
||||||
|
"""### List of UID available in the channel
|
||||||
|
including their modes ~ @ % + *
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
list: The list of UID's including theirs modes
|
||||||
|
"""
|
||||||
|
|
||||||
UID_CHANNEL_DB: list[ChannelModel] = []
|
UID_CHANNEL_DB: list[ChannelModel] = []
|
||||||
|
"""List that contains all the Channels objects (ChannelModel)
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, Base: Base) -> None:
|
def __init__(self, Base: Base) -> None:
|
||||||
self.log = Base.logs
|
self.log = Base.logs
|
||||||
@@ -362,6 +372,26 @@ class Channel:
|
|||||||
except ValueError as ve:
|
except ValueError as ve:
|
||||||
self.log.error(f'{ve}')
|
self.log.error(f'{ve}')
|
||||||
|
|
||||||
|
def delete_user_from_all_channel(self, uid:str) -> bool:
|
||||||
|
try:
|
||||||
|
result = False
|
||||||
|
|
||||||
|
for record in self.UID_CHANNEL_DB:
|
||||||
|
for user_id in record.uids:
|
||||||
|
if self.Base.clean_uid(user_id) == self.Base.clean_uid(uid):
|
||||||
|
record.uids.remove(user_id)
|
||||||
|
self.log.debug(f'The UID {uid} has been removed, here is the new object: {record}')
|
||||||
|
result = True
|
||||||
|
|
||||||
|
for record in self.UID_CHANNEL_DB:
|
||||||
|
if not record.uids:
|
||||||
|
self.UID_CHANNEL_DB.remove(record)
|
||||||
|
self.log.debug(f'The Channel {record.name} has been removed, here is the new object: {record}')
|
||||||
|
|
||||||
|
return result
|
||||||
|
except ValueError as ve:
|
||||||
|
self.log.error(f'{ve}')
|
||||||
|
|
||||||
def get_Channel(self, name: str) -> Union[ChannelModel, None]:
|
def get_Channel(self, name: str) -> Union[ChannelModel, None]:
|
||||||
|
|
||||||
Channel = None
|
Channel = None
|
||||||
|
|||||||
63
core/irc.py
63
core/irc.py
@@ -30,7 +30,7 @@ class Irc:
|
|||||||
self.commands_level = {
|
self.commands_level = {
|
||||||
0: ['help', 'auth', 'copyright', 'uptime'],
|
0: ['help', 'auth', 'copyright', 'uptime'],
|
||||||
1: ['load','reload','unload', 'deauth', 'checkversion'],
|
1: ['load','reload','unload', 'deauth', 'checkversion'],
|
||||||
2: ['show_modules', 'show_timers', 'show_threads', 'show_channels'],
|
2: ['show_modules', 'show_timers', 'show_threads', 'show_channels', 'show_users', 'show_admins'],
|
||||||
3: ['quit', 'restart','addaccess','editaccess', 'delaccess']
|
3: ['quit', 'restart','addaccess','editaccess', 'delaccess']
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,6 +418,7 @@ class Irc:
|
|||||||
self.send2socket(f":{self.Config.SERVICE_NICKNAME} PRIVMSG {self.Config.SERVICE_CHANLOG} :[ {self.Config.CONFIG_COLOR['rouge']}MODULE_NOT_FOUND{self.Config.CONFIG_COLOR['noire']} ]: {moduleNotFound}")
|
self.send2socket(f":{self.Config.SERVICE_NICKNAME} PRIVMSG {self.Config.SERVICE_CHANLOG} :[ {self.Config.CONFIG_COLOR['rouge']}MODULE_NOT_FOUND{self.Config.CONFIG_COLOR['noire']} ]: {moduleNotFound}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.Base.logs.error(f"Something went wrong with a module you want to load : {e}")
|
self.Base.logs.error(f"Something went wrong with a module you want to load : {e}")
|
||||||
|
self.send2socket(f":{self.Config.SERVICE_NICKNAME} PRIVMSG {self.Config.SERVICE_CHANLOG} :[ {self.Config.CONFIG_COLOR['rouge']}ERROR{self.Config.CONFIG_COLOR['noire']} ]: {e}")
|
||||||
|
|
||||||
def insert_db_admin(self, uid:str, level:int) -> None:
|
def insert_db_admin(self, uid:str, level:int) -> None:
|
||||||
|
|
||||||
@@ -619,8 +620,18 @@ class Irc:
|
|||||||
# if self.Config.ABUSEIPDB == 1:
|
# if self.Config.ABUSEIPDB == 1:
|
||||||
# self.Base.create_thread(self.abuseipdb_scan, (cmd[2], ))
|
# self.Base.create_thread(self.abuseipdb_scan, (cmd[2], ))
|
||||||
self.first_connexion_ip = cmd[2]
|
self.first_connexion_ip = cmd[2]
|
||||||
self.first_score = int(cmd[3])
|
|
||||||
pass
|
self.first_score = 0
|
||||||
|
if str(cmd[3]).find('*') != -1:
|
||||||
|
# If * available, it means that an ircop changed the repurtation score
|
||||||
|
# means also that the user exist will try to update all users with same IP
|
||||||
|
self.first_score = int(str(cmd[3]).replace('*',''))
|
||||||
|
for user in self.User.UID_DB:
|
||||||
|
if user.remote_ip == self.first_connexion_ip:
|
||||||
|
user.score_connexion = self.first_score
|
||||||
|
else:
|
||||||
|
self.first_score = int(cmd[3])
|
||||||
|
|
||||||
# Possibilité de déclancher les bans a ce niveau.
|
# Possibilité de déclancher les bans a ce niveau.
|
||||||
except IndexError as ie:
|
except IndexError as ie:
|
||||||
self.Base.logs.error(f'{ie}')
|
self.Base.logs.error(f'{ie}')
|
||||||
@@ -695,6 +706,7 @@ class Irc:
|
|||||||
cmd.pop(0)
|
cmd.pop(0)
|
||||||
uid_who_quit = str(cmd[0]).replace(':', '')
|
uid_who_quit = str(cmd[0]).replace(':', '')
|
||||||
self.User.delete(uid_who_quit)
|
self.User.delete(uid_who_quit)
|
||||||
|
self.Channel.delete_user_from_all_channel(uid_who_quit)
|
||||||
|
|
||||||
case 'PONG':
|
case 'PONG':
|
||||||
# ['@msgid=aTNJhp17kcPboF5diQqkUL;time=2023-12-28T20:35:58.411Z', ':irc.deb.biz.st', 'PONG', 'irc.deb.biz.st', ':Dev-PyDefender']
|
# ['@msgid=aTNJhp17kcPboF5diQqkUL;time=2023-12-28T20:35:58.411Z', ':irc.deb.biz.st', 'PONG', 'irc.deb.biz.st', ':Dev-PyDefender']
|
||||||
@@ -718,27 +730,34 @@ class Irc:
|
|||||||
case 'SJOIN':
|
case 'SJOIN':
|
||||||
# ['@msgid=5sTwGdj349D82L96p749SY;time=2024-08-15T09:50:23.528Z', ':001', 'SJOIN', '1721564574', '#welcome', ':001JD94QH']
|
# ['@msgid=5sTwGdj349D82L96p749SY;time=2024-08-15T09:50:23.528Z', ':001', 'SJOIN', '1721564574', '#welcome', ':001JD94QH']
|
||||||
# ['@msgid=bvceb6HthbLJapgGLXn1b0;time=2024-08-15T09:50:11.464Z', ':001', 'SJOIN', '1721564574', '#welcome', '+lnrt', '13', ':001CIVLQF', '+11ZAAAAAB', '001QGR10C', '*@0014UE10B', '001NL1O07', '001SWZR05', '001HB8G04', '@00BAAAAAJ', '0019M7101']
|
# ['@msgid=bvceb6HthbLJapgGLXn1b0;time=2024-08-15T09:50:11.464Z', ':001', 'SJOIN', '1721564574', '#welcome', '+lnrt', '13', ':001CIVLQF', '+11ZAAAAAB', '001QGR10C', '*@0014UE10B', '001NL1O07', '001SWZR05', '001HB8G04', '@00BAAAAAJ', '0019M7101']
|
||||||
|
# ['@msgid=SKUeuVzOrTShRDduq8VerX;time=2024-08-23T19:37:04.266Z', ':001', 'SJOIN', '1723993047', '#welcome', '+lnrt', '13',
|
||||||
|
# ':001T6VU3F', '001JGWB2K', '@11ZAAAAAB',
|
||||||
|
# '001F16WGR', '001X9YMGQ', '*+001DYPFGP', '@00BAAAAAJ', '001AAGOG9', '001FMFVG8', '001DAEEG7',
|
||||||
|
# '&~G:unknown-users', '"~G:websocket-users', '"~G:known-users', '"~G:webirc-users']
|
||||||
cmd.pop(0)
|
cmd.pop(0)
|
||||||
channel = str(cmd[3]).lower()
|
channel = str(cmd[3]).lower()
|
||||||
mode = cmd[4]
|
|
||||||
len_cmd = len(cmd)
|
len_cmd = len(cmd)
|
||||||
list_users:list = []
|
list_users:list = []
|
||||||
|
occurence = 0
|
||||||
start_boucle = 0
|
start_boucle = 0
|
||||||
|
|
||||||
# Trouver le premier user
|
# Trouver le premier user
|
||||||
for i in range(len_cmd):
|
for i in range(len_cmd):
|
||||||
s: list = re.findall(fr':', cmd[i])
|
s: list = re.findall(fr':', cmd[i])
|
||||||
if s:
|
if s:
|
||||||
start_boucle = i
|
occurence += 1
|
||||||
|
if occurence == 2:
|
||||||
|
start_boucle = i
|
||||||
|
|
||||||
# Boucle qui va ajouter l'ensemble des users (UID)
|
# Boucle qui va ajouter l'ensemble des users (UID)
|
||||||
for i in range(start_boucle, len(cmd)):
|
for i in range(start_boucle, len(cmd)):
|
||||||
parsed_UID = str(cmd[i])
|
parsed_UID = str(cmd[i])
|
||||||
pattern = fr'[:|@|%|\+|~|\*]*'
|
# pattern = fr'[:|@|%|\+|~|\*]*'
|
||||||
pattern = fr':'
|
pattern = fr':'
|
||||||
parsed_UID = re.sub(pattern, '', parsed_UID)
|
parsed_UID = re.sub(pattern, '', parsed_UID)
|
||||||
list_users.append(parsed_UID)
|
clean_uid = self.Base.clean_uid(parsed_UID)
|
||||||
|
if len(clean_uid) == 9:
|
||||||
|
list_users.append(parsed_UID)
|
||||||
|
|
||||||
self.Channel.insert(
|
self.Channel.insert(
|
||||||
self.Channel.ChannelModel(
|
self.Channel.ChannelModel(
|
||||||
@@ -1139,6 +1158,7 @@ class Irc:
|
|||||||
class_name = module_name.split('_')[1].capitalize() # ==> Defender
|
class_name = module_name.split('_')[1].capitalize() # ==> Defender
|
||||||
|
|
||||||
if 'mods.' + module_name in sys.modules:
|
if 'mods.' + module_name in sys.modules:
|
||||||
|
self.Base.logs.info('Unload the module ...')
|
||||||
self.loaded_classes[class_name].unload()
|
self.loaded_classes[class_name].unload()
|
||||||
self.Base.logs.info('Module Already Loaded ... reloading the module ...')
|
self.Base.logs.info('Module Already Loaded ... reloading the module ...')
|
||||||
the_module = sys.modules['mods.' + module_name]
|
the_module = sys.modules['mods.' + module_name]
|
||||||
@@ -1163,8 +1183,23 @@ class Irc:
|
|||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
self.send2socket(f":{self.Config.SERVICE_NICKNAME} PRIVMSG {self.Config.SERVICE_CHANLOG} :Module {module_name} n'est pas chargé !")
|
self.send2socket(f":{self.Config.SERVICE_NICKNAME} PRIVMSG {self.Config.SERVICE_CHANLOG} :Module {module_name} n'est pas chargé !")
|
||||||
except:
|
|
||||||
self.Base.logs.error(f"Something went wrong with a module you want to reload")
|
except TypeError as te:
|
||||||
|
self.Base.logs.error(f"A TypeError raised: {te}")
|
||||||
|
self.send2socket(f":{self.Config.SERVICE_NICKNAME} PRIVMSG {self.Config.SERVICE_CHANLOG} :A TypeError raised: {te}")
|
||||||
|
self.Base.db_delete_module(module_name)
|
||||||
|
except AttributeError as ae:
|
||||||
|
self.Base.logs.error(f"Missing Attribute: {ae}")
|
||||||
|
self.send2socket(f":{self.Config.SERVICE_NICKNAME} PRIVMSG {self.Config.SERVICE_CHANLOG} :Missing Attribute: {ae}")
|
||||||
|
self.Base.db_delete_module(module_name)
|
||||||
|
except KeyError as ke:
|
||||||
|
self.Base.logs.error(f"Key Error: {ke}")
|
||||||
|
self.send2socket(f":{self.Config.SERVICE_NICKNAME} PRIVMSG {self.Config.SERVICE_CHANLOG} :Key Error: {ke}")
|
||||||
|
self.Base.db_delete_module(module_name)
|
||||||
|
except Exception as e:
|
||||||
|
self.Base.logs.error(f"Something went wrong with a module you want to reload: {e}")
|
||||||
|
self.send2socket(f":{self.Config.SERVICE_NICKNAME} PRIVMSG {self.Config.SERVICE_CHANLOG} :Something went wrong with the module: {e}")
|
||||||
|
self.Base.db_delete_module(module_name)
|
||||||
|
|
||||||
case 'quit':
|
case 'quit':
|
||||||
try:
|
try:
|
||||||
@@ -1265,6 +1300,14 @@ class Irc:
|
|||||||
|
|
||||||
self.send2socket(f":{dnickname} NOTICE {fromuser} : Channel: {chan.name} - Users: {list_nicknames}")
|
self.send2socket(f":{dnickname} NOTICE {fromuser} : Channel: {chan.name} - Users: {list_nicknames}")
|
||||||
|
|
||||||
|
case 'show_users':
|
||||||
|
for db_user in self.User.UID_DB:
|
||||||
|
self.send2socket(f":{dnickname} NOTICE {fromuser} :UID : {db_user.uid} - isWebirc: {db_user.isWebirc} - Nickname: {db_user.nickname} - Connection: {db_user.connexion_datetime}")
|
||||||
|
|
||||||
|
case 'show_admins':
|
||||||
|
for db_admin in self.Admin.UID_ADMIN_DB:
|
||||||
|
self.send2socket(f":{dnickname} NOTICE {fromuser} :UID : {db_admin.uid} - Nickname: {db_admin.nickname} - Level: {db_admin.level} - Connection: {db_admin.connexion_datetime}")
|
||||||
|
|
||||||
case 'uptime':
|
case 'uptime':
|
||||||
uptime = self.get_defender_uptime()
|
uptime = self.get_defender_uptime()
|
||||||
self.send2socket(f':{dnickname} NOTICE {fromuser} : {uptime}')
|
self.send2socket(f':{dnickname} NOTICE {fromuser} : {uptime}')
|
||||||
|
|||||||
@@ -23,7 +23,9 @@ class Defender():
|
|||||||
reputation: int
|
reputation: int
|
||||||
reputation_timer: int
|
reputation_timer: int
|
||||||
reputation_seuil: int
|
reputation_seuil: int
|
||||||
|
reputation_score_after_release: int
|
||||||
reputation_ban_all_chan: int
|
reputation_ban_all_chan: int
|
||||||
|
reputation_sg: int
|
||||||
local_scan: int
|
local_scan: int
|
||||||
psutil_scan: int
|
psutil_scan: int
|
||||||
abuseipdb_scan: int
|
abuseipdb_scan: int
|
||||||
@@ -81,7 +83,7 @@ class Defender():
|
|||||||
0: ['code'],
|
0: ['code'],
|
||||||
1: ['join','part', 'info'],
|
1: ['join','part', 'info'],
|
||||||
2: ['owner', 'deowner', 'op', 'deop', 'halfop', 'dehalfop', 'voice', 'devoice', 'ban', 'unban','kick', 'kickban'],
|
2: ['owner', 'deowner', 'op', 'deop', 'halfop', 'dehalfop', 'voice', 'devoice', 'ban', 'unban','kick', 'kickban'],
|
||||||
3: ['reputation','proxy_scan', 'flood', 'status', 'timer','show_reputation', 'show_users', 'sentinel']
|
3: ['reputation','proxy_scan', 'flood', 'status', 'timer','show_reputation', 'sentinel']
|
||||||
}
|
}
|
||||||
self.__set_commands(self.commands_level) # Enrigstrer les nouvelles commandes dans le code
|
self.__set_commands(self.commands_level) # Enrigstrer les nouvelles commandes dans le code
|
||||||
|
|
||||||
@@ -173,12 +175,16 @@ class Defender():
|
|||||||
# Rejoindre les salons
|
# Rejoindre les salons
|
||||||
self.join_saved_channels()
|
self.join_saved_channels()
|
||||||
|
|
||||||
# Variable qui va contenir les options de configuration du module Defender
|
try:
|
||||||
self.ModConfig = self.ModConfModel(
|
# Variable qui va contenir les options de configuration du module Defender
|
||||||
reputation=0, reputation_timer=0, reputation_seuil=10, reputation_ban_all_chan=0,
|
self.ModConfig = self.ModConfModel(
|
||||||
local_scan=0, psutil_scan=0, abuseipdb_scan=0, freeipapi_scan=0, cloudfilt_scan=0,
|
reputation=0, reputation_timer=0, reputation_seuil=26, reputation_score_after_release=27,
|
||||||
flood=0, flood_message=5, flood_time=1, flood_timer=20
|
reputation_ban_all_chan=0,reputation_sg=1,
|
||||||
)
|
local_scan=0, psutil_scan=0, abuseipdb_scan=0, freeipapi_scan=0, cloudfilt_scan=0,
|
||||||
|
flood=0, flood_message=5, flood_time=1, flood_timer=20
|
||||||
|
)
|
||||||
|
except TypeError as te:
|
||||||
|
self.Logs.critical(te)
|
||||||
|
|
||||||
# Logger en debug la variable de configuration
|
# Logger en debug la variable de configuration
|
||||||
self.Logs.debug(self.ModConfig)
|
self.Logs.debug(self.ModConfig)
|
||||||
@@ -489,7 +495,7 @@ class Defender():
|
|||||||
color_bold = self.Config.CONFIG_COLOR['gras']
|
color_bold = self.Config.CONFIG_COLOR['gras']
|
||||||
service_id = self.Config.SERVICE_ID
|
service_id = self.Config.SERVICE_ID
|
||||||
service_prefix = self.Config.SERVICE_PREFIX
|
service_prefix = self.Config.SERVICE_PREFIX
|
||||||
reputation_ban_all_chan = self.Base.int_if_possible(self.ModConfig.reputation_ban_all_chan)
|
reputation_ban_all_chan = self.ModConfig.reputation_ban_all_chan
|
||||||
|
|
||||||
if not get_reputation.isWebirc:
|
if not get_reputation.isWebirc:
|
||||||
# Si le user ne vient pas de webIrc
|
# Si le user ne vient pas de webIrc
|
||||||
@@ -518,7 +524,7 @@ class Defender():
|
|||||||
reputation_flag = self.ModConfig.reputation
|
reputation_flag = self.ModConfig.reputation
|
||||||
reputation_timer = self.ModConfig.reputation_timer
|
reputation_timer = self.ModConfig.reputation_timer
|
||||||
reputation_seuil = self.ModConfig.reputation_seuil
|
reputation_seuil = self.ModConfig.reputation_seuil
|
||||||
ban_all_chan = self.Base.int_if_possible(self.ModConfig.reputation_ban_all_chan)
|
ban_all_chan = self.ModConfig.reputation_ban_all_chan
|
||||||
service_id = self.Config.SERVICE_ID
|
service_id = self.Config.SERVICE_ID
|
||||||
dchanlog = self.Config.SERVICE_CHANLOG
|
dchanlog = self.Config.SERVICE_CHANLOG
|
||||||
color_red = self.Config.CONFIG_COLOR['rouge']
|
color_red = self.Config.CONFIG_COLOR['rouge']
|
||||||
@@ -534,15 +540,11 @@ class Defender():
|
|||||||
|
|
||||||
for user in self.UID_REPUTATION_DB:
|
for user in self.UID_REPUTATION_DB:
|
||||||
if not user.isWebirc: # Si il ne vient pas de WebIRC
|
if not user.isWebirc: # Si il ne vient pas de WebIRC
|
||||||
# self.Irc.debug(f"Nickname: {self.db_reputation[uid]['nickname']} | uptime: {self.get_user_uptime_in_minutes(uid)} | reputation time: {reputation_timer}")
|
|
||||||
if self.get_user_uptime_in_minutes(user.uid) >= reputation_timer and int(user.score) <= int(reputation_seuil):
|
if self.get_user_uptime_in_minutes(user.uid) >= reputation_timer and int(user.score) <= int(reputation_seuil):
|
||||||
self.Irc.send2socket(f":{service_id} PRIVMSG {dchanlog} :[{color_red} REPUTATION {color_black}] : Action sur {user.nickname} aprés {str(reputation_timer)} minutes d'inactivité")
|
self.Irc.send2socket(f":{service_id} PRIVMSG {dchanlog} :[{color_red} REPUTATION {color_black}] : Action sur {user.nickname} aprés {str(reputation_timer)} minutes d'inactivité")
|
||||||
# if not system_reputation_timer_action(cglobal['reputation_timer_action'], uid, self.db_reputation[uid]['nickname']):
|
|
||||||
# return False
|
|
||||||
self.Irc.send2socket(f":{service_id} KILL {user.nickname} After {str(reputation_timer)} minutes of inactivity you should reconnect and type the password code ")
|
self.Irc.send2socket(f":{service_id} KILL {user.nickname} After {str(reputation_timer)} minutes of inactivity you should reconnect and type the password code ")
|
||||||
|
|
||||||
self.Logs.info(f"Nickname: {user.nickname} KILLED after {str(reputation_timer)} minutes of inactivity")
|
self.Logs.info(f"Nickname: {user.nickname} KILLED after {str(reputation_timer)} minutes of inactivity")
|
||||||
|
|
||||||
uid_to_clean.append(user.uid)
|
uid_to_clean.append(user.uid)
|
||||||
|
|
||||||
for uid in uid_to_clean:
|
for uid in uid_to_clean:
|
||||||
@@ -553,8 +555,9 @@ class Defender():
|
|||||||
self.Irc.send2socket(f":{service_id} MODE {chan.name} -b {get_user_reputation.nickname}!*@*")
|
self.Irc.send2socket(f":{service_id} MODE {chan.name} -b {get_user_reputation.nickname}!*@*")
|
||||||
|
|
||||||
# Lorsqu'un utilisateur quitte, il doit être supprimé de {UID_DB}.
|
# Lorsqu'un utilisateur quitte, il doit être supprimé de {UID_DB}.
|
||||||
self.User.delete(uid)
|
self.Channel.delete_user_from_all_channel(uid)
|
||||||
self.reputation_delete(uid)
|
self.reputation_delete(uid)
|
||||||
|
self.User.delete(uid)
|
||||||
|
|
||||||
except AssertionError as ae:
|
except AssertionError as ae:
|
||||||
self.Logs.error(f'Assertion Error -> {ae}')
|
self.Logs.error(f'Assertion Error -> {ae}')
|
||||||
@@ -1004,6 +1007,9 @@ class Defender():
|
|||||||
try:
|
try:
|
||||||
self.reputation_first_connexion['ip'] = cmd[2]
|
self.reputation_first_connexion['ip'] = cmd[2]
|
||||||
self.reputation_first_connexion['score'] = cmd[3]
|
self.reputation_first_connexion['score'] = cmd[3]
|
||||||
|
if str(cmd[3]).find('*') != -1:
|
||||||
|
# If the reputation changed, we do not need to scan the IP
|
||||||
|
return None
|
||||||
|
|
||||||
if not self.Base.is_valid_ip(cmd[2]):
|
if not self.Base.is_valid_ip(cmd[2]):
|
||||||
return None
|
return None
|
||||||
@@ -1038,71 +1044,39 @@ class Defender():
|
|||||||
self.flood(find_nickname, channel)
|
self.flood(find_nickname, channel)
|
||||||
|
|
||||||
case 'UID':
|
case 'UID':
|
||||||
|
# If Init then do nothing
|
||||||
if self.Irc.INIT == 1:
|
if self.Irc.INIT == 1:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if 'webirc' in cmd[0]:
|
|
||||||
isWebirc = True
|
|
||||||
else:
|
|
||||||
isWebirc = False
|
|
||||||
|
|
||||||
# Supprimer la premiere valeur et finir le code normalement
|
# Supprimer la premiere valeur et finir le code normalement
|
||||||
cmd.pop(0)
|
cmd.pop(0)
|
||||||
|
|
||||||
uid = str(cmd[7])
|
# Get User information
|
||||||
nickname = str(cmd[2])
|
_User = self.User.get_User(str(cmd[7]))
|
||||||
username = str(cmd[5])
|
if _User is None:
|
||||||
hostname = str(cmd[6])
|
self.Logs.critical(f'This UID: [{cmd[7]}] is not available please check why')
|
||||||
umodes = str(cmd[9])
|
return None
|
||||||
vhost = str(cmd[10])
|
|
||||||
|
|
||||||
reputation_flag = self.Base.int_if_possible(self.ModConfig.reputation)
|
reputation_flag = self.ModConfig.reputation
|
||||||
reputation_seuil = self.Base.int_if_possible(self.ModConfig.reputation_seuil)
|
reputation_seuil = self.ModConfig.reputation_seuil
|
||||||
|
|
||||||
if self.Irc.INIT == 0:
|
if self.Irc.INIT == 0:
|
||||||
# A chaque nouvelle connexion chargé les données dans reputation
|
# Si le user n'es pas un service ni un IrcOP
|
||||||
client_ip = ''
|
if not re.match(fr'^.*[S|o?].*$', _User.umodes):
|
||||||
client_score = 0
|
if reputation_flag == 1 and _User.score_connexion <= reputation_seuil:
|
||||||
if 'ip' in self.reputation_first_connexion:
|
|
||||||
client_ip = self.reputation_first_connexion['ip']
|
|
||||||
if 'score' in self.reputation_first_connexion:
|
|
||||||
client_score = self.reputation_first_connexion['score']
|
|
||||||
|
|
||||||
# Si réputation activé lancer un whois sur le nickname connecté
|
|
||||||
# Si le user n'es pas un service ni un IrcOP alors whois
|
|
||||||
if not re.match(fr'^.*[S|o?].*$', umodes):
|
|
||||||
if reputation_flag == 1 and int(client_score) <= int(reputation_seuil):
|
|
||||||
# if not db_isTrusted_user(user_id):
|
|
||||||
|
|
||||||
# get user information
|
|
||||||
get_user = self.User.get_User(uid)
|
|
||||||
if get_user is None:
|
|
||||||
self.Logs.error(f'This UID {uid} does not exisit')
|
|
||||||
|
|
||||||
# self.insert_db_reputation(uid, client_ip, nickname, username, hostname, umodes, vhost, client_score, isWebirc)
|
|
||||||
|
|
||||||
currentDateTime = self.Base.get_datetime()
|
currentDateTime = self.Base.get_datetime()
|
||||||
self.reputation_insert(
|
self.reputation_insert(
|
||||||
self.ReputationModel(
|
self.ReputationModel(
|
||||||
uid=uid,
|
uid=_User.uid, nickname=_User.nickname, username=_User.username, hostname=_User.hostname,
|
||||||
nickname=nickname,
|
umodes=_User.umodes, vhost=_User.vhost, ip=_User.remote_ip, score=_User.score_connexion,
|
||||||
username=username,
|
secret_code=self.Base.get_random(8), isWebirc=_User.isWebirc, connected_datetime=currentDateTime,
|
||||||
hostname=hostname,
|
|
||||||
umodes=umodes,
|
|
||||||
vhost=vhost,
|
|
||||||
ip=client_ip,
|
|
||||||
score=client_score,
|
|
||||||
secret_code=self.Base.get_random(8),
|
|
||||||
isWebirc=isWebirc,
|
|
||||||
connected_datetime=currentDateTime,
|
|
||||||
updated_datetime=currentDateTime
|
updated_datetime=currentDateTime
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
# self.Irc.send2socket(f":{service_id} WHOIS {nickname}")
|
# self.Irc.send2socket(f":{service_id} WHOIS {nickname}")
|
||||||
if self.reputation_check(uid):
|
if self.reputation_check(_User.uid):
|
||||||
if reputation_flag == 1 and int(client_score) <= int(reputation_seuil):
|
if reputation_flag == 1 and _User.score_connexion <= reputation_seuil:
|
||||||
self.system_reputation(uid)
|
self.system_reputation(_User.uid)
|
||||||
self.Logs.info('Démarrer le systeme de reputation')
|
self.Logs.info('Démarrer le systeme de reputation')
|
||||||
|
|
||||||
case 'SJOIN':
|
case 'SJOIN':
|
||||||
@@ -1111,19 +1085,6 @@ class Defender():
|
|||||||
cmd.pop(0)
|
cmd.pop(0)
|
||||||
parsed_chan = cmd[3]
|
parsed_chan = cmd[3]
|
||||||
|
|
||||||
'''
|
|
||||||
mode = ''
|
|
||||||
if len(cmd) > 4:
|
|
||||||
mode = cmd[4]
|
|
||||||
|
|
||||||
self.Channel.insert(
|
|
||||||
self.Channel.ChannelModel(
|
|
||||||
name=parsed_chan,
|
|
||||||
mode=mode
|
|
||||||
)
|
|
||||||
)
|
|
||||||
'''
|
|
||||||
|
|
||||||
if self.ModConfig.reputation == 1:
|
if self.ModConfig.reputation == 1:
|
||||||
parsed_UID = cmd[4]
|
parsed_UID = cmd[4]
|
||||||
pattern = fr'^:[@|%|\+|~|\*]*'
|
pattern = fr'^:[@|%|\+|~|\*]*'
|
||||||
@@ -1134,6 +1095,10 @@ class Defender():
|
|||||||
if not get_reputation is None:
|
if not get_reputation is None:
|
||||||
isWebirc = get_reputation.isWebirc
|
isWebirc = get_reputation.isWebirc
|
||||||
|
|
||||||
|
if not isWebirc:
|
||||||
|
if parsed_chan != self.Config.SALON_JAIL:
|
||||||
|
self.Irc.send2socket(f":{service_id} SAPART {get_reputation.nickname} {parsed_chan}")
|
||||||
|
|
||||||
if self.ModConfig.reputation_ban_all_chan == 1 and not isWebirc:
|
if self.ModConfig.reputation_ban_all_chan == 1 and not isWebirc:
|
||||||
if parsed_chan != self.Config.SALON_JAIL:
|
if parsed_chan != self.Config.SALON_JAIL:
|
||||||
self.Irc.send2socket(f":{service_id} MODE {parsed_chan} +b {get_reputation.nickname}!*@*")
|
self.Irc.send2socket(f":{service_id} MODE {parsed_chan} +b {get_reputation.nickname}!*@*")
|
||||||
@@ -1172,24 +1137,25 @@ class Defender():
|
|||||||
cmd.pop(0)
|
cmd.pop(0)
|
||||||
uid = str(cmd[0]).replace(':','')
|
uid = str(cmd[0]).replace(':','')
|
||||||
get_Reputation = self.reputation_get_Reputation(uid)
|
get_Reputation = self.reputation_get_Reputation(uid)
|
||||||
|
jail_salon = self.Config.SALON_JAIL
|
||||||
|
service_id = self.Config.SERVICE_ID
|
||||||
|
|
||||||
if get_Reputation is None:
|
if get_Reputation is None:
|
||||||
self.Logs.debug(f'This UID: {uid} is not listed in the reputation dataclass')
|
self.Logs.debug(f'This UID: {uid} is not listed in the reputation dataclass')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
# Update the new nickname
|
||||||
oldnick = get_Reputation.nickname
|
oldnick = get_Reputation.nickname
|
||||||
newnickname = cmd[2]
|
newnickname = cmd[2]
|
||||||
|
|
||||||
jail_salon = self.Config.SALON_JAIL
|
|
||||||
service_id = self.Config.SERVICE_ID
|
|
||||||
|
|
||||||
# self.update_db_reputation(uid, newnickname)
|
|
||||||
get_Reputation.nickname = newnickname
|
get_Reputation.nickname = newnickname
|
||||||
|
|
||||||
for chan in self.Channel.UID_CHANNEL_DB:
|
# If ban in all channel is ON then unban old nickname an ban the new nickname
|
||||||
if chan.name != jail_salon:
|
if self.ModConfig.reputation_ban_all_chan == 1:
|
||||||
self.Irc.send2socket(f":{service_id} MODE {chan.name} -b {oldnick}!*@*")
|
for chan in self.Channel.UID_CHANNEL_DB:
|
||||||
self.Irc.send2socket(f":{service_id} MODE {chan.name} +b {newnickname}!*@*")
|
if chan.name != jail_salon:
|
||||||
|
self.Irc.send2socket(f":{service_id} MODE {chan.name} -b {oldnick}!*@*")
|
||||||
|
self.Irc.send2socket(f":{service_id} MODE {chan.name} +b {newnickname}!*@*")
|
||||||
|
|
||||||
except KeyError as ke:
|
except KeyError as ke:
|
||||||
self.Logs.error(f'cmd - NICK - KeyError: {ke}')
|
self.Logs.error(f'cmd - NICK - KeyError: {ke}')
|
||||||
|
|
||||||
@@ -1247,9 +1213,7 @@ class Defender():
|
|||||||
try:
|
try:
|
||||||
timer_sent = self.Base.int_if_possible(cmd[1])
|
timer_sent = self.Base.int_if_possible(cmd[1])
|
||||||
timer_sent = int(timer_sent)
|
timer_sent = int(timer_sent)
|
||||||
# self.Irc.create_ping_timer(timer_sent, 'Defender', 'run_db_action_timer')
|
|
||||||
self.Base.create_timer(timer_sent, self.run_db_action_timer)
|
self.Base.create_timer(timer_sent, self.run_db_action_timer)
|
||||||
# self.Base.create_timer(timer_sent, self.Base.garbage_collector_sockets)
|
|
||||||
|
|
||||||
except TypeError as te:
|
except TypeError as te:
|
||||||
self.Logs.error(f"Type Error -> {te}")
|
self.Logs.error(f"Type Error -> {te}")
|
||||||
@@ -1262,7 +1226,7 @@ class Defender():
|
|||||||
self.Irc.send2socket(f':{dnickname} PRIVMSG {dchanlog} : No one is suspected')
|
self.Irc.send2socket(f':{dnickname} PRIVMSG {dchanlog} : No one is suspected')
|
||||||
|
|
||||||
for suspect in self.UID_REPUTATION_DB:
|
for suspect in self.UID_REPUTATION_DB:
|
||||||
self.Irc.send2socket(f':{dnickname} PRIVMSG {dchanlog} : Uid: {suspect.uid} | Nickname: {suspect.nickname} | Connected on: {suspect.connected_datetime} | Updated on: {suspect.updated_datetime}')
|
self.Irc.send2socket(f':{dnickname} PRIVMSG {dchanlog} : Uid: {suspect.uid} | Nickname: {suspect.nickname} | Reputation: {suspect.score} | Secret code: {suspect.secret_code} | Connected on: {suspect.connected_datetime}')
|
||||||
|
|
||||||
case 'code':
|
case 'code':
|
||||||
try:
|
try:
|
||||||
@@ -1297,7 +1261,7 @@ class Defender():
|
|||||||
self.Logs.debug(f'{jailed_UID} - {jailed_nickname} removed from REPUTATION_DB')
|
self.Logs.debug(f'{jailed_UID} - {jailed_nickname} removed from REPUTATION_DB')
|
||||||
self.Irc.send2socket(f":{service_id} SAPART {jailed_nickname} {jailed_salon}")
|
self.Irc.send2socket(f":{service_id} SAPART {jailed_nickname} {jailed_salon}")
|
||||||
self.Irc.send2socket(f":{service_id} SAJOIN {jailed_nickname} {welcome_salon}")
|
self.Irc.send2socket(f":{service_id} SAJOIN {jailed_nickname} {welcome_salon}")
|
||||||
self.Irc.send2socket(f":{link} REPUTATION {jailed_IP} {int(reputation_seuil) + 1}")
|
self.Irc.send2socket(f":{link} REPUTATION {jailed_IP} {self.ModConfig.reputation_score_after_release}")
|
||||||
self.User.get_User(jailed_UID).score_connexion = reputation_seuil + 1
|
self.User.get_User(jailed_UID).score_connexion = reputation_seuil + 1
|
||||||
self.Irc.send2socket(f":{service_id} PRIVMSG {jailed_nickname} :[{color_green} MOT DE PASS CORRECT {color_black}] : You have now the right to enjoy the network !")
|
self.Irc.send2socket(f":{service_id} PRIVMSG {jailed_nickname} :[{color_green} MOT DE PASS CORRECT {color_black}] : You have now the right to enjoy the network !")
|
||||||
|
|
||||||
@@ -1311,7 +1275,6 @@ class Defender():
|
|||||||
except KeyError as ke:
|
except KeyError as ke:
|
||||||
self.Logs.error(f'_hcmd code: KeyError {ke}')
|
self.Logs.error(f'_hcmd code: KeyError {ke}')
|
||||||
# self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Right command : /msg {dnickname} code [code]')
|
# self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Right command : /msg {dnickname} code [code]')
|
||||||
pass
|
|
||||||
|
|
||||||
case 'reputation':
|
case 'reputation':
|
||||||
# .reputation [on/off] --> activate or deactivate reputation system
|
# .reputation [on/off] --> activate or deactivate reputation system
|
||||||
@@ -1336,6 +1299,15 @@ class Defender():
|
|||||||
self.Irc.send2socket(f":{service_id} JOIN {jail_chan}")
|
self.Irc.send2socket(f":{service_id} JOIN {jail_chan}")
|
||||||
self.Irc.send2socket(f":{service_id} SAMODE {jail_chan} +{dumodes} {dnickname}")
|
self.Irc.send2socket(f":{service_id} SAMODE {jail_chan} +{dumodes} {dnickname}")
|
||||||
self.Irc.send2socket(f":{service_id} MODE {jail_chan} +{jail_chan_mode}")
|
self.Irc.send2socket(f":{service_id} MODE {jail_chan} +{jail_chan_mode}")
|
||||||
|
|
||||||
|
if self.ModConfig.reputation_sg == 1:
|
||||||
|
for chan in self.Channel.UID_CHANNEL_DB:
|
||||||
|
if chan.name != jail_chan:
|
||||||
|
self.Irc.send2socket(f":{service_id} MODE {chan.name} +b ~security-group:unknown-users")
|
||||||
|
self.Irc.send2socket(f":{service_id} MODE {chan.name} +e ~security-group:webirc-users")
|
||||||
|
self.Irc.send2socket(f":{service_id} MODE {chan.name} +e ~security-group:known-users")
|
||||||
|
self.Irc.send2socket(f":{service_id} MODE {chan.name} +e ~security-group:websocket-users")
|
||||||
|
|
||||||
self.add_defender_channel(jail_chan)
|
self.add_defender_channel(jail_chan)
|
||||||
|
|
||||||
if activation == 'off':
|
if activation == 'off':
|
||||||
@@ -1349,17 +1321,26 @@ class Defender():
|
|||||||
self.Irc.send2socket(f":{service_id} SAMODE {jail_chan} -{dumodes} {dnickname}")
|
self.Irc.send2socket(f":{service_id} SAMODE {jail_chan} -{dumodes} {dnickname}")
|
||||||
self.Irc.send2socket(f":{service_id} MODE {jail_chan} -sS")
|
self.Irc.send2socket(f":{service_id} MODE {jail_chan} -sS")
|
||||||
self.Irc.send2socket(f":{service_id} PART {jail_chan}")
|
self.Irc.send2socket(f":{service_id} PART {jail_chan}")
|
||||||
|
|
||||||
|
for chan in self.Channel.UID_CHANNEL_DB:
|
||||||
|
if chan.name != jail_chan:
|
||||||
|
self.Irc.send2socket(f":{service_id} MODE {chan.name} -b ~security-group:unknown-users")
|
||||||
|
self.Irc.send2socket(f":{service_id} MODE {chan.name} -e ~security-group:webirc-users")
|
||||||
|
self.Irc.send2socket(f":{service_id} MODE {chan.name} -e ~security-group:known-users")
|
||||||
|
self.Irc.send2socket(f":{service_id} MODE {chan.name} -e ~security-group:websocket-users")
|
||||||
|
|
||||||
self.delete_defender_channel(jail_chan)
|
self.delete_defender_channel(jail_chan)
|
||||||
|
|
||||||
if len_cmd == 4:
|
if len_cmd == 4:
|
||||||
get_set = str(cmd[1]).lower()
|
get_set = str(cmd[1]).lower()
|
||||||
|
|
||||||
if get_set != 'set':
|
if get_set != 'set':
|
||||||
return False
|
raise IndexError('Showing help')
|
||||||
|
|
||||||
get_options = str(cmd[2]).lower()
|
get_options = str(cmd[2]).lower()
|
||||||
|
|
||||||
match get_options:
|
match get_options:
|
||||||
|
|
||||||
case 'banallchan':
|
case 'banallchan':
|
||||||
key = 'reputation_ban_all_chan'
|
key = 'reputation_ban_all_chan'
|
||||||
get_value = str(cmd[3]).lower()
|
get_value = str(cmd[3]).lower()
|
||||||
@@ -1379,6 +1360,7 @@ class Defender():
|
|||||||
|
|
||||||
self.update_db_configuration(key, 0)
|
self.update_db_configuration(key, 0)
|
||||||
self.Irc.send2socket(f':{dnickname} PRIVMSG {dchanlog} :[ {self.Config.CONFIG_COLOR["verte"]}BAN ON ALL CHANS{self.Config.CONFIG_COLOR["noire"]} ] : Deactivated by {fromuser}')
|
self.Irc.send2socket(f':{dnickname} PRIVMSG {dchanlog} :[ {self.Config.CONFIG_COLOR["verte"]}BAN ON ALL CHANS{self.Config.CONFIG_COLOR["noire"]} ] : Deactivated by {fromuser}')
|
||||||
|
|
||||||
case 'limit':
|
case 'limit':
|
||||||
reputation_seuil = int(cmd[3])
|
reputation_seuil = int(cmd[3])
|
||||||
key = 'reputation_seuil'
|
key = 'reputation_seuil'
|
||||||
@@ -1394,14 +1376,34 @@ class Defender():
|
|||||||
self.Irc.send2socket(f':{dnickname} PRIVMSG {dchanlog} :[ {self.Config.CONFIG_COLOR["verte"]}REPUTATION TIMER{self.Config.CONFIG_COLOR["noire"]} ] : Timer set to {str(reputation_timer)} minute(s) by {fromuser}')
|
self.Irc.send2socket(f':{dnickname} PRIVMSG {dchanlog} :[ {self.Config.CONFIG_COLOR["verte"]}REPUTATION TIMER{self.Config.CONFIG_COLOR["noire"]} ] : Timer set to {str(reputation_timer)} minute(s) by {fromuser}')
|
||||||
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Reputation set to {reputation_timer}')
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Reputation set to {reputation_timer}')
|
||||||
|
|
||||||
|
case 'score_after_release':
|
||||||
|
reputation_score_after_release = int(cmd[3])
|
||||||
|
key = 'reputation_score_after_release'
|
||||||
|
self.update_db_configuration(key, reputation_score_after_release)
|
||||||
|
self.Irc.send2socket(f':{dnickname} PRIVMSG {dchanlog} :[ {self.Config.CONFIG_COLOR["verte"]}REPUTATION SCORE AFTER RELEASE{self.Config.CONFIG_COLOR["noire"]} ] : Reputation score after release set to {str(reputation_score_after_release)} by {fromuser}')
|
||||||
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Reputation score after release set to {reputation_score_after_release}')
|
||||||
|
|
||||||
|
case 'security_group':
|
||||||
|
reputation_sg = int(cmd[3])
|
||||||
|
key = 'reputation_sg'
|
||||||
|
self.update_db_configuration(key, reputation_sg)
|
||||||
|
self.Irc.send2socket(f':{dnickname} PRIVMSG {dchanlog} :[ {self.Config.CONFIG_COLOR["verte"]}REPUTATION SECURITY-GROUP{self.Config.CONFIG_COLOR["noire"]} ] : Reputation Security-group set to {str(reputation_sg)} by {fromuser}')
|
||||||
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Reputation score after release set to {reputation_sg}')
|
||||||
|
|
||||||
case _:
|
case _:
|
||||||
pass
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} :Right command : /msg {dnickname} reputation [ON/OFF]')
|
||||||
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} :Right command : /msg {dnickname} reputation set banallchan [ON/OFF]')
|
||||||
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} :Right command : /msg {dnickname} reputation set limit [1234]')
|
||||||
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} :Right command : /msg {dnickname} reputation set score_after_release [1234]')
|
||||||
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} :Right command : /msg {dnickname} reputation set timer [1234]')
|
||||||
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} :Right command : /msg {dnickname} reputation set action [kill|None]')
|
||||||
|
|
||||||
except IndexError as ie:
|
except IndexError as ie:
|
||||||
self.Logs.warning(f'{ie}')
|
self.Logs.warning(f'{ie}')
|
||||||
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Right command : /msg {dnickname} reputation [ON/OFF]')
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Right command : /msg {dnickname} reputation [ON/OFF]')
|
||||||
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Right command : /msg {dnickname} reputation set banallchan [ON/OFF]')
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Right command : /msg {dnickname} reputation set banallchan [ON/OFF]')
|
||||||
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Right command : /msg {dnickname} reputation set limit [1234]')
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Right command : /msg {dnickname} reputation set limit [1234]')
|
||||||
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Right command : /msg {dnickname} reputation set score_after_release [1234]')
|
||||||
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Right command : /msg {dnickname} reputation set timer [1234]')
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Right command : /msg {dnickname} reputation set timer [1234]')
|
||||||
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Right command : /msg {dnickname} reputation set action [kill|None]')
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : Right command : /msg {dnickname} reputation set action [kill|None]')
|
||||||
|
|
||||||
@@ -1583,6 +1585,7 @@ class Defender():
|
|||||||
try:
|
try:
|
||||||
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : [{color_green if self.ModConfig.reputation == 1 else color_red}Reputation{color_black}] ==> {self.ModConfig.reputation}')
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : [{color_green if self.ModConfig.reputation == 1 else color_red}Reputation{color_black}] ==> {self.ModConfig.reputation}')
|
||||||
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : reputation_seuil ==> {self.ModConfig.reputation_seuil}')
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : reputation_seuil ==> {self.ModConfig.reputation_seuil}')
|
||||||
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : reputation_after_release ==> {self.ModConfig.reputation_score_after_release}')
|
||||||
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : reputation_ban_all_chan ==> {self.ModConfig.reputation_ban_all_chan}')
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : reputation_ban_all_chan ==> {self.ModConfig.reputation_ban_all_chan}')
|
||||||
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : reputation_timer ==> {self.ModConfig.reputation_timer}')
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : reputation_timer ==> {self.ModConfig.reputation_timer}')
|
||||||
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : [Proxy_scan]')
|
self.Irc.send2socket(f':{dnickname} NOTICE {fromuser} : [Proxy_scan]')
|
||||||
@@ -1923,8 +1926,3 @@ class Defender():
|
|||||||
if not chan.name in channel_to_dont_quit:
|
if not chan.name in channel_to_dont_quit:
|
||||||
self.Irc.send2socket(f":{service_id} PART {chan.name}")
|
self.Irc.send2socket(f":{service_id} PART {chan.name}")
|
||||||
self.join_saved_channels()
|
self.join_saved_channels()
|
||||||
|
|
||||||
case 'show_users':
|
|
||||||
|
|
||||||
for db_user in self.User.UID_DB:
|
|
||||||
self.Irc.send2socket(f":{dnickname} NOTICE {fromuser} :UID : {db_user.uid} - isWebirc: {db_user.isWebirc} - Nickname: {db_user.nickname} - Connection: {db_user.connexion_datetime}")
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"version": "5.0.6"
|
"version": "5.0.7"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user