This Python script is designed to help replace system .so library files on Android devices where adb root is not available (i.e., production builds). It uses adb and su to remount /system as read-write, back up existing libraries, and replace them with new versions.
- Scans for replacement
.sofiles in a localReplace/folder. - If
Replace/is empty, allows manual selection of files. - Checks whether a matching library exists on the device in:
/system/lib//system/vendor/lib/
- Makes a timestamped backup of the original library in
Backup/. - Pushes the new library via
/sdcard/, then usessuto:- Copy it to the system path
- Set permissions to
644 - Delete the temporary file
- Supports devices with root access via Magisk/SuperSU, even without
adb root.
π Folder Structure project/ βββ Replace/ # Place your replacement .so files here βββ Backup/ # Automatically created for backups βββ replace_libs.py # The main script
- Python 3
- ADB installed and in your PATH
- Android device with:
- USB debugging enabled
- Root access via Magisk/SuperSU
- Read/write remount capability for
/system
adb shellwith workingsu(test withadb shell β su β whoami β root)
- Connect your Android device via USB.
- Enable USB Debugging.
- Place
.sofiles to replace into theReplace/folder. - Run the script:
python3 replace_libs.py
Follow the prompts to confirm replacements.
β οΈ Disclaimer
This tool modifies system files β use at your own risk.
Always ensure you have proper backups and understand the implications of modifying /system.