[TOOL] UnSIN ~ SIN v3/v4/v5 Unpacker [v1.13]

Search This thread

IgorEisberg

Senior Member
Jul 6, 2009
1,799
3,878
www.audiobudget.com
This tool was especially made for the new SIN v3 format used in Xperia Z3+/Z4 and Xperia Z4 Tablet (and more recent Xperia devices as well), as well as SIN v4 format introduced with Xperia XZ Premium and SIN v5 format introduced with Xperia XZ2 and Xperia XZ2 Compact.
This tool can unpack every SIN v3/v4/v5 file to it's contained binary or EXT4 image file, the later can then be extracted with 7zip to its inner files.

Special credits to @Androxyde (of Flashtool) for original Java SIN code, @tal.aloni for Sparse decompression method and Dino Chiesa for TAR extraction method.

SUPPORTED SIN FORMATS:
SIN v3
= Custom format (utilizing LZ4 compression)
SIN v4 = gzip + tar + Android sparse format
SIN v5 = tar + Custom sparse format (utilizing LZ4 compression)

REQUIREMENTS:
Windows: 64-bit support only. No other requirements.
Linux: 64-bit support only. No other requirements

USAGE:
Just drag and drop a SIN file onto this EXE file, or write in Command Prompt "unsin system.sin" (or any other SIN image).
Make sure you have at least 6GB of free space on your hard drive, as the output EXT4 images are huge.

Note: super_*.img (extracted from super_*.sin) has to be further unpacked into individual partition images:
* Windows: Using 7zip, right-click the super_*.img, then use "Open Inside #" see all of the contained partitions (they will be labeled with the *.ext extension).
* Linux: Using "lpunpack super_*.img" (Google for a pre-compiled lpunpack binary)

COMMAND-LINE OPTIONS:
unsin
--- Intro, version and usage instructions.
unsin <file path 1> [<file path 2> ... <file path n>] --- Unpack specified *.sin file(s)
unsin -d --- Unpack all *.sin files in the current directory (non-recursive)
unsin -d <dir path 1> [<dir path 2> ... <dir path n>] --- Unpack all *.sin files in the specified directories (non-recursive)
unsin -dr --- Unpack all *.sin files in the current directory (recursive)
unsin -dr <dir path 1> [<dir path 2> ... <dir path n>] --- Unpack all *.sin files in the specified directories (recursive)

NOTES:
* The order of the options has no significance.
(i.e. -dr is the same as -rd)
* The options are case-insensitive. (i.e. -d is the same as -D)

CHANGELOG:
v1.13 [May 20, 2020]
:
- Added support for super.sin images. (Note: those have to be further unpacked using lpunpack into individual partition images)
- Added exit status on success (code 0) and failure (code 1) for usage with automation scripts.
- Built using the latest .NET Core SDK 3.1.300.
v1.12 [October 1, 2019]:
- Added intro, version and usage instructions to binary (when executing without any arguments)
- .NET Core Windows x64 binary rebuilt with .NET Core 3.0 and file size reduced to ~1.8MB.
- .NET Core Linux x64 binary rebuilt with .NET Core 3.0 and file size reduced to ~2.1MB.
- The .NET Framework variant is discontinued, final version is v1.11.
v1.11 [August 12, 2019]:
- Added .NET Core native self-contained binaries: UnSIN 1.11 (Win x64).zip and UnSIN 1.11 (Linux x64).zip
v1.11 [May 31, 2019]
:
- Fixed unsparsing of SINs containing non-EXT4 images that were split into multiple sparse parts. (mainly affecting recent modem.sin images)
v1.10 [June 12, 2018]:
- Fixed wrong implementation of FILL sparse chunk type that resulted in corrupted images in rare occasions.
v1.9 [April 9, 2018]:
- Workaround for certain SIN files that contain 2 unexpected 0x00 bytes, specifically on F5121 Oreo firmware's oem.sin files. Purpose of these bytes is unknown, probably reserved for future use, but can be safely skipped.
- Added command-line options by a user's request.
v1.8 [March 23, 2018]:
- Fixed a silly mistake that resulted in corrupted EXT4 images.
- Significantly optimized memory usage.
v1.7 [March 23, 2018]:
- Added support for SIN v5 (tar + Custom sparse format) files that were introduced in Xperia XZ2 and Xperia XZ2 Compact firmware.
v1.6 [June 29, 2017]:
- Removed some unnecessary stages, making the extraction a lot faster.
- Improved checking of available disk space, to accommodate for the removal of pre-assigned container file.
v1.5 [June 10, 2017]:
- Fixed extraction for SIN v4. Images can now be mounted properly.
v1.4 [June 6, 2017]:
- The extracted images are now identical to those extracted by Flashtool, and can be mounted properly.
- Fixed support for old SIN v3 formats that used a different partition information (i.e. Xperia C).
v1.3 [May 11, 2017]:
- Fixed SIN v4 support for non-sparse binaries.
v1.2 [May 10, 2017]:
- Added support for SIN v4 (gzip + tar + Android sparse format) files that were introduced in Xperia XZ Premium firmware. (NOTE: At least .NET Framework 4.0 is now required!)
v1.1 [December 1, 2016]:
- Algorithms were fixed to support large Nougat-based SIN files.
v1.0 [June 5, 2015]:
- Initial release.
 

