Thursday, April 7, 2016

Extracting files from windows executables (.exe) in linux

I am trying to extract firmimg.d7 from the iDRAC firmware exe file, to be used in a drac update using the drac web interface.

The first thing to do is to strip any prepended data (e.g. a SFX stub) from the archive, using a tool called zip. You can install this tool in centos by running yum install zip.

$ file iDRAC-with-Lifecycle-Controller_Firmware_JHF76_WN64_2.30.30.30_A00.EXE
iDRAC-with-Lifecycle-Controller_Firmware_JHF76_WN64_2.30.30.30_A00.EXE: PE32+ executable for MS Windows (GUI) Mono/.Net assembly

$ zip -J iDRAC-with-Lifecycle-Controller_Firmware_JHF76_WN64_2.30.30.30_A00.EXE

$ file iDRAC-with-Lifecycle-Controller_Firmware_JHF76_WN64_2.30.30.30_A00.EXE
iDRAC-with-Lifecycle-Controller_Firmware_JHF76_WN64_2.30.30.30_A00.EXE: Zip archive data, at least v1.0 to extract

Once the file has been shown as zip archive, the normal unzip program can be used to extract it

$ unzip iDRAC-with-Lifecycle-Controller_Firmware_JHF76_WN64_2.30.30.30_A00.EXE
Archive:  iDRAC-with-Lifecycle-Controller_Firmware_JHF76_WN64_2.30.30.30_A00.EXE
 extracting: bmcexe.bat
 extracting: bmcfexe.bat
  inflating: bmcfw64.exe
  inflating: bmcfwu.cfg
 extracting: bmcinv.bat
  inflating: DellSPMsg.dll
  inflating: dupgenexec.dll
  inflating: dupgeninv.dll
  inflating: dupvalid.dll
  inflating: getSystemId.exe
   creating: hapi/
  inflating: hapi/dcdbas32.cat
  inflating: hapi/dcdbas32.inf
  inflating: hapi/dcdbas32.sys
  inflating: hapi/dcdbas64.cat
  inflating: hapi/dcdbas64.inf
  inflating: hapi/dcdbas64.sys
 extracting: hapi/dcdipm64.sys
  inflating: hapi/dchapi32.dll
  inflating: hapi/dchapi64.dll
  inflating: hapi/dchbas32.dll
  inflating: hapi/dchbas64.dll
  inflating: hapi/dchcfg32.exe
  inflating: hapi/dchcfg64.exe
  inflating: hapi/dchcfl32.dll
  inflating: hapi/dchcfl64.dll
  inflating: hapi/dchesm32.dll
  inflating: hapi/dchipm32.dll
  inflating: hapi/dchipm64.dll
  inflating: hapi/dchtvm32.dll
  inflating: hapi/dciwds32.exe
  inflating: hapi/dcmdev32.exe
  inflating: hapi/dcmdev64.exe
  inflating: hapi/dcwipm32.dll
  inflating: hapi/dcwipm64.dll
  inflating: hapi/hapint.exe
  inflating: hapi/hapint64.exe
  inflating: hapi/omsacntl.exe
  inflating: hapinst.bat
  inflating: package.xml
   creating: payload/
  inflating: payload/firmimg.d7
  inflating: PIEConfig.xml
  inflating: PIEInfo.txt
  inflating: spconfig.xml
  inflating: spsetup.exe
  inflating: winhapi.ini

Now, the firmimg.d7 is ready to be used.

No comments: