Attack / bot.py
Reooiq's picture
Update bot.py
fb99a74 verified
Raw History Blame Contribute Delete
5.42 kB
import asyncio
import os
import logging
import random
import sys
from threading import Thread
from http.server import HTTPServer, SimpleHTTPRequestHandler
from pyrogram import Client, errors, types, enums
# إعداد اللوق
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(message)s')
logger = logging.getLogger(__name__)
# المتغيرات
API_ID = int(os.getenv("API_ID", "33236310"))
API_HASH = os.getenv("API_HASH", "d8b1097f2d17f2e30d7f82d538071726")
SESSION_STRING = os.getenv("SESSION_STRING") or os.getenv("STRING_SESSION") or ""
TARGET_CHANNEL = os.getenv("TARGET_CHANNEL", "")
KEYWORDS = ["دردشة", "شات", "قروب", "سوالف", "تعارف", "شباب", "بنات", "العاب", "تداول", "عملات", "بينانس", "ضحك"]
PROCESSED_USERS = set()
VISITED_GROUPS = set()
# الجسر
Thread(target=lambda: HTTPServer(("0.0.0.0", 7860), SimpleHTTPRequestHandler).serve_forever(), daemon=True).start()
async def sync_contacts(app):
"""مزامنة الأرقام من ملف contacts.txt"""
if os.path.exists("contacts.txt"):
try:
with open("contacts.txt", "r") as f:
phones = [line.strip() for line in f if line.strip()]
if phones:
sample = random.sample(phones, min(15, len(phones)))
logger.info(f"📡 مزامنة {len(sample)} رقم جديد من ملفك...")
contacts = [types.InputPhoneContact(phone=p, first_name=f"User_{random.randint(1,999)}") for p in sample]
await app.import_contacts(contacts)
except: pass
async def find_and_hunt(app):
"""البحث عن جروبات عشوائية وصيد المتفاعلين"""
word = random.choice(KEYWORDS)
try:
# البحث عن مجموعات
search_results = await app.get_inline_bot_results("google", word) # محاكاة بحث
# ملاحظة: في Pyrogram نستخدم البحث العام
async for dialog in app.get_chat_history("me", limit=1): # حركة للتمويه
pass
# لنستخدم قائمة جروبات مستهدفة أو البحث العام
target_hunt = f"@{word}" # تجربة يوزر الكلمة مباشرة
chat = await app.join_chat(target_hunt)
VISITED_GROUPS.add(chat.id)
logger.info(f"✅ تم اقتحام جروب: {chat.title}")
hunted = []
async for message in app.get_chat_history(chat.id, limit=100):
if message.from_user and not message.from_user.is_bot:
if message.from_user.id not in PROCESSED_USERS:
hunted.append(message.from_user)
await app.leave_chat(chat.id) # الخروج لمسح الأثر
return hunted
except: return []
async def start_attack():
app = Client(
"beast_final",
api_id=API_ID, api_hash=API_HASH,
session_string=SESSION_STRING.strip(),
device_model="Samsung Galaxy S24 Ultra",
system_version="Android 14",
app_version="10.11.1",
in_memory=True
)
try:
await app.start()
logger.info("💀 تم إطلاق الوحش بنظام Pyrogram وبصمة سامسونج!")
while True:
try:
await sync_contacts(app)
# تجميع الأهداف
targets = []
# من جهات الاتصال
contacts = await app.get_contacts()
targets.extend([c for c in contacts if c.id not in PROCESSED_USERS])
# من الاقتحام
hunted_users = await find_and_hunt(app)
targets.extend(hunted_users)
random.shuffle(targets)
logger.info(f"🎯 تم حشد {len(targets)} ضحية للهجوم...")
for user in targets:
if user.id in PROCESSED_USERS: continue
PROCESSED_USERS.add(user.id)
name = getattr(user, 'first_name', 'User')
try:
# محاولة الحشر المباشر
await app.add_chat_members(TARGET_CHANNEL, user.id)
logger.info(f"✅ حشر مباشر: {name}")
await asyncio.sleep(random.randint(10, 20))
except (errors.UserPrivacyRestricted, errors.PeerFlood, errors.FloodWait):
# الخطة البديلة: قصف الخاص
try:
msg = f"أهلاً {name}! 👋\nندعوك للانضمام لأكبر تجمع متفاعل من هنا:\nhttps://t.me/{TARGET_CHANNEL}"
await app.send_message(user.id, msg)
logger.info(f"📨 قصف خاص لـ {name}")
await asyncio.sleep(random.randint(10, 20))
except: continue
except: continue
logger.info("🔄 تبريد المحرك ...")
await asyncio.sleep(30)
except Exception as e:
logger.error(f"💥 خطأ دورة: {e}")
await asyncio.sleep(30)
finally:
await app.stop()
if __name__ == "__main__":
asyncio.run(start_attack())