[DEPRECATED] Universal HTC RUU/ROM Decryption Tool (v2.0.0) - new link inside

Search This thread

AntikerTa

Senior Member
Nov 12, 2015
140
42
Perfectly. 1.5.3 is working without Erros. Thank you. At the Moment i do not need this, but it is nice to know that i can extract the zip File from the exe. I am a Mac User and Mac OS can not handle the exe File. I have installed Ubuntu on a second Partition to follow your Instructions. I have tried it on a Mac because Linux and Mac have the same UNIX Ground and i thought maybe it is possible but it was not working on Mac OS. :p
 

Captain_Throwback

Recognized Developer
which files that were outputted are ones that i should put into a project folder in superRs kitchen? I have
2PQ9IMG.zip
firmware.zip
boot.img
system.img

Would it just be system, boot, and firmware?
The kitchen tells you what to put where, and even the next to last line of the script output tells you what you need to use as your ROM base.
 

techlogik

Senior Member
Aug 23, 2006
1,853
304
Just wondering what your procedure really is for a successful flashable build. I want to deodex 6.0.0 version and I like that for now and not the latest 6.0.1 1.55 version.

I noted your flashable zips are a lot different from mine after the extractions and rom build.

Thanks
 
Last edited:

Captain_Throwback

Recognized Developer
Just wondering what your procedure really is for a successful flashable build. I want to deodex 6.0.0 version and I like that for now and not the latest 6.0.1 1.55 version.

I noted your flashable zips are a lot different from mine after the extractions and rom build.

Thanks
Not sure how the builds can be different if you're using the same Kitchen I am. I don't manually change anything in the build - I only use the Kitchen options.

All I do is use the extracted boot and system images as the base for extraction in the kitchen, unpack boot image to disable dm-verity and forced encryption, then repack, and then build the ROM.

Deodexing only works on the 6.0.1 build - it won't finish successfully on 6.0.
 

techlogik

Senior Member
Aug 23, 2006
1,853
304
Maybe it is the 6.0 deodexed that is imploding it then. It finishes deodexing the Rom, it builds the .zip. But as I said, the contents of my flashable zip is much different than your's, I have a system.new.dat file along with a few other system files, not a /system folder. Also, the install scripts is entirely different, no symlinks etc..like your .zip/install script.

Will do more testing. Thanks
 
Last edited:

Captain_Throwback

Recognized Developer
Maybe it is the 6.0 deodexed that is imploding it then. It finishes deodexing the Rom, it builds the .zip. But as I said, the contents of my flashable zip is much different than your's, I have a system.new.dat file along with a few other system files, not a /system folder. Also, the install scripts is entirely different, no symlinks etc..like your .zip/install script.

Will do more testing. Thanks
Use set_metadata, not sparse_dat. There are options to choose the type in the Kitchen settings. I haven't gotten sparse dat to flash successfully on the A9 (which is why I'm not using it).
 

Captain_Throwback

Recognized Developer
This tool is for A9 only, and how could i merge splitted system_* into one file manually.

I want to extract boot and system images from M9's RUU.
This tool actually isn't just for the A9. It just won't work (in its present state) for you on the M9. @nkk71 & I do have a universal version in the works (I technically already have a working beta) which should be released soon.
 
  • Like
Reactions: sabpprook and nkk71

Captain_Throwback

Recognized Developer
This tool is for A9 only, and how could i merge splitted system_* into one file manually.

I want to extract boot and system images from M9's RUU.
New version is up. Give it a try and let us know how it works.

P.S. Since this isn't just an A9 thing anymore, at some point a new thread in a more general section will be created. Until that happens, though, if you have any issues, please make sure you report what device you're using this with so we can better troubleshoot your issue. Your Terminal output would also be helpful (please use code and hide tags to post them). Thanks!
 
Last edited:
  • Like
Reactions: JochenP and nkk71

nkk71

Inactive Recognized Developer / Contributor
May 26, 2010
8,743
7,571
50
Beirut
Thanks Captain_Throwback for putting this together :good::good:


Hi guys,

I'd like to remind you this is a Universal Tool, and as such is a tool in continued development.

