Metadata-Version: 2.4
Name: androguard
Version: 5.0.0
Summary: Androguard is a full python tool to play with Android files.
Author-email: Anthony Desnos <anthony@42.bzh>
License: 
                                         Apache License
                                   Version 2.0, January 2004
                                http://www.apache.org/licenses/
        
           TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
        
           1. Definitions.
        
              "License" shall mean the terms and conditions for use, reproduction,
              and distribution as defined by Sections 1 through 9 of this document.
        
              "Licensor" shall mean the copyright owner or entity authorized by
              the copyright owner that is granting the License.
        
              "Legal Entity" shall mean the union of the acting entity and all
              other entities that control, are controlled by, or are under common
              control with that entity. For the purposes of this definition,
              "control" means (i) the power, direct or indirect, to cause the
              direction or management of such entity, whether by contract or
              otherwise, or (ii) ownership of fifty percent (50%) or more of the
              outstanding shares, or (iii) beneficial ownership of such entity.
        
              "You" (or "Your") shall mean an individual or Legal Entity
              exercising permissions granted by this License.
        
              "Source" form shall mean the preferred form for making modifications,
              including but not limited to software source code, documentation
              source, and configuration files.
        
              "Object" form shall mean any form resulting from mechanical
              transformation or translation of a Source form, including but
              not limited to compiled object code, generated documentation,
              and conversions to other media types.
        
              "Work" shall mean the work of authorship, whether in Source or
              Object form, made available under the License, as indicated by a
              copyright notice that is included in or attached to the work
              (an example is provided in the Appendix below).
        
              "Derivative Works" shall mean any work, whether in Source or Object
              form, that is based on (or derived from) the Work and for which the
              editorial revisions, annotations, elaborations, or other modifications
              represent, as a whole, an original work of authorship. For the purposes
              of this License, Derivative Works shall not include works that remain
              separable from, or merely link (or bind by name) to the interfaces of,
              the Work and Derivative Works thereof.
        
              "Contribution" shall mean any work of authorship, including
              the original version of the Work and any modifications or additions
              to that Work or Derivative Works thereof, that is intentionally
              submitted to Licensor for inclusion in the Work by the copyright owner
              or by an individual or Legal Entity authorized to submit on behalf of
              the copyright owner. For the purposes of this definition, "submitted"
              means any form of electronic, verbal, or written communication sent
              to the Licensor or its representatives, including but not limited to
              communication on electronic mailing lists, source code control systems,
              and issue tracking systems that are managed by, or on behalf of, the
              Licensor for the purpose of discussing and improving the Work, but
              excluding communication that is conspicuously marked or otherwise
              designated in writing by the copyright owner as "Not a Contribution."
        
              "Contributor" shall mean Licensor and any individual or Legal Entity
              on behalf of whom a Contribution has been received by Licensor and
              subsequently incorporated within the Work.
        
           2. Grant of Copyright License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              copyright license to reproduce, prepare Derivative Works of,
              publicly display, publicly perform, sublicense, and distribute the
              Work and such Derivative Works in Source or Object form.
        
           3. Grant of Patent License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              (except as stated in this section) patent license to make, have made,
              use, offer to sell, sell, import, and otherwise transfer the Work,
              where such license applies only to those patent claims licensable
              by such Contributor that are necessarily infringed by their
              Contribution(s) alone or by combination of their Contribution(s)
              with the Work to which such Contribution(s) was submitted. If You
              institute patent litigation against any entity (including a
              cross-claim or counterclaim in a lawsuit) alleging that the Work
              or a Contribution incorporated within the Work constitutes direct
              or contributory patent infringement, then any patent licenses
              granted to You under this License for that Work shall terminate
              as of the date such litigation is filed.
        
           4. Redistribution. You may reproduce and distribute copies of the
              Work or Derivative Works thereof in any medium, with or without
              modifications, and in Source or Object form, provided that You
              meet the following conditions:
        
              (a) You must give any other recipients of the Work or
                  Derivative Works a copy of this License; and
        
              (b) You must cause any modified files to carry prominent notices
                  stating that You changed the files; and
        
              (c) You must retain, in the Source form of any Derivative Works
                  that You distribute, all copyright, patent, trademark, and
                  attribution notices from the Source form of the Work,
                  excluding those notices that do not pertain to any part of
                  the Derivative Works; and
        
              (d) If the Work includes a "NOTICE" text file as part of its
                  distribution, then any Derivative Works that You distribute must
                  include a readable copy of the attribution notices contained
                  within such NOTICE file, excluding those notices that do not
                  pertain to any part of the Derivative Works, in at least one
                  of the following places: within a NOTICE text file distributed
                  as part of the Derivative Works; within the Source form or
                  documentation, if provided along with the Derivative Works; or,
                  within a display generated by the Derivative Works, if and
                  wherever such third-party notices normally appear. The contents
                  of the NOTICE file are for informational purposes only and
                  do not modify the License. You may add Your own attribution
                  notices within Derivative Works that You distribute, alongside
                  or as an addendum to the NOTICE text from the Work, provided
                  that such additional attribution notices cannot be construed
                  as modifying the License.
        
              You may add Your own copyright statement to Your modifications and
              may provide additional or different license terms and conditions
              for use, reproduction, or distribution of Your modifications, or
              for any such Derivative Works as a whole, provided Your use,
              reproduction, and distribution of the Work otherwise complies with
              the conditions stated in this License.
        
           5. Submission of Contributions. Unless You explicitly state otherwise,
              any Contribution intentionally submitted for inclusion in the Work
              by You to the Licensor shall be under the terms and conditions of
              this License, without any additional terms or conditions.
              Notwithstanding the above, nothing herein shall supersede or modify
              the terms of any separate license agreement you may have executed
              with Licensor regarding such Contributions.
        
           6. Trademarks. This License does not grant permission to use the trade
              names, trademarks, service marks, or product names of the Licensor,
              except as required for reasonable and customary use in describing the
              origin of the Work and reproducing the content of the NOTICE file.
        
           7. Disclaimer of Warranty. Unless required by applicable law or
              agreed to in writing, Licensor provides the Work (and each
              Contributor provides its Contributions) on an "AS IS" BASIS,
              WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
              implied, including, without limitation, any warranties or conditions
              of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
              PARTICULAR PURPOSE. You are solely responsible for determining the
              appropriateness of using or redistributing the Work and assume any
              risks associated with Your exercise of permissions under this License.
        
           8. Limitation of Liability. In no event and under no legal theory,
              whether in tort (including negligence), contract, or otherwise,
              unless required by applicable law (such as deliberate and grossly
              negligent acts) or agreed to in writing, shall any Contributor be
              liable to You for damages, including any direct, indirect, special,
              incidental, or consequential damages of any character arising as a
              result of this License or out of the use or inability to use the
              Work (including but not limited to damages for loss of goodwill,
              work stoppage, computer failure or malfunction, or any and all
              other commercial damages or losses), even if such Contributor
              has been advised of the possibility of such damages.
        
           9. Accepting Warranty or Additional Liability. While redistributing
              the Work or Derivative Works thereof, You may choose to offer,
              and charge a fee for, acceptance of support, warranty, indemnity,
              or other liability obligations and/or rights consistent with this
              License. However, in accepting such obligations, You may act only
              on Your own behalf and on Your sole responsibility, not on behalf
              of any other Contributor, and only if You agree to indemnify,
              defend, and hold each Contributor harmless for any liability
              incurred by, or claims asserted against, such Contributor by reason
              of your accepting any such warranty or additional liability.
        
           END OF TERMS AND CONDITIONS
        
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Software Development
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENCE
Requires-Dist: apkparser-ag @ git+https://github.com/androguard/apk-parser.git
Requires-Dist: dexparser-ag @ git+https://github.com/androguard/dex-parser.git
Requires-Dist: axml>=0.0.2
Requires-Dist: rich>=14.0.0
Provides-Extra: disasm
Requires-Dist: dex-bytecode-py @ git+https://github.com/androguard/dex-bytecode.git#subdirectory=dex-bytecode-py ; extra == "disasm"
Provides-Extra: decompile
Requires-Dist: dex-decompiler @ git+https://github.com/androguard/dex-decompiler.git#subdirectory=dex-decompiler-py ; extra == "decompile"
Provides-Extra: arm
Requires-Dist: arm-disassembler @ git+https://github.com/androguard/arm_disassembler.git#subdirectory=arm_disassembler-py ; extra == "arm"
Requires-Dist: arm-decompiler @ git+https://github.com/androguard/arm_decompiler.git#subdirectory=arm_decompiler-py ; extra == "arm"
Provides-Extra: patch
Requires-Dist: apk-patch @ git+https://github.com/androguard/apk-patch.git#subdirectory=crates/apk-patch-py ; extra == "patch"
Provides-Extra: mcp
Requires-Dist: mcp>=1.0; extra == "mcp"
Provides-Extra: full
Requires-Dist: androguard[arm,decompile,disasm,mcp,patch]; extra == "full"
Dynamic: license-file


