Captain_Throwback
Recognized Developer
Welcome to the Universal HTC RUU Decryption and Extraction Tool
*** by nkk71 and Captain_Throwback ***
this thread is a continuation of Captain_Throwback's A9 decryption thread
*** by nkk71 and Captain_Throwback ***
this thread is a continuation of Captain_Throwback's A9 decryption thread
Disclaimer
You use this tool and the files produced by it at your own discretion and risk. Though the tool in itself is harmless as it only decrypts RUUs, the files produced by it, if wrongfully flashed on a device, could lead to damage.
We are not responsible for any wrongfully created or flashed packages produced by the output of this tool.
Foreword
First off, we want to thank the great work done by the fantastic devs here on XDA, which has allowed us to put this together.
The credit goes to them for bringing us the tools to make all this possible.
Introduction
HTC's RUUs (Rom Update Utility) whether as a .EXE or a .ZIP come in various formats, and are usually encrypted, so access to the files within is "restricted".
The Decryption Tool will decrypt and extract these RUUs, and give you access to the files therein. It will also "assemble" a proper system.img from the various split system files.
HTC often changes their RUU formats and decryption keys, and this tool is designed to account for the various formats we've come to see, so far. Please remember this is a Universal Tool (trying to take many variables into account) and as such is a tool under continued development, should we or you come across bugs or new RUU formats, please follow the proper instructions on how to report them.
Features
The tool will decrypt and extract a RUU.EXE or ROM.ZIP, and create:
- a workable system.img + boot.img (in OUT/system)
- system.img
- boot.img
- (needed by ROM developers)
.
. - as well as the remainder of the files (in OUT/firmware), such as
- firmware
- preinstalled apps
- etc.
- (needed to create firmware packages)
The tool will use the following sequence to try to find a suitable decryption key (rearranged as of version 3.1.0, since bruutveal is usually considerably slower than a keyfile test):
- User provided keyfile.bin
- User provided --device flag
- Known keys (stored in the keyfiles folder)
- All ruuveal built-in keys
- User provided hboot or hosd
- Attempt force extraction of hboot or hosd
If no user provided file is supplied, and the above steps fail; then you will have to provide an hboot or hosd, which you can usually easily extract from a firmware.zip inside the appropriate OTA.zip (those are usually signed but not encrypted, so extraction of hboot/hosd should be easy)
Installation instructions
Download the appropriate zip package for your operating system, and extract the files to the folder of your choice, but keep the folder structure intact, it should be:
Linux
Code:
-rwxrwxr-x 1 nkk71 nkk71 1702627 May 20 15:12 RUU_Decrypt_Tool[/INDENT]
[INDENT]drwxrwxr-x 4 nkk71 nkk71 4096 May 17 19:02 bin[/INDENT]
[INDENT]drwxrwxr-x 3 nkk71 nkk71 4096 May 11 13:44 keyfiles
Windows
Code:
20/05/2016 15:24 10,557,725 RUU_Decrypt_Tool.exe[/INDENT]
[INDENT]24/01/2016 13:27 3,406,908 cygwin1.dll[/INDENT]
[INDENT]17/05/2016 15:47 <DIR> bin[/INDENT]
[INDENT]18/05/2016 11:15 <DIR> keyfiles
The bin and keyfiles folders, have to be in the same folder as the main binary, as shown above.
Android Magisk Module
Please refer to Captain_Throwback's post.
Using the tool
Free disk space info
At least 5GB of available disk space (but 10GB is more realistic for an HTC One M8 or higher RUU.EXE) (ROMs are big)!
The good news is that you can have the program and it's subfolders in one place, but the decryption and extraction, will take place where the actual RUU file is located.
For example, I have the tool and it's subfolders on my desktop, but the RUU.EXE is on an external drive:
Code:
[/INDENT]
[INDENT]C:Usersnkk71DesktopHTC_RUU_Decrypt_Tool_v3.0.0>dir[/INDENT]
[INDENT]20/05/2016 17:10 <DIR> .[/INDENT]
[INDENT]20/05/2016 17:10 <DIR> ..[/INDENT]
[INDENT]17/05/2016 15:47 <DIR> bin[/INDENT]
[INDENT]24/01/2016 13:27 3,406,908 cygwin1.dll[/INDENT]
[INDENT]20/05/2016 17:01 <DIR> keyfiles[/INDENT]
[INDENT]20/05/2016 15:24 10,557,725 RUU_Decrypt_Tool_3.0.0.exe[/INDENT]
[INDENT] 2 File(s) 13,964,633 bytes[/INDENT]
[INDENT] 4 Dir(s) 3,699,408,896 bytes free[/INDENT]
[INDENT][/INDENT]
[INDENT] [/INDENT]
[INDENT]C:Usersnkk71DesktopHTC_RUU_Decrypt_Tool_v3.0.0>dir I:testhima[/INDENT]
[INDENT]20/05/2016 17:11 <DIR> .[/INDENT]
[INDENT]20/05/2016 17:11 <DIR> ..[/INDENT]
[INDENT]28/02/2016 03:23 2,418,411,600 RUU_HIMA_UL_M60_SENSE70_TMUS_MR_TMOUS_3.39.531.7.exe[/INDENT]
[INDENT] 1 File(s) 2,418,411,600 bytes[/INDENT]
[INDENT] 2 Dir(s) 100,648,206,336 bytes free[/INDENT]
[INDENT][/INDENT]
[INDENT] [/INDENT]
[INDENT]C:Usersnkk71DesktopHTC_RUU_Decrypt_Tool_v3.0.0>[/INDENT]
[INDENT]RUU_Decrypt_Tool_3.0.0.exe I:testhimaRUU_HIMA_UL_M60_SENSE70_TMUS_MR_TMOUS_3.39.531.7.exe[/INDENT]
[INDENT][/INDENT]
[INDENT][/INDENT]
[INDENT]+++ Welcome to the HTC RUU Decryption Tool 3.0.0 +++[/INDENT]
[INDENT] by nkk71 and Captain_Throwback[/INDENT]
[INDENT][/INDENT]
[INDENT]RUU identified as Executable file[/INDENT]
[INDENT]...[/INDENT]
[INDENT]...[/INDENT]
[INDENT]...[/INDENT]
[INDENT]Finished: Successfully extracted zip files to[/INDENT]
[INDENT] 'I:/test/hima/OUT'[/INDENT]
[INDENT]
RUU_Decrypt_Tool Usage
This is a terminal / command prompt program, there is no GUI, so don't try to "double click" it.
Code:
[/INDENT]
[INDENT][B]RUU_Decrypt_Tool [options] <RUUName: RUU.exe or ROM.zip> [keyfile/hboot/hosd][/B][/INDENT]
[INDENT][/INDENT]
[INDENT] If none of the required arguments are supplied a simple Yes/No interface will be presented.[/INDENT]
[INDENT][/INDENT]
[INDENT] Required arguments (and/or):[/INDENT]
[INDENT] -s, --system extract the system.img and boot.img (for ROM)[/INDENT]
[INDENT] -f, --firmware extract the firmware files[/INDENT]
[INDENT] -z, --sdruuzip copy and rename rom.zip for SD-Card flashing[/INDENT]
[INDENT] Note: this will create a duplicate if the input is already a rom.zip[/INDENT]
[INDENT][/INDENT]
[INDENT] Keyfile Updater arguments:[/INDENT]
[INDENT] -o, --offline disable down/upload of keyfiles[/INDENT]
[INDENT] --no-upload do not upload if a new keyfile is generated[/INDENT]
[INDENT] --sync-keyfiles sync entire keyfile folder (download & upload)[/INDENT]
[INDENT] when used without a RUU the tool will only synchronize the[/INDENT]
[INDENT] keyfiles, otherwise it will download new keyfiles before decrypting[/INDENT]
[INDENT] and upload only if a new keyfile is generated[/INDENT]
[INDENT][/INDENT]
[INDENT] Logging:[/INDENT]
[INDENT] -L, --log log all output to a txt file named[/INDENT]
[INDENT] 'RUU_Decrypt_LOG-{MID}_{MAINVER}.txt' in the OUT folder[/INDENT]
[INDENT][/INDENT]
[INDENT] Debugging Options (not usually needed):[/INDENT]
[INDENT] -k, --keepall keep all intermediary files[/INDENT]
[INDENT] -c, --slowcleanup do a 'slow cleanup', ie dont delete files once partially processed[/INDENT]
[INDENT] -P, --debuginfo print debug info (paths and exec)[/INDENT]
[INDENT][/INDENT]
[INDENT] Direct ruuveal support (needed for older devices):[/INDENT]
[INDENT] -d, --device DEVICE specify device (this is only needed for old unruu supported devices)[/INDENT]
[INDENT] please run ruuveal to see the list of DEVICEs supported[/INDENT]
[INDENT]
where
- <RUUName: RUU.exe or ROM.zip> is the file that you wish to decrypt
. - keyfile/hboot/hosd is an optional keyfile or hboot / hosd (depends on device) if it is not specified, the tool will go through the known keys to try and find a proper one. if it does not, it will inform the user that (s)he needs to provide one.
As of version 3.6.0 RC1, the tool when called from the command line has to:
- Either include at lease one of the required arguments:
- -s : system.img and boot.img
- -f : firmware files
- -z : rom.zip for SD-Card flashing
- You can also combine them in the form of -sf for example to create both system.img and extract firmware files.
- Or be run for keyfile synchronization only:
- RUU_Decrypt_Tool --sync-keyfiles
If neither (1) nor (2) are used, the Tool will present the Y/N interface and any other flags will be disregarded.
The other flags should be self-explanatory.
NOTE: If using the tool on Windows, you can simply drag & drop the desired exe or zip you want to decrypt onto the RUU_Decrypt_Tool.exe, and a command prompt will open to begin the process.
Downloads
User Submitted Keyfiles
The Tool will automatically download any new keyfiles available before decryption, and will upload a new keyfile if one is generated.
The download and/or upload of keyfiles is at the user's discretion. You will be prompted when using the Y/N interface, otherwise from the command line, the following options are available:
Code:
-o, --offline disable down/upload of keyfiles[/INDENT]
[INDENT] --no-upload do not upload if a new keyfile is generated[/INDENT]
[INDENT] --sync-keyfiles sync entire keyfiles folder (download & upload)[/INDENT]
[INDENT]
The default is to both download and upload, and I would recommend those options be used. The keyfiles are only 96 bytes so the transfer of files will be of no significance.
Example output
they're too big to fit into even one post
Changelog in post #2
Credits and Thanks
@Captain_Throwback for his support, motivation, and overall helpfullness
@topjohnwu for Mac OS X port and magiskboot
twogood for unshield
@kmdm for unruu & ruuveal
@Flemmard for bruutveal
@osm0sis for Android Image Kitchen
@joeykrim for his original Decrypt RUU Thread
XDA:DevDB Information
Universal HTC RUU/ROM Decryption Tool, Tool/Utility for the Chef Central
Contributors
nkk71, Captain_Throwback
Source Code: https://github.com/nkk71/HTC-RUU-Decrypt-Tool
Version Information
Status: Stable
Current Stable Version: 3.6.8
Stable Release Date: 2017-11-28
Created 2016-05-20
Last Updated 2018-09-03
Last edited: