yashsingh1/xdaforums huggingface dataset:
[Android] nkk71:
Thanks, will check it. There has been a slight change (not uploaded since it wasn't worth it) for the ftp transfer, though I can't say if that's the problem. The only time I've encountered upload issues was due to a firewall / connection problem.

Forced extraction will fail 99% of times, as it is in your case. Unfortunately the tool is not explaining that well.

You'll need to provide your own "user-supplied hosd" to be able to generate a proper decryption key.
[Android] FireStorm919:
I'm sorry I didn't understand, can you please explain what is a hosd and how can I provide it ?
[Android] nkk71:
From the OP:

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)​

^^ the bold part
[Android] FireStorm919:
It worked ! Your tool is awesome,

I got a small error when uploading keyfile though

Uploading new keyfile...
Connecting...
Uploading '2PYA_keyfile_1.16.401.22.bin'...upload error 19 (FTP: couldn't retrieve (RETR failed) the specified file)!
Transfer error!
ERROR: Uploading new keyfile failed.
please consider sharing/uploading it, so it can be included in future
releases of this tool, at:
http://xdaforums.com/chef-central/android/tool-universal-htc-ruu-rom-decryption-t3382928

BTW it would be helpful for new users if a small section on how to get hboot or hosd files was included, I had some trouble as my device didn't have any OTA updates yet, so I went to TWRP File Manager and got it from /dev/block/bootdevice

Thanks Again ! Good Luck !
[Android] nkk71:
Thanks glad you like it.

Yes, that's one way of doing it too :good:, but beyond the scope of the tool. Most users who are using it, should be able to determine the best course of action available at their disposal ;)

I'll see how / if to add that information in the OP / tool.

Thanks for mentioning it, seems we have / had a glitch at some point with uploads. We'll be looking into it soon-ish.

If you don't mind, please attach it here so we can add it to the server for everyone to be able to make use of it.
[Android] FireStorm919:
Sorry, I cant get the keyfile now. Here is the hosd file, I hope you won't mind getting the keys from it. :)

It's 2:19AM over here and I shut down the computer and went to bed, lol:D

The device is HTC Desire 10 Pro, BTW.

hosd file
[Android] nkk71:
Just wanted to let everyone know, that the tool currently has two bugs (as some of you may have already noticed):

Uploading of new keyfiles is not working

"Force extracted" hosd and subsequent keyfile generation isn't working properly (they're not really force-extracted, just happens the first zip is unencrypted so the tool does not need a "user supplied" hosd) Thanks to [MENTION=1331268]santod040[/MENTION] for mentioning it

Both issues have been fixed, so I'll be updating the tool in the coming day or two, but I wanted to give everyone the opportunity to express any other suggestions, concerns, or potential bugs, that can/could help the overall usefulness of the tool.

Thanks :good:
[Android] Prot02018:
Hello guys,

I don't fully understand this tool yet nkk71, but thanks so much for making it!

My questions is... I live in China and have the Chinese variant of the HTC U11+ arriving in a few days. Do you know of any way to put the HK or Taiwanese ROM onto my Chinese U11+? Can your tool perform this?

Many thanks in advance!
[Android] nkk71:
That would be beyond the scope of this tool and thread, you should ask in your device specific forum under Q&A.
[Android] Cassious:
So if im trying to make a flashable zip for a fresh install, which folders am i zipping? I read on one post im just supposed to zip the firmware folder...but that folder is on 6xx mb...i know thats not right...any help would be appreciated..
[Android] santod040:
That's not the purpose or intention of this utility.

If you're not sure what to zip, to make a flashable zip for your device, you probably shouldn't be.

This utility is here to make the task of decrypting an RUU simpler/more user friendly then the manual commandline methods that many of the seasoned developers/rom makers used to have to go through each time.

It does this extremely well and is not intended to be a rom making tool/kitchen.

Look at SuperR's kitchen, if you need/want/desire a rom zip making utility.

