from flask import Flask, render_template_string, request, jsonify
from telethon import TelegramClient, errors
import asyncio
import threading
import time
import os
import json
app = Flask(__name__)
# ===== КОНФИГ =====
API_ID = 12345 # ЗАМЕНИ НА СВОЙ (получить на my.telegram.org)
API_HASH = "your_api_hash_here" # ЗАМЕНИ НА СВОЙ
# Список аккаунтов-жалобщиков (номер:api_hash) - можно менять через веб-интерфейс
ACCOUNTS = [
{"phone": "+79001234567", "api_hash": "abc123def"},
{"phone": "+79007654321", "api_hash": "ghi456jkl"}
]
TARGET = "" # юзернейм жертвы (@username)
REASON = "spam" # причина: spam, violence, pornography, copyright
REPORT_TEXT = "Массовые жалобы на нарушение правил Telegram: рассылка вредоносных ссылок и фишинг."
REPORT_COUNT = 0
IS_RUNNING = False
THREAD = None
# ===== HTML-ШАБЛОН (встроенный) =====
HTML_TEMPLATE = """
RepBot - Массовые жалобы Telegram
"""
# ===== ФУНКЦИИ ОТПРАВКИ ЖАЛОБ =====
async def send_report(client, target, reason, text):
try:
await client.start()
entity = await client.get_entity(target)
# Отправляем жалобу через внутренний метод Telethon
result = await client.client.invoke(
'account.reportPeer',
peer=entity,
reason=reason,
message=text
)
return True
except Exception as e:
print(f"Ошибка: {e}")
return False
async def attack_loop(target, reason, text):
global REPORT_COUNT, IS_RUNNING
while IS_RUNNING:
for acc in ACCOUNTS:
if not IS_RUNNING:
break
client = TelegramClient(f'session_{acc["phone"]}', API_ID, acc["api_hash"])
try:
success = await send_report(client, target, reason, text)
if success:
REPORT_COUNT += 1
print(f"[+] Жалоба отправлена с {acc['phone']} (#{REPORT_COUNT})")
else:
print(f"[-] Ошибка с {acc['phone']}")
except Exception as e:
print(f"[!] Критическая ошибка: {e}")
finally:
await client.disconnect()
time.sleep(2) # пауза между жалобами
time.sleep(5) # пауза между циклами
def start_attack_thread(target, reason, text):
global THREAD, IS_RUNNING
if IS_RUNNING:
return "Атака уже запущена"
if not target:
return "Укажи цель (@username)"
IS_RUNNING = True
THREAD = threading.Thread(target=lambda: asyncio.run(attack_loop(target, reason, text)))
THREAD.start()
return "Атака запущена!"
def stop_attack():
global IS_RUNNING
IS_RUNNING = False
return "Атака остановлена"
# ===== РОУТЫ FLASK =====
@app.route('/')
def index():
return render_template_string(HTML_TEMPLATE,
accounts=ACCOUNTS,
target=TARGET,
report_text=REPORT_TEXT,
report_count=REPORT_COUNT)
@app.route('/start', methods=['POST'])
def start():
global TARGET, REPORT_TEXT
data = request.json
TARGET = data.get('target', '')
REASON = data.get('reason', 'spam')
REPORT_TEXT = data.get('text', REPORT_TEXT)
msg = start_attack_thread(TARGET, REASON, REPORT_TEXT)
return jsonify({'message': msg})
@app.route('/stop', methods=['POST'])
def stop():
return jsonify({'message': stop_attack()})
@app.route('/stats')
def stats():
return jsonify({'report_count': REPORT_COUNT, 'is_running': IS_RUNNING})
@app.route('/add_account', methods=['POST'])
def add_account():
data = request.json
phone = data.get('phone')
api_hash = data.get('api_hash')
if phone and api_hash:
ACCOUNTS.append({'phone': phone, 'api_hash': api_hash})
save_accounts()
return jsonify({'status': 'ok'})
return jsonify({'status': 'error'}), 400
@app.route('/remove_account', methods=['POST'])
def remove_account():
data = request.json
phone = data.get('phone')
global ACCOUNTS
ACCOUNTS = [a for a in ACCOUNTS if a['phone'] != phone]
save_accounts()
return jsonify({'status': 'ok'})
def save_accounts():
with open('accounts.json', 'w') as f:
json.dump(ACCOUNTS, f)
def load_accounts():
global ACCOUNTS
if os.path.exists('accounts.json'):
with open('accounts.json', 'r') as f:
ACCOUNTS = json.load(f)
# Загружаем аккаунты при старте
load_accounts()
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)