Support for YAA. And all the other good stuff you've come to know and love
Jonathan Levin, (@Morpheus______), http://newosxbook.com/ - 10/19/2021
About
Trying to unpack an iOS 15 OTA I encountered the mysterious YAA. Which broke the my ota tool. That was unacceptable.
The YAA format (presumably, Yet Another Archiver?) is not documented, but has been around for quite a bit (don't blame me, I quit Darwin!). Basically, although the format can support multiple compression types, in OTA it's already PBZXed, making it *really* simple.
Marker is YAA followed by an integer character specifying IN ASCII length of header length field (usually, 1)
Header length follows (usually 1 byte, though variable)
Attributes follow. These include:
Attribute
Length
Specifies
TYP
1 (0x31)
'D'irectory or 'F'ile
PATP
short
PATtern (filename)
MOD
1 (0x31) or 2 (0x32)
chmod(2)
settings
UID
1 (0x31)
chown(2)
GID
1 (0x31)
chgrp(2)
FLG
1 (0x31) or 2 (0x32)
Flags. Probably for chflags(1)
MTM
'S' (8) or 'T' (12)
Modification time
LNKP
short
Link name (to PAT)
DATA
short
Payload (contents) immediate after YAA header
DATB
long
AFT
1 (0x31) or 2 (0x32)
Padding after file
The format is really simple to reverse - and list -v -i _file really helps, too.
The ota tool will now work on YAA payloads inside PBZX. As before, it automatically decompresses the PBZX encapsulation (to /tmp/out, if you want to check YAA out for YAAself). All other switches work exactly the same way (I refactored processFile to a processFileInner, as you can see in the open source).
All yours. A nice greet would be nice if you end up github'ing it like some people do. Plagiarism is low.
And you can always ask for features, though I think at this point there aren't any to add.