Python Miwear tools for extracting and handling archives/logs
Project description
miwear
A Python toolkit for extracting, processing and analyzing MiWear archive and log files.
miwear bundles a set of small, focused command-line tools for the everyday chores of working with MiWear device dumps — unpacking .tar.gz/.zip/.gz bundles, merging rotated logs, parsing crash assertions, auditing resource directories, analyzing log patterns, and driving serial consoles.
Features
- Batch extraction for
.tar.gz,.zipand.gzarchives with sensible defaults - Log utilities: assertion extraction, gzipped log merging, pattern filtering
- Resource audit: duplicate detection, unused-asset scanning, two-directory diff, with Markdown + interactive HTML reports
- Log analyzer for AppID / screen transition entries, exportable to CSV or interactive HTML
- Optional serial console integration (miniterm, one-shot, periodic, or batch-file modes)
- Pure Python standard library — no dependencies for core tools
- Works on Python 3.10+ across Linux, macOS and Windows
Installation
Install from PyPI:
pip install miwear
Enable the optional serial console tool:
pip install "miwear[serial]"
Install from source:
git clone https://github.com/Junbo-Zheng/miwear
cd miwear
pip install .
CLI tools
After installation the following commands are on your PATH:
| Command | Purpose |
|---|---|
miwear_log |
Extract a MiWear log archive and merge its contents into a single log file |
miwear_assert |
Extract assertion information from a log |
miwear_gz |
Decompress and merge .gz log shards |
miwear_tz |
Batch-extract .tar.gz archives in a directory |
miwear_uz |
Batch-extract .zip archives in a directory |
miwear_check |
Resource audit (duplicates / unused / diff) with Markdown + HTML reports |
miwear_loganalyzer |
Parse AppID / screen log patterns into CSV or interactive HTML |
miwear_serial |
Serial console helper (requires pyserial) |
[!TIP] Every command accepts
--helpfor the full list of options and--versionto print the installed version.
Usage
miwear_log — extract and merge log archives
# Positional path (recommended)
miwear_log ~/Downloads/log.tar.gz
# Explicit -f flag
miwear_log -f ~/Downloads/log.tar.gz
# Pull straight from an Android phone via adb
miwear_log --phone -f 123456_abc
miwear_assert — extract assertion information
miwear_assert -i mi.log -o assert_log.txt
miwear_gz — decompress and merge .gz shards
miwear_gz --path ./logs --log_file my.log --output_file merged.log
miwear_tz / miwear_uz — batch extraction
miwear_tz --path ./logs
miwear_uz --path ./logs
miwear_check — resource audit
Find duplicate files (default mode):
miwear_check -d ./resources -e bin
miwear_check -d ./resources -e bin png
miwear_check -d ./resources -e bin -p theme_ config_
miwear_check -d ./resources -e bin --action delete
Find unused resources (-d sets where resources live, -c sets where to look for references — defaults to -d):
miwear_check -m unused -d ./project -e bin
miwear_check -m unused -d ./project -c ./project/ota -e bin
miwear_check -m unused -d ./project -e bin --code-ext ".c,.h,.cpp,.java"
Run both checks together:
miwear_check -m both -d ./project -e bin
Diff two directories (e.g. design PNG vs. converted BIN):
miwear_check -m diff --path1 ./design --path2 ./converted
miwear_check -m diff --path1 ./design --path2 ./converted -i .git,node_modules
miwear_check -m diff --path1 ./design --path2 ./converted --sort count
[!NOTE] When the scan directory contains
view/andview_XX/res*variants,miwear_checkprompts you to pick one (default: the variant with the most files). Use-ito skip the prompt.
Diff mode matches files by base name (everything before the first dot) under the same relative directory, so e.g. confirm.indexed_8.png and confirm.bin pair up automatically.
All modes emit a Markdown report and an interactive HTML report (with search / filter / sort), and optionally open the HTML in your browser when done:
miwear_check -d ./resources -e bin -o my_report.md
miwear_check -d ./resources -e bin --no-output
miwear_loganalyzer — parse MiWear log patterns
# Default: all analyzers → miwear.csv
miwear_loganalyzer -f 1.log
# Interactive HTML report (opens in browser)
miwear_loganalyzer -f 1.log --html --open-browser
# Pick a single analyzer
miwear_loganalyzer -f 1.log -t appid
miwear_loganalyzer -f 1.log -t screen -o screens.csv
miwear_serial — serial console helper
[!IMPORTANT] Requires
pyserial. Install viapip install miwear[serial].
Open an interactive miniterm session (default):
miwear_serial -p /dev/ttyACM0 -b 921600
Send one command, optionally parsing the response:
miwear_serial -p /dev/ttyUSB1 -b 115200 -c "ps"
miwear_serial -p /dev/ttyUSB1 -b 115200 -c "ps" -r
Repeat on a timer:
miwear_serial -p /dev/ttyACM1 -i 1.0 -c "ps"
miwear_serial -p /dev/ttyACM1 -i 2.0 -c "ps" --count 5
Run batch commands from a file:
miwear_serial -f commands.txt
miwear_serial -f commands.txt -i 2.0 --count 5
Record output to a log file:
miwear_serial -p /dev/ttyACM0 -b 921600 -s # miwear.log (default)
miwear_serial -p /dev/ttyACM0 -b 921600 -s log.txt # custom path
Press Ctrl+] to exit miniterm.
Requirements
- Python 3.10 or newer
pyserial(only formiwear_serial)
Author
Junbo Zheng — 3273070@qq.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file miwear-0.0.20.tar.gz.
File metadata
- Download URL: miwear-0.0.20.tar.gz
- Upload date:
- Size: 47.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f3856176ff0627bd5e641126e69f08614f19a1f36934f42b7b5144d463864ac
|
|
| MD5 |
b6cbe7ff04c9cd2ef9cf3a686b8498ec
|
|
| BLAKE2b-256 |
025a3e120f7b57ea9f8d92e86f58d4ec5954bbca318273de3bc57d55a309376e
|
File details
Details for the file miwear-0.0.20-py3-none-any.whl.
File metadata
- Download URL: miwear-0.0.20-py3-none-any.whl
- Upload date:
- Size: 55.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c137c7b69bd4429146e2c2579c91e520b02eeebdd93b60d7ba478bc496d6d39
|
|
| MD5 |
db56f3660abe58042affa2a4d73bd5e8
|
|
| BLAKE2b-256 |
7b07518adb39e140f0ec31b9e920a67b1f4df4a8c7f9b42996aee65735cc744d
|