We've done as much testing as we can at this point in time, but you may find circumstances where the tool may fail.

Please report any issues in short easily readable statements (including RUU name, version and link)
when you add the terminal output, please either encapsulate it in a
Code:
hidden code
or use pastebin, hastebin, etc.

Thanks and enjoy​
 
  • Like
Reactions: Captain_Throwback

sabpprook

Senior Member
Dec 8, 2011
269
369
Kaohsiung
New version is up. Give it a try and let us know how it works.

P.S. Since this isn't just an A9 thing anymore, at some point a new thread in a more general section will be created. Until that happens, though, if you have any issues, please make sure you report what device you're using this with so we can better troubleshoot your issue. Your Terminal output would also be helpful (please use code and hide tags to post them). Thanks!

It works perfectly on M9
http://pastebin.com/Sc7iFs2N
 

nkk71

Inactive Recognized Developer / Contributor
May 26, 2010
8,743
7,571
50
Beirut
Sorry, what if im asking in wrong thread but what this tool used exactly for? updating RUU through linux?

what would "updating RUU through linux", even mean:confused:

Let's look at the thread title:
[DECRYPT RUU][64-BIT LINUX ONLY] Universal HTC RUU/ROM Decryption Tool

[DECRYPT RUU] <- indicates the thread has something to do with RUU decryption
[64-BIT LINUX ONLY] <- it seems to only run on a 64bit linux system
Universal HTC RUU/ROM Decryption Tool <- looks like a Universal Tool to decrypt HTCs RUUs

and by reading the OP,
...
Download the encrypted RUU or encrypted rom zip of your choice from HTC (or wherever).
...
Run ./decrypt-htc and wait for script to complete (you may be prompted for input if there are issues).

...and it outputs the following:
The script will output 3 files (to the "out" folder): boot.img, system.img & the encrypted rom zip you started with (or was extracted from the RUU), named for SD card flashing on your device (if your device has an SD card).
There will also be a folder with the extracted firmware for your device that can be used however you see fit



So I don't know how to explain it better, the tool is used to decrypt HTC RUUs
If that's not what you're looking for, then it's not for you
 
  • Like
Reactions: ink718

ink718

Senior Member
Jan 30, 2008
777
161
NYC
what would "updating RUU through linux", even mean:confused:

Let's look at the thread title:
[DECRYPT RUU][64-BIT LINUX ONLY] Universal HTC RUU/ROM Decryption Tool

[DECRYPT RUU] <- indicates the thread has something to do with RUU decryption
[64-BIT LINUX ONLY] <- it seems to only run on a 64bit linux system
Universal HTC RUU/ROM Decryption Tool <- looks like a Universal Tool to decrypt HTCs RUUs

and by reading the OP,
...
Download the encrypted RUU or encrypted rom zip of your choice from HTC (or wherever).
...
Run ./decrypt-htc and wait for script to complete (you may be prompted for input if there are issues).

...and it outputs the following:
The script will output 3 files (to the "out" folder): boot.img, system.img & the encrypted rom zip you started with (or was extracted from the RUU), named for SD card flashing on your device (if your device has an SD card).
There will also be a folder with the extracted firmware for your device that can be used however you see fit



So I don't know how to explain it better, the tool is used to decrypt HTC RUUs
If that's not what you're looking for, then it's not for you

Thanks brother. Im still a nub at this stuff. I know how to root, flash and few commands, lol. Still learning. Thanks for the explanation.
 

reachedxyz

Member
Apr 3, 2012
34
12
Error not file folder out. please help me
Code:
[email protected]:/home/sphinx/Desktop/RUU# ./decrypt-htc

Welcome to the RUU extraction and decryption script!

No ruu.exe found. Proceeding to rom.zip extraction...

Archive:  rom_A9.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
note:  rom_A9.zip may be a plain executable, not an archive
unzip:  cannot find zipfile directory in one of rom_A9.zip or
        rom_A9.zip.zip, and cannot find rom_A9.zip.ZIP, period.
zip_*.zip

ruuveal
-------

