michaelwright235 / wdb_extract

Extract WDB files of old LG phones firmware
MIT License
3 stars 0 forks source link

Partially working with non-Infineon LG models (e.g. LG-KH1000 (Korean LG model based on Qualcomm which also uses WDB and DLL for firmware)) #2

Open raulmrio28-git opened 6 days ago

raulmrio28-git commented 6 days ago

Decryption of KDZ works fine with your KDZ decryptor tool but not with WDB. I managed to get it to decrypt by getting DLL size from input argument and not using the already-defined DLL sizes from the script by modifying the initialization and key-getting portions to use a size input parameter (can be seen on https://gist.github.com/raulmrio28-git/e167d9a36ebc9fd71766cc1c4e6ff45b). Now that I managed to get that out of the way the WDB extraction won't work, the header read is fine but not the rest, where I get this error (uncommented the debugging prints):

Found a suitable decryption key
Original:
0x91,0x3,0x13,0xeb,0xb8,0xef,0xd,0x2c,0xbd,0x4,0x94,0xa4,0x97,0x9,0xdc,0x29,0xf9,0x3,0x59,0xf2,0x85,0x50,0x13,0x20,0x2e,0x96,0x41,0xb5,0xd2,0x7a,0x8a,0xab,0x51,0xfe,0xaf,0x8f,0xcf,0x6b,0x97,
Decrypted:
0x27,0x0,0x0,0x0,0xa9,0x3,0x0,0x0,0xc,0x0,0x0,0x0,0xb,0x0,0x0,0x0,0x4b,0x57,0x31,0x30,0x30,0x36,0x31,0x36,0x2e,0x77,0x64,0x62,0x4b,0x57,0x31,0x30,0x30,0x36,0x31,0x36,0x5f,0x30,0x30,
File name: KW100616.wdb
SW: KW100616_00
0xd,0xfc,0x58,0xf6,0x20,0x37,0xbc,0xca,0x2b,0x2e,0x79,0xfc,0x5b,0x19,0x58,0x16,0x99,0xb1,0xeb,0x35,0x43,0xf5,0x1c,0xcb,0xb4,0x47,0x67,0xe9,0xa9,0x5,0xb9,0x4b,0x5d,0xc9,0x75,0xbe,0x44,0x1c,0x88,0x39,0x63,0x1c,0x15,0x41,0xe6,0xaa,0x0,0x35,0x38,0x4f,0xbb,0xa8,0x4,0x24,0x6e,0x7f,0x80,0x30,0xf9,0xeb,0x1f,0x7a,0xe9,0x89,0x19,0x70,0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x3f,0x22,0x41,0xcd,0x19,0xbd,0x8f,0xe7,0xd0,0x2,0xbf,0xf8,0x48,0x7,0x71,0xd2,0xdf,0xa,0x48,0x12,0x6e,0xe,0x92,0x79,0x50,0x4f,0xf5,0x36,0xdb,0x17,0x59,0x81,0xbb,0xe8,0xbe,0x2f,0xdc,0x18,0x14,0x93,0x8d,0xdb,0x81,0x22,0x84,0xdd,0x67,0x4d,0x96,0x2f,0xab,0x55,0xb1,0xc8,0x2f,0x4,0x81,0x15,
Number of files: 187
Traceback (most recent call last):
  File "D:\kdz_test\wdb.py", line 172, in <module>
    WdbFile(args.filename, args.dll_filename, args.o)
  File "D:\kdz_test\wdb.py", line 39, in __init__
    self.__find_files()
  File "D:\kdz_test\wdb.py", line 111, in __find_files
    file_header_len = self.file_in.read(4)[0]
                      ~~~~~~~~~~~~~~~~~~~~^^^
IndexError: index out of range

Run with these arguments (please note the use of my "patched" wdb script, D:\kdz_test is where I stored my files): wdb.py -o D:\kdz_test\KH1000 D:\kdz_test\KW100616.wdb D:\kdz_test\KH1000_1.0.0.8.dll

michaelwright235 commented 3 days ago

I couldn't find a workable link for LG KG1000 firmware, so I can't test it. Can you send me one? I have a discord link in my profile.

raulmrio28-git commented 1 day ago

I couldn't find a workable link for LG KG1000 firmware, so I can't test it. Can you send me one? I have a discord link in my profile.

  1. I meant LG-KH1000, pardon me for the typo
  2. https://lg-firmwares.com/downloads-file/12666/KW100616_00 Sadly downloading from this site won't work but I do have them somewhere on my PC which I'll upload on a Mega folder link https://mega.nz/folder/vooS1AKR#jCZVajaMv4e465KcP1ZUVg