fork download
  1. import requests
  2.  
  3. # 🧱 رابط السيرفر
  4. base_url = "http:172.16.101.221) 11"
  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 "login" in content or "تسجيل الدخول" in content or "index.html" in content:
  36. print("✅ الصفحة تطلب تسجيل دخول (محميّة).")
  37. else:
  38. snippet = content[:200].replace('\n', ' ')
  39. print(f"⚠️ الصفحة مفتوحة بدون تسجيل دخول! مقتطف:\n{snippet}")
  40. elif status in [301, 302]:
  41. location = response.headers.get("Location", "")
  42. print(f"🔁 تم التوجيه إلى: {location} → غالباً محمية.")
  43. else:
  44. print("❌ الصفحة غير متاحة أو تم حظرها.\n")
  45.  
  46. print("-" * 40)
  47.  
  48. except Exception as e:
  49. print(f"🚫 خطأ في الوصول إلى {url}: {e}")
  50. print("-" * 40)
  51.  
  52. if __name__ == "__main__":
  53. test_paths()
Success #stdin #stdout 1s 36516KB
stdin
Standard input is empty
stdout
🚀 بدء فحص الصفحات...

🚫 خطأ في الوصول إلى http:172.16.101.221) 11/index.html: Invalid URL 'http:172.16.101.221) 11/index.html': No host supplied
----------------------------------------
🚫 خطأ في الوصول إلى http:172.16.101.221) 11/status.html: Invalid URL 'http:172.16.101.221) 11/status.html': No host supplied
----------------------------------------
🚫 خطأ في الوصول إلى http:172.16.101.221) 11/logout?erase-cookie=on: Invalid URL 'http:172.16.101.221) 11/logout?erase-cookie=on': No host supplied
----------------------------------------
🚫 خطأ في الوصول إلى http:172.16.101.221) 11/admin.html: Invalid URL 'http:172.16.101.221) 11/admin.html': No host supplied
----------------------------------------
🚫 خطأ في الوصول إلى http:172.16.101.221) 11/config.html: Invalid URL 'http:172.16.101.221) 11/config.html': No host supplied
----------------------------------------
🚫 خطأ في الوصول إلى http:172.16.101.221) 11/debug.html: Invalid URL 'http:172.16.101.221) 11/debug.html': No host supplied
----------------------------------------