failed to open source zip: No such file or directory
mv: cannot stat ‘zip_0.zip’: No such file or directory

Freeing up some space...

Extracting sparse system images from decrypted zip files...

unzip:  cannot find or open out_zip_*.zip, out_zip_*.zip.zip or out_zip_*.zip.ZIP.

No zipfiles found.

Freeing up moar space...

Converting sparse images into a single raw system image (this may take several minutes)...
Cannot open input file system.img*

Freeing up all the space...

Raw system image creation complete! Image is now ready for extraction by ROM Kitchen :)

Renaming and moving files...

unzip:  cannot find or open ../out/firmware.zip, ../out/firmware.zip.zip or ../out/firmware.zip.ZIP.
cat: android-info.txt: No such file or directory

mv: cannot stat ‘boot*’: No such file or directory
rm: cannot remove ‘android-info.txt’: No such file or directory
Rom.zip has been renamed for your device.

Boot image extracted from firmware.zip. boot.img & system.img can be used as base for building a new ROM.

Script complete! Files can be found in the 'out' folder. Enjoy your decrypted system!
 

nkk71

Inactive Recognized Developer / Contributor
May 26, 2010
8,743
7,571
50
Beirut
Error not file folder out. please help me
Code:
[email protected]:/home/sphinx/Desktop/RUU# ./decrypt-htc

Welcome to the RUU extraction and decryption script!

No ruu.exe found. Proceeding to rom.zip extraction...

Archive:  rom_A9.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
note:  rom_A9.zip may be a plain executable, not an archive
unzip:  cannot find zipfile directory in one of rom_A9.zip or
        rom_A9.zip.zip, and cannot find rom_A9.zip.ZIP, period.
zip_*.zip

ruuveal
-------

failed to open source zip: No such file or directory
mv: cannot stat ‘zip_0.zip’: No such file or directory

Freeing up some space...

Extracting sparse system images from decrypted zip files...

unzip:  cannot find or open out_zip_*.zip, out_zip_*.zip.zip or out_zip_*.zip.ZIP.

No zipfiles found.

Freeing up moar space...

Converting sparse images into a single raw system image (this may take several minutes)...
Cannot open input file system.img*

Freeing up all the space...

Raw system image creation complete! Image is now ready for extraction by ROM Kitchen :)

Renaming and moving files...

unzip:  cannot find or open ../out/firmware.zip, ../out/firmware.zip.zip or ../out/firmware.zip.ZIP.
cat: android-info.txt: No such file or directory

mv: cannot stat ‘boot*’: No such file or directory
rm: cannot remove ‘android-info.txt’: No such file or directory
Rom.zip has been renamed for your device.

Boot image extracted from firmware.zip. boot.img & system.img can be used as base for building a new ROM.

Script complete! Files can be found in the 'out' folder. Enjoy your decrypted system!


What are you trying to decrypt?


As mentioned previously:
Please report any issues in short easily readable statements (including RUU name, version and link)

Code:
Archive:  rom_A9.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
note:  rom_A9.zip may be a plain executable, not an archive
unzip:  cannot find zipfile directory in one of rom_A9.zip or
        rom_A9.zip.zip, and cannot find rom_A9.zip.ZIP, period.
^^ doesnt seem to be a proper RUU, maybe a bad download, maybe some other file. that's why i asked for people to "including RUU name, version and link"
 

un1ocked

Senior Member
Sep 24, 2011
210
9
always get this error

EDIT:
my htc is not compatible
 

