{"id":39916896,"url":"https://github.com/dipcore/mstar-bin-tool","last_synced_at":"2026-01-18T17:04:09.333Z","repository":{"id":41448806,"uuid":"67906238","full_name":"dipcore/mstar-bin-tool","owner":"dipcore","description":"Scripts to manipulate Mstar firmware binaries (e.g. MstarUpgrade.bin, LetvUpgrade.bin etc)","archived":false,"fork":false,"pushed_at":"2023-10-28T18:32:43.000Z","size":790,"stargazers_count":244,"open_issues_count":17,"forks_count":118,"subscribers_count":19,"default_branch":"master","last_synced_at":"2023-11-07T15:18:18.060Z","etag":null,"topics":["cryptography","extract-keys","firmware","firmware-tools","monaco","mstar","mstar-bin","napoli","packer","unpacker"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dipcore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-11T02:47:28.000Z","updated_at":"2023-11-06T02:55:40.000Z","dependencies_parsed_at":"2022-08-31T07:41:40.454Z","dependency_job_id":null,"html_url":"https://github.com/dipcore/mstar-bin-tool","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/dipcore/mstar-bin-tool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipcore%2Fmstar-bin-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipcore%2Fmstar-bin-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipcore%2Fmstar-bin-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipcore%2Fmstar-bin-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dipcore","download_url":"https://codeload.github.com/dipcore/mstar-bin-tool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipcore%2Fmstar-bin-tool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28543619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T14:59:57.589Z","status":"ssl_error","status_checked_at":"2026-01-18T14:59:46.540Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptography","extract-keys","firmware","firmware-tools","monaco","mstar","mstar-bin","napoli","packer","unpacker"],"created_at":"2026-01-18T17:04:08.834Z","updated_at":"2026-01-18T17:04:09.325Z","avatar_url":"https://github.com/dipcore.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mstar-bin-tool\n\nCommand line tools to pack/unpack MStar bin firmware\n\nCurrently available tools:\n - **unpack.py** - unpack MStar bin firmware\n - **pack.py** - pack MStar bin firmware\n - **extract_keys.py** - extract AES and RSA-public keys from MBOOT binary\n - **secure_partition.py** - encrypt image and generate signature file\n\n\n## Unpack MStar bin firmware files\n\n```\nUsage: unpack.py \u003cfirmware\u003e \u003coutput folder [default: ./unpacked/]\u003e\n        \u003cfirmware\u003e - MStar bin firmware to unpack\n        \u003coutput folder\u003e - directory to store unpacked stuff. Default value: ./unpacked/\n```\n\n\n## Pack MStar bin firmware \n```\nUsage: pack.py \u003cconfig file\u003e\nExample: pack.py configs/letv-x355pro-full.ini\n\t\t\u003cconfig file\u003e - Configuration file. The config file structure will be described later.\n                        For now you can take a look at configs/letv-x355pro-full.ini\n                        and use it as an example\n```\n\n\n## Extract keys from MBOOT\nThat tool is used to get AES and public RSA keys from the MBOOT. AES keys are needed to encrypt/decrypt \nboot.img and recovery.img images. aescrypt2 tool is used.\n\n```\nUsage: extract_keys.py \u003cpath to mboot\u003e [\u003cfolder to store keys\u003e] [\u003ckey bank offset\u003e] [\u003ckey bank size\u003e]\nDefaults:\n          \u003cfolder to store keys\u003e        keys\n          \u003ckey bank offset\u003e             0x168e00\n          \u003ckey bank size\u003e               0x450\nExample: extract_keys.py ./unpacked/MBOOT.img\nExample: extract_keys.py ./unpacked/MBOOT.img ./keys 0x169e00 0x450\n```\n\n## Encrypt/Decrypt partition\nYou can encrypt/decrypt partition with using *aescrypt2.exe* tool, which is located in bin/win32 folder\n\nDefault mstar key is *hex:0007FF4154534D92FC55AA0FFF0110E0* All mstar default keys are in default_keys folder. (These keys are in public access in github)\n\nLast 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.\n\nTo encrypt image use:\n```\naescrypt2 0 boot.img boot.img.aes hex:0007FF4154534D92FC55AA0FFF0110E0\nor\naescrypt2 0 boot.img boot.img.aes keys/AESBootKey\n```\n\nSo to decrypt image use:\n```\naescrypt2 1 boot.img.aes boot.img hex:0007FF4154534D92FC55AA0FFF0110E0\nor\naescrypt2 1 boot.img boot.img.aes keys/AESBootKey\n```\n\n## Encrypt partition and generate signature\nAll new MStar builds have SECURE_BOOT option enabled. In that case \nboot.img and recovery.img is encrypted (AES) and signed with RSA priv keys.\nThat script is used to encrypt image and generate sign file. \n\nTo manually encrypt|decrypt image use aescrypt2 tool from bin folder.\nAES key can be extracted from MBOOT with extract_keys.py script.\n\n```\nUsage: secure_partition.py \u003cfile to encrypt\u003e \u003cAES key file\u003e \u003cRSA private key file\u003e \u003cRSA public key file\u003e \u003coutput encrypted file\u003e \u003coutput signature file\u003e\nExample: secure_partition.py ./pack/boot.img ./keys/AESbootKey ./keys/RSAboot_priv.txt ./keys/RSAboot_pub.txt ./pack/boot.img.aes ./pack/bootSign\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdipcore%2Fmstar-bin-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdipcore%2Fmstar-bin-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdipcore%2Fmstar-bin-tool/lists"}