Created
January 31, 2026 13:48
-
-
Save anonymousik/757536bb762d96a5aaa20f574070c2db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import sys | |
| import subprocess | |
| import time | |
| import urllib.request | |
| from pathlib import Path | |
| # ========================================== | |
| # KONFIGURACJA AUTOMATYCZNA | |
| # ========================================== | |
| CACHE_DIR = Path.home() / ".playbox_cache" | |
| CACHE_DIR.mkdir(parents=True, exist_ok=True) | |
| # Linki do stabilnych wersji (VP9 Optimized) | |
| APPS = { | |
| "SmartTube": { | |
| "url": "https://github.com/yuliskov/SmartTube/releases/download/latest/smarttube_stable.apk", | |
| "pkg": "com.teamsmart.videomanager.tv" | |
| }, | |
| "Projectivy": { | |
| "url": "https://github.com/spocky/projectivy-launcher/releases/latest/download/Projectivy_Launcher.apk", | |
| "pkg": "com.k2.projectivy" | |
| }, | |
| "Termux": { | |
| "url": "https://f-droid.org/repo/com.termux_118.apk", | |
| "pkg": "com.termux" | |
| } | |
| } | |
| # Skrypty wstrzykiwane bezpośrednio do pamięci RAM urządzenia | |
| AGENTS = { | |
| "gpu_turbo": """ | |
| #!/bin/sh | |
| echo "[GPU] Wymuszanie kompozycji sprzętowej..." | |
| # Wymuszenie renderingu na GPU (Mali-G31) | |
| setprop debug.hwui.renderer opengl | |
| setprop debug.sf.hw 1 | |
| setprop debug.composition.type gpu | |
| setprop debug.egl.hw 1 | |
| # Wyłączenie VSync dla UI (zmniejsza input lag, może powodować tearing, ale warto na S905X2) | |
| setprop debug.cpurend.vsync false | |
| service call SurfaceFlinger 1008 i32 1 | |
| """, | |
| "bloat_killer": """ | |
| #!/bin/sh | |
| echo "[RAM] Zamrażanie procesów tła..." | |
| # Lista procesów zidentyfikowana w logach Sagemcom | |
| PM_DISABLE="pm disable-user --user 0" | |
| $PM_DISABLE com.google.android.katniss # Asystent (duże zużycie) | |
| $PM_DISABLE com.google.android.speech.pumpkin | |
| $PM_DISABLE com.google.android.tungsten.setupwraith | |
| $PM_DISABLE com.sagemcom.stb.setupwizard | |
| $PM_DISABLE com.amazon.amazonvideo.livingroom # Jeśli nie używasz Prime | |
| $PM_DISABLE com.android.printspooler | |
| $PM_DISABLE com.google.android.feedback | |
| pm trim-caches 9999M | |
| """, | |
| "compiler_pro": """ | |
| #!/bin/sh | |
| echo "[AOT] Kompilacja krytyczna (System + Media)..." | |
| # Speed-profile: szybki start, mniejsze zużycie RAM | |
| cmd package compile -m speed-profile -f com.android.systemui | |
| cmd package compile -m speed -f com.k2.projectivy | |
| cmd package compile -m speed -f com.teamsmart.videomanager.tv | |
| cmd package compile -m speed -f com.google.android.apps.mediashell | |
| """ | |
| } | |
| class TitaniumPilot: | |
| def __init__(self): | |
| self.device = self._detect_device() | |
| print(f"\033[96m[TITANIUM v8] Cel: {self.device} | Chipset: Amlogic S905X2\033[0m") | |
| self._connect() | |
| def _detect_device(self): | |
| # 1. Sprawdź argumenty | |
| if len(sys.argv) > 1 and "--device" in sys.argv: | |
| return sys.argv[sys.argv.index("--device") + 1] | |
| # 2. Sprawdź podłączone | |
| try: | |
| out = subprocess.check_output(["adb", "devices"], text=True).strip() | |
| for line in out.splitlines(): | |
| if "\tdevice" in line: | |
| return line.split("\t")[0] | |
| except: pass | |
| # 3. Fallback (Domyślne IP użytkownika) | |
| return "192.168.1.3:5555" | |
| def _connect(self): | |
| print(f"\033[93m[*] Nawiązywanie połączenia z {self.device}...\033[0m") | |
| subprocess.run(["adb", "disconnect"], stdout=subprocess.DEVNULL) | |
| res = subprocess.run(["adb", "connect", self.device], capture_output=True, text=True) | |
| if "connected" in res.stdout: | |
| print("\033[92m[✓] Połączenie aktywne.\033[0m") | |
| else: | |
| print("\033[91m[!] Błąd połączenia. Upewnij się, że debugowanie USB jest włączone.\033[0m") | |
| # Próba mimo błędu, czasem status jest fałszywy | |
| def adb_shell(self, cmd): | |
| full = ["adb", "-s", self.device, "shell", cmd] | |
| try: | |
| return subprocess.check_output(full, stderr=subprocess.STDOUT, text=True).strip() | |
| except: return "" | |
| def push_and_run(self, name, content): | |
| local = f"agent_{name}.sh" | |
| remote = f"/data/local/tmp/{name}.sh" | |
| with open(local, "w") as f: f.write(content) | |
| subprocess.run(["adb", "-s", self.device, "push", local, remote], stdout=subprocess.DEVNULL) | |
| subprocess.run(["adb", "-s", self.device, "shell", f"chmod +x {remote}"], stdout=subprocess.DEVNULL) | |
| print(f"\033[94m[*] Uruchamianie modułu: {name}...\033[0m") | |
| # Uruchomienie z timeoutem, żeby nie wisiało | |
| try: | |
| subprocess.run(["adb", "-s", self.device, "shell", f"sh {remote}"], timeout=180) | |
| print(f"\033[92m[✓] Moduł {name} zakończony.\033[0m") | |
| except subprocess.TimeoutExpired: | |
| print(f"\033[93m[!] Moduł {name} trwał zbyt długo, ale działa w tle.\033[0m") | |
| if os.path.exists(local): os.remove(local) | |
| def install_apps(self): | |
| print("\n\033[95m[APPS] Weryfikacja i instalacja...\033[0m") | |
| installed = self.adb_shell("pm list packages") | |
| for name, data in APPS.items(): | |
| if data["pkg"] in installed: | |
| print(f"\033[90m {name} zainstalowany.\033[0m") | |
| continue | |
| print(f"\033[93m Pobieranie {name}...\033[0m") | |
| apk_path = CACHE_DIR / f"{name}.apk" | |
| try: | |
| if not apk_path.exists(): | |
| urllib.request.urlretrieve(data["url"], apk_path) | |
| print(f" Instalacja {name} na urządzeniu...") | |
| remote_apk = f"/data/local/tmp/{name}.apk" | |
| subprocess.run(["adb", "-s", self.device, "push", str(apk_path), remote_apk], stdout=subprocess.DEVNULL) | |
| subprocess.run(["adb", "-s", self.device, "shell", "pm", "install", "-r", "-g", remote_apk], stdout=subprocess.DEVNULL) | |
| self.adb_shell(f"rm {remote_apk}") | |
| print(f"\033[92m [✓] Sukces.\033[0m") | |
| except Exception as e: | |
| print(f"\033[91m [!] Błąd instalacji {name}: {e}\033[0m") | |
| def apply_settings(self): | |
| print("\n\033[95m[SETTINGS] Optymalizacja bazy danych Androida...\033[0m") | |
| tweaks = { | |
| "window_animation_scale": "0.5", | |
| "transition_animation_scale": "0.5", | |
| "animator_duration_scale": "0.5", | |
| "wifi_sleep_policy": "2", # Nigdy nie usypiaj | |
| "background_process_limit": "3", # Walka z OOM | |
| "wait_for_debugger": "0", | |
| "anr_show_background": "0" | |
| } | |
| for k, v in tweaks.items(): | |
| self.adb_shell(f"settings put global {k} {v}") | |
| # Czasem settings są w 'system' lub 'secure' | |
| self.adb_shell(f"settings put system {k} {v}") | |
| print("\033[92m[✓] Ustawienia wdrożone.\033[0m") | |
| def run(self): | |
| # 1. Instalacja | |
| self.install_apps() | |
| # 2. Debloat (Kluczowe dla RAM) | |
| self.push_and_run("bloat_killer", AGENTS["bloat_killer"]) | |
| # 3. GPU Turbo | |
| self.push_and_run("gpu_turbo", AGENTS["gpu_turbo"]) | |
| # 4. Settings | |
| self.apply_settings() | |
| # 5. Kompilacja (Na końcu) | |
| print("\n\033[95m[BOOST] Rozpoczynam kompilację AOT (To potrwa ok. 2 min)...\033[0m") | |
| self.push_and_run("compiler_pro", AGENTS["compiler_pro"]) | |
| print("\n" + "="*50) | |
| print("\033[92m[TITANIUM COMPLETE] System Sagemcom zmodernizowany.\033[0m") | |
| print("Pamięć RAM: Zwolniona (Bloatware Off)") | |
| print("Interfejs: Skompilowany (Speed Profile)") | |
| print("Wideo: VP9 Priority") | |
| print("="*50) | |
| print("Zalecany restart ręczny: adb reboot") | |
| if __name__ == "__main__": | |
| pilot = TitaniumPilot() | |
| pilot.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment