# Architecture ## System overview SlopRoot provides an open source root solution for legacy Android devices. The system contains two main applications and a native binary suite: 1. SlopRoot (`org.sloproot`): The root installer application. 2. SuManager (`org.sloproot.sumanager`): The root privilege manager application. 3. Native binaries: Standalone `su`, `dirtycow`, and `payload` executables. The app enables root-install attempts on Android 2.2 through Android 4.4 (API 8 through 19), subject to the ROM and kernel being vulnerable. It can check existing root state on Android 5.0 through 6.0; it does not attempt root there. Android 7.0 and newer is refused. The emulator smoke check covers app installation and launch on API 10, 15, and 19; that check does not validate exploit success or OEM firmware compatibility. ## SlopRoot application SlopRoot contains the following components: - `MainActivity`: Controls root checks, exploit execution, asset installation, and diagnostic logs. - `RootTerminalActivity`: Provides an interactive command shell through `su` or the local app user. - `RootEngine`: Manages device inspection, payload extraction, helper or daemon backup, Dirty COW execution, Wi-Fi DHCP triggering on locked-down stock firmware, and helper restoration. - `DeviceInfo`: Collects device model, Android version, API level, CPU ABI, SELinux status, and root state. - `Shell`: Executes local shell commands and captures text output with timeout controls. ## SuManager application SuManager controls application access to the root shell: - `MainActivity`: Displays managed application policies, access logs, and global settings. - `RequestActivity`: Displays interactive root authorization prompts when an untrusted application calls `su`. - `TerminalActivity`: Provides a root shell for manual system administration. - `SuDatabase`: Manages SQLite storage for the `policies` and `access_logs` tables. It writes the root policy cache to the app's private files directory and, when available, `/data/system/sumanager/policy.conf`. - `SuSettings`: Stores user preferences for access logging and toast alerts in `SharedPreferences`. ## Native su binary The native `su` binary supports two operational modes: 1. Direct setuid mode: The binary executes directly when installed with setuid root permissions (`chmod 6755`). 2. Daemon mode: The binary starts at system boot and listens on the abstract Unix socket `sumanager`. When a client process requests root access, `su` performs the following steps: 1. Reads client credentials with `SO_PEERCRED`. 2. Inspects `/data/data/org.sloproot.sumanager/policy.conf`. 3. If a policy exists, permits or denies root access immediately. 4. If no policy exists, launches `RequestActivity` through `am start`. 5. Connects to a random, per-request `/dev/sumanager_req_.sock` socket and verifies the response token. 6. Switches UID and GID to 0 and executes the requested shell. ## Multi-architecture support The build produces binaries across six CPU architectures: - `arm`: ARMv7-a with Thumb-2 instructions. - `armv6`: ARMv6 instructions for legacy devices. - `armv5`: ARMv5TE instructions for early Android hardware. - `x86`: 32-bit x86 (i686) instructions. - `arm64`: 64-bit ARMv8-a instructions. - `x86_64`: 64-bit x86-64 instructions. The ARMv5 and ARMv6 `su` binaries link against the device's Bionic libc to avoid newer instructions in the NDK's bundled libc. The other `su` binaries are static. Root installation itself is enabled only for 32-bit ARM and x86 targets. ## User interface rules The user interface follows strict anti-slop rules: - Use only standard Android native elements (`Button`, `TextView`, `EditText`, `CheckBox`, `ListView`, `ProgressBar`). - Use default platform themes (`Theme.Black` on API 8 through 10, `Theme.Holo` on API 11 through 19). - Do not use custom background drawables, colored panels, gradients, or drop shadows. - Do not use subtitles, decorative text, or generic placeholder content. - Ensure all text meets WCAG AA contrast standards.