This isn't that...
[Android] Cassious:
let me be great :laugh: ill check out the kitchen, but this is doing exactly what i need it to do for the ruu exe i have, im just looking to put it back together to make it flashable.....thanks for the comment tho..
[Android] poppy22:
How should I use this tool?

---------- Post added at 03:16 PM ---------- Previous post was at 03:12 PM ----------

I can't download this tool
[Android] xunholyx:
Instructions are in the OP, of course. They usually are.

I just tried downloading it (even though I already have it) and there were no problems for me.
[Android] poppy22:
I went to the download page and didn't see the download hint. The download could not be executed on GitHub. Can you upload an executable file to the network hard disk? Thanks
[Android] nkk71:
Maybe you should reread the OP, the downloads are in the Download Tab (the tabs are at the top of the thread, just above the title)

https://xdaforums.com/devdb/project/?id=15338#downloads

Github is for the source code.
[Android] poppy22:
I open the download link, there's nothing in it.
[Android] xunholyx:
https://xdaforums.com/devdb/project/?id=15338#downloads
[Android] xunholyx:
By the way, what I've linked above can be found in the OP as already stated
[Android] nkk71:
Back on topic please gents, if he can't find the download section, then perhaps he needs to start elsewhere, and PM'ing on a how-to isn't going to help either.

This tool is simply a convenience for some members, it is not the the "Earth shattering" discovery of the decade, unlike what Daffy and Marvin have to say

As to my previous post about any suggestions, since I guess everything is perfect :rolleyes::eek: (except the bugs, I mentioned earlier) I decided to add a KeyFile checker, eg:

...
[U]Downloading keyfiles...[/U]
Connecting...

Found 50 keyfiles
Your keyfiles are up to date.
Download_Keyfiles took 2.869 seconds.

[U]Checking keyfiles' state...[/U]
Analyzing 55 files
Deleting empty file: dummy1.bin
Renaming: dummy2.bin with extension -INCORRECTSIZE, filesize is not correct for a keyfile
Renaming: 0P4E_keyfile_2.14.631.15 (copy).bin with extension -DUPLICATE, it is identical to 0P4E_keyfile_2.14.631.15.bin
Renaming: 0P6B_keyfile_6.1.bin with extension -DUPLICATE, it is identical to 0P6B_keyfile_6.bin
Renaming: 0P6B_keyfile_6.2.bin with extension -DUPLICATE, it is identical to 0P6B_keyfile_6.bin
Finished: 50 valid and unique keyfiles found.
WARNING: There were bad and/or duplicates found, consider cleaning your keyfiles folder!
Check_All_Keyfiles took 0.001 seconds.
...
[Android] nkk71:
Well looks like I'm in "build hellybelly" again, Windows does not want to build (and it's been trying for hours), so I'll let that go for tonight.

For you that enjoy a linux64 build, I uploaded that one earlier today (same hidden place as usual).

Changelog is in post #2 ... yeah, no Earth shattering kaboom either.

btw, the linux64 was tested in both Ubuntu 16.04 as well as WSL, both worked fine.

Once I get Windows to build again, I'll upload those and then change thread title, etc.
[Android] nkk71:
Version 3.6.8 is out for Linux64, Windows32, and Windows64

(in the Downloads Tab as usual)
​

I removed 3.6.7 yesterday (after a whopping 6 downloads :p), because the keyfile integrity check was not included in the --sync-keyfiles option. And also today's earlier uploads (zero downloads, so no version bump) which (in Windows builds) had a small bug it seems.

Changelog

28 November 2017 (version 3.6.8)
---------------------------------
* New: Keyfile folder integrity check (duplicate, empty, and
incorrectly sized keyfiles)
* [3.6.8] Keyfile folder integrity check during --sync-keyfiles
* Fix: keyfile_updater upload (ftp protocol issue), also
integrate libcurl into keyfile_updater to avoid external linkage
(no more need for libcurl.so / cygcurl.dll)
* Fix: "Force extracted" hosd (when the first zip is not
encrypted) and subsequent keyfile generation (thx [MENTION=1331268]santod040[/MENTION])
* Fix: Allow magiskboot to segfault, during an attempt
at force extraction (see posts [URL="https://xdaforums.com/showpost.php?p=74524361&postcount=339"]339[/URL] and [URL="https://xdaforums.com/showpost.php?p=74524655&postcount=340"]340[/URL])

