1 1.1.1.2 christos 2 1.1 christos #------------------------------------------------------------------------------ 3 1.1.1.12 christos # $File: gnu,v 1.24 2021/04/26 15:56:00 christos Exp $ 4 1.1 christos # gnu: file(1) magic for various GNU tools 5 1.1 christos # 6 1.1 christos # GNU nlsutils message catalog file format 7 1.1 christos # 8 1.1.1.3 christos # GNU message catalog (.mo and .gmo files) 9 1.1.1.3 christos 10 1.1.1.8 christos # Update: Joerg Jenderek 11 1.1.1.8 christos # URL: https://www.gnu.org/software/gettext/manual/html_node/MO-Files.html 12 1.1.1.8 christos # Reference: ftp://ftp.gnu.org/pub/gnu/gettext/gettext-0.19.8.tar.gz/ 13 1.1.1.8 christos # gettext-0.19.8.1/gettext-runtime/intl/gmo.h 14 1.1.1.8 christos # Note: maybe call it like "GNU translation gettext machine object" 15 1.1 christos 0 string \336\22\4\225 GNU message catalog (little endian), 16 1.1.1.8 christos #0 ulelong 0x950412DE GNU-format message catalog data 17 1.1.1.8 christos # TODO: write lines in such a way that code can also be called for big endian variant 18 1.1.1.8 christos #>0 use gettext-object 19 1.1.1.8 christos #0 name gettext-object 20 1.1.1.8 christos >4 ulelong x revision 21 1.1.1.8 christos !:mime application/x-gettext-translation 22 1.1.1.8 christos # mo extension is also used for Easeus Partition Master PE32 executable module 23 1.1.1.8 christos # like ConvertFatToNTFS.mo 24 1.1.1.8 christos !:ext gmo/mo 25 1.1.1.8 christos # only found three revision combinations 0.0 0.1 1.1 as unsigned 32-bit 26 1.1.1.8 christos # major revision 27 1.1.1.8 christos >4 ulelong/0xFFff x %u. 28 1.1.1.8 christos # minor revision 29 1.1.1.8 christos >4 ulelong&0x0000FFff x \b%u 30 1.1.1.8 christos >>8 ulelong x \b, %u message 31 1.1.1.8 christos # plural s 32 1.1.1.8 christos >>8 ulelong >1 \bs 33 1.1.1.8 christos # size of hashing table 34 1.1.1.8 christos #>20 ulelong x \b, %u hash 35 1.1.1.8 christos #>20 ulelong >1 \bes 36 1.1.1.12 christos #>24 ulelong x at %#x 37 1.1.1.11 christos # for revision x.0 offset of table with originals is 1Ch if directly after header 38 1.1.1.8 christos >4 ulelong&0x0000FFff =0 39 1.1.1.12 christos >>12 ulelong !0x1C \b, at %#x string table 40 1.1.1.8 christos # but for x.1 table offset i found is 30h. That means directly after bigger header 41 1.1.1.8 christos >4 ulelong&0x0000FFff >0 42 1.1.1.12 christos >>12 ulelong !0x30 \b, at %#x string table 43 1.1.1.8 christos # The following variables are only used in .mo files with minor revision >= 1 44 1.1.1.8 christos # number of system dependent segments 45 1.1.1.8 christos #>>28 ulelong x \b, %u segment 46 1.1.1.8 christos #>>28 ulelong >1 \bs 47 1.1.1.8 christos # offset of table describing system dependent segments 48 1.1.1.12 christos #>>32 ulelong x at %#x 49 1.1.1.8 christos # number of system dependent strings pairs 50 1.1.1.8 christos >>36 ulelong x \b, %u sysdep message 51 1.1.1.8 christos >>36 ulelong >1 \bs 52 1.1.1.8 christos # offset of table with start offsets of original sysdep strings 53 1.1.1.12 christos #>>40 ulelong x \b, at %#x sysdep strings 54 1.1.1.8 christos # offset of table with start offsets of translated sysdep strings 55 1.1.1.12 christos #>>44 ulelong x \b, at %#x sysdep translations 56 1.1.1.12 christos # >>(44.l) ulelong x %#x chars 57 1.1.1.12 christos # >>>&0 ulelong x at %#x 58 1.1.1.8 christos # >>>>(&-4) string x "%s" 59 1.1.1.8 christos # string table after big header 60 1.1.1.12 christos #>>48 ubequad x \b, string table %#llx 61 1.1.1.8 christos # 62 1.1.1.8 christos # 0th string length seems to be always 0 63 1.1.1.8 christos #>(12.l) ulelong x \b, %u chars 64 1.1.1.12 christos #>>&0 ulelong x at %#x 65 1.1.1.11 christos # if 1st string length positive inspect offset and string 66 1.1.1.8 christos #>(12.l+8) ulelong >0 \b, %u chars 67 1.1.1.12 christos #>>&0 ulelong x at %#x 68 1.1.1.11 christos # if 2nd string length positive inspect offset and string 69 1.1.1.8 christos # >(12.l+16) ulelong >0 \b, %u chars 70 1.1.1.12 christos # >>&0 ulelong x at %#x 71 1.1.1.8 christos # skip newline byte 72 1.1.1.8 christos #>>>(&-4) ubyte =0x0A 73 1.1.1.8 christos #>>>>&0 string x "%s" 74 1.1.1.8 christos #>>>(&-4) ubyte !0x0A 75 1.1.1.8 christos #>>>>&-1 string x '%s' 76 1.1.1.8 christos # offset of table with translation strings 77 1.1.1.12 christos #>16 ulelong x \b, at %#x translation table 78 1.1.1.8 christos # check translation 0 length and offset 79 1.1.1.8 christos >(16.l) ulelong >0 80 1.1.1.8 christos >>&0 ulelong x 81 1.1.1.8 christos # translation 0 seems to be often Project-Id with name and version 82 1.1.1.8 christos >>>(&-4) string x \b, %s 83 1.1.1.8 christos # trans. 1 with bytes >= 1 unlike icoutils-0.31.0\po\en (a] boldquot.gmo with 1 NL 84 1.1.1.8 christos >(16.l+8) ulelong >1 85 1.1.1.8 christos >>&0 ulelong x 86 1.1.1.8 christos >>>(&-4) ubyte !0x0A 87 1.1.1.8 christos >>>>&-1 string x '%s' 88 1.1.1.8 christos # 1 New Line like in tar-1.29\po\de.gmo 89 1.1.1.8 christos >>>(&-4) ubyte =0x0A 90 1.1.1.8 christos >>>>&0 ubyte !0x0A 91 1.1.1.8 christos >>>>>&-1 string x '%s' 92 1.1.1.8 christos # 2nd New Line like in parted-3.1\po\de.gmo 93 1.1.1.8 christos >>>>&0 ubyte =0x0A 94 1.1.1.8 christos >>>>>&0 string x '%s' 95 1.1.1.3 christos 96 1.1 christos 0 string \225\4\22\336 GNU message catalog (big endian), 97 1.1.1.8 christos #0 ubelong 0x950412DE GNU-format message catalog data 98 1.1.1.8 christos !:mime application/x-gettext-translation 99 1.1.1.8 christos !:ext gmo/mo 100 1.1.1.8 christos # TODO: for big endian use same code as for little endian 101 1.1.1.8 christos #>0 use \^gettext-object 102 1.1.1.8 christos # DEBUG code 103 1.1.1.12 christos #>16 ubelong x \b, at %#x translation table 104 1.1.1.12 christos #>(16.L) ubelong x %#x chars 105 1.1.1.12 christos #>>&0 ubelong x at %#x 106 1.1.1.8 christos # unexpected value HERE! 107 1.1.1.12 christos #>>>(&-4) ubequad x %#llx 108 1.1.1.8 christos # 109 1.1.1.3 christos >4 beshort x revision %d. 110 1.1.1.3 christos >6 beshort >0 \b%d, 111 1.1.1.3 christos >>8 belong x %d messages, 112 1.1.1.3 christos >>36 belong x %d sysdep messages 113 1.1.1.3 christos >6 beshort =0 \b%d, 114 1.1.1.3 christos >>8 belong x %d messages 115 1.1.1.3 christos 116 1.1 christos 117 1.1 christos # GnuPG 118 1.1 christos # The format is very similar to pgp 119 1.1 christos 0 string \001gpg GPG key trust database 120 1.1 christos >4 byte x version %d 121 1.1 christos # Note: magic.mime had 0x8501 for the next line instead of 0x8502 122 1.1 christos 0 beshort 0x8502 GPG encrypted data 123 1.1 christos !:mime text/PGP # encoding: data 124 1.1 christos 125 1.1.1.8 christos # Update: Joerg Jenderek 126 1.1.1.8 christos # Note: PGP and GPG use same data structure. 127 1.1.1.8 christos # So recognition is now done by ./pgp with start test for byte 0x99 128 1.1 christos # This magic is not particularly good, as the keyrings don't have true 129 1.1 christos # magic. Nevertheless, it covers many keyrings. 130 1.1.1.8 christos # 0 ubeshort-0x9901 <2 131 1.1.1.8 christos # >3 byte 4 132 1.1.1.8 christos # >>4 bedate x GPG key public ring, created %s 133 1.1.1.8 christos # !:mime application/x-gnupg-keyring 134 1.1 christos 135 1.1.1.4 christos # Symmetric encryption 136 1.1.1.4 christos 0 leshort 0x0d8c 137 1.1.1.4 christos >4 leshort 0x0203 138 1.1.1.4 christos >>2 leshort 0x0204 GPG symmetrically encrypted data (3DES cipher) 139 1.1.1.4 christos >>2 leshort 0x0304 GPG symmetrically encrypted data (CAST5 cipher) 140 1.1.1.4 christos >>2 leshort 0x0404 GPG symmetrically encrypted data (BLOWFISH cipher) 141 1.1.1.4 christos >>2 leshort 0x0704 GPG symmetrically encrypted data (AES cipher) 142 1.1.1.4 christos >>2 leshort 0x0804 GPG symmetrically encrypted data (AES192 cipher) 143 1.1.1.4 christos >>2 leshort 0x0904 GPG symmetrically encrypted data (AES256 cipher) 144 1.1.1.4 christos >>2 leshort 0x0a04 GPG symmetrically encrypted data (TWOFISH cipher) 145 1.1.1.4 christos >>2 leshort 0x0b04 GPG symmetrically encrypted data (CAMELLIA128 cipher) 146 1.1.1.4 christos >>2 leshort 0x0c04 GPG symmetrically encrypted data (CAMELLIA192 cipher) 147 1.1.1.4 christos >>2 leshort 0x0d04 GPG symmetrically encrypted data (CAMELLIA256 cipher) 148 1.1.1.4 christos 149 1.1.1.4 christos 150 1.1.1.5 christos # GnuPG Keybox file 151 1.1.1.9 christos # <https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob;f=kbx/keybox-blob.c;hb=HEAD> 152 1.1.1.5 christos # From: Philipp Hahn <hahn (a] univention.de> 153 1.1.1.5 christos 0 belong 32 154 1.1.1.5 christos >4 byte 1 155 1.1.1.5 christos >>8 string KBXf GPG keybox database 156 1.1.1.5 christos >>>5 byte 1 version %d 157 1.1.1.5 christos >>>16 bedate x \b, created-at %s 158 1.1.1.5 christos >>>20 bedate x \b, last-maintained %s 159 1.1.1.5 christos 160 1.1.1.5 christos 161 1.1.1.7 christos # From: James Youngman <jay (a] gnu.org> 162 1.1 christos # gnu find magic 163 1.1 christos 0 string \0LOCATE GNU findutils locate database data 164 1.1 christos >7 string >\0 \b, format %s 165 1.1 christos >7 string 02 \b (frcode) 166 1.1 christos 167 1.1 christos # Files produced by GNU gettext 168 1.1.1.3 christos 169 1.1.1.3 christos # gettext message catalogue 170 1.1.1.6 christos 0 search/1024 \nmsgid 171 1.1.1.6 christos >&0 search/1024 \nmsgstr GNU gettext message catalogue text 172 1.1.1.6 christos !:strength +100 173 1.1.1.3 christos !:mime text/x-po 174