mountify

repository·master·Indexed 22 days ago

https://github.com/backslashxx/mountify

A tool for globally mounting modules via OverlayFS to mimic OEM mounts and reduce detection risks. It functions as a KernelSU metamodule and is compatible with APatch and Magisk. Version 1.5.6 supports tmpfs and ext4 sparse modes, includes a WebUI for configuration, and provides a 'nuke' Loadable Kernel Module (LKM) to unregister ext4 sysfs nodes. Requires CONFIG_OVERLAY_FS=y in the Linux kernel.

Tokens
2.2K
Snippets
5
Records
15
Agent score
76%

What's inside mountify

  1. How to unmount modules with Mountify

    master

    To achieve unmounting, it is recommended to use Zygisk providers like NeoZygisk, NoHello, ReZygisk, or Zygisk Assistant.

    If using Zygisk Next, set the Denylist Policy to "Enforced" or "Unmount Only".

    Then, configure the following in config.sh:

    1. Set the provider type:
      • MOUNT_DEVICE_NAME="APatch" (for APatch)
      • MOUNT_DEVICE_NAME="KSU" (for KernelSU forks)
      • MOUNT_DEVICE_NAME="magisk" (for Magisk)
    2. Enable in-kernel unmount methods (as a second choice to Zygisk):
      • mountify_custom_umount=1 (default is 0)
  2. Add a new language to the Mountify WebUI

    master

    To add support for a new language in the Mountify WebUI, follow these steps:

    1. Fork the repository.
    2. Create the translation file: Copy webui/public/locales/en.xml to the strings folder and rename it to {language-code}.xml (e.g., es.xml). Use standard language codes (refer to Crowdin language codes).
    3. Register the language: Add an entry to webui/public/locales/languages.json. The format must be "language-code": "Language name in your language". Maintain alphabetical order in the JSON object.
    4. Translate: Translate all string values within your new .xml file.
    5. Credit: Add your information to webui/public/locales/CONTRIBUTOR.md.
    6. Submit: Open a pull request.
    {
        "en": "English",
        "fr": "Français",
        "zh-CN": "简体中文"
    }
  3. Unregister an ext4 sysfs node using the nuke LKM

    master

    The nuke Loadable Kernel Module (LKM) is used to unregister an ext4 sysfs node. To use it, you must locate the address of ext4_unregister_sysfs from /proc/kallsyms and pass it along with the target mount point to the module via insmod.

    Requirements:

    • Linux kernel 4.4 or newer.
    • Kernel must be compiled with CONFIG_KALLSYMS=y.
    • You must temporarily set /proc/sys/kernel/kptr_restrict to 1 to allow reading kernel pointer addresses from /proc/kallsyms.

    Usage Steps:

    1. Save the current value of kptr_restrict.
    2. Set kptr_restrict to 1.
    3. Extract the hex address for ext4_unregister_sysfs from /proc/kallsyms.
    4. Load the module using insmod with the mount_point and symaddr parameters.
    5. Restore the original kptr_restrict value.
    #!/bin/sh
    
    kptr_set=$(cat /proc/sys/kernel/kptr_restrict)
    echo 1 > /proc/sys/kernel/kptr_restrict
    ptr_address=$(grep " ext4_unregister_sysfs$" /proc/kallsyms | awk {'print "0x"$1'})
    insmod nuke.ko mount_point="/data/adb/modules" symaddr="$ptr_address"
    echo $kptr_set > /proc/sys/kernel/kptr_restrict
  4. Update an existing language in the Mountify WebUI

    master
    To update translations for an existing language, follow the same process as adding a new language, but skip the steps for creating a new XML file and registering the language in languages.json. You should directly edit the existing {language-code}.xml file in webui/public/locales/.
  5. Requirements and Compatibility

    master

    To use Mountify, ensure your environment meets these requirements:

    • Kernel Config: CONFIG_OVERLAY_FS=y is required. CONFIG_TMPFS_XATTR=y is highly encouraged.
    • Compatibility: Works as a KernelSU metamodule, and is compatible with APatch and Magisk.
    • Limitations:
      • Fails with De-Bloater because it uses dummy text instead of proper whiteouts.
      • Recommendation: Use System App Nuker instead, as it uses proper whiteouts.
  6. How to skip mounting a specific module

    master

    You can prevent Mountify from mounting a specific module by creating a trigger file in the module's directory (/data/adb/modules/<module_id>/):

    • KernelSU / APatch (Metamodule mode): Create a file named skip_mount.
    • Magisk: Create a file named skip_mountify.
  7. Manage Mountify configuration via Web UI

    master

    The Mountify Web UI provides a browser-based interface to manage module configurations. It dynamically generates input groups based on the config and configMetadata objects.

    Key features include:

    • Dynamic Input Generation: Automatically creates text fields, select menus, or custom input groups based on metadata.
    • Requirement Logic: Certain configuration keys can be disabled unless specific requirements (JavaScript function results or other config values) are met.
    • Advanced Mode: A toggle to show or hide configuration keys marked as advanced in their metadata.
    • Module Selection: A dedicated interface to select which modules Mountify should manage by scanning /data/adb/modules and checking for valid system directories.
    • Language Support: Built-in translation loading for the UI.
    • System Controls: Includes buttons to toggle update status in module.prop and trigger a system reboot.
  8. Configure Mountify via config.sh

    master

    Mountify can be configured through its WebUI or by manually editing /data/adb/mountify/config.sh.

    General Configuration

    • mountify_mounts: Set to 2 to mount all modules with a system folder (default), or 1 to mount only specific modules listed in modules.txt.
    • FAKE_MOUNT_NAME: Set a custom name for the fake folder (e.g., FAKE_MOUNT_NAME="mountify").
    • mountify_stop_start: Set to 1 to restart Android at service (required for certain modules).

    Module Selection

    If mountify_mounts=1, you must list the desired module_ids in /data/adb/mountify/modules.txt:

    module_id
    Adreno_Gpu_Driver
    DisplayFeatures
    ViPER4Android-RE-Fork
    mountify_whiteouts
    # Example modules.txt content
    module_id
    Adreno_Gpu_Driver
    DisplayFeatures
    ViPER4Android-RE-Fork
    mountify_whiteouts
  9. Configure ext4 sparse mode options

    master

    If your setup is tmpfs_xattr capable, you can force ext4 sparse mode using these settings in config.sh:

    • use_ext4_sparse=1: Forces the use of ext4 mode.
    • spoof_sparse=1: Attempts to spoof the sparse mount as an Android service.
    • FAKE_APEX_NAME="com.android.mntservice": Customizes the name of the spoofed Android service.
    • sparse_size="2048": Sets the sparse image size in MB.
    • enable_lkm_nuke=1: Attempts to load an experimental LKM to remove ext4 nodes.
    • lkm_filename="nuke.ko": Defines the filename for the LKM.
  10. Configure Mountify modules via the Module Selector

    master

    The Module Selector allows you to choose which installed modules Mountify will interact with. It scans /data/adb/modules for directories containing a system folder but no etc/hosts file. The selection is persisted to /data/adb/mountify/modules.txt.

    To use this programmatically or understand the logic:

    1. The UI fetches the list of eligible modules using exec.
    2. It reads the current selection from /data/adb/mountify/modules.txt.
    3. Upon saving, it writes the selected module names back to /data/adb/mountify/modules.txt using a newline-separated list.
  11. Toggle the update status in module.prop

    master

    The Web UI includes a switch to toggle whether the module uses updateJson or updateLink in its module.prop file. This is managed via a sed command executed through the system.

    Logic:

    • If updateJson is present, it replaces it with updateLink.
    • If updateLink is present, it replaces it with updateJson.