Attachments

  • UnSIN 1.13 (Linux x64).zip
    885.2 KB · Views: 1,131
  • UnSIN 1.13 (Win x64).zip
    1.1 MB · Views: 7,546
Last edited:

SirRobin78

Senior Member
Please can someone explain me how i can extract the media files from the xperia tablet z4 firmeware within the memorystick_red.sin file? i´ve tried several things, got an ext4 file but all tools get an error message or told me the file is not valid...

Thank you!
 

IgorEisberg

Senior Member
Jul 6, 2009
1,799
3,878
www.audiobudget.com
v1.2 [May 10, 2017]:
- Added support for SIN v4 (gzip+tar+Android sparse format) files that were introduced in Xperia XZ Premium firmware. (NOTE: At least .NET Framework 4.0 is now required!)
 
  • Like
Reactions: AndroPlus

VeixES

Senior Member
Mar 5, 2012
423
188
Tallinn
Great work. Extracting the system image now works.
Digging in modem files to see CA combinations supported...
 

AndroPlus

Senior Member
v1.2 [May 10, 2017]:
- Added support for SIN v4 (gzip+tar+Android sparse format) files that were introduced in Xperia XZ Premium firmware. (NOTE: At least .NET Framework 4.0 is now required!)
Thank you for quick update!
v1.2 is working great for system.sin, but it fails to decompress image chunks if I try to unpack elabel or kernel.
It says other process is using 'LTALabel.000' and the process can't access.
 

IgorEisberg

Senior Member
Jul 6, 2009
1,799
3,878
www.audiobudget.com
Thank you for quick update!
v1.2 is working great for system.sin, but it fails to decompress image chunks if I try to unpack elabel or kernel.
It says other process is using 'LTALabel.000' and the process can't access.

v1.3 [May 11, 2017]:
- Fixed SIN v4 support for non-sparse binaries.

