from pyrogram import Client
global animating
import asyncio
import os
from colored import fg, attr
import art
import sys
import time
from threading import Thread
from itertools import cycle
COLOR_CYCLE = cycle(['#FF0000', '#FF7F00', '#FFFF00', '#00FF00', '#0000FF', '#4B0082', '#8F00FF'])
UPDATE_INTERVAL = 0.1
animating = True
def clear_screen():
os.system('cls' if os.name == 'nt' else 'clear')
def color_animator():
while animating:
current_color = next(COLOR_CYCLE)
sys.stdout.write(f'\x1b]10;{current_color}\x1b\\')
sys.stdout.flush()
time.sleep(UPDATE_INTERVAL)
def animated_print(text):
colors = ['red', 'green', 'yellow', 'blue', 'magenta', 'cyan']
result = ''
for idx, char in enumerate(text):
color = colors[(idx + int(time.time() * 10)) % len(colors)]
result += fg(color) + char + attr('reset')
print(result)
class ConsoleSpamManager:
def __init__(self):
global animating
animating = True
self.animation_thread = Thread(target=color_animator)
self.animation_thread.start()
def __del__(self):
global animating
animating = False
self.animation_thread.join()
def run(self):
clear_screen()
self.print_art()
animated_print('Добро пожаловать в NFT Spammer Pro v2! Made by @wizardov\n')
self.collect_api_credentials()
self.choose_action()
def print_art(self):
colors = cycle(['red', 'green', 'yellow', 'blue', 'magenta', 'cyan'])
ascii_art = art.text2art('WIZARDOV SPAMIT')
for line in ascii_art.split('\n'):
colored_line = ''
for idx, char in enumerate(line):
color = next(colors)
colored_line += fg(color) + char + attr('reset')
print(colored_line)
time.sleep(0.05)
def collect_api_credentials(self):
self.api_id = int(self.get_input('Введите ваш API ID: '))
self.api_hash = self.get_input('Введите ваш API Hash: ')
self.session_name = self.get_input('Введите имя сессии (оставьте пустым для дефолтного значения): ').strip() or 'spam_session'
self.interval = float(self.get_input('Введите интервал между сообщениями (в секундах): '))
def get_input(self, prompt):
animated_print(prompt)
return input()
def choose_action(self):
animated_print('\nВыберите действие:\n1. Спам по чатам.\n2. Спам в личные сообщения.\nВаш выбор: ')
action = input()
if action == '1':
self.mass_channel_spam()
elif action == '2':
self.private_message_spam()
else:
animated_print('Некорректный выбор. Повторите попытку.')
self.choose_action()
def mass_channel_spam(self):
try:
with open('рассылка.txt', 'r', encoding='utf-8') as f:
self.channels = [line.strip() for line in f.readlines() if line.startswith('@')]
except FileNotFoundError:
animated_print("Файл 'рассылка.txt' не найден. Создайте его и добавьте туда каналы.")
return None
message = self.get_input('Введите текст сообщения: ')
image_path = self.get_image_path()
confirm = self.get_input(f"\nОтправить сообщение '{message}' в каналы из файла 'рассылка.txt' с изображением '{os.path.basename(image_path)}'? (Y/N): ").lower()
if confirm != 'y':
animated_print('Действие отменено.')
return
async def spam_channels():
async with Client(self.session_name, api_id=self.api_id, api_hash=self.api_hash) as app:
for channel in self.channels:
try:
await app.send_photo(channel, photo=image_path, caption=message)
animated_print(f'Сообщение отправлено в канал {channel}')
await asyncio.sleep(self.interval)
except Exception as e:
animated_print(f'Ошибка отправки в канал {channel}: {e}')
asyncio.run(spam_channels())
self.show_completion()
def private_message_spam(self):
username = self.get_input('Введите юзернейм пользователя: ')
messages_count = int(self.get_input('Сколько сообщений отправить: '))
message_text = self.get_input('Введите текст сообщения: ')
image_path = self.get_image_path()
confirm = self.get_input(f"\nОтправить {messages_count} сообщений пользователю {username} с изображением '{os.path.basename(image_path)}'? (Y/N): ").lower()
if confirm != 'y':
animated_print('Действие отменено.')
return
async def spam_private_messages():
async with Client(self.session_name, api_id=self.api_id, api_hash=self.api_hash) as app:
for _ in range(messages_count):
try:
await app.send_photo(username, photo=image_path, caption=message_text)
animated_print(f'Сообщение отправлено пользователю {username}')
await asyncio.sleep(self.interval)
except Exception as e:
animated_print(f'Ошибка отправки пользователю {username}: {e}')
asyncio.run(spam_private_messages())
self.show_completion()
def get_image_path(self):
path = self.get_input('Введите путь к изображению (или нажмите Enter для пропуска): ').strip()
if not path:
return
return path
def show_completion(self):
clear_screen()
self.print_art()
animated_print('Спам завершён. Хотите повторить? (Y/N): ')
if input().lower() == 'y':
self.run()
else:
animated_print('Выход из программы...')
if __name__ == '__main__':
manager = ConsoleSpamManager()
manager.run()