apkfile


Nameapkfile JSON
Version 0.1.7 PyPI version JSON
download
home_page
SummaryPython wrapper for aapt • ApkFile, XapkFile, ApkmFile
upload_time2023-11-16 14:45:29
maintainer
docs_urlNone
authorDavid Lev
requires_python
licenseMIT
keywords apk aapt apkfile apks apkm xapk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## ⛏️ [apkfile](https://github.com/david-lev/apkfile) • Python library for handling APK, APKM, XAPK, and APKS files
[![CodeFactor](https://www.codefactor.io/repository/github/david-lev/apkfile/badge)](https://www.codefactor.io/repository/github/david-lev/apkfile)
[![PyPI Downloads](https://img.shields.io/pypi/dm/apkfile?style=flat-square)](https://badge.fury.io/py/apkfile)
[![PyPI Version](https://badge.fury.io/py/apkfile.svg)](https://pypi.org/project/apkfile/)

### Install with pip
```bash
pip3 install -U apkfile
```
### Or, install from source:
```bash
git clone https://github.com/david-lev/apkfile.git
cd apkfile
python3 setup.py install
```

You also need to install ``aapt`` (see [Install aapt](#install-aapt) below).

### Usage

```python
from apkfile import ApkFile, XapkFile, ApkmFile, ApksFile

# Get apk info
apk_file = ApkFile(path='/home/david/Downloads/wa.apk')
print(apk_file.package_name, apk_file.version_name, apk_file.version_code)
print(apk_file.as_dict())

# Get apkm info
apkm_file = ApkmFile('/home/david/Downloads/chrome.apkm')
for split in apkm_file.splits:
    print(split.split_name)
apkm_file.install(check=True, upgrade=True)

# Using context manager (delete the extracted files when done)
with XapkFile(path='/home/david/Downloads/telegram.xapk') as xf:
    print(xf.base.abis, x.permissions, x.langs)

# Get apks info
apks_file = ApksFile(path='/home/david/Downloads/facebook.apks')
print(apks_file.base.permissions, apks_file.md5, apks_file.sha256)

```

### How this library works?
This library uses [``aapt``](https://elinux.org/Android_aapt) to extract information from the `.APK` file, and then parses the output to get the information.
- For the zip files (`.APKM`, `.XAPK`, and `.APKS`), the basic information (`package_name`, `version_name`, `version_code`, etc.) is derived from the .json file, and the rest of the information is extracted when it requested (lazy evaluation).
- The library also provide ways to install the files (and check compatibility; `min_sdk_version`,  `abis` and `langs`) using [adb](#install-adb). Just connect your device/s and run the `install` method. (you can use the ``install_apks`` function independently).


### Install aapt
apkfile requires [``aapt``](https://elinux.org/Android_aapt) to be in the ``PATH``.
In each operating system, the way to install aapt is different, if you installed Android Studio, add one of the build-tools paths to the ``PATH``, if you are on a Debian-based Linux system (Ubuntu etc.) you can install with ``sudo apt install aapt``, and on Windows and Mac? Just google "How to install aapt on X".
- You can manually provide a path to aapt: ``ApkFile(..., aapt_path='/path/to/aapt')``.

### Install adb
if you want to use the ``install`` method, you need to install [``adb``](https://developer.android.com/studio/command-line/adb).

- You can manually provide a path to adb: ``ApkFile(...).install(adb_path='/path/to/adb')``.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "apkfile",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "apk,aapt,apkfile,apks,apkm,xapk",
    "author": "David Lev",
    "author_email": "davidlev@telegmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7f/d6/a3b951d2670d93a67a66a26a11e86d29082eb6b1d300a5116ebc35ec28f4/apkfile-0.1.7.tar.gz",
    "platform": null,
    "description": "## \u26cf\ufe0f [apkfile](https://github.com/david-lev/apkfile) \u2022 Python library for handling APK, APKM, XAPK, and APKS files\n[![CodeFactor](https://www.codefactor.io/repository/github/david-lev/apkfile/badge)](https://www.codefactor.io/repository/github/david-lev/apkfile)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/apkfile?style=flat-square)](https://badge.fury.io/py/apkfile)\n[![PyPI Version](https://badge.fury.io/py/apkfile.svg)](https://pypi.org/project/apkfile/)\n\n### Install with pip\n```bash\npip3 install -U apkfile\n```\n### Or, install from source:\n```bash\ngit clone https://github.com/david-lev/apkfile.git\ncd apkfile\npython3 setup.py install\n```\n\nYou also need to install ``aapt`` (see [Install aapt](#install-aapt) below).\n\n### Usage\n\n```python\nfrom apkfile import ApkFile, XapkFile, ApkmFile, ApksFile\n\n# Get apk info\napk_file = ApkFile(path='/home/david/Downloads/wa.apk')\nprint(apk_file.package_name, apk_file.version_name, apk_file.version_code)\nprint(apk_file.as_dict())\n\n# Get apkm info\napkm_file = ApkmFile('/home/david/Downloads/chrome.apkm')\nfor split in apkm_file.splits:\n    print(split.split_name)\napkm_file.install(check=True, upgrade=True)\n\n# Using context manager (delete the extracted files when done)\nwith XapkFile(path='/home/david/Downloads/telegram.xapk') as xf:\n    print(xf.base.abis, x.permissions, x.langs)\n\n# Get apks info\napks_file = ApksFile(path='/home/david/Downloads/facebook.apks')\nprint(apks_file.base.permissions, apks_file.md5, apks_file.sha256)\n\n```\n\n### How this library works?\nThis library uses [``aapt``](https://elinux.org/Android_aapt) to extract information from the `.APK` file, and then parses the output to get the information.\n- For the zip files (`.APKM`, `.XAPK`, and `.APKS`), the basic information (`package_name`, `version_name`, `version_code`, etc.) is derived from the .json file, and the rest of the information is extracted when it requested (lazy evaluation).\n- The library also provide ways to install the files (and check compatibility; `min_sdk_version`,  `abis` and `langs`) using [adb](#install-adb). Just connect your device/s and run the `install` method. (you can use the ``install_apks`` function independently).\n\n\n### Install aapt\napkfile requires [``aapt``](https://elinux.org/Android_aapt) to be in the ``PATH``.\nIn each operating system, the way to install aapt is different, if you installed Android Studio, add one of the build-tools paths to the ``PATH``, if you are on a Debian-based Linux system (Ubuntu etc.) you can install with ``sudo apt install aapt``, and on Windows and Mac? Just google \"How to install aapt on X\".\n- You can manually provide a path to aapt: ``ApkFile(..., aapt_path='/path/to/aapt')``.\n\n### Install adb\nif you want to use the ``install`` method, you need to install [``adb``](https://developer.android.com/studio/command-line/adb).\n\n- You can manually provide a path to adb: ``ApkFile(...).install(adb_path='/path/to/adb')``.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python wrapper for aapt \u2022 ApkFile, XapkFile, ApkmFile",
    "version": "0.1.7",
    "project_urls": {
        "Documentation": "https://github.com/david-lev/apkfile#readme",
        "Download": "https://pypi.org/project/apkfile/",
        "Funding": "https://github.com/sponsors/david-lev",
        "Issue Tracker": "https://github.com/david-lev/apkfile/issues",
        "Source Code": "https://github.com/david-lev/apkfile"
    },
    "split_keywords": [
        "apk",
        "aapt",
        "apkfile",
        "apks",
        "apkm",
        "xapk"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6609f3af6707d2a54fbebc250c6cbf4fc2d776fb3b9b5ee9b9ad14acca9d9cc3",
                "md5": "3200658ba838dc956ce882e2638fed7a",
                "sha256": "bc7273e86f8a0b4c9dadf8b07d3ea9649f73216430b2d0c7f292c7ed56a3db21"
            },
            "downloads": -1,
            "filename": "apkfile-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3200658ba838dc956ce882e2638fed7a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 13799,
            "upload_time": "2023-11-16T14:45:27",
            "upload_time_iso_8601": "2023-11-16T14:45:27.981802Z",
            "url": "https://files.pythonhosted.org/packages/66/09/f3af6707d2a54fbebc250c6cbf4fc2d776fb3b9b5ee9b9ad14acca9d9cc3/apkfile-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7fd6a3b951d2670d93a67a66a26a11e86d29082eb6b1d300a5116ebc35ec28f4",
                "md5": "85363227adb0f57f175faf62ee7399cf",
                "sha256": "9d2bcc179eea27485685a1c9c5ac473f53518adfa7750a8c129a4095ee1ff3fb"
            },
            "downloads": -1,
            "filename": "apkfile-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "85363227adb0f57f175faf62ee7399cf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 14995,
            "upload_time": "2023-11-16T14:45:29",
            "upload_time_iso_8601": "2023-11-16T14:45:29.221543Z",
            "url": "https://files.pythonhosted.org/packages/7f/d6/a3b951d2670d93a67a66a26a11e86d29082eb6b1d300a5116ebc35ec28f4/apkfile-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-16 14:45:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "david-lev",
    "github_project": "apkfile#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "apkfile"
}
        
Elapsed time: 0.26502s