Note that the kernel and fotakernel have a new format. (the signature is ANDROID rather than ELF).
.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 102
    This tool was especially made for the new SIN v3 format used in Xperia Z3+/Z4 and Xperia Z4 Tablet (and more recent Xperia devices as well), as well as SIN v4 format introduced with Xperia XZ Premium and SIN v5 format introduced with Xperia XZ2 and Xperia XZ2 Compact.
    This tool can unpack every SIN v3/v4/v5 file to it's contained binary or EXT4 image file, the later can then be extracted with 7zip to its inner files.

    Special credits to @Androxyde (of Flashtool) for original Java SIN code, @tal.aloni for Sparse decompression method and Dino Chiesa for TAR extraction method.

    SUPPORTED SIN FORMATS:
    SIN v3
    = Custom format (utilizing LZ4 compression)
    SIN v4 = gzip + tar + Android sparse format
    SIN v5 = tar + Custom sparse format (utilizing LZ4 compression)

    REQUIREMENTS:
    Windows: 64-bit support only. No other requirements.
    Linux: 64-bit support only. No other requirements

    USAGE:
    Just drag and drop a SIN file onto this EXE file, or write in Command Prompt "unsin system.sin" (or any other SIN image).
    Make sure you have at least 6GB of free space on your hard drive, as the output EXT4 images are huge.

    Note: super_*.img (extracted from super_*.sin) has to be further unpacked into individual partition images:
    * Windows: Using 7zip, right-click the super_*.img, then use "Open Inside #" see all of the contained partitions (they will be labeled with the *.ext extension).
    * Linux: Using "lpunpack super_*.img" (Google for a pre-compiled lpunpack binary)

    COMMAND-LINE OPTIONS:
    unsin
    --- Intro, version and usage instructions.
    unsin <file path 1> [<file path 2> ... <file path n>] --- Unpack specified *.sin file(s)
    unsin -d --- Unpack all *.sin files in the current directory (non-recursive)
    unsin -d <dir path 1> [<dir path 2> ... <dir path n>] --- Unpack all *.sin files in the specified directories (non-recursive)
    unsin -dr --- Unpack all *.sin files in the current directory (recursive)
    unsin -dr <dir path 1> [<dir path 2> ... <dir path n>] --- Unpack all *.sin files in the specified directories (recursive)

    NOTES:
    * The order of the options has no significance.
    (i.e. -dr is the same as -rd)
    * The options are case-insensitive. (i.e. -d is the same as -D)

    CHANGELOG:
    v1.13 [May 20, 2020]
    :
    - Added support for super.sin images. (Note: those have to be further unpacked using lpunpack into individual partition images)
    - Added exit status on success (code 0) and failure (code 1) for usage with automation scripts.
    - Built using the latest .NET Core SDK 3.1.300.
    v1.12 [October 1, 2019]:
    - Added intro, version and usage instructions to binary (when executing without any arguments)
    - .NET Core Windows x64 binary rebuilt with .NET Core 3.0 and file size reduced to ~1.8MB.
    - .NET Core Linux x64 binary rebuilt with .NET Core 3.0 and file size reduced to ~2.1MB.
    - The .NET Framework variant is discontinued, final version is v1.11.
    v1.11 [August 12, 2019]:
    - Added .NET Core native self-contained binaries: UnSIN 1.11 (Win x64).zip and UnSIN 1.11 (Linux x64).zip
    v1.11 [May 31, 2019]
    :
    - Fixed unsparsing of SINs containing non-EXT4 images that were split into multiple sparse parts. (mainly affecting recent modem.sin images)
    v1.10 [June 12, 2018]:
    - Fixed wrong implementation of FILL sparse chunk type that resulted in corrupted images in rare occasions.
    v1.9 [April 9, 2018]:
    - Workaround for certain SIN files that contain 2 unexpected 0x00 bytes, specifically on F5121 Oreo firmware's oem.sin files. Purpose of these bytes is unknown, probably reserved for future use, but can be safely skipped.
    - Added command-line options by a user's request.
    v1.8 [March 23, 2018]:
    - Fixed a silly mistake that resulted in corrupted EXT4 images.
    - Significantly optimized memory usage.
    v1.7 [March 23, 2018]:
    - Added support for SIN v5 (tar + Custom sparse format) files that were introduced in Xperia XZ2 and Xperia XZ2 Compact firmware.
    v1.6 [June 29, 2017]:
    - Removed some unnecessary stages, making the extraction a lot faster.
    - Improved checking of available disk space, to accommodate for the removal of pre-assigned container file.
    v1.5 [June 10, 2017]:
    - Fixed extraction for SIN v4. Images can now be mounted properly.
    v1.4 [June 6, 2017]:
    - The extracted images are now identical to those extracted by Flashtool, and can be mounted properly.
    - Fixed support for old SIN v3 formats that used a different partition information (i.e. Xperia C).
    v1.3 [May 11, 2017]:
    - Fixed SIN v4 support for non-sparse binaries.
    v1.2 [May 10, 2017]:
    - Added support for SIN v4 (gzip + tar + Android sparse format) files that were introduced in Xperia XZ Premium firmware. (NOTE: At least .NET Framework 4.0 is now required!)
    v1.1 [December 1, 2016]:
    - Algorithms were fixed to support large Nougat-based SIN files.
    v1.0 [June 5, 2015]:
    - Initial release.
    7
    Fixed for Nougat.
    It should also work much smoother and use far far less RAM and CPU while it's working.
    Take note: it takes time, just be patient, and use it on an SSD if you have one to speed things up.
    6
    v1.9 [April 9, 2018]:
    - Workaround for certain SIN files that contain 2 unexpected 0x00 bytes, specifically on F5121 Oreo firmware's oem.sin files. Purpose of these bytes is unknown, probably reserved for future use, but can be safely skipped.
    - Added command-line options by a user's request. Details are in the OP.
    6
    All apps from XZ2 working on XZ Premium Soundenhancement, fingerprint service, cametracommon, and some new apps like XperiaX loops, overlay file etc.
    Only camera and settings not working on xz premium Needed port I try but not effect yet. I thing it is possible. Setting Has a new icon.

    I made a silly mistake in v1.7, so some of the apps will probably be corrupted. You should get v1.8 and unpack the SIN again.
    The mistake was resolved. Should have checked MD5 before releasing v1.7. Silly me.

    v1.8 [March 23, 2018]:
    - Fixed a silly mistake that resulted in corrupted EXT4 images.
    - Significantly optimized memory usage.

    NOTE: Don't use v1.7, even if your EXT4 can be opened - they are corrupted and some data will be invalid! Update to v1.8.
    5
    @IgorEisberg Unable to Unsin XZ2 and XZ2 compact .sin files. It seems that the .sin files are not gzipped anymore. Zipping them manually and then trying unsin.exe results in broken .ext4 file. Needs more skills and knowhow than i can provide. thank you

    Sadly, that's not the main issue. The optional gzip decompression was an easy fix. However, now...
    Code:
    Extracting sparse files from SIN... Done!
    Restoring image from sparse files... Failed!
    ERROR: Unknown chunk type: 0xCAC5
    Sony used some new Android Sparse format.
    The known Sparse chunk types are: 0xCAC1 (Raw), 0xCAC2 (Fill), 0xCAC3 (Don't Care) and 0xCAC4 (CRC).
    Sony used a new type: 0xCAC5
    This calls for further investigation about the meaning of this chunk type.