Fix: "Force extracted" hosd (when the first zip is not encrypted) and subsequent keyfile generation

(eg 2Q4DIMG_OCEAN_M_DTWL_O80_SENSE90GP_HTCCN_CHS_2_1.03.1405.1_Radio_8998-002772-1710131105_release_514643_combined_signed_2_4.zip)

Find First Encrypted ZIP
Encrypted zip to be used for testing: [B]'zip_1.zip'[/B]
[I] ^^ note it's not zip_0.zip, so we can assume zip_0.zip in not encrypted :)[/I]

Trying force extraction of hboot/hosd...
Archive: zip_0.zip
warning [zip_0.zip]: 256 extra bytes at beginning or within zipfile
(attempting to process anyway)
inflating: tmp/hosd_signed.img
...

Decompressing to [ramdisk.cpio]
MagiskBoot vMAGISK_VERSION(MAGISK_VER_CODE) (by topjohnwu) - Boot Image Modification Tool
Loading cpio: [ramdisk.cpio]
Extracting [sbin/downloadzip] to [downloadzip]

Attempting to generate keyfile
bruutveal
---------

SUCCESS!rcing key[loop 2]: 824726/1154384....
[B]Successful bruutveal run, key written to: C:/nkk71/HTC-RUU_Decrypt_Tool_3.6.8-WINDOWS32/OUT/tmp/use_keyfile.bin
bruutveal keyfile has been successfully generated 'C:/nkk71/HTC-RUU_Decrypt_Tool_3.6.8-WINDOWS32/OUT/tmp/use_keyfile.bin'[/B]
...

Fix: Allow magiskboot to segfault, during an attempt at force extraction...

(eg 2PYAIMG_A56DJ_PRO_DUGL_M60_SENSE80GP_HTC_Europe_1.16.401.22_Radio_0.A56DJPV1P22.6400.1208.A56W_release_493000_signed_2_4.zip)

Decompressing to [ramdisk.cpio]
magiskboot exited abnormally (status=139, errno=2 'No such file or directory')
ERROR: Could not find suitable decryption key!
[B]Please provide a suitable keyfile, hboot or hosd (depending on device).[/B]

If you do encounter anything unusual, strange, or simply *huh, this should be automatic* just let me know. (cough [MENTION=1331268]santod040[/MENTION] ;) )

Keyfiles are not included in the zips, just let the tool download them.

Enjoy
[Android] CEsquerre:
Recrypt?

Is there any possibility of implementing the re-encryption of ZIP files?

The idea is to change the CID of the ROM, the aboot file to one without the red letters (This build is for development purposes only ...), the splash file, and be able to flash it in S-ON devices.
[Android] The_Walking_Playground:
Hi,

I did a quick search of the thread and found this post: https://xdaforums.com/chef-central/...-htc-ruu-rom-decryption-t3382928/post73704100

I think it answers your question ;).

TWP
[Android] xunholyx:
Once you modify it, you'll lose the signature. Just get S-Off ffs

EDIT: The link in the post above explains it perfectly
[Android] 5m4r7ph0n36uru:
You will be missed OP. Hope all's better were you're now.
[Android] Flippy498:
I was absolutely shocked when I heard the sad news.

Thanks [MENTION=2605798]nkk71[/MENTION] for everything you've taught me about the One M9 and all your contributions here on xda. May your soul rest in peace.
[Android] eboy998:
I need to download this tool, why I can not find the file in the download page?:confused:

