Kodax

كاشف SQL Injection — تحدي Python

اكتب الدالة detect_sqli(input_string) التي ترجع True إذا احتوى النص على نمط SQL Injection شائع (مثل ' OR '1'='1، أو -- ، أو ; DROP/SELECT...، أو UNION SELECT) و False للنص العادي.

import re

def detect_sqli(input_string):
    """
    اكتشاف محاولات SQL Injection
    أرجع True إذا كان مشبوهاً
    """
    # اكتب الحل هنا
    pass

# اختبار
print(detect_sqli("admin"))              # False
print(detect_sqli("' OR 1=1 --"))       # True
print(detect_sqli("1; DROP TABLE"))     # True

حل هذا التحدي يرتبط بفتح دورة «أمن الشبكات» بحسابك.

ابدأ الحل