I have these commands: Download and push Magisk modules…
- User
I have these commands:
Download and push Magisk modules
url2="https://github.com/rojenzaman/sqlite3-magisk-module/releases/download/2024.04.18/SQLite-v3.45.3-for-magisk.multi-arch.zip" env:TEMP "Downloads" tempDir | Out-Null tempDir "MagiskFrida-16.3.1-1.zip" tempDir "SQLite-v3.45.3-for-magisk.multi-arch.zip" (New-Object System.Net.WebClient).DownloadFile(file1) (New-Object System.Net.WebClient).DownloadFile(file2) adb push outputDir adb push outputDir Remove-Item -Recurse -Force outputDir successfully!"
You can also add that will also install SQLite and MagiskFrida
- Assistant
Certainly! You can enhance your script to not only download and push the Magisk modules but also install them on your Android device. Below is the updated PowerShell script with added commands to install the
MagiskFridaandSQLitemodules usingadb:# Download and install Magisk modules $url1 = "https://github.com/ViRb3/magisk-frida/releases/download/16.3.1-1/MagiskFrida-16.3.1-1.zip" $url2 = "https://github.com/rojenzaman/sqlite3-magisk-module/releases/download/2024.04.18/SQLite-v3.45.3-for-magisk.multi-arch.zip" $tempDir = Join-Path $env:TEMP "Downloads" $outputDir = "/storage/emulated/0/Download" # Create temporary download directory New-Item -ItemType Directory -Force -Path $tempDir | Out-Null # Define local file paths $file1 = Join-Path $tempDir "MagiskFrida-16.3.1-1.zip" $file2 = Join-Path $tempDir "SQLite-v3.45.3-for-magisk.multi-arch.zip" # Download the module ZIP files Write-Host "Downloading MagiskFrida module..." (New-Object System.Net.WebClient).DownloadFile($url1, $file1) Write-Host "Downloading SQLite module..." (New-Object System.Net.WebClient).DownloadFile($url2, $file2) # Push the ZIP files to the device Write-Host "Pushing MagiskFrida module to device..." adb push $file1 $outputDir Write-Host "Pushing SQLite module to device..." adb push $file2 $outputDir # Clean up temporary files Remove-Item -Recurse -Force $tempDir # Install the modules on the device Write-Host "Installing MagiskFrida module..." adb shell su -c "magisk --install-module '$outputDir/MagiskFrida-16.3.1-1.zip'" Write-Host "Installing SQLite module..." adb shell su -c "magisk --install-module '$outputDir/SQLite-v3.45.3-for-magisk.multi-arch.zip'" # Optional: Reboot the device to activate the modules Write-Host "Rebooting device to activate modules..." adb reboot Write-Host "Magisk modules downloaded, pushed, and installed successfully!"Explanation:
-
Downloading Modules: The script downloads the Magisk module ZIP files to a temporary directory on your PC.
-
Pushing Modules to Device: It then pushes these ZIP files to the
/storage/emulated/0/Downloaddirectory on your Android device. -
Installing Modules: The script uses
adb shellwithsu -cto execute commands with root privileges on the device. It runs themagisk --install-modulecommand to install each module from the downloaded ZIP files. -
Rebooting Device: After installation, the script reboots the device to activate the newly installed modules.
Notes:
-
Magisk Command Availability: This script assumes that the
magiskcommand-line tool is available on your device, which is the case for Magisk v22.0 and above. -
Root Access Required: The device must be rooted with Magisk, and USB debugging must be enabled.
-
Permissions: Ensure that your
adbhas the necessary permissions to execute commands on the device. You may need to authorize your PC on the device when prompted. -
Error Handling: For a production script, consider adding error handling to catch and display errors during download, push, or installation processes.
Alternative Installation Method:
If for some reason the
magiskcommand is not available, you can manually copy the modules to the Magisk modules directory:# Alternative installation without 'magisk' command Write-Host "Manually installing modules..." # Define the modules directory $modulesDir = "/data/adb/modules_update" # Push ZIP files directly to the modules directory adb shell su -c "mkdir -p '$modulesDir'" adb shell su -c "cp '$outputDir/MagiskFrida-16.3.1-1.zip' '$modulesDir'" adb shell su -c "cp '$outputDir/SQLite-v3.45.3-for-magisk.multi-arch.zip' '$modulesDir'" # Set appropriate permissions adb shell su -c "chmod 644 '$modulesDir/MagiskFrida-16.3.1-1.zip'" adb shell su -c "chmod 644 '$modulesDir/SQLite-v3.45.3-for-magisk.multi-arch.zip'" # Reboot the device Write-Host "Rebooting device to activate modules..." adb rebootImportant: Using the
magiskcommand is the recommended and safer method to install modules, as it ensures proper installation and avoids potential issues with permissions or corrupting the modules directory.Final Reminder:
Always exercise caution when executing scripts that modify system files or install modules on your device. Make sure to have backups of important data.
-