<p align="center"><img width="200" src="./.github/logo.png" alt="Androguard"></p>
<h2 align="center">Androguard</h2>

# Androguard: Reverse engineering and pentesting for Android applications

<div align="center">

![Powered By: Androguard](https://img.shields.io/badge/androguard-green?style=for-the-badge&label=Powered%20by&link=https%3A%2F%2Fgithub.com%2Fandroguard)

</div>


[![PyPI Upload](https://github.com/androguard/androguard/actions/workflows/pythonpublish.yml/badge.svg)](https://github.com/androguard/androguard/actions/workflows/pythonpublish.yml)
![PyPI - Version](https://img.shields.io/pypi/v/androguard)
![Static Badge](https://img.shields.io/badge/Documentation-InProgress-red)

**Androguard 5** is a Python toolkit for Android reverse engineering: open an APK, inspect the manifest and DEX, disassemble or decompile code, hunt references and vulnerabilities, and optionally patch or analyze native ARM — from the CLI, a high-level `Application` API, Claude Code skills, or an MCP server for LLM hosts.

### Main features

- **APK / DEX analysis** — package metadata, permissions, classes, methods, strings (`apkparser-ag`, `dexparser-ag`, `axml`)
- **Dalvik disassembly & CFG** — method-level bytecode via `androguard[disasm]`
- **Java decompilation** — methods, classes, or whole packages via `androguard[decompile]`
- **Cross-refs & vulns** — `findrefs`, vulnerability scanners, method emulation
- **Native ARM64** — disassemble / decompile `.so` code via `androguard[arm]`
- **APK patch** — decode / rebuild project trees via `androguard[patch]`
- **LLM integration** — Claude Code agent & skills, plus an **MCP server** (`androguard-mcp`) for Claude Code, Cursor, and other MCP clients
- **MASTG demo coverage** — status of every OWASP MASTG Android demo vs `scan_vulns` in [`docs/mastg-coverage.md`](docs/mastg-coverage.md)

Do you think your phone has been pwned? Please check [IsMyPhonePwned](https://github.com/IsMyPhonePwned).


## Installation

Androguard 5 is this repository. It is not the package currently published on PyPI (`androguard` 4.1.4). From a checkout, install the local tree. A bare `pip install androguard` or `pip install 'androguard[full]'` downloads 4.1.4 and uninstalls 5.0.0.

```bash
# from this repo (Rust toolchain required for the optional extras)
# Python 3.14+ needs the PyO3 forward-compat flag (bindings use PyO3 0.23, max 3.13)
export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
# Rust apk-parser + dex-parser (siblings under ../)
pip install -e ../apk-parser
pip install -e ../dex-parser
pip install -e .
pip install -e '.[full]'
```

After 5.0.0 is published, the same extras install from PyPI:

```bash
pip install androguard
pip install 'androguard[full]'
```

> [!IMPORTANT]
> Versions >= 4.0.0 are new releases after a long time, where the project has substantial differences from the previous stable version 3.3.5 from 2019. This means that certain functionalities have been removed. If you notice an issue with your project using the latest version, please open up an [issue](https://github.com/androguard/androguard/issues).

## Ecosystem

Androguard v5 is built on dedicated libraries:

| Layer | Library | Role |
|-------|---------|------|
| APK archive | [apk-parser](https://github.com/androguard/apk-parser) (`apkparser-ag`) | ZIP structure, signatures, manifest hooks |
| DEX structure | [dex-parser](https://github.com/androguard/dex-parser) (`dexparser-ag`) | Rust core + Python bindings: classes, methods, fields, bytecode |
| Binary XML / ARSC | [axml](https://github.com/androguard/axml) / [axml-parser](https://github.com/androguard/axml-parser) (Rust) | `AndroidManifest.xml`, `resources.arsc` |
| Bytecode (optional) | [dex-bytecode](https://github.com/androguard/dex-bytecode) | Dalvik disassembly / CFG / patch via `androguard[disasm]` |
| Decompiler (optional) | [dex-decompiler](https://github.com/androguard/dex-decompiler) | DEX → Java, ASC getclass/findrefs, vulns via `androguard[decompile]` |
| ARM64 (optional) | [arm_disassembler](https://github.com/androguard/arm_disassembler) / [arm_decompiler](https://github.com/androguard/arm_decompiler) | Native code via `androguard[arm]` |
| APK patch (optional) | [apk-patch](https://github.com/androguard/apk-patch) | In-memory decode/build via `androguard[patch]` |

## Examples

Runnable demos live in [`examples/`](examples/) and are also executed by the
test suite (`tests/test_examples.py`):

```bash
python -m examples.application_summary
python -m examples.disassemble      # androguard[disasm]
python -m examples.decompile       # androguard[decompile]
python -m examples.arm             # androguard[arm]
python -m examples.patch_decode    # androguard[patch]
python -m examples.run_all
```

See [`examples/README.md`](examples/README.md).

## Claude Code

This repo ships Claude Code project support (similar in spirit to [areclaw](https://github.com/TheQmaks/areclaw), but driven by Androguard itself):

| Path | Role |
|------|------|
| [`CLAUDE.md`](CLAUDE.md) | Project instructions for the agent |
| [`.claude/agents/androguard-analyst.md`](.claude/agents/androguard-analyst.md) | Analyst agent |
| [`.claude/skills/`](.claude/skills/) | `/analyze-apk`, `/decompile-apk`, `/find-refs`, `/scan-vulns` |
| [`workspace/`](workspace/) | Samples, decompiled output, reports |

```bash
claude /agent androguard-analyst
claude /analyze-apk path/to/app.apk
claude /decompile-apk path/to/app.apk com.example.app
```

## MCP server

Androguard can run as an [MCP](https://modelcontextprotocol.io/) server so LLM hosts (Claude Code, Cursor, …) call typed analysis tools instead of shelling out to the CLI.

```bash
pip install -e '.[mcp,decompile]'   # add [disasm] for disassembly tools
androguard-mcp                     # or: python -m androguard.mcp
```

Example client config:

```json
{
  "mcpServers": {
    "androguard": {
      "command": "androguard-mcp",
      "env": {
        "ANDROGUARD_MCP_ROOTS": "/path/to/androguard"
      }
    }
  }
}
```

Typical flow: `open_apk` → `session_id` → `list_classes` / `find_refs` / `decompile_method` / `scan_vulns`.

On launch the server prints a stderr banner (versions, tools, path roots, extras). Use `--log-tools` to log each tool call, and `--log-level DEBUG` for more detail.

Full tool list, env vars, and security notes: [`docs/mcp-server.md`](docs/mcp-server.md). Design background: [`docs/mcp-server-plan.md`](docs/mcp-server-plan.md).

## Quick start

### Command line

```bash
# Summary: package, main activity, dex count, classes, methods
androguard -i my.apk

# List classes or methods
androguard -i my.apk --list-classes
androguard -i my.apk --list-methods

# Disassemble methods matching regex (requires androguard[disasm])
androguard -i my.apk --disasm --class 'TestActivity' --method 'onCreate'
androguard -i my.apk --disasm --class 'Ltests/androguard/.*' --method '<init>'
androguard -i my.apk --disasm --method 'onCreate' --limit 10
androguard -i my.apk --disasm --class TestActivity --method onCreate --cfg

# Decompile to Java (requires androguard[decompile])
androguard -i my.apk --decompile-method 'tests.androguard.TestActivity#onCreate'
androguard -i my.apk --decompile --class TestActivity --method onCreate
androguard -i my.apk --decompile -o out.java
androguard -i my.apk -d decompiled/ --only-package tests.androguard
androguard -i my.apk --getclass tests.androguard.TestActivity
androguard -i my.apk --findrefs string --findrefs-value password
androguard -i my.apk --scan-vulns
androguard -i my.apk --emulate 'tests.androguard.TestActivity#onCreate'

# Decode project tree (requires androguard[patch])
androguard -i my.apk --decode-project
```

### CLI smoke test (bundled sample)

After `pip install -e '.[full]'`, exercise the main CLI features against the repo
sample APK (`tests/data/APK/TestActivity.apk`):

```bash
# from the androguard repo root
APK=tests/data/APK/TestActivity.apk
CLS=tests.androguard.TestActivity
METH="$CLS#onCreate"

androguard -i "$APK"                                    # summary
androguard -i "$APK" --list-classes | head
androguard -i "$APK" --list-methods | head

# disasm (androguard[disasm])
androguard -i "$APK" --disasm --class TestActivity --method onCreate
androguard -i "$APK" --disasm --class TestActivity --method onCreate --cfg

# decompile / ASC / vulns / emulate (androguard[decompile])
androguard -i "$APK" --decompile-method "$METH"
androguard -i "$APK" --getclass "$CLS"
androguard -i "$APK" -d /tmp/androguard-decompiled/ --only-package tests.androguard
androguard -i "$APK" --findrefs string --findrefs-value "this is a test"
androguard -i "$APK" --scan-vulns                       # MASWE / MASVS / MASTG ids
androguard -i "$APK" --emulate "$METH"

# patch (androguard[patch])
androguard -i "$APK" --decode-project
```

Or run the Python demos (same coverage, including optional ARM):

```bash
python -m examples.run_all
```

### MASTG demo coverage

Androguard’s vulnerability scanner is validated against **all** OWASP MASTG Android demos.
The checked-in results live in:

**[`docs/mastg-coverage.md`](docs/mastg-coverage.md)**

It lists every `MASTG-DEMO-*` with validate status (`pass` / `gap` / `skip`), Frida static assessment when relevant, and the `scan_vulns` categories found.

```bash
# regenerate after a validate run (needs JDK 17 + ANDROID_HOME for a full rebuild)
python scripts/mastg_validate.py --setup
python scripts/mastg_validate.py            # builds/scans demos → JSON + refreshes docs/mastg-coverage.md
python scripts/mastg_coverage_doc.py        # refresh the markdown from the latest JSON only
```

### High-level API (`Application`)

```python
from androguard import Application

app = Application("my.apk")

print(app.summary())
# {'app_name': '...', 'main_activity': '...', 'package': 'com.example',
#  'dex_files': ['classes.dex', ...], 'classes': 1234, 'strings': 5678,
#  'methods': 8900, 'signed': True}

for name in app.class_names[:10]:
    print(name)

for method in app.methods:
    if method.get_code():
        print(method.class_name, method.name, method.get_code().insns_size)
```

### APK layer (`apkparser-ag`)

```python
import io
from apkparser import APK, OPTION_AXML, OPTION_SIGNATURE, OPTION_PERMISSION

with open("my.apk", "rb") as f:
    apk = APK(
        io.BytesIO(f.read()),
        {
            OPTION_AXML: True,
            OPTION_SIGNATURE: True,
            OPTION_PERMISSION: True,
        },
    )

print(apk.get_app_name())
print(apk.get_main_activity())
print(apk.axml.package if apk.axml else "")  # from decoded manifest
print(list(apk.get_dex_names()))  # classes.dex, classes2.dex, ...

manifest_xml = apk.get_android_manifest()
raw_manifest = apk.get_file("AndroidManifest.xml")
```

Or through Androguard re-exports:

```python
from androguard.core.apk import APK, OPTION_AXML
```

### DEX layer ([dex-parser](https://github.com/androguard/dex-parser))

From an APK’s DEX blobs:

```python
from dexparser import DEX, DEXHelper, DEX_from_source

# From APK bytes (via apkparser)
raw = apk.get_file("classes.dex")
dh = DEXHelper.from_string(raw)

# From a .dex file on disk
d = DEX.from_path("classes.dex")
dh = DEXHelper.from_rawdex(d)

# Path, bytes, or stream
dh = DEXHelper.from_rawdex(DEX_from_source("classes.dex"))
```

Iterate structure:

```python
for cls in dh.get_classes():
    print("CLASS", cls.name, "extends", cls.sname)

for method in dh.get_methods():
    print("METHOD", method.class_name, method.name, method.proto)
    code = method.get_code()
    if code:
        insns = code["insns"].value   # raw Dalvik bytecode (bytes)
        print("  insns:", code.insns_size, "bytes:", len(insns))

for field in dh.get_fields():
    print("FIELD", field.class_name, field.name, field.type_field)

for s in dh.get_strings():
    if "password" in s.lower():
        print(s)
```

Header as a dict:

```python
d = DEX(bytes_data)
print(d["header"])  # file_size, class_defs_size, string_ids_size, ...
```

Androguard shortcuts:

```python
from androguard.misc import AnalyzeAPK, AnalyzeDex

apk_obj, dex_helpers, app = AnalyzeAPK("my.apk")
dh = AnalyzeDex("classes.dex")       # path or bytes
```

### Dalvik disassembly (`dex-bytecode`, optional)

```python
from androguard.core.bytecode import (
    disassemble,
    disassemble_method_code,
    basic_blocks,
    cfg_edges,
    patch_branch,
    encode_instruction,
    encode_nop,
)

# Raw bytecode
for ins in disassemble(b"\x00\x00\x0e\x00"):
    print(f"{ins['offset']:08x}  {ins['mnemonic']} {ins['operands']}")

# CFG / basic blocks
print(basic_blocks(b"\x00\x00\x28\x00\x0e\x00"))  # nop; goto +0; return-void
print(cfg_edges(b"\x00\x00\x28\x00\x0e\x00"))

# Encode / patch
print(encode_instruction("const/4", "v0, 1").hex())
print(encode_nop().hex())
mutated = patch_branch(b"\x28\x01\x0e\x00", 0, 2)

# From a parsed method
code = method.get_code()
if code:
    for ins in disassemble_method_code(code):
        print(ins["disasm"])
```

Through `Application`:

```python
for method in app.methods:
    code = method.get_code()
    if not code:
        continue
    for line in app.iter_disassembly(method):
        print(line)
    print(app.method_basic_blocks(method))
    print(app.method_cfg_edges(method))
```

### Java decompilation ([dex-decompiler](https://github.com/androguard/dex-decompiler), optional)

```python
from androguard.core.decompiler import (
    parse_dex,
    decompile_method,
    getclass,
    findrefs,
    scan_vulns,
    method_cfg,
    emulate_method,
    descriptor_to_java,
)

raw = apk.get_file("classes.dex")
dex = parse_dex(raw)

# Entire DEX as one Java source string
print(dex.decompile()[:2000])

# One method (Java class names)
java = dex.decompile_method("tests.androguard.TestActivity", "onCreate")

# Package layout on disk
dex.decompile_to_dir("out/")

# ASC helpers (APK or DEX bytes)
print(getclass(apk_bytes, "tests.androguard.TestActivity")[:500])
print(findrefs(apk_bytes, "string", "password")[:5])
print(scan_vulns(raw)[:3])
rows, nodes, edges = method_cfg(raw, "tests.androguard.TestActivity", "onCreate")
print(emulate_method(raw, "tests.androguard.TestActivity", "onCreate"))

# Dalvik descriptor → Java name
print(descriptor_to_java("Ltests/androguard/TestActivity;"))
# tests.androguard.TestActivity
```

Through `Application`:

```python
# CLASS#METHOD selector (Java names, same as dex-decompiler CLI)
print(app.decompile_method_selector("tests.androguard.TestActivity#onCreate"))

# Regex on Dalvik descriptors / method names
for method, source in app.iter_decompiled_methods(
    class_pattern=r"TestActivity",
    method_pattern=r"onCreate",
):
    print(method.class_name, "→", len(source), "chars")

# All DEX files from the APK → decompiled/ classes/ classes2/ …
app.decompile_apk_to_dir("decompiled/", only_package="tests.androguard")

# ASC + analysis
print(app.getclass("tests.androguard.TestActivity")[:500])
print(app.findrefs("type", "Landroid/app/Activity;"))
print(app.scan_vulns()[:3])
print(app.emulate("tests.androguard.TestActivity", "onCreate"))
```

### ARM64 (`arm_disassembler` / `arm_decompiler`, optional)

```python
from androguard.core import arm

print(arm.decode_one(0xD503201F))  # nop
for ins in arm.disassemble(bytes.fromhex("1f2003d5c0035fd6")):
    print(ins["text"])

out = arm.decompile(bytes.fromhex("1f2003d5c0035fd6"), name="foo")
print(out["source"])
```

### APK patch ([apk-patch](https://github.com/androguard/apk-patch), optional)

```python
from androguard.core import patch

project = patch.decode(apk_bytes, no_res=True)
# edit project["files"]["project/AndroidManifest.xml"] etc.
rebuilt = patch.build(project["files"], project_root=project["project_root"])

# or one-shot
rebuilt = patch.roundtrip(apk_bytes, sign=True)
# via Application
project = app.decode_project(only_manifest=True)
rebuilt = app.rebuild(sign=True, no_res=True)
```

### Legacy entry point

Scripts that used `AnalyzeAPK` in older Androguard versions can keep the same call pattern; the third return value is now a full `Application` instead of a cross-reference `Analysis` object (not yet restored in v5):

```python
from androguard.misc import AnalyzeAPK

apk_obj, dex_list, app = AnalyzeAPK("my.apk")
print(app.summary())
```

## Documentation

**Documentation contains outdated information — in progress of updating**

The [Github Pages Documentation](http://androguard.github.io/androguard/) is the most up to date source.

Additional documentation that contains outdated information is available at [ReadTheDocs](http://androguard.readthedocs.io/en/latest/).

## Authors: Androguard Team

Androguard + tools: Anthony Desnos (anthony at 42.bzh).

## Projects using Androguard

In alphabetical order:

* [AndroPyTool](https://github.com/alexMyG/AndroPyTool)
* [AppKnox](http://appknox.com)
* [Cuckoo Sandbox](https://cuckoosandbox.org)
* [Deckard](https://github.com/hrkfdn/deckard)
* [Droidbot](https://github.com/honeynet/droidbot)
* [Droidstatx](https://github.com/integrity-sa/droidstatx)
* [εxodus](https://github.com/Exodus-Privacy/exodus)
* [F-Droid Server](https://gitlab.com/fdroid/fdroidserver)
* [gplaycli](https://github.com/matlink/gplaycli)
* [Koodous](https://koodous.com)
* [MobSF](https://github.com/MobSF/Mobile-Security-Framework-MobSF)
* [qiew](https://github.com/mtivadar/qiew)
* [Quark-Engine](https://github.com/quark-engine/quark-engine)
* [Virustotal](https://virustotal.readme.io/reference/androguard)
* [Viper Framework](https://github.com/viper-framework/viper)
* ... and many more!

You are using Androguard and are not listed here? Just create a [ticket](https://github.com/androguard/androguard/issues) or send us a [pull request](https://github.com/androguard/androguard/pulls) with your project!

## Licenses

### Androguard

Copyright (C) 2012 - 2026, Anthony Desnos (anthony at 42.bzh)
All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
