Skip to content
The Chat Archive
o1-preview-2024-09-12· OpenAI WildChat-4.8M (AI2)

I have these commands: Download and push Magisk modules…

  1. User

    I have these commands:

    Download and push Magisk modules

    url1="https://github.com/ViRb3/magisk−frida/releases/download/16.3.1−1/MagiskFrida−16.3.1−1.zip"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−PathtempDir=Join-Path env:TEMP "Downloads" outputDir="/storage/emulated/0/Download"New−Item−ItemTypeDirectory−Force−PathoutputDir="/storage/emulated/0/Download" New-Item -ItemType Directory -Force -Path tempDir | Out-Null file1=Join−Pathfile1=Join-Path tempDir "MagiskFrida-16.3.1-1.zip" file2=Join−Pathfile2=Join-Path tempDir "SQLite-v3.45.3-for-magisk.multi-arch.zip" (New-Object System.Net.WebClient).DownloadFile(url1,url1,file1) (New-Object System.Net.WebClient).DownloadFile(url2,url2,file2) adb push file1file1 outputDir adb push file2file2 outputDir Remove-Item -Recurse -Force tempDirWrite−Host"MagiskmodulesdownloadedandpushedtotempDir Write-Host "Magisk modules downloaded and pushed to outputDir successfully!"

    You can also add that will also install SQLite and MagiskFrida

  2. 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 MagiskFrida and SQLite modules using adb:

    # 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/Download directory on your Android device.

    • Installing Modules: The script uses adb shell with su -c to execute commands with root privileges on the device. It runs the magisk --install-module command 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 magisk command-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 adb has 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 magisk command 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 reboot
    

    Important: Using the magisk command 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.