# mstar-bin-tool
Command line tools to pack/unpack MStar bin firmware
Currently available tools:
- **unpack.py** - unpack MStar bin firmware
- **pack.py** - pack MStar bin firmware
- **extract_keys.py** - extract AES and RSA-public keys from MBOOT binary
- **secure_partition.py** - encrypt image and generate signature file
## Unpack MStar bin firmware files
```
Usage: unpack.py <firmware> <output folder [default: ./unpacked/]>
<firmware> - MStar bin firmware to unpack
<output folder> - directory to store unpacked stuff. Default value: ./unpacked/
```
## Pack MStar bin firmware
```
Usage: pack.py <config file>
Example: pack.py configs/letv-x355pro-full.ini
<config file> - Configuration file. The config file structure will be described later.
For now you can take a look at configs/letv-x355pro-full.ini
and use it as an example
```
## Extract keys from MBOOT
That tool is used to get AES and public RSA keys from the MBOOT. AES keys are needed to encrypt/decrypt
boot.img and recovery.img images. aescrypt2 tool is used.
```
Usage: extract_keys.py <path to mboot> [<folder to store keys>] [<key bank offset>] [<key bank size>]
Defaults:
<folder to store keys> keys
<key bank offset> 0x168e00
<key bank size> 0x450
Example: extract_keys.py ./unpacked/MBOOT.img
Example: extract_keys.py ./unpacked/MBOOT.img ./keys 0x169e00 0x450
```
## Encrypt/Decrypt partition
You can encrypt/decrypt partition with using *aescrypt2.exe* tool, which is located in bin/win32 folder
Default mstar key is *hex:0007FF4154534D92FC55AA0FFF0110E0* All mstar default keys are in default_keys folder. (These keys are in public access in github)
Last parameter can be hex value or path to AES key. If your vendor is using custom aes keys you can use extract_keys.py to extract them.
To encrypt image use:
```
aescrypt2 0 boot.img boot.img.aes hex:0007FF4154534D92FC55AA0FFF0110E0
or
aescrypt2 0 boot.img boot.img.aes keys/AESBootKey
```
So to decrypt image use:
```
aescrypt2 1 boot.img.aes boot.img hex:0007FF4154534D92FC55AA0FFF0110E0
or
aescrypt2 1 boot.img boot.img.aes keys/AESBootKey
```
## Encrypt partition and generate signature
All new MStar builds have SECURE_BOOT option enabled. In that case
boot.img and recovery.img is encrypted (AES) and signed with RSA priv keys.
That script is used to encrypt image and generate sign file.
To manually encrypt|decrypt image use aescrypt2 tool from bin folder.
AES key can be extracted from MBOOT with extract_keys.py script.
```
Usage: secure_partition.py <file to encrypt> <AES key file> <RSA private key file> <RSA public key file> <output encrypted file> <output signature file>
Example: secure_partition.py ./pack/boot.img ./keys/AESbootKey ./keys/RSAboot_priv.txt ./keys/RSAboot_pub.txt ./pack/boot.img.aes ./pack/bootSign
```
没有合适的资源?快使用搜索试试~ 我知道了~
zharlan-mstar-bin-tool-master.zip
共48个文件
ini:19个
txt:7个
py:5个
5星 · 超过95%的资源 需积分: 29 16 下载量 109 浏览量
2022-12-28
20:32:00
上传
评论 2
收藏 16.65MB ZIP 举报
温馨提示
在mstar-bin-tool-master工具基础上进行了修改,自定义了LeTV-X450Pro和PPTV-65Q900的bin解封包脚本。不仅可以打包system.img,也支持打包tvconfig.img。
资源推荐
资源详情
资源评论
收起资源包目录
zharlan-mstar-bin-tool-master.zip (48个子文件)
zharlan-mstar-bin-tool-master
utils.py 11KB
Zharlan-CompileCMD.txt 400B
Zharlan_app
dbzm_4.1.6.apk 16.96MB
configs
zharlan-letv-x450pro-full.ini 593B
zharlan-pptv-65q900-sys.ini 471B
zharlan-letv-x450pro-sys.ini 475B
cankao
letv-x355pro-system.ini 632B
letv-x355pro-recovery-no-secure.ini 932B
letv-x355pro-recovery.ini 1KB
letv-x355pro-full.ini 5KB
empty-skip-example.ini 613B
tcl-s68at02-system.ini 703B
letv-emmc2usb.ini 1KB
xgimi.ini 471B
letv-enable-uart.ini 339B
letv-x340-43-recovery-no-secure.ini 910B
dexp-madison-system.ini 650B
letv-x4-recovery-no-secure.ini 1KB
letv-x450pro-system.ini 652B
letv-x4-systemless-live.ini 997B
LETV_USB_SCRIPT_938.ini 522B
letv-force-bin-update.ini 339B
unpacked
extract_keys.py 6KB
secure_partition.py 2KB
docs
Introduction to MBoot.doc 916KB
bin
win32
alignment.exe 60KB
lzop.exe 128KB
rsa_sign.exe 135KB
SubSecureInfoGen.exe 70KB
aescrypt2.exe 70KB
pack
unpack.py 6KB
hosts 190B
pack.py 11KB
default_keys
RSAupgrade_priv.txt 2KB
RSAimage_pub.bin 260B
RSAboot_priv.txt 2KB
RSAimage_pub.txt 528B
AESupgrade.bin 16B
RSAboot_pub.txt 528B
RSAupgrade_pub.txt 528B
RSAboot_pub.bin 260B
AESboot.bin 16B
RSAimage_priv.txt 2KB
RSAupgrade_pub.bin 260B
README.md 155B
__pycache__
utils.cpython-310.pyc 10KB
utils.cpython-37.pyc 10KB
README.md 3KB
共 48 条
- 1
资源评论
- leilycn2023-03-26#内容详尽
Harlan9001
- 粉丝: 228
- 资源: 48
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功