please help me
[Android] roirraW "edor" ehT:
I am deeply saddened to hear of [MENTION=2605798]nkk71[/MENTION] 's passing. My heart goes out to his wife and everyone who knew him much better than I.
[Android] nealzXincredible:
Hi total noob at this, I have attached a screenshot of what's happening when i run the Decryption tool. I can't execute any commands when pressing enter just exits the program :( How can I load my RUU zip in to the program to extract hosd.img? Any advice would be helpful, thanks in advance.
[Android] santod040:
I can't make out anything in your attached image.

But the file you seek is already posted in the firmware zip for your device.

Simply extract it from there...
[Android] nealzXincredible:
How can I extract the firmware zip from the Nougat RUU zip? Since this tool isn't working for me..
[Android] santod040:
Extract from the firmware zip, posted in firmware thread OP.
[Android] nealzXincredible:
Sorry, I don't know what you mean by firmware thread OP. Can you give me the link please?
[Android] xunholyx:
Put the RUU.zip into the Decryption Tool folder

open cmd and enter this:

RUU_Decrypt_Tool -f *drag and drop the RUU.zip file here* then press enter

then look in the firmware folder extracted from that for the hosd.img
[Android] nealzXincredible:
If you look at my screen shot, I can't execute any commands cause pressing enter just closes the program.
[Android] xunholyx:
I looked at your screenshot. You never entered any commands. Go to the Decrypt Tool folder, open CMD and enter the commands I listed

Don't click on anything in the folder, just open CMD
[Android] santod040:
Seriously...? Come on now.

You've been at this for days.

Round and round....

https://xdaforums.com/showthread.php?t=3387520
[Android] nealzXincredible:
Nice one mate, the program started :D

---------- Post added at 04:54 AM ---------- Previous post was at 04:49 AM ----------

I appreciate all the help my friend and apologies for all the headaches I'm giving you. I'll buy you a beer or two when all this is over :)
[Android] sudowtf:
Thanks

!!! worked on latest m7 unlocked ruu exe. +1 Linux 64bit.
[Android] sudowtf:
Okay, well i can't unzip the resultant PN07IMG.zip file to make my own mods.

commandline results:

$ 7z x ./PN07IMG.zip

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.utf8,Utf16=on,HugeFiles=on,64 bits,8 CPUs Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz (306C3),ASM,AES-NI)

Scanning the drive for archives:
1 file, 1552059991 bytes (1481 MiB)

Extracting archive: ./PN07IMG.zip
ERROR: ./PN07IMG.zip
./PN07IMG.zip
Open ERROR: Can not open the file as [zip] archive

ERRORS:
Is not archive

Can't open as archive: 1
Files: 0
Size: 0
Compressed: 0

$ unzip PN07IMG.zip
Archive: PN07IMG.zip
warning [PN07IMG.zip]: 1081227532 extra bytes at beginning or within zipfile
(attempting to process anyway)
file #1: bad zipfile offset (local header sig): 1081227532
(attempting to re-compensate)
file #1: bad zipfile offset (local header sig): 1081227532
file #2: bad zipfile offset (local header sig): 179
(attempting to re-compensate)
file #2: bad zipfile offset (local header sig): 179
inflating: dzdata_32g.img
error: invalid compressed data to inflate
inflating: dzdata_16g.hdr
inflating: dzdata_64g.hdr
inflating: dzdata_32g.hdr
inflating: tp_HMX852XD.img
inflating: dzdata_64g.img
error: invalid compressed data to inflate
inflating: boot_signed.img
[Android] nkk71:
finished with 3.0.2 yesterday - which adds back the functionality of extracting hboot/hosd from the zip(s) itself if possible (one example is M8 6.12.401.4), and some code cleanup,

dunno if i'll upload that today or not, but soon-ish