Attachments

  • VirtualBox_my-linux_07_02_2016_12_49_45.png
    VirtualBox_my-linux_07_02_2016_12_49_45.png
    223 KB · Views: 142
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 29
    UPDATE: This version of the tool is now deprecated. Please use the updated version!
    (and thank @nkk71 while you're at it!!)


    [TOOL][LINUX|WINDOWS][64bit][20-MAY-2016]Universal HTC RUU/ROM Decryption Tool 3.0.0









    ----------------------------------------------------
    Original Post:

    First of all, I want to state that I deserve credit for none of this - all I did was aggregate some of the great work done by the fantastic devs here on XDA.

    BIG Thanks @nkk71, for his idea to make this work universally on all encrypted HTC RUUs and all his hard work to make it happen! All I really did was post the thread.

    Prerequisites:
    - A system running a 64-bit Linux distro (tested on Ubuntu 15.10 & 16.04 LTS)
    - At least 5GB of available disk space (ROMs are big)

    readme.txt:
    Code:
    *** Captain_Throwback & nkk71's RUU decryption scripts for HTC Devices ***
    
    INSTALLATION STEPS:
    Extract files into folder of your choice, being sure to preserve the folder structure. The decrypt-htc binary and this readme file should be the only files in the root folder.
    
    Download the encrypted RUU or encrypted rom zip of your choice from HTC (or wherever).
    
    Place RUU.exe in the "place_ruu_here" folder or the ROM.zip in the "place_rom_zip_here" folder.
    
    Run ./decrypt-htc and wait for script to complete (you may be prompted for input if there are issues).
    
    The script will output 3 files (to the "out" folder): boot.img, system.img & the encrypted rom zip you started with (or was extracted from the RUU), named for SD card flashing on your device (if your device has an SD card). There will also be a folder with the extracted firmware for your device that can be used however you see fit :).
    NOTE: For the A9, for example, the rom.zip will be named 2PQ9IMG.zip. Each device has a specific filename which will be reflected.

    Below is a script of the expected output of the script when processing a RUU.exe.
    Code:
    Welcome to the RUU extraction and decryption script!
    
    Extracting temporary files...
    Extracting rom zip files...
    Extracting rom.zip...done.
    Extracting android-info.txt...done.
    Cleaning up...
    Done!
    
    Extracting ZIP files
        LargeZip format detected, using ruuveal
    ruuveal
    -------
    
    Large zip format detected containing 7 zipfile(s)
    Dumped (copied) zip file to: 01_dmp.zip
    Dumped (copied) zip file to: 02_dmp.zip
    Dumped (copied) zip file to: 03_dmp.zip
    Dumped (copied) zip file to: 04_dmp.zip
    Dumped (copied) zip file to: 05_dmp.zip
    Dumped (copied) zip file to: 06_dmp.zip
    Dumped (copied) zip file to: 07_dmp.zip
    Finished: Successfully extracted zip files to '/home/throwback/android/decrypt/tool/working/extract'
    
    Model ID found by extracting android-info.txt from RUU. Model ID identified as: 0PJA
    
    Looking for keyfile: 0PJA_keyfile_2.bin
    Found matching keyfile! Using keyfile: 0PJA_keyfile_2.bin
    
    Decrypting ZIP files
    
    Decrypting 01_dmp.zip
        Encrypted zip detected, running ruuveal...
    ruuveal
    -------
    
    Decrypted RUU (zip) written to: /home/throwback/android/decrypt/tool/working/decrypt/decrypted_zips/dec_01_dmp.zip
    
    Decrypting 02_dmp.zip
        Encrypted zip detected, running ruuveal...
    ruuveal
    -------
    
    Decrypted RUU (zip) written to: /home/throwback/android/decrypt/tool/working/decrypt/decrypted_zips/dec_02_dmp.zip
    
    Decrypting 03_dmp.zip
        Encrypted zip detected, running ruuveal...
    ruuveal
    -------
    
    Decrypted RUU (zip) written to: /home/throwback/android/decrypt/tool/working/decrypt/decrypted_zips/dec_03_dmp.zip
    
    Decrypting 04_dmp.zip
        Encrypted zip detected, running ruuveal...
    ruuveal
    -------
    
    Decrypted RUU (zip) written to: /home/throwback/android/decrypt/tool/working/decrypt/decrypted_zips/dec_04_dmp.zip
    
    Decrypting 05_dmp.zip
        Encrypted zip detected, running ruuveal...
    ruuveal
    -------
    
    Decrypted RUU (zip) written to: /home/throwback/android/decrypt/tool/working/decrypt/decrypted_zips/dec_05_dmp.zip
    
    Decrypting 06_dmp.zip
        Encrypted zip detected, running ruuveal...
    ruuveal
    -------
    
    Decrypted RUU (zip) written to: /home/throwback/android/decrypt/tool/working/decrypt/decrypted_zips/dec_06_dmp.zip
    
    Decrypting 07_dmp.zip
        Encrypted zip detected, running ruuveal...
    ruuveal
    -------
    
    Decrypted RUU (zip) written to: /home/throwback/android/decrypt/tool/working/decrypt/decrypted_zips/dec_07_dmp.zip
    
    Unzipping decrypted zips
    Archive:  decrypted_zips/dec_01_dmp.zip
      inflating: decrypted_all/android-info.txt  
      inflating: decrypted_all/aboot_signed.img  
      inflating: decrypted_all/radio.img  
      inflating: decrypted_all/splash1.nb0  
      inflating: decrypted_all/adsp.img  
      inflating: decrypted_all/rfg_1.img  
      inflating: decrypted_all/rfg_2.img  
      inflating: decrypted_all/ramdisk.img  
      inflating: decrypted_all/android-info2.txt  
      inflating: decrypted_all/sensor_hub.img  
      inflating: decrypted_all/emmc_appsboot.mbn  
      inflating: decrypted_all/persist.img  
      inflating: decrypted_all/dt.img    
      inflating: decrypted_all/bootloader  
      inflating: decrypted_all/gpt_main_32g.img  
      inflating: decrypted_all/pg2fs_ship_signkey.img  
      inflating: decrypted_all/apppreload.img  
      inflating: decrypted_all/cota.img  
      inflating: decrypted_all/gpt_main_64g.img  
      inflating: decrypted_all/sbl1-8994-1.img  
      inflating: decrypted_all/sdi.img   
      inflating: decrypted_all/hosd_signed.img  
      inflating: decrypted_all/rpm-8994-1.img  
      inflating: decrypted_all/pmic-8994-1.img  
      inflating: decrypted_all/boot_signed.img  
      inflating: decrypted_all/recovery_signed.img  
      inflating: decrypted_all/cpe.img   
      inflating: decrypted_all/tz-8994-1.img  
      inflating: decrypted_all/hyp-8994-1.img  
      inflating: decrypted_all/tp_SYN3351.img  
      inflating: decrypted_all/tp_MXM11876.img  
      inflating: decrypted_all/cir.img   
      inflating: decrypted_all/backup_android-info.txt  
    
    Archive:  decrypted_zips/dec_04_dmp.zip
      inflating: decrypted_all/system.img_02  
    
    Archive:  decrypted_zips/dec_03_dmp.zip
      inflating: decrypted_all/system.img_01  
    
    Archive:  decrypted_zips/dec_07_dmp.zip
      inflating: decrypted_all/dzdata_16g.img  
      inflating: decrypted_all/dzdata_32g.img  
      inflating: decrypted_all/dzdata_16g.hdr  
      inflating: decrypted_all/dzdata_32g.hdr  
      inflating: decrypted_all/dzdata_64g.hdr  
      inflating: decrypted_all/dzdata_64g.img  
    
    Archive:  decrypted_zips/dec_06_dmp.zip
      inflating: decrypted_all/system.img_04  
    
    Archive:  decrypted_zips/dec_02_dmp.zip
      inflating: decrypted_all/system.img_00  
    
    Archive:  decrypted_zips/dec_05_dmp.zip
      inflating: decrypted_all/system.img_03  
    
    7 archives were successfully processed.
    
    Move system img files to system folder
    ‘decrypted_all/system.img_00’ -> ‘decrypted_system/system.img_00’
    ‘decrypted_all/system.img_01’ -> ‘decrypted_system/system.img_01’
    ‘decrypted_all/system.img_02’ -> ‘decrypted_system/system.img_02’
    ‘decrypted_all/system.img_03’ -> ‘decrypted_system/system.img_03’
    ‘decrypted_all/system.img_04’ -> ‘decrypted_system/system.img_04’
    Finished: Successfully decrypted RUU to '/home/throwback/android/decrypt/tool/working/decrypt'
    
    /home/throwback/android/decrypt/tool/working/decrypt/decrypted_system
    /home/throwback/android/decrypt/tool/out
    
    Attempting to create system.img
        Multi-part system images
        Sparse Image detected, using simg2img
            Please be patient, this can take several minutes...finished.
    Testing system.img...
    e2fsck 1.42.12 (29-Aug-2014)
    Pass 1: Checking inodes, blocks, and sizes
    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 4: Checking reference counts
    Pass 5: Checking group summary information
    /home/throwback/android/decrypt/tool/out/system.img: 4685/286720 files (0.0% non-contiguous), 1041188/1146880 blocks
    Finished: Successfully created system.img in '/home/throwback/android/decrypt/tool/out'
    
    Renaming and moving files...
    
    Rom.zip has been renamed for your device.
    
    Boot image extracted from firmware.zip. boot.img & system.img can be used as base for building a new ROM.
    
    Script complete! Files can be found in the 'out' folder. Enjoy your decrypted system!
    (above output is from M9 RUU)


    Important Notes:
    • If decrypting a rom.zip that is "combined" (meaning the first zip isn't encrypted), you will see the following error message at the top of the ruuveal section:
      • Code:
        invalid htc aes encrypted zip file!
      This just indicates that the first zip file isn't encrypted. The script will continue and complete with no issues, so this isn't a concern.
    • You may also see these messages:
      • Code:
        caution: filename not matched:  system.img*
      • Code:
        1 archive had fatal errors.
      These errors indicate that the first zip doesn't contain a system image to be extracted, which is fine (that's the zip that contains the firmware). This isn't a concern either.
    • The last issue you might notice is this:
      • Code:
        warning [../out/firmware.zip]:  256 extra bytes at beginning or within zipfile
          (attempting to process anyway)
      The extra 256 bytes is HTC's signature on the unencrypted firmware zip. This also is nothing to worry about.
    As long as you have all of the output files at the end of the script, everything should be fine.

    Thanks:
    twogood for unshield
    @kmdm for unruu & ruuveal
    @Flemmard for bruutveal
    @osm0sis for Android Image Kitchen
    @A.S._id for ANDROID_IMG_REPACK_TOOLS
    11
    Additional Info

    Change Log:
    January 11, 2016 - v2.0.0
    • Complete overhaul of existing script and process
    • Now works on any encrypted RUU/ROM for any HTC device with a known decryption key
    • For devices with unknown keyfile, user can provide hboot or hosd image (based on same software version is preferable) and a new keyfile will be created. You can share the new keyfile so that it can be added to our database.
    • Improved script output and error handling

    January 1, 2016 - v1.5.3
    • Fixed the binary problem - should now work on PCs other than mine :eek:

    January 1, 2016 - v1.5.2
    • Back to bash script (for now) to ensure compatibility with other PCs

    January 1, 2016 - v1.5.1
    • Some script and binary cleanup (back end stuffs)

    December 31, 2015 - v1.5
    • Compile script into binary format (back end stuffs)

    December 31, 2015 - v1.4.1
    • Back-end cleanup to use "working" folder for zip processing

    December 31, 2015 - v1.4
    • Added code to handle "combined" zips where first zip file is already decrypted

    December 31, 2015 - v1.3
    • Can now handle encrypted rom zips!
    • Kill script if no files found
    • Script renamed from decrypt.sh to decrypt-htc.sh
    • Renames rom.zip from ruu (or provided rom.zip) to 2PQ9IMG.zip (or whatever corresponds to that for other applicable devices) automatically and puts in "out" folder

    December 31, 2015 - v1.2
    • Added unshield and libunshield to zip so manual compilation is no longer necessary (thanks @nkk71)

    December 30, 2015 - v1.1
    • Added version number
    • Modified script to allow for usage on multiple HTC devices

    December 30, 2015
    • Initial version
    10
    Mine [emoji6]

    Sent from my HTC One M9 using Tapatalk
    6
    Updated this (just now) to allow for handling of other devices which use the same type of encrypted RUU (like the Desire 626s, for example).
    6
    v1.2 is up! No more compilation of libunshield is necessary, thanks to @nkk71's help! Seriously, give that guy some love!