Unfortunately we do not accept new members for free, Now Registration cost 30€, if you are interesting Send Email to [email protected]

SWFL Extractor Tool
21-07-2023, 18:07 PM,
Post: #1
XZBMW  SWFL Extractor Tool
Hello all,


I would like to share with you a tool I developed to parse and extract BMW SWE firmware files.

It works with SWFL, BTLD, FLSL files from the psdzdata/swe/.
Maybe some of you had a look over the swfl_0000uuuu.bin.uuu_uuu_uuu files and saw that some of them use a compression method. It can also be confirmed by checking the corresponding swfl_0000uuuu.xml.uuu_uuu_uuu that some segments are marked as <FLASH-SEGMENT COMPRESSION-STATUS="COMPRESSED"> and some are <FLASH-SEGMENT COMPRESSION-STATUS="UNCOMPRESSED">.
BMW is actually using NRV algorithm for the compressed sections.

I created a Python script to parse the .xml, extract binary blocks from corresponding .bin and call the unucl extractor app which is the open source implementation of the NRV compression algorithm and reassemble the final binary.

I have included in the archive 2 builds of the UCL extractor, for x64 Linux and Windows.

Windows CMD or Linux terminal usage example:
python extract.py -i swfl_00004a5a.bin.010_006_040 -x swfl_00004a5a.xml.010_006_040

! Python is required to be installed on your machine !


Have Fun!


Attached Files
SWFLExtractor.zip
File Type: .zip
Downloaded: 377 times
Size: 8.22 MB

Reputation: +16 - juantg93 [+1] , luntik [+1] , BmwMerc [+1] , diagso [+1] , Jumper [+1] , TheNine90 [+1] , Mwahab [+1] , simzep [+1] , palapas1974 [+1] , jaramillo [+1] , OneKillaWatt [+1] , s_s [+1] , VroomVroom [+1] , ruben_17non [+1] , Kayhan 17# [+1] , zalimhan74 [+1]
Quote this message in a reply
[+] 32 users say Thank You to bogdantogo for this post
21-07-2023, 18:31 PM,
Post: #2
RE: SWFL Exctractor Tool
I have tried it on a professional nbt unit, and I have not been able to get it to work. I don't know if I've done something wrong. I attach a log.


Attached Files
Windows PowerShell.txt
File Type: .txt
Downloaded: 102 times
Size: 1.2 KB

Quote this message in a reply
[+] 1 user says Thank You to juantg93 for this post
21-07-2023, 19:26 PM,
Post: #3
RE: SWFL Exctractor Tool
In your case the file after '-x' parameter needs to be the xml, not the same .bin you passed on the '-i' parameter.
The required command in your case:
python extract.py -i swfl_00001280.bin.003_013_001 -x swfl_00001280.xml.003_013_001

P.S '-x' and '-o' parameters are optional, only '-i' is mandatory. If you don't set them the script will automatically fill the xml file and generate swfl_00001280.bin.003_013_001.extracted

Just make sure that you have the .xml in the same location where the .bin is stored
Reputation: +1 - juantg93 [+1]
Quote this message in a reply
[+] 1 user says Thank You to bogdantogo for this post
21-07-2023, 20:07 PM,
Post: #4
RE: SWFL Exctractor Tool
(21-07-2023, 19:26 PM)bogdantogo Wrote:  In your case the file after '-x' parameter needs to be the xml, not the same .bin you passed on the '-i' parameter.
The required command in your case:
python extract.py  -i swfl_00001280.bin.003_013_001 -x swfl_00001280.xml.003_013_001

P.S '-x' and '-o' parameters are optional, only '-i' is mandatory. If you don't set them the script will automatically fill the xml file and generate swfl_00001280.bin.003_013_001.extracted

Just make sure that you have the .xml in the same location where the .bin is stored

Sorry. It was a silly mistake on my part.


Now a file named ''swfl_00001280.bin.003_013_001.extracted'' has been generated.

With this file how can I see what is inside?
Quote this message in a reply
21-07-2023, 23:31 PM,
Post: #5
RE: SWFL Exctractor Tool
(21-07-2023, 20:07 PM)juantg93 Wrote:  
(21-07-2023, 19:26 PM)bogdantogo Wrote:  In your case the file after '-x' parameter needs to be the xml, not the same .bin you passed on the '-i' parameter.
The required command in your case:
python extract.py  -i swfl_00001280.bin.003_013_001 -x swfl_00001280.xml.003_013_001

P.S '-x' and '-o' parameters are optional, only '-i' is mandatory. If you don't set them the script will automatically fill the xml file and generate swfl_00001280.bin.003_013_001.extracted

Just make sure that you have the .xml in the same location where the .bin is stored

Sorry. It was a silly mistake on my part.


Now a file named ''swfl_00001280.bin.003_013_001.extracted'' has been generated.

With this file how can I see what is inside?

Even after extracting, it's still a binary file, you could use bin file viewer like Winhex to view it. But you can only see binary data, you can only figure out what the data meaning by your self, because no one will disclosure the data structure.

