Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,5 @@ cython_debug/
out/
assemblies.*
*.apk
*.so
*.bin
55 changes: 40 additions & 15 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,32 +1,57 @@
# Xamarin AssemblyStore Explorer (pyxamstore)
This is an alpha release of an `assemblies.blob` AssemblyStore parser written in Python. The tool is capable of unpack and repackaging `assemblies.blob` and `assemblies.manifest` Xamarin files from an APK.

## Installing
Run the installer script:
> [!NOTE]
> unpack and repack xamarin assemblies blob from `assemblies.blob` (V1) or payload `libassemblies.<arch>.blob.so` (V2/V3) format.

python setup.py install
## Installing
- Using `pip` [recommended]:
```shell
pip install -U git+https://github.com/AbhiTheModder/pyxamstore
```

You can then use the tool by calling `pyxamstore`

## Usage

```shell
$ pyxamstore -h
Pack/unpack Xamarin AssemblyStore payloads.

positional arguments:
elf_path Path to the ELF file to operate on; in case of V1 format, it should be path to the assemblies.blob file.
extracted_dir Directory created by a previous --unpack/-u (used for --pack/-p); in case of V1 format, it should be path to the assemblies.json
(config) file.

options:
-h, --help show this help message and exit
--out-path OUT_PATH, -o OUT_PATH
Path for output: when unpacking, directory to place extracted files (default: <elf>_extracted); when packing, path for the
re‑packed ELF (default: overwrite original ELF).
--arch val, -r val Which architecture to unpack: arm(64), x86(_64) (default: arm64); Only to be used with V1 format. V2 & V3 format doesn't need
this
--unpack, -u Extract assemblies
--pack, -p Re‑pack assemblies
```

### Unpacking
I recommend using the tool in conjunction with `apktool`. The following commands can be used to unpack an APK and unpack the Xamarin DLLs:
```shell
# V1 format
pyxamstore path/to/assemblies/assemblies.blob -u

apktool d yourapp.apk
pyxamstore unpack -d yourapp/unknown/assemblies/
# V2/V3 format
pyxamstore path/to/libassemblies.<arch>.blob.so -u
```

Assemblies that are detected as compressed with LZ4 will be automatically decompressed in the extraction process.

### Repacking
If you want to make changes to the DLLs within the AssemblyStore, you can use `pyxamstore` along with the `assemblies.json` generated during the unpack to create a new `assemblies.blob` file(s). The following command from the directory where your `assemblies.json` file exists:

pyxamstore pack
```shell
# V1 format
pyxamstore path/to/assemblies/assemblies.json -p

From here you'll need to copy the new manifest and blobs as well as repackage/sign the APK.
# V2/V3 format
pyxamstore path/to/libassemblies.<arch>.blob.so <extracted_dir> -o path/to/libassemblies.<arch>.blob.so -p
```

# Additional Details
Additional file format details can be found on my [personal website](https://www.thecobraden.com/posts/unpacking_xamarin_assembly_stores/).

# Known Limitations
* Python3 support (working on it!)
* DLLs that have debug/config data associated with them
52 changes: 52 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[tool.poetry]
name = "pyxamstore"
version = "2.0.0"
description = "Python utility for parsing Xamarin AssemblyStore files"
authors = ["jakev", "AbhiTheModder"]
keywords = [
"android",
"device",
"security",
"mobile",
"reverse-engineering",
"Xamarin",
"AssemblyStore",
"reverse",
"hacking",
]

classifiers = [
'Development Status :: 5 - Production/Stable',
'Natural Language :: English',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
]
license = "MIT"
readme = "README.md"
homepage = "https://github.com/AbhiTheModder/pyxamstore"
repository = "https://github.com/AbhiTheModder/pyxamstore"
documentation = "https://github.com/AbhiTheModder/pyxamstore"

[tool.poetry.dependencies]
python = "^3.6"
lz4 = "^4.3.3"
xxhash = "^3.4.1"
future = "^1.0.0"
pyelftools = "^0.29"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
pyxamstore = "pyxamstore:main"
Loading