apk-puller

1.0.0 • Public • Published

APK Puller

A command-line tool to extract APKs from connected Android devices.

APK Puller Banner

GitHub

Table of Contents

Prerequisites

  • Node.js (v12 or higher)
  • Android Debug Bridge (ADB) installed and available in your PATH
  • USB debugging enabled on your Android device

Installation

npm install -g apk-puller

Usage

Basic usage:

apk-puller

With options:

apk-puller --filter "Chrome" --output ~/Downloads

Command Line Options

  • -f, --filter <search>: Filter apps by name or package name
  • -o, --output <directory>: Specify output directory for the APK file (defaults to current directory)

Practical Use Cases

1. Adding Certificate Trust to Non-Rooted Device

If you need to make an app trust your certificate on a non-rooted device (useful for debugging/testing):

  1. Extract the APK:

    apk-puller --filter "YourApp"
  2. Decompile the APK:

    apktool d YourApp.apk
  3. Edit the network security configuration:

    <!-- res/xml/network_security_config.xml -->
    <?xml version="1.0" encoding="utf-8"?>
    <network-security-config>
        <base-config>
            <trust-anchors>
                <certificates src="system"/>
                <certificates src="user"/>
            </trust-anchors>
        </base-config>
    </network-security-config>
  4. Update AndroidManifest.xml to use the config:

    <application
        android:networkSecurityConfig="@xml/network_security_config"
        ...
    >
  5. Rebuild and sign:

    apktool b YourApp -o YourApp_modified.apk
    keytool -genkey -v -keystore debug.keystore -alias debugkey -keyalg RSA
    jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore debug.keystore YourApp_modified.apk debugkey
  6. Install the modified APK:

    adb install -r YourApp_modified.apk

2. Analyzing App Dependencies

Extract an APK to analyze its dependencies and libraries:

apk-puller --filter "AppName" --output ~/analysis
cd ~/analysis
unzip AppName.apk -d extracted
ls -la extracted/lib/

3. Backup Before Updates

Save a working version before updating:

# Create backup directory
mkdir -p ~/app_backups/AppName
# Pull current version
apk-puller --filter "AppName" --output ~/app_backups/AppName
# Rename with version
mv ~/app_backups/AppName/com.example.app.apk ~/app_backups/AppName/v1.2.3.apk

4. Multiple Device Management

When working with multiple devices:

# Pull same app from different devices
apk-puller --filter "AppName"
# Tool will show device selection:
? Select a device:
❯ Pixel_4_API_30 (emulator-5554)
  RealDevice (RF8R90XXXXX)

Example Outputs

Basic Usage

When you run apk-puller without any options, you'll see an interactive menu:

  1. If multiple devices are connected, you'll see a device selection menu:

    ? Select a device:
    ❯ RF8R90XXXXX
      emulator-5554
    
  2. Then you'll see a list of all user-installed apps:

    ? Select an app to extract:
    ❯ Instagram (com.instagram.android)
      Chrome (com.android.chrome)
      WhatsApp (com.whatsapp)
      Gmail (com.google.android.gm)
      ...
    
  3. After selection, you'll see the success message:

    Successfully pulled APK to: /path/to/directory/com.instagram.android.apk
    

Using Filters

When using the --filter option, you'll see a filtered list of apps:

$ apk-puller --filter "Chrome"
? Select an app to extract:
❯ Chrome (com.android.chrome)
  Chrome Beta (com.android.chrome.beta)
  Chrome Dev (com.android.chrome.dev)

Error Messages

You might see these error messages in certain situations:

  1. No devices connected:

    Error: No devices found. Please connect an Android device and enable USB debugging.
    
  2. No matching apps found:

    Error: No apps found matching "NonExistentApp"
    
  3. ADB not installed:

    Error: Make sure ADB is installed and available in your PATH
    

Features

  • Automatically detects connected Android devices
  • Interactive device selection if multiple devices are connected
  • Lists all installed apps on the selected device
  • Interactive app selection
  • Filter apps by name or package name
  • Specify custom output directory
  • Shows app names along with package names
  • Only shows user-installed applications
  • Colored output for better visibility
  • Error handling and user-friendly messages

Troubleshooting

If you encounter any issues:

  1. Make sure ADB is installed and available in your PATH
  2. Verify USB debugging is enabled on your device
  3. Check if your device is properly connected
  4. Ensure you have the necessary permissions on your device
  5. Make sure the output directory exists and is writable

Connect with Me

Made with ❤️ by GlizzyKingDreko

Readme

Keywords

Package Sidebar

Install

npm i apk-puller

Weekly Downloads

6

Version

1.0.0

License

MIT

Unpacked Size

13.3 kB

Total Files

4

Last publish

Collaborators

  • glizzykingdreko