(maybe I should jump version numbers more... those 3.0.x increments seem too small :laugh:

as for Mac, since it's unix based anyway, i guess so ... well, if I got it to compile on Windows (including the linux bins), then I dont really see how much of a problem Mac's would be

and the only one I have is the wife's.... and you can imagine what would happen if I touch that, let alone wanted to compile anything on it :p
[Android] nkk71:
About version 3.0.2 "force extraction"

Though most of the time this will

fail

, there are / have been several instances where HTC release their RUU either only signed or "mixed"

if we're talking about newer models

then the M9 1.xx.xxx.x series was not encrypted at all only signed (so keyfile isnt needed at all)

and

sometimes

the first zip (within the LargeZip) is signed but not encrypted, the rest are, such as the M8 6.12.401.4

in which case:

+++ Welcome to the HTC RUU Decryption Tool 3.0.2 +++
by nkk71 and Captain_Throwback

RUU identified as HTC LargeZip file
Moving 'M8_6.12.401.4.zip' temporarily to working folder

Extracting ZIP files
LargeZip format detected, using ruuveal
ruuveal
-------

Large zip format detected containing 6 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
Finished: Successfully extracted zip files to 'dumped_zips'

Attempting to find suitable keyfile
[B][COLOR="Blue"]Find First Encrypted ZIP
Encrypted zip to be used for testing: '[COLOR="Red"]02_dmp.zip[/COLOR]'[/COLOR][/B]

[B][I]Trying force extraction of hboot/hosd...[/I][/B]
[B][COLOR="Blue"]Archive: 01_dmp.zip
inflating: tmp/hboot_signedbyaa.img[/COLOR][/B]
caution: filename not matched: hosd*
Archive: 02_dmp.zip
warning [02_dmp.zip]: 128 extra bytes at beginning or within zipfile
(attempting to process anyway)
caution: filename not matched: hboot*
caution: filename not matched: hosd*
Archive: 03_dmp.zip
warning [03_dmp.zip]: 128 extra bytes at beginning or within zipfile
(attempting to process anyway)
caution: filename not matched: hboot*
caution: filename not matched: hosd*
Archive: 04_dmp.zip
warning [04_dmp.zip]: 128 extra bytes at beginning or within zipfile
(attempting to process anyway)
caution: filename not matched: hboot*
caution: filename not matched: hosd*
Archive: 05_dmp.zip
warning [05_dmp.zip]: 128 extra bytes at beginning or within zipfile
(attempting to process anyway)
caution: filename not matched: hboot*
caution: filename not matched: hosd*
Archive: 06_dmp.zip
warning [06_dmp.zip]: 128 extra bytes at beginning or within zipfile
(attempting to process anyway)
caution: filename not matched: hboot*
caution: filename not matched: hosd*
... assuming hboot...

Attempting to generate keyfile
bruutveal
---------

SUCCESS!rcing key[loop 3]: 823163/2096384....
[B][I]Successful bruutveal run, key written to: /media/nkk71/RUU/testruns/OUT/tmp/use_keyfile.bin
bruutveal keyfile has been successfully generated '/media/nkk71/RUU/testruns/OUT/tmp/use_keyfile.bin'
Finished: Successfully found decryption key, copied to 'tmp/use_keyfile.bin'[/I][/B]

Decrypting ZIP files
......
......
INFO: RUU modelid: 0P6B10000
INFO: RUU mainver: 6.12.401.4

Finished: Successfully extracted zip files to
'/media/nkk71/RUU/testruns/OUT'
[Android] nkk71:
Version 3.0.2 uploaded :)

Changelog in post 2... and also updated post 1, about the methods it "tries" to find a suitable keyfile.

Note that when a new keyfile is generated, the user will be given the following output:

[B][U]Checking keyfile state[/U][/B]
Moving keyfile to 0PJA_keyfile_3.39.531.7.bin

[B]INFO: the keyfile '0PJA_keyfile_3.39.531.7.bin' generated appears to be new,
please consider sharing/uploading it, so it can be included in future
releases of this tool, at:[/B]
http://xdaforums.com/chef-central/android/tool-universal-htc-ruu-rom-decryption-t3382928

I hope you will share any new keys :good:
[Android] nkk71:
[MENTION=4470081]topjohnwu[/MENTION] I'll update github later today, if you're compiling it for Mac
[Android] nkk71:
Changelog stash for 3.0.7

