Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Decrypted iTunes Library File Format
<?xml version="1.0" encoding="UTF-8"?>
<ufwb version="1.9">
<grammar name="Decrypted iTunes Library" start="id:148" author="Mr. eXoDia" email="mr.exodia.tpodt@gmail.com" fileextension="itl" uti="com.apple.itunes.db">
<description>Grammar for decrypted iTunes Library files.</description>
<structure name="Defaults" id="149" repeatmin="0" repeatmax="-1" encoding="ISO_8859-1:1987" endian="little" signed="no"/>
<structure name="iTunes Library" id="148" repeatmin="0" repeatmax="-1" extends="id:149" order="variable">
<structref name="hdfm" id="152" repeatmin="0" repeatmax="-1" structure="id:151"/>
<structref name="msdh" id="154" repeatmin="0" repeatmax="-1" structure="id:153"/>
</structure>
<structure name="hdfm" id="151" length="this.headerLength" repeatmin="0" repeatmax="-1" extends="id:149" endian="big">
<string name="signature" mustmatch="yes" id="156" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="hdfm" value="hdfm"/>
</fixedvalues>
</string>
<number name="headerLength" id="157" type="integer" length="4" display="hex"/>
<number name="fileLength" id="158" type="integer" length="4" display="hex"/>
<number name="unknown1" id="159" type="integer" length="2"/>
<number name="unknown2" id="160" type="integer" length="2"/>
<number name="versionLength" id="161" type="integer" length="1"/>
<string name="version" id="162" type="fixed-length" length="31"/>
<number name="unknown3" id="163" type="integer" length="4"/>
<number name="magic1" id="164" type="integer" length="8" display="hex"/>
<number name="unknown4" id="165" type="integer" length="4" display="hex"/>
<number name="unknown5" id="166" type="integer" length="1"/>
<number name="unknown6" id="167" type="integer" length="1"/>
<number name="unknown7" id="168" type="integer" length="1"/>
<number name="unknown8" id="169" type="integer" length="1"/>
</structure>
<structure name="msdh" id="153" length="this.totalLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="171" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="msdh" value="msdh"/>
</fixedvalues>
</string>
<number name="headerLength" id="172" type="integer" length="4" display="hex"/>
<number name="totalLength" id="173" type="integer" length="4" display="hex"/>
<number name="blockType" id="174" type="integer" length="4" display="hex"/>
<binary name="unknown" id="175" length="headerLength-16"/>
<structure name="blockData" id="176" length="0" repeatmin="0" repeatmax="-1" order="variable">
<structref name="mfdh" id="178" repeatmin="0" structure="id:177"/>
<structref name="mhgh" id="180" repeatmin="0" structure="id:179"/>
<structref name="mhoh" id="182" repeatmin="0" structure="id:181"/>
<structref name="mlah" id="184" repeatmin="0" structure="id:183"/>
<structref name="miah" id="186" repeatmin="0" structure="id:185"/>
<structref name="mlih" id="188" repeatmin="0" structure="id:187"/>
<structref name="miih" id="190" repeatmin="0" structure="id:189"/>
<structref name="mlth" id="192" repeatmin="0" structure="id:191"/>
<structref name="mith" id="194" repeatmin="0" structure="id:193"/>
<structref name="mlqh" id="196" repeatmin="0" structure="id:195"/>
<structref name="miqh" id="198" repeatmin="0" structure="id:197"/>
<structref name="mlph" id="200" repeatmin="0" structure="id:199"/>
<structref name="miph" id="202" repeatmin="0" structure="id:201"/>
<structref name="mtph" id="204" repeatmin="0" structure="id:203"/>
<structref name="mlsh" id="206" repeatmin="0" structure="id:205"/>
<structref name="msph" id="208" repeatmin="0" structure="id:207"/>
<structref name="mlrh" id="210" repeatmin="0" structure="id:209"/>
<structref name="mprh" id="212" repeatmin="0" structure="id:211"/>
<structure name="file" id="213" repeatmin="0">
<string name="signature" mustmatch="yes" id="214" type="fixed-length" length="7">
<fixedvalues>
<fixedvalue name="file" value="file://"/>
</fixedvalues>
</string>
<string name="path" id="215" type="fixed-length" length="totalLength-headerLength-7"/>
</structure>
</structure>
</structure>
<structure name="mfdh" id="177" length="this.headerLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="219" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="mfdh" value="mfdh"/>
</fixedvalues>
</string>
<number name="headerLength" id="220" type="integer" length="4" display="hex"/>
<number name="fileLength" id="221" type="integer" length="4" display="hex"/>
<number name="unknown1" id="222" type="integer" length="2"/>
<number name="unknown2" id="223" type="integer" length="2"/>
<number name="versionLength" id="224" type="integer" length="1"/>
<string name="version" id="225" type="fixed-length" length="31"/>
<number name="unknown3" id="226" type="integer" length="4"/>
<number name="magic1" id="227" type="integer" length="8" display="hex"/>
<number name="unknown4" id="228" type="integer" length="4" display="hex"/>
<number name="unknown5" id="229" type="integer" length="1"/>
<number name="unknown6" id="230" type="integer" length="1"/>
<number name="unknown7" id="231" type="integer" length="1"/>
<number name="unknown8" id="232" type="integer" length="1"/>
</structure>
<structure name="mhgh" id="179" length="this.headerLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="234" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="mhgh" value="mhgh"/>
</fixedvalues>
</string>
<number name="headerLength" id="235" type="integer" length="4" display="hex"/>
</structure>
<structure name="mhoh" id="181" length="this.totalLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="237" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="mhoh" value="mhoh"/>
</fixedvalues>
</string>
<number name="headerLength" id="238" type="integer" length="4" display="hex"/>
<number name="totalLength" id="239" type="integer" length="4" display="hex"/>
</structure>
<structure name="mlah" id="183" length="this.headerLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="241" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="mlah" value="mlah"/>
</fixedvalues>
</string>
<number name="headerLength" id="242" type="integer" length="4" display="hex"/>
</structure>
<structure name="miah" id="185" length="this.totalLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="244" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="miah" value="miah"/>
</fixedvalues>
</string>
<number name="headerLength" id="245" type="integer" length="4" display="hex"/>
<number name="totalLength" id="246" type="integer" length="4" display="hex"/>
<binary name="unknown" id="290" length="headerLength-12"/>
<structref name="mhoh" id="293" repeatmin="0" repeatmax="-1" structure="id:181"/>
</structure>
<structure name="mlih" id="187" length="this.headerLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="248" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="mlih" value="mlih"/>
</fixedvalues>
</string>
<number name="headerLength" id="249" type="integer" length="4" display="hex"/>
</structure>
<structure name="miih" id="189" length="this.headerLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="251" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="miih" value="miih"/>
</fixedvalues>
</string>
<number name="headerLength" id="252" type="integer" length="4" display="hex"/>
</structure>
<structure name="mlth" id="191" length="this.headerLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="254" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="mlth" value="mlth"/>
</fixedvalues>
</string>
<number name="headerLength" id="255" type="integer" length="4" display="hex"/>
</structure>
<structure name="mith" id="193" length="this.totalLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="257" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="mith" value="mith"/>
</fixedvalues>
</string>
<number name="headerLength" id="258" type="integer" length="4" display="hex"/>
<number name="totalLength" id="259" type="integer" length="4" display="hex"/>
<binary name="unknown" id="260" length="headerLength-12"/>
<structref name="mhoh" id="261" repeatmin="0" repeatmax="-1" structure="id:181"/>
</structure>
<structure name="mlqh" id="195" length="this.headerLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="263" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="mlqh" value="mlqh"/>
</fixedvalues>
</string>
<number name="headerLength" id="264" type="integer" length="4" display="hex"/>
</structure>
<structure name="miqh" id="197" length="this.headerLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="266" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="miqh" value="miqh"/>
</fixedvalues>
</string>
<number name="headerLength" id="267" type="integer" length="4" display="hex"/>
</structure>
<structure name="mlph" id="199" length="this.headerLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="269" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="mlph" value="mlph"/>
</fixedvalues>
</string>
<number name="headerLength" id="270" type="integer" length="4" display="hex"/>
</structure>
<structure name="miph" id="201" length="this.headerLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="272" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="miph" value="miph"/>
</fixedvalues>
</string>
<number name="headerLength" id="273" type="integer" length="4" display="hex"/>
</structure>
<structure name="mtph" id="203" length="this.headerLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="275" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="mtph" value="mtph"/>
</fixedvalues>
</string>
<number name="headerLength" id="276" type="integer" length="4" display="hex"/>
</structure>
<structure name="mlsh" id="205" length="this.headerLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="278" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="mlsh" value="mlsh"/>
</fixedvalues>
</string>
<number name="headerLength" id="279" type="integer" length="4" display="hex"/>
</structure>
<structure name="msph" id="207" length="this.headerLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="281" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="msph" value="msph"/>
</fixedvalues>
</string>
<number name="headerLength" id="282" type="integer" length="4" display="hex"/>
</structure>
<structure name="mlrh" id="209" length="this.headerLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="284" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="mlrh" value="mlrh"/>
</fixedvalues>
</string>
<number name="headerLength" id="285" type="integer" length="4" display="hex"/>
</structure>
<structure name="mprh" id="211" length="this.headerLength" repeatmin="0" repeatmax="-1" extends="id:149">
<string name="signature" mustmatch="yes" id="287" type="fixed-length" length="4">
<fixedvalues>
<fixedvalue name="mprh" value="mprh"/>
</fixedvalues>
</string>
<number name="headerLength" id="288" type="integer" length="4" display="hex"/>
</structure>
</grammar>
</ufwb>

adamish commented Aug 20, 2015

I've been using this to parse a iTunes 12.2 file... It seems there is now a stsh signature that isn't documented... Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment