Fix rehash command. adding security to force quite defender when a asyncio is blocking the system.

This commit is contained in:
adator
2025-11-24 01:52:25 +01:00
parent cbe527d7d9
commit d989dcd762
14 changed files with 256 additions and 117 deletions

View File

@@ -17,6 +17,7 @@ class MClone(MainModel):
hostname: str = 'localhost'
umodes: str = None
remote_ip: str = '127.0.0.1'
group: str = 'Default'
group: str = 'Default',
geoip: str = 'XX'
# DB_CLONES: list[MClone] = []

View File

@@ -28,7 +28,7 @@ async def coro_connect_clones(uplink: 'Clone',
break
if not clone.connected:
await uplink.ctx.Irc.Protocol.send_uid(clone.nickname, clone.username, clone.hostname, clone.uid, clone.umodes, clone.vhost, clone.remote_ip, clone.realname, print_log=False)
await uplink.ctx.Irc.Protocol.send_uid(clone.nickname, clone.username, clone.hostname, clone.uid, clone.umodes, clone.vhost, clone.remote_ip, clone.realname, clone.geoip, print_log=False)
await uplink.ctx.Irc.Protocol.send_join_chan(uidornickname=clone.uid, channel=uplink.ctx.Config.CLONE_CHANNEL, password=uplink.ctx.Config.CLONE_CHANNEL_PASSWORD, print_log=False)
await asyncio.sleep(interval)

View File

@@ -103,6 +103,17 @@ def generate_ipv4_for_clone(faker_instance: 'Faker', auto: bool = True) -> str:
"""
return faker_instance.ipv4_private() if auto else '127.0.0.1'
def generate_country_code_for_clone(faker_instance: 'Faker') -> str:
"""Generate the alpha-2 country code for clone
Args:
faker_instance (Faker): The Faker Instance
Returns:
str: The Country Code
"""
return faker_instance.country_code('alpha-2')
def generate_hostname_for_clone(faker_instance: 'Faker') -> str:
"""Generate hostname for clone
@@ -143,6 +154,8 @@ def create_new_clone(uplink: 'Clone', faker_instance: 'Faker', group: str = 'Def
hostname = generate_hostname_for_clone(faker)
vhost = generate_vhost_for_clone(faker)
geoip = generate_country_code_for_clone(faker)
checkNickname = uplink.Clone.nickname_exists(nickname)
checkUid = uplink.Clone.uid_exists(uid=uid)
@@ -167,7 +180,8 @@ def create_new_clone(uplink: 'Clone', faker_instance: 'Faker', group: str = 'Def
remote_ip=decoded_ip,
vhost=vhost,
group=group,
channels=[]
channels=[],
geoip=geoip
)
uplink.Clone.insert(clone)