I present you a tool to decompress Dell UEFI BIOS

Discussion in 'MDL Projects and Applications' started by JimboBobB, May 4, 2013.

  1. sudi

    sudi MDL Novice

    Nov 27, 2018
    1
    0
    0
  2. sebus

    sebus MDL Guru

    Jul 23, 2008
    6,049
    1,858
    210
    Code in first post!!!!
     
  3. blaze2051

    blaze2051 MDL Novice

    Dec 13, 2018
    1
    0
    0
    hi all so i managed to extract hdr then i was able to extract several files sections 0-8 . data then extract to body.bin and header.bin.

    Questions is how to i find the splash dell logo and replace it, then compress and flash back?
     
  4. arif maryono

    arif maryono MDL Novice

    May 21, 2018
    1
    0
    0
    i can extract dell bios vostro 5459 but script for this bios not work.please help guide me.thanks
     
  5. sebus

    sebus MDL Guru

    Jul 23, 2008
    6,049
    1,858
    210
    Maybe because this script is 5 yo!
    Lots changed in this time...
     
  6. rustam2v

    rustam2v MDL Novice

    Feb 16, 2019
    1
    0
    0
    #66 rustam2v, Feb 16, 2019
    Last edited: Feb 18, 2019
    Tryed on e6420 bios, with strange result
    C:\bios>DecompNewDell.py e6420a25.exe
    Traceback (most recent call last):
    File "C:\bios\DecompNewDell.py", line 27, in <module>
    match = pat.search(string)
    TypeError: cannot use a string pattern on a bytes-like object

    Any idea how to solve it?
    P.S. Solved. Python 2.7
     
  7. troll23

    troll23 MDL Novice

    Oct 12, 2007
    1
    1
    0
    For Python 3 use this :
    #This script finds the compressed data embedded in a Dell BIOS update program
    #and decompresses it to an apparent HDR file. The main data seems to start
    #at offset 0x58 in the HDR FWIW


    import zlib
    import sys
    import re
    import binascii


    if(len(sys.argv) < 2 or sys.argv[1] == "-h"):
    print ("usage: python DecompNewDell.py <biosupdate.exe>")
    exit()


    f = open(sys.argv[1], "rb")


    string = f.read()


    #The 0x789C at the end is the zlib header.
    #It's necessary to check for that too because the string
    #appears a couple times in the file.
    pat = re.compile(rb'.{4}\xAA\xEE\xAA\x76\x1B\xEC\xBB\x20\xF1\xE6\x51.{1}\x78\x9C')
    match = pat.search(string)


    #Once you find that string, the first 4 bytes are the little endian
    #size of the compressed data. The span will give you the starting
    #offset into the file where it is found
    (start_match, end_match) = match.span()
    #print match.span()
    compessed_len = string[start_match:start_match+4]


    #Now switch the order around since it's little endian
    #and also convert it to a hex string
    compessed_len = binascii.b2a_hex(compessed_len[::-1])
    #and then make it a proper number (separate lines for clarity)
    compessed_len = int(compessed_len, 16)


    #read len bytes out of the file into the new string to decompress
    f.seek(start_match+16)
    string = f.read(compessed_len)


    o = zlib.decompress(string)


    f2 = open(sys.argv[1] + "_decompressed.hdr", "wb")
    f2.write(o)
    f.close()
    f2.close()
    print ("Decompressed data written to %s_decompressed.hdr" % sys.argv[1])
     
  8. John`

    John` MDL Novice

    Jul 10, 2019
    1
    0
    0