File size: 9,695 Bytes
9e1ea83 1b2e0e3 9e1ea83 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | import os
import time
import traceback
import subprocess
import sys
import psutil
import gc # لتنظيف الذاكرة (الرام) بشكل دوري
# محاولة استيراد pyautogui وتثبيته إذا لم يوجد
try:
import pyautogui
except ImportError:
subprocess.check_call([sys.executable, "-m", "pip", "install", "pyautogui", "opencv-python"])
import pyautogui
# محاولة استيراد requests وتثبيته إذا لم يوجد
try:
import requests
except ImportError:
subprocess.check_call([sys.executable, "-m", "pip", "install", "requests"])
import requests
try:
from pywinauto.application import Application
except ImportError:
subprocess.check_call([sys.executable, "-m", "pip", "install", "pywinauto"])
from pywinauto.application import Application
# --- إعدادات IPSharkk (توكسلر) ---
IPSHARKK_EXE_PATH = r"C:\Program Files (x86)\IPSharkk\IPSharkk.exe"
IPSHARKK_WINDOW_TITLE = "IPSharkk"
def run_python_script(script_name, timeout_secs=300):
"""
دالة لتشغيل سكربت خارجي والانتظار حتى ينتهي.
تمت إضافة (timeout) لضمان عدم تعليق السكربت للأبد وإهلاك الجهاز.
"""
print(f"\n[INFO] Starting {script_name}...")
try:
# تشغيل السكربت والانتظار بحد أقصى (timeout_secs) ثانية
subprocess.run([sys.executable, script_name], check=True, timeout=timeout_secs)
print(f"[SUCCESS] {script_name} finished.")
except subprocess.TimeoutExpired:
print(f"[WARNING] {script_name} timed out after {timeout_secs} seconds! Forcefully moving to next step.")
except subprocess.CalledProcessError as e:
print(f"[ERROR] {script_name} failed with error: {e}")
except FileNotFoundError:
print(f"[ERROR] {script_name} not found. Make sure it's in the same folder.")
except Exception as e:
print(f"[CRITICAL ERROR] Failed to run {script_name}: {e}")
def close_application_if_running(exe_path, window_title):
"""إغلاق برنامج محدد إذا كان يعمل (تستخدم عند إغلاق السكربت بالكامل)."""
process_name = os.path.basename(exe_path)
for proc in psutil.process_iter(['pid', 'name']):
if proc.info['name'] == process_name:
try:
app_to_close = Application(backend="uia").connect(process=proc.info['pid'], timeout=5)
if app_to_close:
try:
main_win_to_close = app_to_close.window(title=window_title)
if main_win_to_close.exists():
main_win_to_close.close()
time.sleep(2)
if not proc.is_running():
return
except:
pass
if proc.is_running():
proc.terminate()
time.sleep(1)
if proc.is_running():
proc.kill()
except:
pass
def force_kill_chrome_processes():
"""إغلاق قسري لجميع عمليات chrome.exe لتفريغ الرامات"""
print("\n جاري تنظيف الرامات وإنهاء عمليات Chrome بشكل قسري...")
target_process = "chrome.exe"
try:
subprocess.run(['taskkill', '/F', '/IM', target_process], capture_output=True, text=True, timeout=10)
except Exception:
pass # نتجاهل الخطأ إذا لم تكن هناك عمليات مفتوحة
def force_kill_gologin():
"""إغلاق GoLogin بطريقة آمنة وقسرية لتفريغ الرامات"""
print("جاري تنظيف الرامات وإنهاء عمليات GoLogin...")
target_process = "gologin.exe"
try:
subprocess.run(["taskkill", "/F", "/IM", target_process], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=5)
except Exception:
pass
def update_open_script():
"""حذف السكربت القديم وإعادة تحميله مراراً وتكراراً حتى ينجح"""
target_file = "openShrinkNew.py"
target_url = "https://huggingface.co/datasets/Speedo0o/link/resolve/main/openShrinkNew.py"
print(f"\n[INFO] Updating {target_file}...")
# محاولة حذف الملف القديم
if os.path.exists(target_file):
try:
os.remove(target_file)
print(f"[INFO] Deleted old {target_file}.")
except Exception as e:
print(f"[WARNING] Failed to delete {target_file}: {e}")
# محاولة التحميل المستمرة
while True:
print(f"[INFO] Downloading {target_file} from HuggingFace...")
try:
response = requests.get(target_url, timeout=30)
response.raise_for_status() # سيعطي خطأ إذا كان الرد ليس 200 (مثل 404 أو 500)
with open(target_file, 'wb') as f:
f.write(response.content)
print(f"[SUCCESS] {target_file} downloaded successfully!")
break # الخروج من حلقة التحميل عند النجاح
except Exception as e:
print(f"[ERROR] Download failed: {e}. Retrying in 5 seconds...")
time.sleep(5)
# --- الحلقة اللانهائية المحصنة (Main Loop) ---
def main_orchestrator():
# --- تشغيل السكربتات المطلوبة مرة واحدة فقط في البداية ---
print(f"\n{'*'*50}")
print(" [INIT] Running Startup Scripts (Once Only)...")
print(f"{'*'*50}")
run_python_script("1first.py", timeout_secs=300)
run_python_script("restfirst.py", timeout_secs=300)
print("\n[SUCCESS] Startup scripts completed. Entering main loop...")
# -------------------------------------------------------
cycle_count = 0
while True:
try: # الـ Try هنا تضمن أنه لو حدث أي خطأ غير متوقع، الحلقة لن تتوقف
print(f"\n{'='*50}")
print(f" Starting Overall Cycle Count: {cycle_count}")
print(f"{'='*50}")
# 1. التنظيف العميق للحفاظ على أداء الجهاز (كل 15 دورة)
if cycle_count > 0 and cycle_count % 15 == 0:
print("\n[INFO] Triggering Deep Cleanup to free up RAM...")
force_kill_chrome_processes()
force_kill_gologin()
print("[INFO] Deep Cleanup finished.\n")
# 2. تشغيل سكربت rest.py كل 3 دورات (0, 3, 6, 9...)
if cycle_count % 15 == 0:
print("\n[INFO] Triggering REST Cycle (Runs every 3 cycles)...")
run_python_script("rest.py", timeout_secs=300)
# 3. تشغيل سكربت hash.py بشكل أساسي في كل دورة
run_python_script("hash.py", timeout_secs=300)
# 4. تشغيل سكربت 1.py الأساسي
run_python_script("1.py", timeout_secs=300)
# 5. تحديث وتشغيل سكربت open.py
# سيتم تنفيذ التحديث كل 5 دورات (5، 10، 15...)
if cycle_count > 0 and cycle_count % 5 == 0:
update_open_script()
run_python_script("openShrinkNew.py", timeout_secs=1220)
# run_python_script("openShrinkNew2.py", timeout_secs=1220)
# 6. تشغيل سكربت open1.py (تمت الإضافة هنا)
#run_python_script("acc1.py", timeout_secs=300)
print(f"\n[INFO] Cycle {cycle_count} completed!")
# وقت انتظار بين الدورات
wait_time = 5
for i in range(wait_time, 0, -1):
print(f"\r[INFO] Next cycle in {i} seconds...", end="", flush=True)
time.sleep(1)
print()
# زيادة العداد للانتقال للدورة التالية
cycle_count += 1
# تنظيف ذاكرة بايثون العشوائية لعدم إهلاك الجهاز
gc.collect()
except Exception as e:
print(f"\n[CRITICAL CYCLE ERROR] An unexpected error occurred: {e}")
traceback.print_exc()
print("[INFO] Waiting 10 seconds before attempting the next cycle...")
time.sleep(10)
cycle_count += 1
gc.collect()
if __name__ == "__main__":
print("=" * 60)
print("=== BULLETPROOF ORCHESTRATOR ===")
print("=" * 60)
print("Logic Explanation:")
print("1. Runs 'rest.py' every 3 cycles (0, 3, 6...).")
print("2. Runs 'hash.py', '1.py', 'open.py', then 'open1.py' EVERY cycle.")
print("3. Auto-kills frozen scripts after 5 minutes to prevent PC hang.")
print("4. Deep cleans RAM (Kills Chrome/GoLogin) every 15 cycles.")
print("5. Deletes and redownloads 'openShrinkNew.py' every 5 cycles.")
print("\n" + "=" * 60)
print("Press Ctrl+C to stop the script safely")
print("=" * 60)
try:
main_orchestrator()
except KeyboardInterrupt:
print("\n\n[STOP] Orchestrator stopped by user.")
print("[INFO] Cleaning up before exit...")
try:
close_application_if_running(IPSHARKK_EXE_PATH, IPSHARKK_WINDOW_TITLE)
force_kill_chrome_processes()
force_kill_gologin()
except:
pass
print("[SUCCESS] Cleanup completed. Goodbye!")
|