#!/usr/bin/env python3 """ Final Clean Screenshot Capture Script Captures the essential verified screenshots: 1. SlopRoot main view 2. SlopRoot exploit / root diagnostic running 3. SuManager main view 4. SuManager interactive superuser request prompt 5. SlopRoot tablet sideways (landscape) dual-pane view 6. SuManager tablet sideways (landscape) dual-pane view """ import os import sys import time import shutil import subprocess from PIL import Image BASE_DIR = "/mnt/16aebe95-f920-450d-b96c-c06bb50ba672/sloproot" ARTIFACT_DIR = "/home/koutsie/.gemini/antigravity-cli/brain/a27700c5-eca4-4bd4-8f04-fddd76c9f8a6" DOCS_SCREENSHOTS = os.path.join(BASE_DIR, "docs/screenshots") os.makedirs(DOCS_SCREENSHOTS, exist_ok=True) ANDROID_HOME = os.path.join(BASE_DIR, "android-sdk") ANDROID_AVD_HOME = os.path.join(BASE_DIR, "avd") env = os.environ.copy() env["ANDROID_HOME"] = ANDROID_HOME env["ANDROID_AVD_HOME"] = ANDROID_AVD_HOME env["PATH"] = f"{ANDROID_HOME}/emulator:{ANDROID_HOME}/platform-tools:{env['PATH']}" PORT = "5554" DEVICE = f"emulator-{PORT}" def adb_cmd(*args): return subprocess.run(["adb", "-s", DEVICE] + list(args), env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) def take_screenshot(filename, description, min_colors=50): out_path = os.path.join(DOCS_SCREENSHOTS, filename) print(f"\nCapturing: {description} -> {filename}...") time.sleep(2) res = subprocess.run(["python3", os.path.join(BASE_DIR, "tests/adb_screenshot.py"), out_path, DEVICE], env=env) if res.returncode != 0 or not os.path.exists(out_path): raise RuntimeError(f"Screenshot failed for {filename}") with Image.open(out_path) as im: colors = im.getcolors(maxcolors=100000) num_colors = len(colors) if colors else 100000 print(f" Verified {filename}: dimensions={im.size}, colors={num_colors}, size={os.path.getsize(out_path)} bytes") if num_colors < min_colors: raise ValueError(f"Screenshot {filename} has insufficient colors: {num_colors} < {min_colors}") artifact_path = os.path.join(ARTIFACT_DIR, filename) shutil.copyfile(out_path, artifact_path) print(f" Copied to artifact directory: {artifact_path}") return out_path def boot_emulator(avd_name): subprocess.run(["adb", "emu", "kill"], env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) time.sleep(2) print(f"Booting emulator AVD: {avd_name}...") proc = subprocess.Popen( ["emulator", "-avd", avd_name, "-port", PORT, "-no-window", "-no-audio", "-no-boot-anim", "-gpu", "swiftshader_indirect"], env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL ) adb_cmd("wait-for-device") for i in range(60): res = adb_cmd("shell", "getprop", "sys.boot_completed") if res.stdout.strip() == "1": print(f" {avd_name} booted in {i}s") break time.sleep(1) # Disable keyguard and wake screen adb_cmd("shell", "sqlite3", "/data/data/com.android.providers.settings/databases/settings.db", 'INSERT OR REPLACE INTO secure (name, value) VALUES ("lockscreen.disabled", "1");') adb_cmd("shell", "svc", "power", "stayon", "true") adb_cmd("shell", "input", "keyevent", "82") adb_cmd("shell", "input", "keyevent", "3") time.sleep(2) # Reinstall fresh APKs adb_cmd("install", "-r", os.path.join(BASE_DIR, "release_folder/SlopRoot.apk")) adb_cmd("install", "-r", os.path.join(BASE_DIR, "sumanager/build/sumanager.apk")) return proc def capture_phone_screenshots(): proc = boot_emulator("test_api19_x86") try: # 1. SlopRoot main view adb_cmd("shell", "am", "start", "-n", "org.sloproot/.MainActivity") time.sleep(3) take_screenshot("01_sloproot_main.png", "SlopRoot Main View (Android 4.4 KitKat)") # 2. SlopRoot exploit / root diagnostic running # Tap 'Check root' button (x=80, y=238) adb_cmd("shell", "input", "tap", "80", "238") time.sleep(2) take_screenshot("02_sloproot_exploit_running.png", "SlopRoot Exploit and Root Diagnostic Running") # 3. SuManager main view adb_cmd("shell", "am", "start", "-n", "org.sloproot.sumanager/.MainActivity") time.sleep(3) take_screenshot("03_sumanager_main.png", "SuManager Main View (Managed Applications)") # 4. Asking for root from SuManager (Authorization Prompt) # Create an untrusted root request from shell adb_cmd("shell", "am", "start", "-a", "android.intent.action.MAIN", "-n", "org.sloproot.sumanager/.RequestActivity", "--ei", "caller_uid", "10088", "--es", "caller_pkg", "com.test.legacyapp", "--es", "caller_cmd", "/system/bin/sh -c 'id; cat /proc/version'") time.sleep(3) take_screenshot("04_sumanager_request_prompt.png", "SuManager Superuser Root Request Prompt") # Dismiss dialog adb_cmd("shell", "input", "keyevent", "4") time.sleep(1) finally: adb_cmd("emu", "kill") try: proc.terminate() proc.wait(timeout=5) except Exception: proc.kill() time.sleep(2) def capture_tablet_screenshots(): proc = boot_emulator("test_tablet_api19") try: # Rotate tablet to sideways / landscape orientation print("Configuring tablet to sideways (landscape 1280x800) orientation...") adb_cmd("shell", "content", "insert", "--uri", "content://settings/system", "--bind", "name:s:accelerometer_rotation", "--bind", "value:i:0") adb_cmd("shell", "content", "insert", "--uri", "content://settings/system", "--bind", "name:s:user_rotation", "--bind", "value:i:1") time.sleep(3) # 5. Tablet sideways SlopRoot dual-pane view adb_cmd("shell", "am", "start", "-n", "org.sloproot/.MainActivity") time.sleep(3) take_screenshot("05_tablet_sideways_sloproot.png", "SlopRoot Tablet Sideways Dual-Pane Layout (1280x800)") # 6. Tablet sideways SuManager dual-pane view adb_cmd("shell", "am", "start", "-n", "org.sloproot.sumanager/.MainActivity") time.sleep(3) take_screenshot("06_tablet_sideways_sumanager.png", "SuManager Tablet Sideways Dual-Pane Layout (1280x800)") finally: adb_cmd("emu", "kill") try: proc.terminate() proc.wait(timeout=5) except Exception: proc.kill() time.sleep(2) def main(): print("=== Starting Final Clean Screenshot Capture Suite ===") capture_phone_screenshots() capture_tablet_screenshots() print("\n=== All Final Screenshots Captured, Verified, and Archived Successfully ===") if __name__ == "__main__": main()