mirror of
https://github.com/iio612/DEFENDER.git
synced 2026-02-14 19:54:21 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f31e67be6 | ||
|
|
3cd2077f63 | ||
|
|
9c78ad0860 | ||
|
|
487f9a2762 |
148
README.md
148
README.md
@@ -57,58 +57,146 @@ Pour Les prochains lancement de defender vous devez utiliser la commande suivant
|
||||
$ sudo systemctl --user start defender
|
||||
|
||||
# Configuration
|
||||
|
||||
```
|
||||
SERVEUR (Serveur)
|
||||
SERVEUR_IP: Adresse IP du serveur IRC à rejoindre.
|
||||
SERVEUR_HOSTNAME: Nom d'hôte du serveur IRC à rejoindre (optionnel).
|
||||
SERVEUR_LINK: Lien vers le serveur IRC (optionnel).
|
||||
SERVEUR_PORT: Port de connexion au serveur IRC.
|
||||
SERVEUR_PASSWORD: Mot de passe d'enregistrement du service sur le serveur IRC.
|
||||
SERVEUR_ID: Identifiant unique du service.
|
||||
SERVEUR_SSL: Active la connexion SSL sécurisée au serveur IRC (true/false).
|
||||
* SERVEUR_IP: Adresse IP du serveur IRC à rejoindre. (default : 127.0.0.1)
|
||||
* SERVEUR_HOSTNAME: Nom d'hôte du serveur IRC à rejoindre (optionnel).
|
||||
* SERVEUR_LINK: Lien vers le serveur IRC (optionnel).
|
||||
* SERVEUR_PORT: Port de connexion au serveur IRC.
|
||||
* SERVEUR_PASSWORD: Mot de passe d'enregistrement du service sur le serveur IRC.
|
||||
SERVEUR_ID: Identifiant unique du service. (default : 19Z)
|
||||
SERVEUR_SSL: Active la connexion SSL sécurisée au serveur IRC (true/false) (default : false).
|
||||
|
||||
SERVICE (Service)
|
||||
SERVICE_NAME: Nom du service IRC.
|
||||
SERVICE_NICKNAME: Surnom utilisé par le service sur le serveur IRC.
|
||||
SERVICE_REALNAME: Nom réel du service affiché sur le serveur IRC.
|
||||
SERVICE_USERNAME: Nom d'utilisateur utilisé par le service pour se connecter au serveur IRC.
|
||||
SERVICE_HOST: Nom d'hôte du service affiché sur le serveur IRC (optionnel).
|
||||
SERVICE_INFO: Description du service.
|
||||
SERVICE_CHANLOG: Canal utilisé pour la journalisation des actions du service.
|
||||
SERVICE_SMODES: Modes serveur appliqués aux canaux rejoints par le service.
|
||||
SERVICE_CMODES: Modes de canal appliqués aux canaux rejoints par le service.
|
||||
SERVICE_UMODES: Modes utilisateur appliqués au service.
|
||||
SERVICE_PREFIX: Caractère utilisé comme préfixe des commandes du service.
|
||||
SERVICE_NAME: Nom du service IRC. (default : Defender)
|
||||
SERVICE_NICKNAME: Surnom utilisé par le service sur le serveur IRC. (default : Defender)
|
||||
SERVICE_REALNAME: Nom réel du service affiché sur le serveur IRC. (default : Defender Security)
|
||||
SERVICE_USERNAME: Nom d'utilisateur utilisé par le service pour se connecter au serveur IRC. (default : IRCSecurity)
|
||||
SERVICE_HOST: Nom d'hôte du service affiché sur le serveur IRC (optionnel). (default : defender.local.network)
|
||||
SERVICE_INFO: Description du service. (default : Defender Network IRC Service)
|
||||
SERVICE_CHANLOG: Canal utilisé pour la journalisation des actions du service. (default : #services)
|
||||
SERVICE_SMODES: Modes serveur appliqués aux canaux rejoints par le service. (default : +ioqBS)
|
||||
SERVICE_CMODES: Modes de canal appliqués aux canaux rejoints par le service. (default : ntsOP)
|
||||
SERVICE_UMODES: Modes utilisateur appliqués au service. (default : o)
|
||||
SERVICE_PREFIX: Caractère utilisé comme préfixe des commandes du service. (default : !)
|
||||
|
||||
COMPTE (Compte)
|
||||
OWNER: Nom d'utilisateur possédant les droits d'administration du service.
|
||||
PASSWORD: Mot de passe de l'administrateur du service.
|
||||
OWNER: Nom d'utilisateur possédant les droits d'administration du service. (default : admin)
|
||||
PASSWORD: Mot de passe de l'administrateur du service. (default : admin)
|
||||
|
||||
CANAUX (Canaux)
|
||||
SALON_JAIL: Canal utilisé comme prison pour les utilisateurs sanctionnés.
|
||||
SALON_JAIL_MODES: Modes appliqués au canal de prison.
|
||||
SALON_LIBERER: Canal utilisé pour la libération des utilisateurs sanctionnés.
|
||||
SALON_JAIL: Canal utilisé comme prison pour les utilisateurs sanctionnés. (default : #jail)
|
||||
SALON_JAIL_MODES: Modes appliqués au canal de prison. (default : sS)
|
||||
SALON_LIBERER: Canal utilisé pour la libération des utilisateurs sanctionnés. (default : #welcome)
|
||||
|
||||
API (API)
|
||||
API_TIMEOUT: Durée maximale d'attente d'une réponse de l'API en secondes.
|
||||
API_TIMEOUT: Durée maximale d'attente d'une réponse de l'API en secondes. (default : 2)
|
||||
|
||||
SCANNER (Scanner)
|
||||
PORTS_TO_SCAN: Liste des ports à scanner pour détecter des serveurs potentiellement malveillants.
|
||||
PORTS_TO_SCAN: Liste des ports à scanner pour détecter des serveurs potentiellement malveillants. (default : [])
|
||||
|
||||
SÉCURITÉ (Sécurité)
|
||||
WHITELISTED_IP: Liste d'adresses IP autorisées à contourner certaines restrictions.
|
||||
GLINE_DURATION: Durée de bannissement temporaire d'un utilisateur en minutes.
|
||||
WHITELISTED_IP: Liste d'adresses IP autorisées à contourner certaines restrictions. (default : ['127.0.0.1'])
|
||||
GLINE_DURATION: Durée de bannissement temporaire d'un utilisateur en minutes. (default : "30")
|
||||
|
||||
DEBUG (Debug)
|
||||
DEBUG_LEVEL: Niveau de verbosité des messages de debug (plus grand est le nombre, plus il y a d'informations).
|
||||
DEBUG_LEVEL: Niveau de verbosité des messages de debug (plus grand est le nombre, plus il y a d'informations). (default : 20) Pour une production
|
||||
|
||||
COULEURS (Couleurs)
|
||||
CONFIG_COLOR: Dictionnaire contenant des codes de couleurs IRC pour un meilleur affichage des messages.
|
||||
|
||||
```
|
||||
Modification de la configuration
|
||||
|
||||
Vous devez modifier le fichier configuration.json en remplaçant les valeurs par défaut avec vos propres informations. Assurez-vous de bien lire la description de chaque paramètre pour une configuration optimale du service.
|
||||
|
||||
## Exemple de configuration de base
|
||||
```json
|
||||
{
|
||||
"SERVEUR_IP": "IP.DE.TON.SERVER",
|
||||
"SERVEUR_HOSTNAME": "HOST.DE.TON.SERVER",
|
||||
"SERVEUR_LINK": "LINK.DE.TON.SERVER",
|
||||
"SERVEUR_PORT": 6901,
|
||||
"SERVEUR_PASSWORD": "MOT_DE_PASS_DE_TON_LINK",
|
||||
"SERVEUR_ID": "10Z",
|
||||
"SERVEUR_SSL": true,
|
||||
|
||||
"SERVICE_NAME": "defender",
|
||||
"SERVICE_NICKNAME": "Dev-PyDefender",
|
||||
"SERVICE_REALNAME": "Python Defender Security",
|
||||
"SERVICE_USERNAME": "Dev-PyDefender",
|
||||
"SERVICE_HOST": "HOST.DE.TON.DEFENDER",
|
||||
|
||||
"OWNER": "TON_NICK_NAME",
|
||||
"PASSWORD": "admin",
|
||||
|
||||
"CONFIG_COLOR": {
|
||||
"blanche": "\\u0003\\u0030",
|
||||
"noire": "\\u0003\\u0031",
|
||||
"bleue": "\\u0003\\u0020",
|
||||
"verte": "\\u0003\\u0033",
|
||||
"rouge": "\\u0003\\u0034",
|
||||
"jaune": "\\u0003\\u0036",
|
||||
"gras": "\\u0002",
|
||||
"nogc": "\\u0002\\u0003"
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Exemple complet de configuration
|
||||
```json
|
||||
{
|
||||
"SERVEUR_IP": "YOUR.SERVER.IP",
|
||||
"SERVEUR_HOSTNAME": "irc.deb.biz.st",
|
||||
"SERVEUR_LINK": "defenderdev.deb.biz.st",
|
||||
"SERVEUR_PORT": 6901,
|
||||
"SERVEUR_PASSWORD": "yourpassword",
|
||||
"SERVEUR_ID": "10Z",
|
||||
"SERVEUR_SSL": true,
|
||||
|
||||
"SERVICE_NAME": "defender",
|
||||
"SERVICE_NICKNAME": "Dev-PyDefender",
|
||||
"SERVICE_REALNAME": "Python Defender Security",
|
||||
"SERVICE_USERNAME": "Dev-PyDefender",
|
||||
"SERVICE_HOST": "HOST.DE.TON.DEFENDER",
|
||||
"SERVICE_INFO": "Network IRC Service",
|
||||
"SERVICE_CHANLOG": "#services",
|
||||
"SERVICE_SMODES": "+ioqBS",
|
||||
"SERVICE_CMODES": "ntsOP",
|
||||
"SERVICE_UMODES": "o",
|
||||
"SERVICE_PREFIX": "!",
|
||||
|
||||
"OWNER": "TON_NICK_NAME",
|
||||
"PASSWORD": "admin",
|
||||
|
||||
"SALON_JAIL": "#jail",
|
||||
"SALON_JAIL_MODES": "sS",
|
||||
"SALON_LIBERER": "#welcome",
|
||||
|
||||
"SALON_CLONES": "#clones",
|
||||
|
||||
"API_TIMEOUT": 2,
|
||||
|
||||
"PORTS_TO_SCAN": [3028, 8080, 1080, 1085, 4145, 9050],
|
||||
"WHITELISTED_IP": ["127.0.0.1"],
|
||||
"GLINE_DURATION": "30",
|
||||
|
||||
"DEBUG_LEVEL": 10,
|
||||
|
||||
"CONFIG_COLOR": {
|
||||
"blanche": "\\u0003\\u0030",
|
||||
"noire": "\\u0003\\u0031",
|
||||
"bleue": "\\u0003\\u0020",
|
||||
"verte": "\\u0003\\u0033",
|
||||
"rouge": "\\u0003\\u0034",
|
||||
"jaune": "\\u0003\\u0036",
|
||||
"gras": "\\u0002",
|
||||
"nogc": "\\u0002\\u0003"
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
# \\!/ Attention \\!/
|
||||
Le mot de passe de l'administrateur et le mot de passe du service doivent être modifiés pour des raisons de sécurité.
|
||||
Ne partagez pas vos informations de connexion au serveur IRC avec des tiers.
|
||||
|
||||
@@ -414,6 +414,7 @@ class Clones:
|
||||
nickname: str
|
||||
username: str
|
||||
realname: str
|
||||
channels: list
|
||||
vhost: str = None
|
||||
connected: bool = False
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ class Connection:
|
||||
fullname = str(response[0]).replace(':', '')
|
||||
nickname = fullname.split('!')[0].replace(':','')
|
||||
|
||||
if response[2] == current_clone_nickname:
|
||||
if response[2] == current_clone_nickname and nickname != self.Config.SERVICE_NICKNAME:
|
||||
message = []
|
||||
for i in range(3, len(response)):
|
||||
message.append(response[i])
|
||||
|
||||
@@ -28,22 +28,17 @@ class Install:
|
||||
|
||||
self.set_configuration()
|
||||
|
||||
if not self.check_python_version():
|
||||
# Tester si c'est la bonne version de python
|
||||
exit("Python Version Error")
|
||||
else:
|
||||
if self.skip_install:
|
||||
return None
|
||||
|
||||
if self.skip_install:
|
||||
return None
|
||||
# Sinon tester les dependances python et les installer avec pip
|
||||
if self.do_install():
|
||||
|
||||
# Sinon tester les dependances python et les installer avec pip
|
||||
if self.do_install():
|
||||
self.install_dependencies()
|
||||
|
||||
self.install_dependencies()
|
||||
self.create_service_file()
|
||||
|
||||
self.create_service_file()
|
||||
|
||||
self.print_final_message()
|
||||
self.print_final_message()
|
||||
|
||||
return None
|
||||
|
||||
@@ -74,13 +69,24 @@ class Install:
|
||||
venv_python_executable=f'{os.path.join(defender_install_folder, venv_folder, "bin")}{os.sep}python'
|
||||
)
|
||||
|
||||
# Exclude Windows OS
|
||||
if not self.check_python_version():
|
||||
# If the Python version is not good then Exit
|
||||
exit("/!\\ Python version error /!\\")
|
||||
|
||||
if not os.path.exists(os.path.join(self.config.defender_install_folder, 'core', 'configuration.json')):
|
||||
# If configuration file do not exist
|
||||
exit("/!\\ Configuration file (configuration.json) doesn't exist /!\\")
|
||||
|
||||
# Exclude Windows OS from the installation
|
||||
if os.name == 'nt':
|
||||
#print('/!\\ Skip installation /!\\')
|
||||
self.skip_install = True
|
||||
else:
|
||||
if self.is_root():
|
||||
self.skip_install = True
|
||||
return False
|
||||
|
||||
if self.is_root():
|
||||
exit(f'/!\\ I highly not recommend running Defender as root /!\\')
|
||||
self.skip_install = True
|
||||
return False
|
||||
|
||||
def is_root(self) -> bool:
|
||||
|
||||
|
||||
@@ -1376,7 +1376,7 @@ class Irc:
|
||||
self.send2socket(f':{dnickname} NOTICE {fromuser} : {uptime}')
|
||||
|
||||
case 'copyright':
|
||||
self.send2socket(f':{dnickname} NOTICE {fromuser} : # Defender V.{self.Config.current_version} Developped by adator® and dktmb® #')
|
||||
self.send2socket(f':{dnickname} NOTICE {fromuser} : # Defender V.{self.Config.current_version} Developped by adator® #')
|
||||
|
||||
case 'checkversion':
|
||||
|
||||
|
||||
@@ -150,8 +150,33 @@ class Config:
|
||||
with open(conf_filename, 'r') as configuration_data:
|
||||
configuration:dict[str, Union[str, int, list, dict]] = json.load(configuration_data)
|
||||
|
||||
for key, value in configuration['CONFIG_COLOR'].items():
|
||||
configuration['CONFIG_COLOR'][key] = str(value).encode('utf-8').decode('unicode_escape')
|
||||
config_dict = {"CONFIG_COLOR" : {
|
||||
"blanche": "\\u0003\\u0030",
|
||||
"noire": "\\u0003\\u0031",
|
||||
"bleue": "\\u0003\\u0020",
|
||||
"verte": "\\u0003\\u0033",
|
||||
"rouge": "\\u0003\\u0034",
|
||||
"jaune": "\\u0003\\u0036",
|
||||
"gras": "\\u0002",
|
||||
"nogc": "\\u0002\\u0003"
|
||||
}
|
||||
}
|
||||
|
||||
missing_color = False
|
||||
|
||||
if not "CONFIG_COLOR" in configuration:
|
||||
missing_color = True
|
||||
configuration_color = config_dict
|
||||
else:
|
||||
configuration_color = configuration["CONFIG_COLOR"]
|
||||
|
||||
if missing_color:
|
||||
for key, value in configuration_color.items():
|
||||
configuration_color['CONFIG_COLOR'][key] = str(value).encode('utf-8').decode('unicode_escape')
|
||||
configuration['CONFIG_COLOR'] = configuration_color['CONFIG_COLOR']
|
||||
else:
|
||||
for key, value in configuration['CONFIG_COLOR'].items():
|
||||
configuration['CONFIG_COLOR'][key] = str(value).encode('utf-8').decode('unicode_escape')
|
||||
|
||||
return configuration
|
||||
|
||||
@@ -164,35 +189,35 @@ class Config:
|
||||
import_config = self.__load_json_service_configuration()
|
||||
|
||||
ConfigObject: ConfigDataModel = ConfigDataModel(
|
||||
SERVEUR_IP=import_config["SERVEUR_IP"],
|
||||
SERVEUR_HOSTNAME=import_config["SERVEUR_HOSTNAME"],
|
||||
SERVEUR_LINK=import_config["SERVEUR_LINK"],
|
||||
SERVEUR_PORT=import_config["SERVEUR_PORT"],
|
||||
SERVEUR_PASSWORD=import_config["SERVEUR_PASSWORD"],
|
||||
SERVEUR_ID=import_config["SERVEUR_ID"],
|
||||
SERVEUR_SSL=import_config["SERVEUR_SSL"],
|
||||
SERVICE_NAME=import_config["SERVICE_NAME"],
|
||||
SERVICE_NICKNAME=import_config["SERVICE_NICKNAME"],
|
||||
SERVICE_REALNAME=import_config["SERVICE_REALNAME"],
|
||||
SERVICE_USERNAME=import_config["SERVICE_USERNAME"],
|
||||
SERVICE_HOST=import_config["SERVICE_HOST"],
|
||||
SERVICE_INFO=import_config["SERVICE_INFO"],
|
||||
SERVICE_CHANLOG=import_config["SERVICE_CHANLOG"],
|
||||
SERVICE_SMODES=import_config["SERVICE_SMODES"],
|
||||
SERVICE_CMODES=import_config["SERVICE_CMODES"],
|
||||
SERVICE_UMODES=import_config["SERVICE_UMODES"],
|
||||
SERVICE_PREFIX=import_config["SERVICE_PREFIX"],
|
||||
OWNER=import_config["OWNER"],
|
||||
PASSWORD=import_config["PASSWORD"],
|
||||
SALON_JAIL=import_config["SALON_JAIL"],
|
||||
SALON_JAIL_MODES=import_config["SALON_JAIL_MODES"],
|
||||
SALON_LIBERER=import_config["SALON_LIBERER"],
|
||||
SALON_CLONES=import_config["SALON_CLONES"],
|
||||
API_TIMEOUT=import_config["API_TIMEOUT"],
|
||||
PORTS_TO_SCAN=import_config["PORTS_TO_SCAN"],
|
||||
WHITELISTED_IP=import_config["WHITELISTED_IP"],
|
||||
GLINE_DURATION=import_config["GLINE_DURATION"],
|
||||
DEBUG_LEVEL=import_config["DEBUG_LEVEL"],
|
||||
SERVEUR_IP=import_config["SERVEUR_IP"] if "SERVEUR_IP" in import_config else '127.0.0.1',
|
||||
SERVEUR_HOSTNAME=import_config["SERVEUR_HOSTNAME"] if "SERVEUR_HOSTNAME" in import_config else None,
|
||||
SERVEUR_LINK=import_config["SERVEUR_LINK"] if "SERVEUR_LINK" in import_config else None,
|
||||
SERVEUR_PORT=import_config["SERVEUR_PORT"] if "SERVEUR_PORT" in import_config else 6667,
|
||||
SERVEUR_PASSWORD=import_config["SERVEUR_PASSWORD"] if "SERVEUR_PASSWORD" in import_config else None,
|
||||
SERVEUR_ID=import_config["SERVEUR_ID"] if "SERVEUR_ID" in import_config else '19Z',
|
||||
SERVEUR_SSL=import_config["SERVEUR_SSL"] if "SERVEUR_SSL" in import_config else False,
|
||||
SERVICE_NAME=import_config["SERVICE_NAME"] if "SERVICE_NAME" in import_config else 'Defender',
|
||||
SERVICE_NICKNAME=import_config["SERVICE_NICKNAME"] if "SERVICE_NICKNAME" in import_config else 'Defender',
|
||||
SERVICE_REALNAME=import_config["SERVICE_REALNAME"] if "SERVICE_REALNAME" in import_config else 'Defender Security',
|
||||
SERVICE_USERNAME=import_config["SERVICE_USERNAME"] if "SERVICE_USERNAME" in import_config else 'IRCSecurity',
|
||||
SERVICE_HOST=import_config["SERVICE_HOST"] if "SERVICE_HOST" in import_config else 'defender.local.network',
|
||||
SERVICE_INFO=import_config["SERVICE_INFO"] if "SERVICE_INFO" in import_config else 'Defender Network IRC Service',
|
||||
SERVICE_CHANLOG=import_config["SERVICE_CHANLOG"] if "SERVICE_CHANLOG" in import_config else '#services',
|
||||
SERVICE_SMODES=import_config["SERVICE_SMODES"] if "SERVICE_SMODES" in import_config else '+ioqBS',
|
||||
SERVICE_CMODES=import_config["SERVICE_CMODES"] if "SERVICE_CMODES" in import_config else 'ntsOP',
|
||||
SERVICE_UMODES=import_config["SERVICE_UMODES"] if "SERVICE_UMODES" in import_config else 'o',
|
||||
SERVICE_PREFIX=import_config["SERVICE_PREFIX"] if "SERVICE_PREFIX" in import_config else '!',
|
||||
OWNER=import_config["OWNER"] if "OWNER" in import_config else 'admin',
|
||||
PASSWORD=import_config["PASSWORD"] if "PASSWORD" in import_config else 'admin',
|
||||
SALON_JAIL=import_config["SALON_JAIL"] if "SALON_JAIL" in import_config else '#jail',
|
||||
SALON_JAIL_MODES=import_config["SALON_JAIL_MODES"] if "SALON_JAIL_MODES" in import_config else 'sS',
|
||||
SALON_LIBERER=import_config["SALON_LIBERER"] if "SALON_LIBERER" in import_config else '#welcome',
|
||||
SALON_CLONES=import_config["SALON_CLONES"] if "SALON_CLONES" in import_config else '#clones',
|
||||
API_TIMEOUT=import_config["API_TIMEOUT"] if "API_TIMEOUT" in import_config else 2,
|
||||
PORTS_TO_SCAN=import_config["PORTS_TO_SCAN"] if "PORTS_TO_SCAN" in import_config else [],
|
||||
WHITELISTED_IP=import_config["WHITELISTED_IP"] if "WHITELISTED_IP" in import_config else ['127.0.0.1'],
|
||||
GLINE_DURATION=import_config["GLINE_DURATION"] if "GLINE_DURATION" in import_config else '30',
|
||||
DEBUG_LEVEL=import_config["DEBUG_LEVEL"] if "DEBUG_LEVEL" in import_config else 20,
|
||||
CONFIG_COLOR=import_config["CONFIG_COLOR"],
|
||||
table_admin='core_admin',
|
||||
table_commande='core_command',
|
||||
|
||||
@@ -153,18 +153,22 @@ class Clone():
|
||||
self.Irc.send2socket(f':{self.Config.SERVICE_NICKNAME} PRIVMSG {self.Config.SERVICE_CHANLOG} :Clones start to join {channel_name} with {wait} secondes frequency')
|
||||
if clone_name is None:
|
||||
for clone in self.Clone.UID_CLONE_DB:
|
||||
time.sleep(wait)
|
||||
self.Irc.send2socket(f':{self.Config.SERVICE_NICKNAME} PRIVMSG {clone.nickname} :JOIN {channel_name}')
|
||||
if not channel_name in clone.channels:
|
||||
time.sleep(wait)
|
||||
self.Irc.send2socket(f':{self.Config.SERVICE_NICKNAME} PRIVMSG {clone.nickname} :JOIN {channel_name}')
|
||||
clone.channels.append(channel_name)
|
||||
else:
|
||||
for clone in self.Clone.UID_CLONE_DB:
|
||||
if clone_name == clone.nickname:
|
||||
time.sleep(wait)
|
||||
self.Irc.send2socket(f':{self.Config.SERVICE_NICKNAME} PRIVMSG {clone.nickname} :JOIN {channel_name}')
|
||||
if not channel_name in clone.channels:
|
||||
time.sleep(wait)
|
||||
self.Irc.send2socket(f':{self.Config.SERVICE_NICKNAME} PRIVMSG {clone.nickname} :JOIN {channel_name}')
|
||||
clone.channels.append(channel_name)
|
||||
|
||||
def generate_names(self) -> tuple[str, str, str]:
|
||||
try:
|
||||
fake = faker.Faker('en_GB')
|
||||
nickname = fake.first_name()
|
||||
# nickname = fake.first_name()
|
||||
# username = fake.last_name()
|
||||
|
||||
# Generate Username
|
||||
@@ -175,6 +179,14 @@ class Clone():
|
||||
# Create realname XX F|M Department
|
||||
gender = fake.random_choices(['F','M'], 1)
|
||||
gender = ''.join(gender)
|
||||
|
||||
if gender == 'F':
|
||||
nickname = fake.first_name_female()
|
||||
elif gender == 'M':
|
||||
nickname = fake.first_name_male()
|
||||
else:
|
||||
nickname = fake.first_name()
|
||||
|
||||
age = random.randint(20, 60)
|
||||
fake_fr = faker.Faker(['fr_FR', 'en_GB'])
|
||||
department = fake_fr.department_name()
|
||||
@@ -185,11 +197,11 @@ class Clone():
|
||||
randomize = ''.join(random.choice(caracteres) for _ in range(2))
|
||||
nickname = nickname + str(randomize)
|
||||
self.Clone.insert(
|
||||
self.Clone.CloneModel(alive=True, nickname=nickname, username=username, realname=realname)
|
||||
self.Clone.CloneModel(alive=True, nickname=nickname, username=username, realname=realname, channels=[])
|
||||
)
|
||||
else:
|
||||
self.Clone.insert(
|
||||
self.Clone.CloneModel(alive=True, nickname=nickname, username=username, realname=realname)
|
||||
self.Clone.CloneModel(alive=True, nickname=nickname, username=username, realname=realname, channels=[])
|
||||
)
|
||||
|
||||
return (nickname, username, realname)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"version": "5.2.4"
|
||||
"version": "5.2.5"
|
||||
}
|
||||
Reference in New Issue
Block a user