Skip to content

speidy/BMW-SWE-extractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

SWFL Extractor

A Python script for extracting files from BMW SWFL (Software Flash) binary files based on XML manifest files.

Features

  • ✅ Parses XML manifest files with FLASH-SEGMENTS information
  • ✅ Extracts individual files from binary containers
  • ✅ Supports multiple compression methods (gzip, NRV/UCL)
  • ✅ Handles both compressed and uncompressed segments
  • ✅ Creates detailed extraction manifest
  • ✅ Cross-platform support (Linux, Windows)

Usage

python3 extract.py -i <input_bin> -x <input_xml> -o <output_dir>

Parameters

  • -i, --input: Input binary file (required)
  • -x, --xml: XML manifest file (optional, auto-detected if not provided)
  • -o, --output: Output directory (optional, defaults to <input>_extracted)

Examples

# Basic usage with auto-detection
python3 extract.py -i samples/swfl_00009ff7.bin.006_012_003

# Specify all parameters
python3 extract.py -i samples/swfl_00009ff7.bin.006_012_003 -x samples/swfl_00009ff7.xml.006_012_003 -o extracted_files

# Extract to current directory
python3 extract.py -i samples/swfl_00009ff7.bin.006_012_003 -o .

Output

The script creates:

  1. Individual extracted files - Each segment is extracted as a separate file with its original name
  2. Extraction manifest - extraction_manifest.json containing metadata about all extracted files
  3. Detailed logging - Progress information and decompression status

Supported Compression Methods

  • gzip/gz: Standard gzip compression (using Python's built-in gzip module)
  • nrv/ucl: NRV/UCL compression (using unucl tool)
  • none: Uncompressed data

Requirements

  • Python 3.6+
  • unucl executable (included in unucl/ directory)
    • Linux: unucl.linux.x86-64
    • Windows: unucl.exe

File Structure

SWFLExtractor/
├── extract.py                    # Main extraction script
├── unucl/                       # Decompression tools
│   ├── unucl.linux.x86-64      # Linux executable
│   └── unucl.exe               # Windows executable
├── samples/                     # Sample files
│   ├── swfl_00009ff7.bin.006_012_003    # Example binary file
│   ├── swfl_00009ff7.xml.006_012_003    # Example XML manifest
│   └── swfl_00009ff7_006_012_003.json   # Example manifest JSON
├── test_extraction/             # Example output directory
└── README.md                   # This file

Example Output

input: samples/swfl_00009ff7.bin.006_012_003
xml: samples/swfl_00009ff7.xml.006_012_003
output: test_extraction
Using unucl: ./unucl/unucl.linux.x86-64
Found 24 flash segments
Processing segment: MANIFEST (swfl_00009ff7_006_012_003.json)
  Source: 0x00000200 - 0x00001EB2 (size: 7347)
  Target: 0x00000000 - 0x00001CB2 (size: 7347)
  Compression: UNCOMPRESSED (none)
  Extracted to: test_extraction/swfl_00009ff7_006_012_003.json
Processing segment: BIN_1 (abl-sa8155.elf.bin)
  Source: 0x00002600 - 0x00032DB9 (size: 198586)
  Target: 0x0000000A - 0x000307C3 (size: 198586)
  Compression: COMPRESSED (gz)
  Decompressing...
  Decompressed: 221184 bytes
  Extracted to: test_extraction/abl-sa8155.elf.bin
...
Extraction complete! 24 files extracted to: test_extraction

Troubleshooting

Decompression Failures

If decompression fails for some files, the script will:

  1. Try alternative decompression methods
  2. Fall back to using the original compressed data
  3. Continue processing other files
  4. Log the failure in the output

Missing XML File

If no XML file is specified and auto-detection fails:

  1. Check that the XML file exists in the same directory as the binary
  2. Ensure the XML filename follows the pattern: <binary_name>.xml
  3. Use the -x parameter to specify the XML file explicitly

Permission Issues

If you encounter permission issues:

  1. Ensure the script has read access to the input files
  2. Ensure the script has write access to the output directory
  3. On Linux, you may need to make the unucl executable: chmod +x unucl/unucl.linux.x86-64

About

SWE files extractor for BMW psdzdata swe files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages