[Sony Cross-Device General] IgorEisberg:
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 its 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 SharpZipLib for GZIP and TAR extraction methods.

SUPPORTED SIN FORMATS:

SIN v3 = Proprietary 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:

unsin [-o DIR] <sin_files>

Where -o DIR lets you specify an output directory (default: next to each SIN file).

Or, if on Windows, just drag and drop a SIN file onto the EXE file.

Make sure you have a lot of free space on your hard drive, as some raw images can be 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 or compile yourself from AOSP source)

CHANGELOG:

v2.0 [January 19, 2024]:

- Replaced .NET's GZipStream and old TAR extraction code with SharpZipLib equivalents which reduced binary size.

- Code refactored, redundant options removed.

- Added "-o" option to specify an output directory.

- Sparse chunks are no longer extracted to a temporary directory. Instead, they are read to memory, parsed and written to the output file sequentially.

- Built using the latest .NET SDK 8.0.101.

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.