(yeah i'm jumping version numbers)

* Add error handling to copy_file and append_file
* Remove using PATH, instead use it inline
* Fixes for paths with spaces
* Don't use raise()
* Add debug info printing option -P
* Fix readlink does not null terminate string
* Read android-info from RUU.EXE if available, but if
decryption is successful, update it from there
* Change 'change_dir' to "normal" behaviour (non-zero is fail)
* Add get_basename instead of using basename (for portability; uhm hint hint)

thanks [MENTION=2256702]Zanzibar[/MENTION] for testing
[Android] nkk71:
New 3.0.7 version is up for Windows and Linux

(Changelog in post 2)

You should now be able to run the Tool from anywhere (including PATH) to anywhere (all output files will be in the same drive/location as the RUU)

added the --debuginfo | -P option

[MENTION=4470081]topjohnwu[/MENTION] github updated with 3.0.7 ;)
[Android] topjohnwu:
Nice, will add mac specific code and binaries and pull request :)
[Android] itsmelutfor:
The output, can they be flash on any htc? Like decryption of a9 ruu then can be flashed on any a9 varient? [MENTION=1162986]Captain_Throwback[/MENTION]
[Android] Captain_Throwback:
This tool doesn't somehow change the rules of flashing an RUU.

For an RUU to successfully flash, it has to be for the same device and the model ID and CID have to match.
[Android] itsmelutfor:
If cid n mid match but not main-version dont, will i be still be able to flash system.img from this output?? My phone is s-on.
[Android] Captain_Throwback:
Main version of the RUU has to be the same or newer than your current main version.
[Android] itsmelutfor:
Ops! Its much older. Anyway to make it work without s-off?
[Android] Captain_Throwback:
No safe way that I'm willing to recommend.
[Android] nkk71:
Mac OS X version uploaded (available in the download section)

credits and thanks to [MENTION=4470081]topjohnwu[/MENTION] for porting it to Mac :good::good:
[Android] Sneakyghost:
Soooooo? There actually is a way? Guess I'll hit you up when I have some time to ask for clues [emoji23]
[Android] goodman_east:
well done.
[Android] jollywhitefoot:
This is awesome. Thanks!
[Android] mc9078:
Thanks for this great tool! I like to know how i can modify the system.img to change some files and recompile to rom.zip which can be flashed under HTC HBOOT? My purpose was to modify the CID XML file to change the startup language. Thanks.
[Android] LlabTooFeR:
Finally can get rid of Ubuntu virtual machine and run Windows only...Worked like a charm on M11 and S1 images:good: Well done:D
[Android] The_Walking_Playground:
Hi,

You're not supposed to modify that zip. That zip is for flashing the signed/encrypted RUU/ROM zip via fastboot (or SD card method on devices that have one). This tool extracts boot and system images from the RUU - those are what you modify and can create a flashable zip from.

TWP
[Android] sudowtf:
Thank you, got it:

sudo mount -o loop system.img /mnt/somefolder

OR

7z x system.img
[Android] miteteck:
Hi,

I try to install HTC ruu decrypt tool on my Linux 32bit laptop, but I didn't found a download for Linux 32 in the download section. Is there an other solution?

Thanks for your help!
[Android] The_Walking_Playground:
Hi,

Linux 32-bit isn't supported. So your options are to use a 64-bit distro, or use Windows or arm.

TWP
[Android] miteteck:
Ok, I have installed the arm magisk on my phone, all is good, I have extract the recovery.img I need to take an ota. Thanks The_Walking_Playground for your answer, and thanks to the developers!
[Android] tiancris:
can you help me guys?

try to use ruu for may htc one a9

thanks
[Android] CSnowRules:
It sounds like you're using a version that doesn't automatically download the keyfile you need.

You should use the latest version. I know Linux 64 does the job perfectly...

If you must use Linux 32 bit, you can place https://csnowrules.possessed.us/owncloud/index.php/s/P2f48H6qKB75xNq in the keyfiles folder. This is the key you need. The link will expire in exactly one week.
[Android] tiancris:
im using windows based.
[Android] CSnowRules:
This keyfile will work for all versions.
[Android] tiancris:
still the same result,
[Android] CSnowRules:
Are you sure that you placed the keyfile I linked in the keyfiles folder? If so, please post the output here. Be sure to use the hide tags.
[Android] tiancris:
what next? i think Successfully extracted.