BMW 5 Series and Audi Q4 e-tron user.
If it helps, please give rep yes , thanks!
Quote this message in a reply
21-07-2023, 23:35 PM,
Post: #6
RE: SWFL Exctractor Tool
very usefull for fixing things when they goes wrong.

[Image: GIF-Bandiera-Italiana.gif]
Quote this message in a reply
22-07-2023, 06:21 AM,
Post: #7
RE: SWFL Exctractor Tool
(21-07-2023, 20:07 PM)juantg93 Wrote:  With this file how can I see what is inside?

You dont need this tool
Quote this message in a reply
[+] 1 user says Thank You to zero9 for this post
22-07-2023, 13:04 PM,
Post: #8
RE: SWFL Exctractor Tool
(22-07-2023, 06:21 AM)zero9 Wrote:  
(21-07-2023, 20:07 PM)juantg93 Wrote:  With this file how can I see what is inside?

You dont need this tool

I know. at first i thought it was to extract files like the nbt unpacker. This is a good tool for whoever needs it.
Quote this message in a reply
24-07-2023, 14:42 PM,
Post: #9
RE: SWFL Exctractor Tool
Unfortunately this tool is not an NBT extractor or some other task specific tool. It is generic and works on all SWE NRV compressed FW files.

It is useful for cases when BTLD or other SW component gets corrupted and is needed to correct the FW through JTAG or other Flash write method. Take care that in some cases besides the FW stored in SWE files there are also some adjustment or production data blocks so it really depends from case to case.

It is also useful to reverse engineer stuff and after it was extracted with this tool to pass the binary data through analysis tools like binwalk.
For example I extracted the JAVA app running on ATM2 and the root password seed & hash with binwalk after swfl_00004a54.bin and swfl_00004a55.bin were extracted using this tool.

@jutantg93 the swfl_00001280.bin file is not even compressed. If you look in swfl_00001280.xml it is composed of 2 sections but both have <FLASH-SEGMENT COMPRESSION-STATUS="UNCOMPRESSED">. So in this particular case swfl_00001280.bin.003_013_001 will be identical with swfl_00001280.bin.003_013_001.extracted
Quote this message in a reply
[+] 2 users say Thank You to bogdantogo for this post
13-11-2023, 11:05 AM,
Post: #10
RE: SWFL Exctractor Tool
(21-07-2023, 18:07 PM)bogdantogo Wrote:  Hello all,


I would like to share with you a tool I developed to parse and extract BMW SWE firmware files.

It works with SWFL, BTLD, FLSL files from the psdzdata/swe/.
Maybe some of you had a look over the swfl_0000uuuu.bin.uuu_uuu_uuu files and saw that some of them use a compression method. It can also be confirmed by checking the corresponding swfl_0000uuuu.xml.uuu_uuu_uuu that some segments are marked as <FLASH-SEGMENT COMPRESSION-STATUS="COMPRESSED"> and some are <FLASH-SEGMENT COMPRESSION-STATUS="UNCOMPRESSED">.
BMW is actually using NRV algorithm for the compressed sections.

I created a Python script to parse the .xml, extract binary blocks from corresponding .bin and call the unucl extractor app which is the open source implementation of the NRV compression algorithm and reassemble the final binary.

I have included in the archive 2 builds of the UCL extractor, for x64 Linux and Windows.

Windows CMD or Linux terminal usage example:
python extract.py -i swfl_00004a5a.bin.010_006_040 -x swfl_00004a5a.xml.010_006_040

! Python is required to be installed on your machine !


Have Fun!

Thanks!

exist a command that allows you to compress the extracted file again?
Quote this message in a reply


Possibly Related Threads…
Thread Author Replies Views Last Post
XZBMW SSD Creator Ncsexpert (New Tool) scorpium59 550 39,873 Yesterday, 21:16 PM
Last Post: osd
XZBMW Tool for EGS 8HP replacement? AlpinWeiss2k18 40 7,812 24-04-2024, 13:38 PM
Last Post: BigManLT
  GenEsys Creator (New Tool FA ESYS) scorpium59 416 30,649 23-04-2024, 15:31 PM
Last Post: wiese
  Possible to revert SWFL, SWFK and CAFD on DME st1 2 206 12-04-2024, 15:57 PM
Last Post: user_530d
XZBMW BMW MD1/MG1 ISN Extractor from EEPROM Dump Czozen 30 7,341 02-04-2024, 09:01 AM
Last Post: megars
XZBMW Tool for bench read 8hp Garryq 9 1,679 26-03-2024, 09:32 AM
Last Post: skywoker
  TESTO tool with ICOM Rolzs 5 451 17-03-2024, 20:23 PM
Last Post: Vojno
XZBMW Tool for OBD read / write ZF 8hp TIGHTFIN 7 791 10-03-2024, 07:46 AM
Last Post: syrus
  Engineering Tool mertdavid 2 640 09-03-2024, 17:24 PM
Last Post: pshoey
XZBMW Tool for 35160 eeprom Emmy67 19 2,948 28-02-2024, 13:44 PM
Last Post: Adekborys69

Forum Jump:


Users browsing this thread:
1 Guest(s)

Return to TopReturn to Content