fork download
  1. import requests
  2.  
  3. # 🔧 عنوان السيرفر المحلي (استبدل IP إذا مختلف)
  4. base_url = "http://172.16.101.221"
  5.  
  6. # 🔗 الروابط اللي نبي نختبرها داخل السيرفر
  7. paths = [
  8. "/index.html",
  9. "/status.html",
  10. "/logout?erase-cookie=on",
  11. "/admin.html",
  12. "/config.html",
  13. "/debug.html",
  14. ]
  15.  
  16. # 🎭 هيدر مزيّف كأنه متصفح حقيقي
  17. headers = {
  18. "User-Agent": "Mozilla/5.0 (Windows NT 10.0; TestScript/1.0)"
  19. }
  20.  
  21. def test_paths():
  22. print("🚀 بدء فحص حماية الصفحات...\n")
  23.  
  24. for path in paths:
  25. url = base_url + path
  26. try:
  27. response = requests.get(url, headers=headers, timeout=5, allow_redirects=True)
  28. status = response.status_code
  29. content = response.text.lower()
  30.  
  31. print(f"🔗 {url}")
  32. print(f"📥 كود الحالة: {status}")
  33.  
  34. if status == 200:
  35. if any(word in content for word in ["login", "تسجيل الدخول", "sign in"]):
  36. print("✅ محمية: الصفحة تطلب تسجيل دخول.")
  37. else:
  38. print("🚨 غير محمية: الصفحة مفتوحة بدون تسجيل دخول!")
  39. elif status in [301, 302]:
  40. location = response.headers.get("Location", "غير معروف")
  41. print(f"🔁 تم التوجيه إلى: {location} → غالباً محمية.")
  42. elif status == 403:
  43. print("✅ محمية: تم الحظر (403 Forbidden).")
  44. elif status == 404:
  45. print("❌ الصفحة غير موجودة (404).")
  46. else:
  47. print(f"ℹ️ حالة غير معروفة أو غير متوقعة: {status}")
  48.  
  49. print("-" * 60)
  50.  
  51. except requests.exceptions.RequestException as e:
  52. print(f"❌ خطأ في الاتصال: {e}")
  53. print("-" * 60)
  54.  
  55. if __name__ == "__main__":
  56. test_paths()
Success #stdin #stdout 0.48s 27932KB
stdin
Standard input is empty
stdout
🚀 بدء فحص حماية الصفحات...

❌ خطأ في الاتصال: HTTPConnectionPool(host='172.16.101.221', port=80): Max retries exceeded with url: /index.html (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x14dc6faf72e8>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
------------------------------------------------------------
❌ خطأ في الاتصال: HTTPConnectionPool(host='172.16.101.221', port=80): Max retries exceeded with url: /status.html (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x14dc6faf79e8>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
------------------------------------------------------------
❌ خطأ في الاتصال: HTTPConnectionPool(host='172.16.101.221', port=80): Max retries exceeded with url: /logout?erase-cookie=on (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x14dc6fafc0f0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
------------------------------------------------------------
❌ خطأ في الاتصال: HTTPConnectionPool(host='172.16.101.221', port=80): Max retries exceeded with url: /admin.html (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x14dc6fafc780>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
------------------------------------------------------------
❌ خطأ في الاتصال: HTTPConnectionPool(host='172.16.101.221', port=80): Max retries exceeded with url: /config.html (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x14dc6fad55c0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
------------------------------------------------------------
❌ خطأ في الاتصال: HTTPConnectionPool(host='172.16.101.221', port=80): Max retries exceeded with url: /debug.html (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x14dc6faf7908>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
------------------------------------------------------------