# * _ __ __ _ _
# * / \ _ _ _ __ ___ _ __ __ _| \/ | ___ __| |_ _| | ___ ___
# * / _ \| | | | '__/ _ \| '__/ _` | |\/| |/ _ \ / _` | | | | |/ _ \/ __|
# * / ___ \ |_| | | | (_) | | | (_| | | | | (_) | (_| | |_| | | __/\__ \
# * /_/ \_\__,_|_| \___/|_| \__,_|_| |_|\___/ \__,_|\__,_|_|\___||___/
# *
# * © Copyright 2026
# *
# * https://t.me/AuroraModules
# *
# * 🔒 Code is licensed under GNU AGPLv3
# * 🌐 https://www.gnu.org/licenses/agpl-3.0.html
# * ⛔️ You CANNOT edit this file without direct permission from the author.
# * ⛔️ You CANNOT distribute this file if you have modified it without the direct permission of the author.
# Name: InvalidFiles
# Author: Felix?
# Commands:
# .CreateInvalidFile (cifile) | .FormatFiles (ffiles)
# scope: hikka_only
# meta developer: @AuroraModules
__version__ = (1, 0, 0)
import os
import re
import time
from .. import loader, utils # type: ignore
from telethon.tl.types import Message # type: ignore
from telethon.tl.functions.messages import EditMessageRequest # type: ignore
from telethon.tl.types import InputMediaUploadedDocument, DocumentAttributeFilename # type: ignore
@loader.tds
class InvalidFilesMod(loader.Module):
"""Module for creating corrupted (broken) files of any format."""
strings = {
"name": "InvalidFiles",
"invalid_format": "
" "" ), "invalid_args": ( "👤 File name:{}\n" "⚖️ Size:{}{}\n" "⌛️ Creation:{:.2f} sec.\n" "📤 Upload:{:.2f} sec." "
{prefix}cifile <name> <size>\n"
"Example: {prefix}cifile test.txt 3.4mb\n\n"
"Supported: b, kb, mb, gb"
),
"creating": ".txt .docx .pdf .rtf\n"
"📊 Spreadsheets: .xlsx .csv\n"
"📈 Presentations: .pptx\n"
"🖼️ Images: .jpg .png .gif .bmp .webp\n"
"🎵 Audio: .mp3 .wav .flac\n"
"🎬 Video: .mp4 .mkv .avi\n"
"📦 Archives: .zip .rar .7z\n"
"💻 Code: .py .js .html .css .json"
),
}
strings_ru = {
"invalid_format": "" "" ), "invalid_args": ( "👤 Имя файла:{}\n" "⚖️ Размер:{}{}\n" "⌛️ Создание:{:.2f} сек.\n" "📤 Отправка:{:.2f} сек." "
{prefix}cifile <имя> <размер>\n"
"Пример: {prefix}cifile test.txt 3.4mb\n\n"
"Поддерживаются: b, kb, mb, gb"
),
"creating": ".txt .docx .pdf .rtf\n"
"📊 Таблицы: .xlsx .csv\n"
"📈 Презентации: .pptx\n"
"🖼️ Изображения: .jpg .png .gif .bmp .webp\n"
"🎵 Аудио: .mp3 .wav .flac\n"
"🎬 Видео: .mp4 .mkv .avi\n"
"📦 Архивы: .zip .rar .7z\n"
"💻 Код: .py .js .html .css .json"
),
}
strings_uz = {
"invalid_format": "" "" ), "invalid_args": ( "👤 Fayl nomi:{}\n" "⚖️ Hajmi:{}{}\n" "⌛️ Yaratish:{:.2f} sek.\n" "📤 Yuborish:{:.2f} sek." "
{prefix}cifile <nom> <hajm>\n"
"Misol: {prefix}cifile test.txt 3.4mb\n\n"
"Qo‘llab-quvvatlanadi: b, kb, mb, gb"
),
"creating": ".txt .docx .pdf .rtf\n"
"📊 Jadvallar: .xlsx .csv\n"
"📈 Taqdimotlar: .pptx\n"
"🖼️ Rasmlar: .jpg .png .gif .bmp .webp\n"
"🎵 Audio: .mp3 .wav .flac\n"
"🎬 Video: .mp4 .mkv .avi\n"
"📦 Arxivlar: .zip .rar .7z\n"
"💻 Kod: .py .js .html .css .json"
),
}
strings_de = {
"invalid_format": "" "" ), "invalid_args": ( "👤 Dateiname:{}\n" "⚖️ Größe:{}{}\n" "⌛️ Erstellung:{:.2f} Sek.\n" "📤 Upload:{:.2f} Sek." "
{prefix}cifile <name> <größe>\n"
"Beispiel: {prefix}cifile test.txt 3.4mb\n\n"
"Unterstützt: b, kb, mb, gb"
),
"creating": ".txt .docx .pdf .rtf\n"
"📊 Tabellen: .xlsx .csv\n"
"📈 Präsentationen: .pptx\n"
"🖼️ Bilder: .jpg .png .gif .bmp .webp\n"
"🎵 Audio: .mp3 .wav .flac\n"
"🎬 Video: .mp4 .mkv .avi\n"
"📦 Archive: .zip .rar .7z\n"
"💻 Code: .py .js .html .css .json"
),
}
strings_es = {
"invalid_format": "" "" ), "invalid_args": ( "👤 Nombre del archivo:{}\n" "⚖️ Tamaño:{}{}\n" "⌛️ Creación:{:.2f} seg.\n" "📤 Subida:{:.2f} seg." "
{prefix}cifile <nombre> <tamaño>\n"
"Ejemplo: {prefix}cifile test.txt 3.4mb\n\n"
"Soportado: b, kb, mb, gb"
),
"creating": ".txt .docx .pdf .rtf\n"
"📊 Hojas de cálculo: .xlsx .csv\n"
"📈 Presentaciones: .pptx\n"
"🖼️ Imágenes: .jpg .png .gif .bmp .webp\n"
"🎵 Audio: .mp3 .wav .flac\n"
"🎬 Video: .mp4 .mkv .avi\n"
"📦 Archivos: .zip .rar .7z\n"
"💻 Código: .py .js .html .css .json"
),
}
async def create_invalid_file(self, filename: str, size_str: str):
match = re.fullmatch(r"(\d+(?:\.\d+)?)(b|kb|mb|gb)", size_str.lower())
if not match:
return False, self.strings["invalid_format"]
multiplier = {
"b": 1,
"kb": 1024,
"mb": 1024 ** 2,
"gb": 1024 ** 3,
}
size_value = float(match.group(1))
unit = match.group(2)
total_bytes = int(size_value * multiplier[unit])
if total_bytes > 2 * 1024 ** 3:
return False, self.strings["max_size"]
start_time = time.time()
try:
with open(filename, "wb") as f:
remaining = total_bytes
chunk = 5 * 1024 * 1024
while remaining > 0:
write_size = min(chunk, remaining)
f.write(os.urandom(write_size))
remaining -= write_size
except Exception as e:
return False, self.strings["error"].format(e)
elapsed = time.time() - start_time
return True, (filename, size_value, unit, elapsed)
@loader.command(
ru_doc="<имя>.<формат> <размер> — создать битый файл",
uz_doc="