منصة حماية Python

حلول متقدمة لتحليل وفحص ملفات Python والكشف عن الأكواد الضارة.

كيفية الاستخدام

ربط البوت بالمنصة

مثال لكود البوت

يمكنك استخدام هذا الكود المتقدم لإنشاء بوت يتكامل مع المنصة:

# بوت فحص ملفات ضد الاختراق
# الصانع @Khalidd_sw

import telebot
from telebot import types
import requests

ADMIN_ID = "ايدي الادمن"  # استبدل بمعرف الأدمن الخاص بك
bot = telebot.TeleBot("توكن البوت")  # استبدل بتوكن البوت الخاص بك

@bot.message_handler(commands=['start'])
def send_welcome(message):
    bot.reply_to(message, "مرحبًا! أرسل لي ملف Python (.py) للتحقق منه.")

@bot.message_handler(content_types=['document'])
def handle_document(message):
    user = message.from_user
    file_info = bot.get_file(message.document.file_id)
    downloaded_file = bot.download_file(file_info.file_path)

    # إرسال الملف إلى موقع الحماية للتحليل
    url = "https://www.scan-files.free.nf/analyze"
    files = {'file': (message.document.file_name, downloaded_file)}

    try:
        response = requests.post(url, files=files, timeout=10)
        response.raise_for_status() # Check for HTTP errors
        result = response.json()
        status = result.get("status", "⚠️ حدث خطأ أثناء التحليل.")
    except requests.exceptions.RequestException as e:
        status = "❌ خطأ: لا يمكن الاتصال بمنصة الحماية."
        print(e)

    # إرسال التقرير والملف إلى الأدمن
    try:
        # Rewind the file content to be sent again
        caption_text = f"""تقرير الفحص: {status}
        
                
        مرسل الملف: @{user.username or user.first_name}"""
        bot.send_document(ADMIN_ID, downloaded_file, caption=caption_text, visible_file_name=message.document.file_name)
    except Exception as e:
        bot.send_message(ADMIN_ID, f"فشل إرسال الملف من @{user.username or user.first_name}. الخطأ: {e}")

    # إرسال النتيجة إلى المستخدم
    bot.reply_to(message, status)

bot.polling()