├── .github └── FUNDING.yml ├── android_win_tools ├── androidbootimg.magic ├── find2cpio.bat └── magic ├── authors.txt ├── cleanup.bat ├── repackimg.bat └── unpackimg.bat /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: osm0sis # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: https://www.paypal.me/osm0sis # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /android_win_tools/androidbootimg.magic: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------ 2 | # Various Android OEM non-standard boot image related magic entries 3 | # osm0sis @ xda-developers 4 | #------------------------------------------------------------------------------ 5 | 6 | # ASUS Blob Signature 7 | 0 string -SIGNED-BY-SIGNBLOB- BLOB signing 8 | 9 | # Barnes & Noble Nook Signature 10 | 64 string Red\x20Loader NOOK signing (red loader) 11 | 64 string Green\x20Loader NOOK signing (green loader) 12 | 64 string Green\x20Recovery NOOK signing (green recovery) 13 | 64 string eMMC\x20boot.img+secondloader NOOK signing (emmc boot) 14 | 64 string eMMC\x20recovery.img+secondloader NOOK signing (emmc recovery) 15 | 48 string BauwksBoot NOOKTAB signing (bauwks) 16 | 17 | # Google ChromeOS Signature 18 | 0 string CHROMEOS CHROMEOS signing 19 | 20 | # Samsung/Spreadtrum DHTB Signature 21 | 0 string DHTB\x01\x00\x00 DHTB signing 22 | 23 | # Sony SIN Packaging/Signature 24 | 0 string \x01\x00\x00\x00 SINv1 signing 25 | 0 string \x02\x00\x00\x00 SINv2 signing 26 | 0 string \x03SIN SINv3 signing 27 | 28 | # Google Pixel/Nexus/AOSP Standard 29 | # [test "x" as workaround to odd file/magic behavior not allowing search here] 30 | 0 string x 31 | >0 search ANDROID! AOSP bootimg 32 | >>36 string \x00\x00\x00\x02 \b, PXA variant (020) 33 | >>36 string \x00\x00\x80\x02 \b, PXA variant (028) 34 | >>36 string \x00\x00\x00\x03 \b, PXA variant (030) 35 | >>96 search microloader 36 | >>>1024 string ANDROID! \b, AMONET header 37 | >>1024 string LOKI \b, LOKI header 38 | >>>1028 string \x00 \b (boot) 39 | >>>1028 string \x01 \b (recovery) 40 | >>2048 search \x88\x16\x88\x58 \b, MTK headers 41 | !:strength * 3 42 | 43 | # Google Pixel/AOSP Vendor Standard 44 | # [test "x" as workaround to odd file/magic behavior not allowing search here] 45 | 0 string x 46 | >0 search VNDRBOOT AOSP_VNDR bootimg 47 | !:strength * 3 48 | 49 | # DENX U-Boot 50 | 0 string \x27\x05\x19\x56 U-Boot bootimg 51 | 52 | # Intel OSIP 53 | 1000 search \xFC\xFA\xBC\x00 OSIP bootimg (headerless) 54 | !:strength / 15 55 | 0 string $OS$\x00\x00\x01 OSIP bootimg 56 | >52 string \x00\x00\x00\x00 \b, boot (signed) 57 | >52 string \x01\x00\x00\x00 \b, boot (unsigned) 58 | >52 string \x0C\x00\x00\x00 \b, recovery (signed) 59 | >52 string \x0D\x00\x00\x00 \b, recovery (unsigned) 60 | 61 | # Rockchip KRNL 62 | 0 string KRNL KRNL bootimg 63 | 64 | # Sony ELF 65 | 0 string \x7FELF ELF 66 | >5 string \x01\x01\x61 bootimg 67 | >18 string \x28 (ARM 68 | >18 string \x03 (x86_ 69 | >18 string \x08 (MIPS 70 | >4 string \x01 \b) 71 | >4 string \x02 \b64) 72 | >0 search \x88\x16\x88\x58 \b, MTK headers 73 | 74 | # MediaTek MTK 75 | # [for detection after boot image has already been split] 76 | 0 search \x88\x16\x88\x58 MTK header 77 | >0 search KERNEL \b, kernel type 78 | >0 search ROOTFS \b, rootfs type 79 | >0 search RECOVERY \b, recovery type 80 | !:strength / 20 81 | 82 | # Qualcomm Device Tree 83 | # [for detection after boot image has already been split] 84 | 0 string QCDT QCDT header 85 | !:strength / 20 86 | 87 | # Google Android Verified Boot 1.0 Signature 88 | # [for detection with the tail of the boot image] 89 | 0 search \x02\x01\x01\x30\x82 AVBv1 signing footer 90 | >0 search /boot \b, boot type 91 | >0 search /recovery \b, recovery type 92 | !:strength / 20 93 | 94 | # Google Android Verified Boot 2.0 Signature 95 | # [for detection with the tail of the boot image] 96 | # [test "x" as workaround to odd file/magic behavior not allowing search here] 97 | 0 string x 98 | >0 search AVBf AVBv2 signing footer 99 | !:strength / 20 100 | 101 | # LG Bump 102 | # [for detection with the tail of the boot image] 103 | 0 search \x41\xA9\xE4\x67\x74\x4D\x1D\x1B\xA4\x29\xF2\xEC\xEA\x65\x52\x79 Bump footer 104 | !:strength / 20 105 | 106 | # Samsung SEAndroid 107 | # [for detection with the tail of the boot image] 108 | # [test "x" as workaround to odd file/magic behavior not allowing search here] 109 | 0 string x 110 | >0 search SEANDROIDENFORCE SEAndroid footer 111 | !:strength / 20 112 | -------------------------------------------------------------------------------- /android_win_tools/find2cpio.bat: -------------------------------------------------------------------------------- 1 | "%bin%"\find . | "%bin%"\cpio -H newc -R 0:0 -o -F ..\ramdisk-new.cpio 2>nul 2 | -------------------------------------------------------------------------------- /android_win_tools/magic: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------ 2 | # Slimmed down magic file for archives only 3 | #------------------------------------------------------------------------------ 4 | # $File: archive,v 1.145 2021/01/03 20:58:47 christos Exp $ 5 | # archive: file(1) magic for archive formats (see also "msdos" for self- 6 | # extracting compressed archives) 7 | # 8 | # cpio, ar, arc, arj, hpack, lha/lharc, rar, squish, uc2, zip, zoo, etc. 9 | # pre-POSIX "tar" archives are also handled in the C code ../../src/is_tar.c. 10 | 11 | # POSIX tar archives 12 | # URL: https://en.wikipedia.org/wiki/Tar_(computing) 13 | # Reference: https://www.freebsd.org/cgi/man.cgi?query=tar&sektion=5&manpath=FreeBSD+8-current 14 | # header mainly padded with nul bytes 15 | 500 quad 0 16 | !:strength /2 17 | # filename or extended attribute printable strings in range space null til umlaut ue 18 | >0 ubeshort >0x1F00 19 | >>0 ubeshort <0xFCFD 20 | # last 4 header bytes often null but tar\0 in gtarfail2.tar gtarfail.tar-bad 21 | # at https://sourceforge.net/projects/s-tar/files/testscripts/ 22 | >>>508 ubelong&0x8B9E8DFF 0 23 | # nul, space or ascii digit 0-7 at start of mode 24 | >>>>100 ubyte&0xC8 =0 25 | >>>>>101 ubyte&0xC8 =0 26 | # nul, space at end of check sum 27 | >>>>>>155 ubyte&0xDF =0 28 | # space or ascii digit 0 at start of check sum 29 | >>>>>>>148 ubyte&0xEF =0x20 30 | # minimal check and then display tar archive information which can also be 31 | # embedded inside others like Android Backup, Clam AntiVirus database 32 | >257 string !ustar 33 | # header padded with nuls 34 | >>257 ulong =0 35 | # GNU tar version 1.29 with non pax format option without refusing 36 | # creates misleading V7 header for Long path, Multi-volume, Volume type 37 | >>>156 ubyte 0x4c GNU tar archive 38 | !:mime application/x-gtar 39 | #!:ext tar/gtar 40 | >>>156 ubyte 0x4d GNU tar archive 41 | !:mime application/x-gtar 42 | #!:ext tar/gtar 43 | >>>156 ubyte 0x56 GNU tar archive 44 | !:mime application/x-gtar 45 | #!:ext tar/gtar 46 | >>>156 default x tar archive (V7) 47 | !:mime application/x-tar 48 | #!:ext tar 49 | # other stuff in padding 50 | # some implementations add new fields to the blank area at the end of the header record 51 | # created for example by DOS TAR 3.20g 1994 Tim V.Shapore with -j option 52 | >>257 ulong !0 tar archive (old) 53 | !:mime application/x-tar 54 | #!:ext tar 55 | # magic in newer, GNU, posix variants 56 | >257 string =ustar 57 | # 2 last char of magic and UStar version because string expression does not work 58 | # 2 space characters followed by a null for GNU variant 59 | >>261 ubelong =0x72202000 POSIX tar archive (GNU) 60 | !:mime application/x-gtar 61 | #!:ext tar/gtar 62 | # UStar version with ASCII "00" 63 | >>261 ubelong 0x72003030 POSIX 64 | # gLOBAL and ExTENSION type only found in POSIX.1-2001 format 65 | >>>156 ubyte 0x67 \b.1-2001 66 | >>>156 ubyte 0x78 \b.1-2001 67 | >>>156 ubyte x tar archive 68 | !:mime application/x-ustar 69 | #!:ext tar/ustar 70 | # version with 2 binary nuls embedded in Android Backup like com.android.settings.ab 71 | >>261 ubelong 0x72000000 tar archive (ustar) 72 | !:mime application/x-ustar 73 | #!:ext tar/ustar 74 | # not seen ustar variant with garbish version 75 | >>261 default x tar archive (unknown ustar) 76 | !:mime application/x-ustar 77 | #!:ext tar/ustar 78 | # type flag of 1st tar archive member 79 | #>156 ubyte x \b, %c-type 80 | >156 ubyte x 81 | >>156 ubyte 0 \b, file 82 | >>156 ubyte 0x30 \b, file 83 | >>156 ubyte 0x31 \b, hard link 84 | >>156 ubyte 0x32 \b, symlink 85 | >>156 ubyte 0x33 \b, char device 86 | >>156 ubyte 0x34 \b, block device 87 | >>156 ubyte 0x35 \b, directory 88 | >>156 ubyte 0x36 \b, fifo 89 | >>156 ubyte 0x37 \b, reserved 90 | >>156 ubyte 0x4c \b, long path 91 | >>156 ubyte 0x4d \b, multi volume 92 | >>156 ubyte 0x56 \b, volume 93 | >>156 ubyte 0x67 \b, global 94 | >>156 ubyte 0x78 \b, extension 95 | >>156 default x \b, type 96 | >>>156 ubyte x '%c' 97 | # name[100] 98 | >0 string >\0 %-.60s 99 | # mode mainly stored as an octal number in ASCII null or space terminated 100 | >100 string >\0 \b, mode %-.7s 101 | # user id mainly as octal numbers in ASCII null or space terminated 102 | >108 string >\0 \b, uid %-.7s 103 | # group id mainly as octal numbers in ASCII null or space terminated 104 | >116 string >\0 \b, gid %-.7s 105 | # size mainly as octal number in ASCII 106 | >124 ubyte <0x38 107 | >>124 string >\0 \b, size %-.12s 108 | # coding indicated by setting the high-order bit of the leftmost byte 109 | >124 ubyte >0xEF \b, size 0x 110 | >>124 ubyte !0xff \b%2.2x 111 | >>125 ubyte !0xff \b%2.2x 112 | >>126 ubyte !0xff \b%2.2x 113 | >>127 ubyte !0xff \b%2.2x 114 | >>128 ubyte !0xff \b%2.2x 115 | >>129 ubyte !0xff \b%2.2x 116 | >>130 ubyte !0xff \b%2.2x 117 | >>131 ubyte !0xff \b%2.2x 118 | >>132 ubyte !0xff \b%2.2x 119 | >>133 ubyte !0xff \b%2.2x 120 | >>134 ubyte !0xff \b%2.2x 121 | >>135 ubyte !0xff \b%2.2x 122 | # seconds since 0:0:0 1 jan 1970 UTC as octal number mainly in ASCII null or space terminated 123 | >136 string >\0 \b, seconds %-.11s 124 | # header checksum stored as an octal number in ASCII null or space terminated 125 | #>148 string x \b, cksum %.7s 126 | # linkname[100] 127 | >157 string >\0 \b, linkname %-.40s 128 | # additional fields for ustar 129 | >257 string =ustar 130 | # owner user name null terminated 131 | >>265 string >\0 \b, user %-.32s 132 | # group name null terminated 133 | >>297 string >\0 \b, group %-.32s 134 | # device major minor if not zero 135 | >>329 ubequad&0xCFCFCFCFcFcFcFdf !0 136 | >>>329 string x \b, devmaj %-.7s 137 | >>337 ubequad&0xCFCFCFCFcFcFcFdf !0 138 | >>>337 string x \b, devmin %-.7s 139 | # prefix[155] 140 | >>345 string >\0 \b, prefix %-.155s 141 | # old non ustar/POSIX tar 142 | >257 string !ustar 143 | >>508 string =tar\0 144 | # padding[255] in old star 145 | >>>257 string >\0 \b, padding: %-.40s 146 | >>508 default x 147 | # padding[255] in old tar sometimes comment field 148 | >>>257 string >\0 \b, comment: %-.40s 149 | 150 | # Incremental snapshot gnu-tar format from: 151 | # https://www.gnu.org/software/tar/manual/html_node/Snapshot-Files.html 152 | 0 string GNU\ tar- GNU tar incremental snapshot data 153 | >&0 regex [0-9]\.[0-9]+-[0-9]+ version %s 154 | 155 | # cpio archives 156 | # 157 | # Yes, the top two "cpio archive" formats *are* supposed to just be "short". 158 | # The idea is to indicate archives produced on machines with the same 159 | # byte order as the machine running "file" with "cpio archive", and 160 | # to indicate archives produced on machines with the opposite byte order 161 | # from the machine running "file" with "cpio byte-swapped archive". 162 | # 163 | # The SVR4 "cpio(4)" hints that there are additional formats, but they 164 | # are defined as "short"s; I think all the new formats are 165 | # character-header formats and thus are strings, not numbers. 166 | 0 short 070707 cpio archive 167 | !:mime application/x-cpio 168 | 0 short 0143561 cpio byte-swapped archive 169 | !:mime application/x-cpio # encoding: swapped 170 | 0 string 070707 cpio ASCII archive (pre-SVR4 or odc) 171 | 0 string 070701 cpio ASCII archive (SVR4 with no CRC) 172 | 0 string 070702 cpio ASCII archive (SVR4 with CRC) 173 | 174 | # 175 | # Various archive formats used by various versions of the "ar" 176 | # command. 177 | # 178 | 179 | # 180 | # Original UNIX archive formats. 181 | # They were written with binary values in host byte order, and 182 | # the magic number was a host "int", which might have been 16 bits 183 | # or 32 bits. We don't say "PDP-11" or "VAX", as there might have 184 | # been ports to little-endian 16-bit-int or 32-bit-int platforms 185 | # (x86?) using some of those formats; if none existed, feel free 186 | # to use "PDP-11" for little-endian 16-bit and "VAX" for little-endian 187 | # 32-bit. There might have been big-endian ports of that sort as 188 | # well. 189 | # 190 | 0 leshort 0177555 very old 16-bit-int little-endian archive 191 | 0 beshort 0177555 very old 16-bit-int big-endian archive 192 | 0 lelong 0177555 very old 32-bit-int little-endian archive 193 | 0 belong 0177555 very old 32-bit-int big-endian archive 194 | 195 | 0 leshort 0177545 old 16-bit-int little-endian archive 196 | >2 string __.SYMDEF random library 197 | 0 beshort 0177545 old 16-bit-int big-endian archive 198 | >2 string __.SYMDEF random library 199 | 0 lelong 0177545 old 32-bit-int little-endian archive 200 | >4 string __.SYMDEF random library 201 | 0 belong 0177545 old 32-bit-int big-endian archive 202 | >4 string __.SYMDEF random library 203 | 204 | # 205 | # From "pdp" (but why a 4-byte quantity?) 206 | # 207 | 0 lelong 0x39bed PDP-11 old archive 208 | 0 lelong 0x39bee PDP-11 4.0 archive 209 | 210 | # 211 | # XXX - what flavor of APL used this, and was it a variant of 212 | # some ar archive format? It's similar to, but not the same 213 | # as, the APL workspace magic numbers in pdp. 214 | # 215 | 0 long 0100554 apl workspace 216 | 217 | # 218 | # System V Release 1 portable(?) archive format. 219 | # 220 | 0 string = System V Release 1 ar archive 221 | !:mime application/x-archive 222 | 223 | # 224 | # Debian package; it's in the portable archive format, and needs to go 225 | # before the entry for regular portable archives, as it's recognized as 226 | # a portable archive whose first member has a name beginning with 227 | # "debian". 228 | # 229 | # Update: Joerg Jenderek 230 | # URL: https://en.wikipedia.org/wiki/Deb_(file_format) 231 | 0 string =!\ndebian 232 | # https://manpages.debian.org/testing/dpkg/dpkg-split.1.en.html 233 | >14 string -split part of multipart Debian package 234 | !:mime application/vnd.debian.binary-package 235 | # udeb is used for stripped down deb file 236 | #!:ext deb/udeb 237 | >14 string -binary Debian binary package 238 | !:mime application/vnd.debian.binary-package 239 | # For ipk packager see also https://en.wikipedia.org/wiki/Opkg 240 | #!:ext deb/udeb/ipk 241 | # This should not happen 242 | >14 default x Unknown Debian package 243 | # NL terminated version; for most Debian cases this is 2.0 or 2.1 for split 244 | >68 string >\0 (format %s) 245 | #>68 string !2.0\n 246 | #>>68 string x (format %.3s) 247 | >68 string =2.0\n 248 | # 2nd archive name=control archive name like control.tar.gz or control.tar.xz 249 | >>72 string >\0 \b, with %.14s 250 | # look for 3rd archive name=data archive name like data.tar.{gz,xz,bz2,lzma} 251 | >>0 search/0x93e4f data.tar. \b, data compression 252 | # the above line only works if FILE_BYTES_MAX in ../../src/file.h is raised 253 | # for example like libreoffice-dev-doc_1%3a5.2.7-1+rpi1+deb9u3_all.deb 254 | >>>&0 string x %.2s 255 | # skip space (0x20 BSD) and slash (0x2f System V) character marking end of name 256 | >>>&2 ubyte !0x20 257 | >>>>&-1 ubyte !0x2f 258 | # display 3rd character of file name extension like 2 of bz2 or m of lzma 259 | >>>>>&-1 ubyte x \b%c 260 | >>>>>>&0 ubyte !0x20 261 | >>>>>>>&-1 ubyte !0x2f 262 | # display 4th character of file name extension like a of lzma 263 | >>>>>>>>&-1 ubyte x \b%c 264 | # split debian package case 265 | >68 string =2.1\n 266 | # dpkg-1.18.25/dpkg-split/info.c 267 | # NL terminated ASCII package name like ckermit 268 | >>&0 string x \b, %s 269 | # NL terminated package version like 302-5.3 270 | >>>&1 string x %s 271 | # NL terminated MD5 checksum 272 | >>>>&1 string x \b, MD5 %s 273 | # NL terminated original package length 274 | >>>>>&1 string x \b, unsplitted size %s 275 | # NL terminated part length 276 | >>>>>>&1 string x \b, part length %s 277 | # NL terminated package part like n/m 278 | >>>>>>>&1 string x \b, part %s 279 | # NL terminated package architecture like armhf since dpkg 1.16.1 or later 280 | >>>>>>>>&1 string x \b, %s 281 | 282 | # 283 | # MIPS archive; they're in the portable archive format, and need to go 284 | # before the entry for regular portable archives, as it's recognized as 285 | # a portable archive whose first member has a name beginning with 286 | # "__________E". 287 | # 288 | 0 string =!\n__________E MIPS archive 289 | !:mime application/x-archive 290 | >20 string U with MIPS Ucode members 291 | >21 string L with MIPSEL members 292 | >21 string B with MIPSEB members 293 | >19 string L and an EL hash table 294 | >19 string B and an EB hash table 295 | >22 string X -- out of date 296 | 297 | # 298 | # BSD/SVR2-and-later portable archive formats. 299 | # 300 | # Update: Joerg Jenderek 301 | # URL: http://fileformats.archiveteam.org/wiki/AR 302 | # Reference: https://www.unix.com/man-page/opensolaris/3HEAD/ar.h/ 303 | # Note: Mach-O universal binary in ./cafebabe is dependent 304 | # TODO: unify current ar archive, MIPS archive, Debian package 305 | # distinguish BSD, SVR; 32, 64 bit; HP from other 32-bit SVR; 306 | # *.ar packages from *.a libraries. handle empty archive 307 | 0 string =!\n current ar archive 308 | # print first and possibly second ar_name[16] for debugging purpose 309 | #>8 string x \b, 1st "%.16s" 310 | #>68 string x \b, 2nd "%.16s" 311 | !:mime application/x-archive 312 | # a in most case for libraries; lib for Microsoft libraries; ar else cases 313 | #!:ext a/lib/ar 314 | >8 string __.SYMDEF random library 315 | # first member with long marked name __.SYMDEF SORTED implies BSD library 316 | >68 string __.SYMDEF\ SORTED random library 317 | # Reference: https://parisc.wiki.kernel.org/images-parisc/b/b2/Rad_11_0_32.pdf 318 | # "archive file" entry moved from ./hp 319 | # LST header system_id 0210h~PA-RISC 1.1,... identifies the target architecture 320 | # LST header a_magic 0619h~relocatable library 321 | >68 belong 0x020b0619 - PA-RISC1.0 relocatable library 322 | >68 belong 0x02100619 - PA-RISC1.1 relocatable library 323 | >68 belong 0x02110619 - PA-RISC1.2 relocatable library 324 | >68 belong 0x02140619 - PA-RISC2.0 relocatable library 325 | #EOF for common ar archives 326 | 327 | # 328 | # "Thin" archive, as can be produced by GNU ar. 329 | # 330 | 0 string =!\n thin archive with 331 | >68 belong 0 no symbol entries 332 | >68 belong 1 %d symbol entry 333 | >68 belong >1 %d symbol entries 334 | 335 | 0 search/1 -h- Software Tools format archive text 336 | 337 | # ARC archiver, from Daniel Quinlan (quinlan@yggdrasil.com) 338 | # 339 | # The first byte is the magic (0x1a), byte 2 is the compression type for 340 | # the first file (0x01 through 0x09), and bytes 3 to 15 are the MS-DOS 341 | # filename of the first file (null terminated). Since some types collide 342 | # we only test some types on basis of frequency: 0x08 (83%), 0x09 (5%), 343 | # 0x02 (5%), 0x03 (3%), 0x04 (2%), 0x06 (2%). 0x01 collides with terminfo. 344 | 0 lelong&0x8080ffff 0x0000081a ARC archive data, dynamic LZW 345 | !:mime application/x-arc 346 | 0 lelong&0x8080ffff 0x0000091a ARC archive data, squashed 347 | !:mime application/x-arc 348 | 0 lelong&0x8080ffff 0x0000021a ARC archive data, uncompressed 349 | !:mime application/x-arc 350 | 0 lelong&0x8080ffff 0x0000031a ARC archive data, packed 351 | !:mime application/x-arc 352 | 0 lelong&0x8080ffff 0x0000041a ARC archive data, squeezed 353 | !:mime application/x-arc 354 | 0 lelong&0x8080ffff 0x0000061a ARC archive data, crunched 355 | !:mime application/x-arc 356 | # [JW] stuff taken from idarc, obviously ARC successors: 357 | 0 lelong&0x8080ffff 0x00000a1a PAK archive data 358 | !:mime application/x-arc 359 | 0 lelong&0x8080ffff 0x0000141a ARC+ archive data 360 | !:mime application/x-arc 361 | 0 lelong&0x8080ffff 0x0000481a HYP archive data 362 | !:mime application/x-arc 363 | 364 | # Acorn archive formats (Disaster prone simpleton, m91dps@ecs.ox.ac.uk) 365 | # I can't create either SPARK or ArcFS archives so I have not tested this stuff 366 | # [GRR: the original entries collide with ARC, above; replaced with combined 367 | # version (not tested)] 368 | #0 byte 0x1a RISC OS archive (spark format) 369 | 0 string \032archive RISC OS archive (ArcFS format) 370 | 0 string Archive\000 RISC OS archive (ArcFS format) 371 | 372 | # All these were taken from idarc, many could not be verified. Unfortunately, 373 | # there were many low-quality sigs, i.e. easy to trigger false positives. 374 | # Please notify me of any real-world fishy/ambiguous signatures and I'll try 375 | # to get my hands on the actual archiver and see if I find something better. [JW] 376 | # probably many can be enhanced by finding some 0-byte or control char near the start 377 | 378 | # idarc calls this Crush/Uncompressed... *shrug* 379 | 0 string CRUSH Crush archive data 380 | # Squeeze It (.sqz) 381 | 0 string HLSQZ Squeeze It archive data 382 | # SQWEZ 383 | 0 string SQWEZ SQWEZ archive data 384 | # HPack (.hpk) 385 | 0 string HPAK HPack archive data 386 | # HAP 387 | 0 string \x91\x33HF HAP archive data 388 | # MD/MDCD 389 | 0 string MDmd MDCD archive data 390 | # LIM 391 | 0 string LIM\x1a LIM archive data 392 | # SAR 393 | 3 string LH5 SAR archive data 394 | # BSArc/BS2 395 | 0 string \212\3SB\020\0 BSArc/BS2 archive data 396 | # Bethesda Softworks Archive (Oblivion) 397 | 0 string BSA\0 BSArc archive data 398 | >4 lelong x version %d 399 | # MAR 400 | 2 string =-ah MAR archive data 401 | # ACB 402 | #0 belong&0x00f800ff 0x00800000 ACB archive data 403 | # CPZ 404 | # TODO, this is what idarc says: 0 string \0\0\0 CPZ archive data 405 | # JRC 406 | 0 string JRchive JRC archive data 407 | # Quantum 408 | 0 string DS\0 Quantum archive data 409 | # ReSOF 410 | 0 string PK\3\6 ReSOF archive data 411 | # QuArk 412 | 0 string 7\4 QuArk archive data 413 | # YAC 414 | 14 string YC YAC archive data 415 | # X1 416 | 0 string X1 X1 archive data 417 | 0 string XhDr X1 archive data 418 | # CDC Codec (.dqt) 419 | 0 belong&0xffffe000 0x76ff2000 CDC Codec archive data 420 | # AMGC 421 | 0 string \xad6" AMGC archive data 422 | # NuLIB 423 | 0 string N\xc3\xb5F\xc3\xa9lx\xc3\xa5 NuLIB archive data 424 | # PakLeo 425 | 0 string LEOLZW PAKLeo archive data 426 | # ChArc 427 | 0 string SChF ChArc archive data 428 | # PSA 429 | 0 string PSA PSA archive data 430 | # CrossePAC 431 | 0 string DSIGDCC CrossePAC archive data 432 | # Freeze 433 | 0 string \x1f\x9f\x4a\x10\x0a Freeze archive data 434 | # KBoom 435 | 0 string \xc2\xa8MP\xc2\xa8 KBoom archive data 436 | # NSQ, must go after CDC Codec 437 | 0 string \x76\xff NSQ archive data 438 | # DPA 439 | 0 string Dirk\ Paehl DPA archive data 440 | # BA 441 | # TODO: idarc says "bytes 0-2 == bytes 3-5" 442 | # TTComp 443 | # URL: http://fileformats.archiveteam.org/wiki/TTComp_archive 444 | # Update: Joerg Jenderek 445 | # GRR: line below is too general as it matches also Panorama database "TCDB 2003-10 demo.pan", others 446 | 0 string \0\6 447 | # look for first keyword of Panorama database *.pan 448 | >12 search/261 DESIGN 449 | # skip keyword with low entropy 450 | >12 default x TTComp archive, binary, 4K dictionary 451 | # (version 5.25) labeled the above entry as "TTComp archive data" 452 | # From: Joerg Jenderek 453 | # URL: https://wiki.68kmla.org/DiskCopy_4.2_format_specification 454 | # reference: http://nulib.com/library/FTN.e00005.htm 455 | 0x52 ubeshort 0x0100 456 | # test for disk image size equal or above 400k 457 | >0x40 ubelong >409599 458 | # test also for disk image size equal or below 1440k to skip 459 | # windows7en.mbr UNICODE.DAT 460 | >>0x40 ubelong <1474561 461 | # To skip Flags$StringJoiner.class with size 00106A61h test also for only 4 disk image sizes 462 | # 00064000 for 400k GCR disks 463 | # 000c8000 for 800k GCR disks 464 | # 000b4000 for 720k MFM disks 465 | # 00168000 for 1440k MFM disks 466 | >>>0x40 ubelong&0xffE03fFF 0 467 | # display information of Apple DiskCopy 4.2 floppy image 468 | # image pascal name padded with NULs like Microsoft Mail 469 | >00 pstring/B x Apple DiskCopy 4.2 image %s 470 | #!:mime application/octet-stream 471 | !:mime application/x-dc42-floppy-image 472 | !:apple dCpydImg 473 | #!:ext image/dc42 474 | # data size in bytes like 409600 475 | >0x40 ubelong x \b, %u bytes 476 | # for debugging purpose size in hexadecimal 477 | #>0x40 ubelong x (0x%8.8x) 478 | # tag size in bytes 479 | >0x44 ubelong >0 \b, 0x%x tag size 480 | # data checksum 481 | #>0x48 ubelong x \b, 0x%x checksum 482 | # tag checksum 483 | #>0x4c ubelong x \b, 0x%x tag checksum 484 | # disk encoding 485 | >0x50 ubyte 0 \b, GCR CLV ssdd (400k) 486 | >0x50 ubyte 1 \b, GCR CLV dsdd (800k) 487 | >0x50 ubyte 2 \b, MFM CAV dsdd (720k) 488 | >0x50 ubyte 3 \b, MFM CAV dshd (1440k) 489 | >0x50 ubyte >3 \b, 0x%x encoding 490 | # format byte 491 | >0x51 ubyte x \b, 0x%x format 492 | #>0x54 ubequad x \b, data 0x%16.16llx 493 | # ESP, could this conflict with Easy Software Products' (e.g.ESP ghostscript) documentation? 494 | 0 string ESP ESP archive data 495 | # ZPack 496 | 0 string \1ZPK\1 ZPack archive data 497 | # Sky 498 | 0 string \xbc\x40 Sky archive data 499 | # UFA 500 | 0 string UFA UFA archive data 501 | # Dry 502 | 0 string =-H2O DRY archive data 503 | # FoxSQZ 504 | 0 string FOXSQZ FoxSQZ archive data 505 | # AR7 506 | 0 string ,AR7 AR7 archive data 507 | # PPMZ 508 | 0 string PPMZ PPMZ archive data 509 | # MS Compress 510 | # Update: Joerg Jenderek 511 | # URL: http://fileformats.archiveteam.org/wiki/MS-DOS_installation_compression 512 | # Reference: https://hwiegman.home.xs4all.nl/fileformats/compress/szdd_kwaj_format.html 513 | # Note: use correct version of extracting tool like EXPAND, UNPACK, DECOMP or 7Z 514 | 4 string \x88\xf0\x27 515 | # KWAJ variant 516 | >0 string KWAJ MS Compress archive data, KWAJ variant 517 | !:mime application/x-ms-compress-kwaj 518 | # extension not working in version 5.32 519 | # magic/Magdir/archive, 284: Warning: EXTENSION type ` ??_' has bad char '?' 520 | # file: line 284: Bad magic entry ' ??_' 521 | #!:ext ??_ 522 | # compression method (0-4) 523 | >>8 uleshort x \b, %u method 524 | # offset of compressed data 525 | >>10 uleshort x \b, 0x%x offset 526 | #>>(10.s) uleshort x 527 | #>>>&-6 string x \b, TEST extension %-.3s 528 | # header flags to mark header extensions 529 | >>12 uleshort >0 \b, 0x%x flags 530 | # 4 bytes: decompressed length of file 531 | >>12 uleshort &0x01 532 | >>>14 ulelong x \b, original size: %u bytes 533 | # 2 bytes: unknown purpose 534 | # 2 bytes: length of unknown data + mentioned bytes 535 | # 1-9 bytes: null-terminated file name 536 | # 1-4 bytes: null-terminated file extension 537 | >>12 uleshort &0x08 538 | >>>12 uleshort ^0x01 539 | >>>>12 uleshort ^0x02 540 | >>>>>12 uleshort ^0x04 541 | >>>>>>12 uleshort ^0x10 542 | >>>>>>>14 string x \b, %-.8s 543 | >>>>>>12 uleshort &0x10 544 | >>>>>>>14 string x \b, %-.8s 545 | >>>>>>>>&1 string x \b.%-.3s 546 | >>>>>12 uleshort &0x04 547 | >>>>>>12 uleshort ^0x10 548 | >>>>>>>(14.s) uleshort x 549 | >>>>>>>>&14 string x \b, %-.8s 550 | >>>>>>12 uleshort &0x10 551 | >>>>>>>(14.s) uleshort x 552 | >>>>>>>>&14 string x \b, %-.8s 553 | >>>>>>>>>&1 string x \b.%-.3s 554 | >>>>12 uleshort &0x02 555 | >>>>>12 uleshort ^0x04 556 | >>>>>>12 uleshort ^0x10 557 | >>>>>>>16 string x \b, %-.8s 558 | >>>>>>12 uleshort &0x10 559 | >>>>>>>16 string x \b, %-.8s 560 | >>>>>>>>&1 string x \b.%-.3s 561 | >>>>>12 uleshort &0x04 562 | >>>>>>12 uleshort ^0x10 563 | >>>>>>>(16.s) uleshort x 564 | >>>>>>>>&16 string x \b, %-.8s 565 | >>>>>>12 uleshort &0x10 566 | >>>>>>>(16.s) uleshort x 567 | >>>>>>>&16 string x %-.8s 568 | >>>>>>>>&1 string x \b.%-.3s 569 | >>>12 uleshort &0x01 570 | >>>>12 uleshort ^0x02 571 | >>>>>12 uleshort ^0x04 572 | >>>>>>12 uleshort ^0x10 573 | >>>>>>>18 string x \b, %-.8s 574 | >>>>>>12 uleshort &0x10 575 | >>>>>>>18 string x \b, %-.8s 576 | >>>>>>>>&1 string x \b.%-.3s 577 | >>>>>12 uleshort &0x04 578 | >>>>>>12 uleshort ^0x10 579 | >>>>>>>(18.s) uleshort x 580 | >>>>>>>>&18 string x \b, %-.8s 581 | >>>>>>12 uleshort &0x10 582 | >>>>>>>(18.s) uleshort x 583 | >>>>>>>>&18 string x \b, %-.8s 584 | >>>>>>>>>&1 string x \b.%-.3s 585 | >>>>12 uleshort &0x02 586 | >>>>>12 uleshort ^0x04 587 | >>>>>>12 uleshort ^0x10 588 | >>>>>>>20 string x \b, %-.8s 589 | >>>>>>12 uleshort &0x10 590 | >>>>>>>20 string x \b, %-.8s 591 | >>>>>>>>&1 string x \b.%-.3s 592 | >>>>>12 uleshort &0x04 593 | >>>>>>12 uleshort ^0x10 594 | >>>>>>>(20.s) uleshort x 595 | >>>>>>>>&20 string x \b, %-.8s 596 | >>>>>>12 uleshort &0x10 597 | >>>>>>>(20.s) uleshort x 598 | >>>>>>>>&20 string x \b, %-.8s 599 | >>>>>>>>>&1 string x \b.%-.3s 600 | # 2 bytes: length of data + mentioned bytes 601 | # 602 | # SZDD variant Haruhiko Okumura's LZSS or 7z type MsLZ 603 | >0 string SZDD MS Compress archive data, SZDD variant 604 | !:mime application/x-ms-compress-szdd 605 | #!:ext ??_ 606 | # The character missing from the end of the filename (0=unknown) 607 | >>9 string >\0 \b, %-.1s is last character of original name 608 | # https://www.betaarchive.com/forum/viewtopic.php?t=26161 609 | # Compression mode: "A" (0x41) found but sometimes "B" in Windows 3.1 builds 026 and 034e 610 | >>8 string !A \b, %-.1s method 611 | >>10 ulelong >0 \b, original size: %u bytes 612 | # QBasic SZDD variant 613 | 3 string \x88\xf0\x27 614 | >0 string SZ\x20 MS Compress archive data, QBasic variant 615 | !:mime application/x-ms-compress-sz 616 | #!:ext ??$ 617 | >>8 ulelong >0 \b, original size: %u bytes 618 | 619 | # MP3 (archiver, not lossy audio compression) 620 | 0 string MP3\x1a MP3-Archiver archive data 621 | # ZET 622 | 0 string OZ\xc3\x9d ZET archive data 623 | # TSComp 624 | 0 string \x65\x5d\x13\x8c\x08\x01\x03\x00 TSComp archive data 625 | # ARQ 626 | 0 string gW\4\1 ARQ archive data 627 | # Squash 628 | 3 string OctSqu Squash archive data 629 | # Terse 630 | 0 string \5\1\1\0 Terse archive data 631 | # PUCrunch 632 | 0 string \x01\x08\x0b\x08\xef\x00\x9e\x32\x30\x36\x31 PUCrunch archive data 633 | # UHarc 634 | 0 string UHA UHarc archive data 635 | # ABComp 636 | 0 string \2AB ABComp archive data 637 | 0 string \3AB2 ABComp archive data 638 | # CMP 639 | 0 string CO\0 CMP archive data 640 | # Splint 641 | 0 string \x93\xb9\x06 Splint archive data 642 | # InstallShield 643 | 0 string \x13\x5d\x65\x8c InstallShield Z archive Data 644 | # Gather 645 | 1 string GTH Gather archive data 646 | # BOA 647 | 0 string BOA BOA archive data 648 | # RAX 649 | 0 string ULEB\xa RAX archive data 650 | # Xtreme 651 | 0 string ULEB\0 Xtreme archive data 652 | # Pack Magic 653 | 0 string @\xc3\xa2\1\0 Pack Magic archive data 654 | # BTS 655 | 0 belong&0xfeffffff 0x1a034465 BTS archive data 656 | # ELI 5750 657 | 0 string Ora\ ELI 5750 archive data 658 | # QFC 659 | 0 string \x1aFC\x1a QFC archive data 660 | 0 string \x1aQF\x1a QFC archive data 661 | # PRO-PACK 662 | 0 string RNC PRO-PACK archive data 663 | # 777 664 | 0 string 777 777 archive data 665 | # LZS221 666 | 0 string sTaC LZS221 archive data 667 | # HPA 668 | 0 string HPA HPA archive data 669 | # Arhangel 670 | 0 string LG Arhangel archive data 671 | # EXP1, uses bzip2 672 | 0 string 0123456789012345BZh EXP1 archive data 673 | # IMP 674 | 0 string IMP\xa IMP archive data 675 | # NRV 676 | 0 string \x00\x9E\x6E\x72\x76\xFF NRV archive data 677 | # Squish 678 | 0 string \x73\xb2\x90\xf4 Squish archive data 679 | # Par 680 | 0 string PHILIPP Par archive data 681 | 0 string PAR Par archive data 682 | # HIT 683 | 0 string UB HIT archive data 684 | # SBX 685 | 0 belong&0xfffff000 0x53423000 SBX archive data 686 | # NaShrink 687 | 0 string NSK NaShrink archive data 688 | # SAPCAR 689 | 0 string #\ CAR\ archive\ header SAPCAR archive data 690 | 0 string CAR\ 2.00RG SAPCAR archive data 691 | # Disintegrator 692 | 0 string DST Disintegrator archive data 693 | # ASD 694 | 0 string ASD ASD archive data 695 | # InstallShield CAB 696 | 0 string ISc( InstallShield CAB 697 | # TOP4 698 | 0 string T4\x1a TOP4 archive data 699 | # BatComp left out: sig looks like COM executable 700 | # so TODO: get real 4dos batcomp file and find sig 701 | # BlakHole 702 | 0 string BH\5\7 BlakHole archive data 703 | # BIX 704 | 0 string BIX0 BIX archive data 705 | # ChiefLZA 706 | 0 string ChfLZ ChiefLZA archive data 707 | # Blink 708 | 0 string Blink Blink archive data 709 | # Logitech Compress 710 | 0 string \xda\xfa Logitech Compress archive data 711 | # ARS-Sfx (FIXME: really a SFX? then goto COM/EXE) 712 | 1 string (C)\ STEPANYUK ARS-Sfx archive data 713 | # AKT/AKT32 714 | 0 string AKT32 AKT32 archive data 715 | 0 string AKT AKT archive data 716 | # NPack 717 | 0 string MSTSM NPack archive data 718 | # PFT 719 | 0 string \0\x50\0\x14 PFT archive data 720 | # SemOne 721 | 0 string SEM SemOne archive data 722 | # PPMD 723 | 0 string \x8f\xaf\xac\x84 PPMD archive data 724 | # FIZ 725 | 0 string FIZ FIZ archive data 726 | # MSXiE 727 | 0 belong&0xfffff0f0 0x4d530000 MSXiE archive data 728 | # DeepFreezer 729 | 0 belong&0xfffffff0 0x797a3030 DeepFreezer archive data 730 | # DC 731 | 0 string =2 string \x2\x4 Xpack DiskImage archive data 790 | #!:ext xdi 791 | # XPack Data 792 | # *.xpa updated by Joerg Jenderek Sep 2015 793 | # ftp://ftp.elf.stuba.sk/pub/pc/pack/ 794 | 0 string xpa XPA 795 | #!:ext xpa 796 | # XPA32 797 | # ftp://ftp.elf.stuba.sk/pub/pc/pack/xpa32.zip 798 | # created by XPA32.EXE version 1.0.2 for Windows 799 | >0 string xpa\0\1 \b32 archive data 800 | # created by XPACK.COM version 1.67m or 1.67r with short 0x1800 801 | >3 ubeshort !0x0001 \bck archive data 802 | # XPack Single Data 803 | # changed by Joerg Jenderek Sep 2015 back to like in version 5.12 804 | # letter 'I'+ acute accent is equivalent to \xcd 805 | 0 string \xcd\ jm Xpack single archive data 806 | #!:mime application/x-xpa-compressed 807 | #!:ext xpa 808 | 809 | # TODO: missing due to unknown magic/magic at end of file: 810 | #DWC 811 | #ARG 812 | #ZAR 813 | #PC/3270 814 | #InstallIt 815 | #RKive 816 | #RK 817 | #XPack Diskimage 818 | 819 | # These were inspired by idarc, but actually verified 820 | # Dzip archiver (.dz) 821 | # Update: Joerg Jenderek 822 | # URL: http://speeddemosarchive.com/dzip/ 823 | # reference: http://speeddemosarchive.com/dzip/dz29src.zip/main.c 824 | # GRR: line below is too general as it matches also ASCII texts like Doszip commander help dz.txt 825 | 0 string DZ 826 | # latest version is 2.9 dated 7 may 2003 827 | >2 byte <4 Dzip archive data 828 | !:mime application/x-dzip 829 | #!:ext dz 830 | >>2 byte x \b, version %i 831 | >>3 byte x \b.%i 832 | >>4 ulelong x \b, offset 0x%x 833 | >>8 ulelong x \b, %u files 834 | # ZZip archiver (.zz) 835 | 0 string ZZ\ \0\0 ZZip archive data 836 | 0 string ZZ0 ZZip archive data 837 | # PAQ archiver (.paq) 838 | 0 string \xaa\x40\x5f\x77\x1f\xe5\x82\x0d PAQ archive data 839 | 0 string PAQ PAQ archive data 840 | >3 byte&0xf0 0x30 841 | >>3 byte x (v%c) 842 | # JAR archiver (.j), this is the successor to ARJ, not Java's JAR (which is essentially ZIP) 843 | 0xe string \x1aJar\x1b JAR (ARJ Software, Inc.) archive data 844 | 0 string JARCS JAR (ARJ Software, Inc.) archive data 845 | 846 | # ARJ archiver (jason@jarthur.Claremont.EDU) 847 | 0 leshort 0xea60 ARJ archive data 848 | !:mime application/x-arj 849 | >5 byte x \b, v%d, 850 | >8 byte &0x04 multi-volume, 851 | >8 byte &0x10 slash-switched, 852 | >8 byte &0x20 backup, 853 | >34 string x original name: %s, 854 | >7 byte 0 os: MS-DOS 855 | >7 byte 1 os: PRIMOS 856 | >7 byte 2 os: Unix 857 | >7 byte 3 os: Amiga 858 | >7 byte 4 os: Macintosh 859 | >7 byte 5 os: OS/2 860 | >7 byte 6 os: Apple ][ GS 861 | >7 byte 7 os: Atari ST 862 | >7 byte 8 os: NeXT 863 | >7 byte 9 os: VAX/VMS 864 | >3 byte >0 %d] 865 | # [JW] idarc says this is also possible 866 | 2 leshort 0xea60 ARJ archive data 867 | 868 | # HA archiver (Greg Roelofs, newt@uchicago.edu) 869 | # This is a really bad format. A file containing HAWAII will match this... 870 | #0 string HA HA archive data, 871 | #>2 leshort =1 1 file, 872 | #>2 leshort >1 %hu files, 873 | #>4 byte&0x0f =0 first is type CPY 874 | #>4 byte&0x0f =1 first is type ASC 875 | #>4 byte&0x0f =2 first is type HSC 876 | #>4 byte&0x0f =0x0e first is type DIR 877 | #>4 byte&0x0f =0x0f first is type SPECIAL 878 | # suggestion: at least identify small archives (<1024 files) 879 | 0 belong&0xffff00fc 0x48410000 HA archive data 880 | >2 leshort =1 1 file, 881 | >2 leshort >1 %u files, 882 | >4 byte&0x0f =0 first is type CPY 883 | >4 byte&0x0f =1 first is type ASC 884 | >4 byte&0x0f =2 first is type HSC 885 | >4 byte&0x0f =0x0e first is type DIR 886 | >4 byte&0x0f =0x0f first is type SPECIAL 887 | 888 | # HPACK archiver (Peter Gutmann, pgut1@cs.aukuni.ac.nz) 889 | 0 string HPAK HPACK archive data 890 | 891 | # JAM Archive volume format, by Dmitry.Kohmanyuk@UA.net 892 | 0 string \351,\001JAM\ JAM archive, 893 | >7 string >\0 version %.4s 894 | >0x26 byte =0x27 - 895 | >>0x2b string >\0 label %.11s, 896 | >>0x27 lelong x serial %08x, 897 | >>0x36 string >\0 fstype %.8s 898 | 899 | # Very old RAR archive 900 | # https://jasonblanks.com/wp-includes/images/papers/KnowyourarchiveRAR.pdf 901 | 0 string RE\x7e\x5e RAR archive data (26 string \x8\0\0\0mimetypeapplication/ 930 | 931 | # KOffice / OpenOffice & StarOffice / OpenDocument formats 932 | # From: Abel Cheung 933 | 934 | # KOffice (1.2 or above) formats 935 | # (mimetype contains "application/vnd.kde.") 936 | >>50 string vnd.kde. KOffice (>=1.2) 937 | >>>58 string karbon Karbon document 938 | >>>58 string kchart KChart document 939 | >>>58 string kformula KFormula document 940 | >>>58 string kivio Kivio document 941 | >>>58 string kontour Kontour document 942 | >>>58 string kpresenter KPresenter document 943 | >>>58 string kspread KSpread document 944 | >>>58 string kword KWord document 945 | 946 | # OpenOffice formats (for OpenOffice 1.x / StarOffice 6/7) 947 | # (mimetype contains "application/vnd.sun.xml.") 948 | # URL: https://en.wikipedia.org/wiki/OpenOffice.org_XML 949 | # reference: http://fileformats.archiveteam.org/wiki/OpenOffice.org_XML 950 | >>50 string vnd.sun.xml. OpenOffice.org 1.x 951 | >>>62 string writer Writer 952 | >>>>68 byte !0x2e document 953 | !:mime application/vnd.sun.xml.writer 954 | #!:ext sxw 955 | >>>>68 string .template template 956 | !:mime application/vnd.sun.xml.writer.template 957 | #!:ext stw 958 | >>>>68 string .web Web template 959 | !:mime application/vnd.sun.xml.writer.web 960 | #!:ext stw 961 | >>>>68 string .global global document 962 | !:mime application/vnd.sun.xml.writer.global 963 | #!:ext sxg 964 | >>>62 string calc Calc 965 | >>>>66 byte !0x2e spreadsheet 966 | !:mime application/vnd.sun.xml.calc 967 | #!:ext sxc 968 | >>>>66 string .template template 969 | !:mime application/vnd.sun.xml.calc.template 970 | #!:ext stc 971 | >>>62 string draw Draw 972 | >>>>66 byte !0x2e document 973 | !:mime application/vnd.sun.xml.draw 974 | #!:ext sxd 975 | >>>>66 string .template template 976 | !:mime application/vnd.sun.xml.draw.template 977 | #!:ext std 978 | >>>62 string impress Impress 979 | >>>>69 byte !0x2e presentation 980 | !:mime application/vnd.sun.xml.impress 981 | #!:ext sxi 982 | >>>>69 string .template template 983 | !:mime application/vnd.sun.xml.impress.template 984 | #!:ext sti 985 | >>>62 string math Math document 986 | !:mime application/vnd.sun.xml.math 987 | #!:ext sxm 988 | >>>62 string base Database file 989 | !:mime application/vnd.sun.xml.base 990 | #!:ext sdb 991 | 992 | # OpenDocument formats (for OpenOffice 2.x / StarOffice >= 8) 993 | # URL: http://fileformats.archiveteam.org/wiki/OpenDocument 994 | # https://lists.oasis-open.org/archives/office/200505/msg00006.html 995 | # (mimetype contains "application/vnd.oasis.opendocument.") 996 | >>50 string vnd.oasis.opendocument. OpenDocument 997 | >>>73 string text 998 | >>>>77 byte !0x2d Text 999 | !:mime application/vnd.oasis.opendocument.text 1000 | #!:ext odt 1001 | >>>>77 string -template Text Template 1002 | !:mime application/vnd.oasis.opendocument.text-template 1003 | #!:ext ott 1004 | >>>>77 string -web HTML Document Template 1005 | !:mime application/vnd.oasis.opendocument.text-web 1006 | #!:ext oth 1007 | >>>>77 string -master Master Document 1008 | !:mime application/vnd.oasis.opendocument.text-master 1009 | #!:ext odm 1010 | >>>73 string graphics 1011 | >>>>81 byte !0x2d Drawing 1012 | !:mime application/vnd.oasis.opendocument.graphics 1013 | #!:ext odg 1014 | >>>>81 string -template Drawing Template 1015 | !:mime application/vnd.oasis.opendocument.graphics-template 1016 | #!:ext otg 1017 | >>>73 string presentation 1018 | >>>>85 byte !0x2d Presentation 1019 | !:mime application/vnd.oasis.opendocument.presentation 1020 | #!:ext odp 1021 | >>>>85 string -template Presentation Template 1022 | !:mime application/vnd.oasis.opendocument.presentation-template 1023 | #!:ext otp 1024 | >>>73 string spreadsheet 1025 | >>>>84 byte !0x2d Spreadsheet 1026 | !:mime application/vnd.oasis.opendocument.spreadsheet 1027 | #!:ext ods 1028 | >>>>84 string -template Spreadsheet Template 1029 | !:mime application/vnd.oasis.opendocument.spreadsheet-template 1030 | #!:ext ots 1031 | >>>73 string chart 1032 | >>>>78 byte !0x2d Chart 1033 | !:mime application/vnd.oasis.opendocument.chart 1034 | #!:ext odc 1035 | >>>>78 string -template Chart Template 1036 | !:mime application/vnd.oasis.opendocument.chart-template 1037 | #!:ext otc 1038 | >>>73 string formula 1039 | >>>>80 byte !0x2d Formula 1040 | !:mime application/vnd.oasis.opendocument.formula 1041 | #!:ext odf 1042 | >>>>80 string -template Formula Template 1043 | !:mime application/vnd.oasis.opendocument.formula-template 1044 | #!:ext otf 1045 | # https://www.loc.gov/preservation/digital/formats/fdd/fdd000441.shtml 1046 | >>>73 string database Database 1047 | !:mime application/vnd.oasis.opendocument.database 1048 | #!:ext odb 1049 | # Valid for LibreOffice Base 6.0.1.1 at least 1050 | >>>73 string base Database 1051 | # https://bugs.documentfoundation.org/show_bug.cgi?id=45854 1052 | !:mime application/vnd.oasis.opendocument.database 1053 | #!:mime application/vnd.oasis.opendocument.base 1054 | #!:ext odb 1055 | >>>73 string image 1056 | >>>>78 byte !0x2d Image 1057 | !:mime application/vnd.oasis.opendocument.image 1058 | #!:ext odi 1059 | >>>>78 string -template Image Template 1060 | !:mime application/vnd.oasis.opendocument.image-template 1061 | #!:ext oti 1062 | 1063 | # EPUB (OEBPS) books using OCF (OEBPS Container Format) 1064 | # https://www.idpf.org/ocf/ocf1.0/download/ocf10.htm, section 4. 1065 | # From: Ralf Brown 1066 | >>50 string epub+zip EPUB document 1067 | !:mime application/epub+zip 1068 | 1069 | # From: Joerg Jenderek 1070 | # URL: http://en.wikipedia.org/wiki/CorelDRAW 1071 | # NOTE: version; til 2 WL-based; from 3 til 13 by ./riff; from 14 zip based 1072 | >>50 string x-vnd.corel. Corel 1073 | >>>62 string draw.document+zip Draw drawing, version 14-16 1074 | !:mime application/x-vnd.corel.draw.document+zip 1075 | #!:ext cdr 1076 | >>>62 string draw.template+zip Draw template, version 14-16 1077 | !:mime application/x-vnd.corel.draw.template+zip 1078 | #!:ext cdrt 1079 | >>>62 string zcf.draw.document+zip Draw drawing, version 17-22 1080 | !:mime application/x-vnd.corel.zcf.draw.document+zip 1081 | #!:ext cdr 1082 | >>>62 string zcf.draw.template+zip Draw template, version 17-22 1083 | !:mime application/x-vnd.corel.zcf.draw.template+zip 1084 | #!:ext cdt/cdrt 1085 | # URL: http://product.corel.com/help/CorelDRAW/540240626/Main/EN/Doc/CorelDRAW-Other-file-formats.html 1086 | >>>62 string zcf.pattern+zip Draw pattern, version 22 1087 | !:mime application/x-vnd.corel.zcf.pattern+zip 1088 | #!:ext pat 1089 | # URL: https://en.wikipedia.org/wiki/Corel_Designer 1090 | # Reference: http://fileformats.archiveteam.org/wiki/Corel_Designer 1091 | # Note: called by TrID "Corel DESIGN graphics" 1092 | >>>62 string designer.document+zip DESIGNER graphics, version 14-16 1093 | !:mime application/x-vnd.corel.designer.document+zip 1094 | #!:ext des 1095 | >>>62 string zcf.designer.document+zip DESIGNER graphics, version 17-21 1096 | !:mime application/x-vnd.corel.zcf.designer.document+zip 1097 | #!:ext des 1098 | # URL: http://product.corel.com/help/CorelDRAW/540223850/Main/EN/Documentation/ 1099 | # CorelDRAW-Corel-Symbol-Library-CSL.html 1100 | >>>62 string symbol.library+zip Symbol Library, version 6-16.3 1101 | !:mime application/x-vnd.corel.symbol.library+zip 1102 | #!:ext csl 1103 | >>>62 string zcf.symbol.library+zip Symbol Library, version 17-22 1104 | !:mime application/x-vnd.corel.zcf.symbol.library+zip 1105 | #!:ext csl 1106 | 1107 | # Catch other ZIP-with-mimetype formats 1108 | # In a ZIP file, the bytes immediately after a member's contents are 1109 | # always "PK". The 2 regex rules here print the "mimetype" member's 1110 | # contents up to the first 'P'. Luckily, most MIME types don't contain 1111 | # any capital 'P's. This is a kludge. 1112 | # (mimetype contains "application/") 1113 | >>50 default x Zip data 1114 | >>>38 regex [!-OQ-~]+ (MIME type "%s"?) 1115 | !:mime application/zip 1116 | # (mimetype contents other than "application/*") 1117 | >26 string \x8\0\0\0mimetype 1118 | >>38 string !application/ 1119 | >>>38 regex [!-OQ-~]+ Zip data (MIME type "%s"?) 1120 | !:mime application/zip 1121 | 1122 | # Java Jar files 1123 | >(26.s+30) leshort 0xcafe Java archive data (JAR) 1124 | !:mime application/java-archive 1125 | 1126 | # iOS App 1127 | >(26.s+30) leshort !0xcafe 1128 | >>26 string !\x8\0\0\0mimetype 1129 | >>>30 string Payload/ 1130 | >>>>38 search/64 .app/ iOS App 1131 | !:mime application/x-ios-app 1132 | 1133 | >30 search/100/b application/epub+zip EPUB document 1134 | !:mime application/epub+zip 1135 | 1136 | # Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu) 1137 | # Next line excludes specialized formats: 1138 | >(26.s+30) leshort !0xcafe 1139 | >>30 search/100/b !application/epub+zip 1140 | >>>26 string !\x8\0\0\0mimetype Zip archive data 1141 | !:mime application/zip 1142 | >>>>4 beshort x \b, at least 1143 | >>>>4 beshort x to extract 1144 | >>>>8 beshort x \b, compression method= 1145 | >>>>0x161 string WINZIP \b, WinZIP self-extracting 1146 | 1147 | # StarView Metafile 1148 | # From Pierre Ducroquet 1149 | 0 string VCLMTF StarView MetaFile 1150 | >6 beshort x \b, version %d 1151 | >8 belong x \b, size %d 1152 | 1153 | # Zoo archiver 1154 | 20 lelong 0xfdc4a7dc Zoo archive data 1155 | !:mime application/x-zoo 1156 | >4 byte >48 \b, v%c. 1157 | >>6 byte >47 \b%c 1158 | >>>7 byte >47 \b%c 1159 | >32 byte >0 \b, modify: v%d 1160 | >>33 byte x \b.%d+ 1161 | >42 lelong 0xfdc4a7dc \b, 1162 | >>70 byte >0 extract: v%d 1163 | >>>71 byte x \b.%d+ 1164 | 1165 | # Shell archives 1166 | 10 string #\ This\ is\ a\ shell\ archive shell archive text 1167 | !:mime application/octet-stream 1168 | 1169 | # 1170 | # LBR. NB: May conflict with the questionable 1171 | # "binary Computer Graphics Metafile" format. 1172 | # 1173 | 0 string \0\ \ \ \ \ \ \ \ \ \ \ \0\0 LBR archive data 1174 | # 1175 | # From Rafael Laboissiere 1176 | # The Project Revision Control System (see 1177 | # http://prcs.sourceforge.net) generates a packaged project 1178 | # file which is recognized by the following entry: 1179 | 0 leshort 0xeb81 PRCS packaged project 1180 | 1181 | # Microsoft cabinets 1182 | # by David Necas (Yeti) 1183 | #0 string MSCF\0\0\0\0 Microsoft cabinet file data, 1184 | #>25 byte x v%d 1185 | #>24 byte x \b.%d 1186 | # MPi: All CABs have version 1.3, so this is pointless. 1187 | # Better magic in debian-additions. 1188 | 1189 | # GTKtalog catalogs 1190 | # by David Necas (Yeti) 1191 | 4 string gtktalog\ GTKtalog catalog data, 1192 | >13 string 3 version 3 1193 | >>14 beshort 0x677a (gzipped) 1194 | >>14 beshort !0x677a (not gzipped) 1195 | >13 string >3 version %s 1196 | 1197 | ############################################################################ 1198 | # Parity archive reconstruction file, the 'par' file format now used on Usenet. 1199 | 0 string PAR\0 PARity archive data 1200 | >48 leshort =0 - Index file 1201 | >48 leshort >0 - file number %d 1202 | 1203 | # Felix von Leitner 1204 | 0 string d8:announce BitTorrent file 1205 | !:mime application/x-bittorrent 1206 | # Durval Menezes, 1207 | 0 string d13:announce-list BitTorrent file 1208 | !:mime application/x-bittorrent 1209 | 0 string d7:comment BitTorrent file 1210 | !:mime application/x-bittorrent 1211 | 0 string d4:info BitTorrent file 1212 | !:mime application/x-bittorrent 1213 | 1214 | # Atari MSA archive - Teemu Hukkanen 1215 | 0 beshort 0x0e0f Atari MSA archive data 1216 | >2 beshort x \b, %d sectors per track 1217 | >4 beshort 0 \b, 1 sided 1218 | >4 beshort 1 \b, 2 sided 1219 | >6 beshort x \b, starting track: %d 1220 | >8 beshort x \b, ending track: %d 1221 | 1222 | # Alternate ZIP string (amc@arwen.cs.berkeley.edu) 1223 | 0 string PK00PK\003\004 Zip archive data 1224 | !:mime application/zip 1225 | #!:ext zip/cbz 1226 | 1227 | # ACE archive (from http://www.wotsit.org/download.asp?f=ace) 1228 | # by Stefan `Sec` Zehl 1229 | 7 string **ACE** ACE archive data 1230 | >15 byte >0 version %d 1231 | >16 byte =0x00 \b, from MS-DOS 1232 | >16 byte =0x01 \b, from OS/2 1233 | >16 byte =0x02 \b, from Win/32 1234 | >16 byte =0x03 \b, from Unix 1235 | >16 byte =0x04 \b, from MacOS 1236 | >16 byte =0x05 \b, from WinNT 1237 | >16 byte =0x06 \b, from Primos 1238 | >16 byte =0x07 \b, from AppleGS 1239 | >16 byte =0x08 \b, from Atari 1240 | >16 byte =0x09 \b, from Vax/VMS 1241 | >16 byte =0x0A \b, from Amiga 1242 | >16 byte =0x0B \b, from Next 1243 | >14 byte x \b, version %d to extract 1244 | >5 leshort &0x0080 \b, multiple volumes, 1245 | >>17 byte x \b (part %d), 1246 | >5 leshort &0x0002 \b, contains comment 1247 | >5 leshort &0x0200 \b, sfx 1248 | >5 leshort &0x0400 \b, small dictionary 1249 | >5 leshort &0x0800 \b, multi-volume 1250 | >5 leshort &0x1000 \b, contains AV-String 1251 | >>30 string \x16*UNREGISTERED\x20VERSION* (unregistered) 1252 | >5 leshort &0x2000 \b, with recovery record 1253 | >5 leshort &0x4000 \b, locked 1254 | >5 leshort &0x8000 \b, solid 1255 | # Date in MS-DOS format (whatever that is) 1256 | #>18 lelong x Created on 1257 | 1258 | # sfArk : compression program for Soundfonts (sf2) by Dirk Jagdmann 1259 | # 1260 | 0x1A string sfArk sfArk compressed Soundfont 1261 | >0x15 string 2 1262 | >>0x1 string >\0 Version %s 1263 | >>0x2A string >\0 : %s 1264 | 1265 | # DR-DOS 7.03 Packed File *.??_ 1266 | # Reference: http://www.antonis.de/dos/dos-tuts/mpdostip/html/nwdostip.htm 1267 | # Note: unpacked by PNUNPACK.EXE 1268 | 0 string Packed\ File\ 1269 | # by looking for Control-Z skip ASCII text starting with Packed File 1270 | >0x18 ubyte 0x1a Personal NetWare Packed File 1271 | !:mime application/x-novell-compress 1272 | #!:ext ??_ 1273 | >>12 string x \b, was "%.12s" 1274 | # 1 or 2 1275 | #>>0x19 ubyte x \b, at 0x19 %u 1276 | >>0x1b ulelong x with %u bytes 1277 | 1278 | # EET archive 1279 | # From: Tilman Sauerbeck 1280 | 0 belong 0x1ee7ff00 EET archive 1281 | !:mime application/x-eet 1282 | 1283 | # rzip archives 1284 | 0 string RZIP rzip compressed data 1285 | >4 byte x - version %d 1286 | >5 byte x \b.%d 1287 | >6 belong x (%d bytes) 1288 | 1289 | # From: Joerg Jenderek 1290 | # URL: https://help.foxitsoftware.com/kb/install-fzip-file.php 1291 | # reference: http://mark0.net/download/triddefs_xml.7z/ 1292 | # defs/f/fzip.trid.xml 1293 | # Note: unknown compression; No "PK" zip magic; normally in directory like 1294 | # "%APPDATA%\Foxit Software\Addon\Foxit Reader\Install" 1295 | 0 ubequad 0x2506781901010000 Foxit add-on/update 1296 | !:mime application/x-fzip 1297 | #!:ext fzip 1298 | 1299 | # From: "Robert Dale" 1300 | 0 belong 123 dar archive, 1301 | >4 belong x label "%.8x 1302 | >>8 belong x %.8x 1303 | >>>12 beshort x %.4x" 1304 | >14 byte 0x54 end slice 1305 | >14 beshort 0x4e4e multi-part 1306 | >14 beshort 0x4e53 multi-part, with -S 1307 | 1308 | # Symbian installation files 1309 | # https://www.thouky.co.uk/software/psifs/sis.html 1310 | # http://developer.symbian.com/main/downloads/papers/SymbianOSv91/softwareinstallsis.pdf 1311 | 8 lelong 0x10000419 Symbian installation file 1312 | !:mime application/vnd.symbian.install 1313 | >4 lelong 0x1000006D (EPOC release 3/4/5) 1314 | >4 lelong 0x10003A12 (EPOC release 6) 1315 | 0 lelong 0x10201A7A Symbian installation file (Symbian OS 9.x) 1316 | !:mime x-epoc/x-sisx-app 1317 | 1318 | # From "Nelson A. de Oliveira" 1319 | 0 string MPQ\032 MoPaQ (MPQ) archive 1320 | 1321 | # From: "Nelson A. de Oliveira" 1322 | # .kgb 1323 | 0 string KGB_arch KGB Archiver file 1324 | >10 string x with compression level %.1s 1325 | 1326 | # Type: Parity Archive 1327 | # From: Daniel van Eeden 1328 | 0 string PAR2 Parity Archive Volume Set 1329 | 1330 | # Bacula volume format. (Volumes always start with a block header.) 1331 | # URL: https://bacula.org/3.0.x-manuals/en/developers/developers/Block_Header.html 1332 | # From: Adam Buchbinder 1333 | 12 string BB02 Bacula volume 1334 | >20 bedate x \b, started %s 1335 | 1336 | # ePub is XHTML + XML inside a ZIP archive. The first member of the 1337 | # archive must be an uncompressed file called 'mimetype' with contents 1338 | # 'application/epub+zip' 1339 | 1340 | 1341 | # From: "Michael Gorny" 1342 | # ZPAQ: http://mattmahoney.net/dc/zpaq.html 1343 | 0 string zPQ ZPAQ stream 1344 | >3 byte x \b, level %d 1345 | # From: Barry Carter 1346 | # https://encode.ru/threads/456-zpaq-updates/page32 1347 | 0 string 7kSt ZPAQ file 1348 | 1349 | # BBeB ebook, unencrypted (LRF format) 1350 | # URL: https://www.sven.de/librie/Librie/LrfFormat 1351 | # From: Adam Buchbinder 1352 | 0 string L\0R\0F\0\0\0 BBeB ebook data, unencrypted 1353 | >8 beshort x \b, version %d 1354 | >36 byte 1 \b, front-to-back 1355 | >36 byte 16 \b, back-to-front 1356 | >42 beshort x \b, (%dx, 1357 | >44 beshort x %d) 1358 | 1359 | # Symantec GHOST image by Joerg Jenderek at May 2014 1360 | # https://us.norton.com/ghost/ 1361 | # https://www.garykessler.net/library/file_sigs.html 1362 | 0 ubelong&0xFFFFf7f0 0xFEEF0100 Norton GHost image 1363 | # *.GHO 1364 | >2 ubyte&0x08 0x00 \b, first file 1365 | # *.GHS or *.[0-9] with cns program option 1366 | >2 ubyte&0x08 0x08 \b, split file 1367 | # part of split index interesting for *.ghs 1368 | >>4 ubyte x id=0x%x 1369 | # compression tag minus one equals numeric compression command line switch z[1-9] 1370 | >3 ubyte 0 \b, no compression 1371 | >3 ubyte 2 \b, fast compression (Z1) 1372 | >3 ubyte 3 \b, medium compression (Z2) 1373 | >3 ubyte >3 1374 | >>3 ubyte <11 \b, compression (Z%d-1) 1375 | >2 ubyte&0x08 0x00 1376 | # ~ 30 byte password field only for *.gho 1377 | >>12 ubequad !0 \b, password protected 1378 | >>44 ubyte !1 1379 | # 1~Image All, sector-by-sector only for *.gho 1380 | >>>10 ubyte 1 \b, sector copy 1381 | # 1~Image Boot track only for *.gho 1382 | >>>43 ubyte 1 \b, boot track 1383 | # 1~Image Disc only for *.gho implies Image Boot track and sector copy 1384 | >>44 ubyte 1 \b, disc sector copy 1385 | # optional image description only *.gho 1386 | >>0xff string >\0 "%-.254s" 1387 | # look for DOS sector end sequence 1388 | >0xE08 search/7776 \x55\xAA 1389 | >>&-512 indirect x \b; contains 1390 | 1391 | # Google Chrome extensions 1392 | # https://developer.chrome.com/extensions/crx 1393 | # https://developer.chrome.com/extensions/hosting 1394 | 0 string Cr24 Google Chrome extension 1395 | !:mime application/x-chrome-extension 1396 | >4 ulong x \b, version %u 1397 | 1398 | # SeqBox - Sequenced container 1399 | # ext: sbx, seqbox 1400 | # Marco Pontello marcopon@gmail.com 1401 | # reference: https://github.com/MarcoPon/SeqBox 1402 | 0 string SBx SeqBox, 1403 | >3 byte x version %d 1404 | 1405 | # LyNX archive 1406 | 56 string USE\040LYNX\040TO\040DISSOLVE\040THIS\040FILE LyNX archive 1407 | 1408 | # From: Joerg Jenderek 1409 | # URL: https://www.acronis.com/ 1410 | # Reference: https://en.wikipedia.org/wiki/TIB_(file_format) 1411 | # Note: only tested with True Image 2013 Build 5962 and 2019 Build 14110 1412 | 0 ubequad 0xce24b9a220000000 Acronis True Image backup 1413 | !:mime application/x-acronis-tib 1414 | #!:ext tib 1415 | # 01000000 1416 | #>20 ubelong x \b, at 20 0x%x 1417 | # 20000000 1418 | #>28 ubelong x \b, at 28 0x%x 1419 | # strings like "Generic- SD/MMC 1.00" "Unknown Disk" "Msft Virtual Disk 1.0" 1420 | # ??? 1421 | # strings like "\Device\0000011e" "\Device\0000015a" 1422 | #>0 search/0x6852300/cs \\Device\\ 1423 | #>>&-1 pstring x \b, %s 1424 | # "\Device\HarddiskVolume30" "\Device\HarddiskVolume39" 1425 | #>>>&1 search/180/cs \\Device\\ 1426 | #>>>>&-1 pstring x \b, %s 1427 | #>>>>>&0 search/29/cs \0\0\xc8\0 1428 | # disk label 1429 | #>>>>>>&10 lestring16 x \b, disk label %11.11s 1430 | #>>>>>>&9 plestring16 x \b, disk label "%11.11s" 1431 | #>>>>>>&10 ubequad x %16.16llx 1432 | 1433 | 1434 | # Gentoo XPAK binary package 1435 | # by Michal Gorny 1436 | # https://gitweb.gentoo.org/proj/portage.git/tree/man/xpak.5 1437 | -4 string STOP 1438 | >-16 string XPAKSTOP Gentoo binary package (XPAK) 1439 | 1440 | # From: Joerg Jenderek 1441 | # URL: https://kodi.wiki/view/TexturePacker 1442 | # Reference: https://mirrors.kodi.tv/releases/source/17.3-Krypton.tar.gz 1443 | # /xbmc-Krypton/xbmc/guilib/XBTF.h 1444 | # /xbmc-Krypton/xbmc/guilib/XBTF.cpp 1445 | 0 string XBTF 1446 | # skip ASCII text by looking for terminating \0 of path 1447 | >264 ubyte 0 XBMC texture package 1448 | !:mime application/x-xbmc-xbt 1449 | #!:ext xbt 1450 | # XBTF_VERSION 2 1451 | >>4 string !2 \b, version %-.1s 1452 | # nofFiles /xbmc-Krypton/xbmc/guilib/XBTFReader.cpp 1453 | >>5 ulelong x \b, %u file 1454 | # plural s 1455 | >>5 ulelong >1 \bs 1456 | # path[CXBTFFile[MaximumPathLength=256] 1457 | >>9 string x \b, 1st %s 1458 | 1459 | # ALZIP archive 1460 | # by Hyungjun Park , Hajin Jang 1461 | # http://kippler.com/win/unalz/ 1462 | # https://salsa.debian.org/l10n-korean-team/unalz 1463 | 0 string ALZ\001 ALZ archive data 1464 | #!:ext alz 1465 | 1466 | # https://cf-aldn.altools.co.kr/setup/EGG_Specification.zip 1467 | 0 string EGGA EGG archive data, 1468 | #!:ext egg 1469 | >5 byte x version %u 1470 | >4 byte x \b.%u 1471 | >>0x0E ulelong =0x08E28222 1472 | >>0x0E ulelong =0x24F5A262 \b, split 1473 | >>0x0E ulelong =0x24E5A060 \b, solid 1474 | >>0x0E default x \b, unknown 1475 | 1476 | # PAQ9A archive 1477 | # URL: http://mattmahoney.net/dc/#paq9a 1478 | # Note: Line 1186 of paq9a.cpp gives the magic bytes 1479 | 0 string pQ9\001 PAQ9A archive 1480 | 1481 | #------------------------------------------------------------------------------ 1482 | # $File: compress,v 1.80 2021/03/15 17:49:24 christos Exp $ 1483 | # compress: file(1) magic for pure-compression formats (no archives) 1484 | # 1485 | # compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc. 1486 | # 1487 | # Formats for various forms of compressed data 1488 | # Formats for "compress" proper have been moved into "compress.c", 1489 | # because it tries to uncompress it to figure out what's inside. 1490 | 1491 | # standard unix compress 1492 | 0 string \037\235 compress'd data 1493 | !:mime application/x-compress 1494 | !:apple LZIVZIVU 1495 | >2 byte&0x80 >0 block compressed 1496 | >2 byte&0x1f x %d bits 1497 | 1498 | # gzip (GNU zip, not to be confused with Info-ZIP or PKWARE zip archiver) 1499 | # URL: https://en.wikipedia.org/wiki/Gzip 1500 | # Reference: https://tools.ietf.org/html/rfc1952 1501 | # Update: Joerg Jenderek, Apr 2019 1502 | # Edited by Chris Chittleborough , March 2002 1503 | # * Original filename is only at offset 10 if "extra field" absent 1504 | # * Produce shorter output - notably, only report compression methods 1505 | # other than 8 ("deflate", the only method defined in RFC 1952). 1506 | # Note: find defs -iname '*.trid.xml' -exec grep -q '1F8B08' {} \; -ls 1507 | # TODO: 1508 | # FBR Blueberry FlashBack screen Record https://www.flashbackrecorder.com/ 1509 | # KPR KOffice/Calligra KPresenter application/x-kpresenter 1510 | # KPT KOffice/Calligra KPresenter template? application/x-kpresenter 1511 | # SAV Diggles Saved Game File http://www.innonics.com 1512 | # SAV FarCry (demo) saved game http://www.farcry-thegame.com 1513 | # DAT ZOAGZIP game data format http://en.wikipedia.org/wiki/SD_Gundam_Capsule_Fighter 1514 | 0 string \037\213 1515 | # to display gzip compressed (strength=100=2*50) before other (strength=50)? 1516 | #!:strength * 2 1517 | # no FNAME and FCOMMENT bit implies no file name/comment. That means only binary 1518 | >3 byte&0x18 =0 1519 | # For binary gzipped no ASCII text should occur 1520 | # mcd-monu-cad.trid.xml 1521 | >>10 string MCD Monu-Cad Drawing, Component or Font 1522 | #>>36 string Created\ with\ MONU-CAD 1523 | #!:mime application/octet-stream 1524 | # http://fileformats.archiveteam.org/wiki/Monu-CAD 1525 | # http://www.monucad.com/downloads/FullDemo-2005.EXE 1526 | # /HANDS96.MCC Component 1527 | # /DEMO_DD01.MCD Drawing 1528 | # /MCALF020.FNT Font 1529 | #!:ext mcc/mcd/fnt 1530 | # http://www.generalcadd.com 1531 | >>10 string GXD General CADD, Drawing or Component 1532 | #!:mime application/octet-stream 1533 | # /gxc/BUILDINGEDGE.gxc Component 1534 | # /gxd/HOCKETT-STPAUL-WRHSE.gxd Drawing 1535 | # /gxd/POWERLAND-MILL-ADD-11.gxd Drawing v9.1.06 1536 | #!:ext gxc/gxd 1537 | #>>>13 ubyte 0 \b, version 0 1538 | >>>13 string 09 \b, version 9 1539 | # other gzipped binary like gzipped tar, VirtualBox extension package,... 1540 | >>10 default x gzip compressed data 1541 | !:mime application/gzip 1542 | # size of the original (uncompressed) input data modulo 2^32 1543 | >>>-4 ulelong x \b, original size modulo 2^32 %u 1544 | # gzipped TAR or VirtualBox extension package 1545 | #!:mime application/x-compressed-tar 1546 | #!:mime application/x-virtualbox-vbox-extpack 1547 | # https://www.w3.org/TR/SVG/mimereg.html 1548 | #!:mime image/image/svg+xml-compressed 1549 | # zlib.3.gz 1550 | # microcode-20180312.tgz 1551 | # tpz same as tgz 1552 | # lua-md5_1.2-1_i386_i486.ipk https://en.wikipedia.org/wiki/Opkg 1553 | # Oracle_VM_VirtualBox_Extension_Pack-5.0.12-104815.vbox-extpack 1554 | #!:ext gz/tgz/tpz/ipk/vbox-extpack/svgz 1555 | # FNAME/FCOMMENT bit implies file name/comment as iso-8859-1 text 1556 | >3 byte&0x18 >0 gzip compressed data 1557 | !:mime application/gzip 1558 | # gzipped tar, gzipped Abiword document 1559 | #!:mime application/x-compressed-tar 1560 | #!:mime application/x-abiword-compressed 1561 | #!:mime image/image/svg+xml-compressed 1562 | # kleopatra_splashscreen.svgz gzipped .svg 1563 | #!:ext gz/tgz/tpz/zabw/svgz 1564 | # size of the original (uncompressed) input data modulo 2^32 1565 | >>>-4 ulelong x \b, original size modulo 2^32 %u 1566 | # display information of gzip compressed files 1567 | #>2 byte x THIS iS GZIP 1568 | >2 byte <8 \b, reserved method 1569 | >2 byte >8 \b, unknown method 1570 | >3 byte &0x01 \b, ASCII 1571 | >3 byte &0x02 \b, has CRC 1572 | >3 byte &0x04 \b, extra field 1573 | >3 byte&0xC =0x08 1574 | >>10 string x \b, was "%s" 1575 | >3 byte &0x10 \b, has comment 1576 | >3 byte &0x20 \b, encrypted 1577 | >4 ledate >0 \b, last modified: %s 1578 | >8 byte 2 \b, max compression 1579 | >8 byte 4 \b, max speed 1580 | >9 byte =0x00 \b, from FAT filesystem (MS-DOS, OS/2, NT) 1581 | >9 byte =0x01 \b, from Amiga 1582 | >9 byte =0x02 \b, from VMS 1583 | >9 byte =0x03 \b, from Unix 1584 | >9 byte =0x04 \b, from VM/CMS 1585 | >9 byte =0x05 \b, from Atari 1586 | >9 byte =0x06 \b, from HPFS filesystem (OS/2, NT) 1587 | >9 byte =0x07 \b, from MacOS 1588 | >9 byte =0x08 \b, from Z-System 1589 | >9 byte =0x09 \b, from CP/M 1590 | >9 byte =0x0A \b, from TOPS/20 1591 | >9 byte =0x0B \b, from NTFS filesystem (NT) 1592 | >9 byte =0x0C \b, from QDOS 1593 | >9 byte =0x0D \b, from Acorn RISCOS 1594 | # size of the original (uncompressed) input data modulo 2^32 1595 | #>-4 ulelong x \b, original size modulo 2^32 %u 1596 | #ERROR: line 114: non zero offset 1048572 at level 1 1597 | 1598 | # packed data, Huffman (minimum redundancy) codes on a byte-by-byte basis 1599 | 0 string \037\036 packed data 1600 | !:mime application/octet-stream 1601 | >2 belong >1 \b, %d characters originally 1602 | >2 belong =1 \b, %d character originally 1603 | # 1604 | # This magic number is byte-order-independent. 1605 | 0 short 0x1f1f old packed data 1606 | !:mime application/octet-stream 1607 | 1608 | # XXX - why *two* entries for "compacted data", one of which is 1609 | # byte-order independent, and one of which is byte-order dependent? 1610 | # 1611 | 0 short 0x1fff compacted data 1612 | !:mime application/octet-stream 1613 | # This string is valid for SunOS (BE) and a matching "short" is listed 1614 | # in the Ultrix (LE) magic file. 1615 | 0 string \377\037 compacted data 1616 | !:mime application/octet-stream 1617 | 0 short 0145405 huf output 1618 | !:mime application/octet-stream 1619 | 1620 | # bzip2 1621 | 0 string BZh bzip2 compressed data 1622 | !:mime application/x-bzip2 1623 | >3 byte >47 \b, block size = %c00k 1624 | 1625 | # bzip a block-sorting file compressor 1626 | # by Julian Seward and others 1627 | 0 string BZ0 bzip compressed data 1628 | !:mime application/x-bzip 1629 | >3 byte >47 \b, block size = %c00k 1630 | 1631 | # lzip 1632 | 0 string LZIP lzip compressed data 1633 | !:mime application/x-lzip 1634 | >4 byte x \b, version: %d 1635 | 1636 | # squeeze and crunch 1637 | # Michael Haardt 1638 | 0 beshort 0x76FF squeezed data, 1639 | >4 string x original name %s 1640 | 0 beshort 0x76FE crunched data, 1641 | >2 string x original name %s 1642 | 0 beshort 0x76FD LZH compressed data, 1643 | >2 string x original name %s 1644 | 1645 | # Freeze 1646 | 0 string \037\237 frozen file 2.1 1647 | 0 string \037\236 frozen file 1.0 (or gzip 0.5) 1648 | 1649 | # SCO compress -H (LZH) 1650 | 0 string \037\240 SCO compress -H (LZH) data 1651 | 1652 | # European GSM 06.10 is a provisional standard for full-rate speech 1653 | # transcoding, prI-ETS 300 036, which uses RPE/LTP (residual pulse 1654 | # excitation/long term prediction) coding at 13 kbit/s. 1655 | # 1656 | # There's only a magic nibble (4 bits); that nibble repeats every 33 1657 | # bytes. This isn't suited for use, but maybe we can use it someday. 1658 | # 1659 | # This will cause very short GSM files to be declared as data and 1660 | # mismatches to be declared as data too! 1661 | #0 byte&0xF0 0xd0 data 1662 | #>33 byte&0xF0 0xd0 1663 | #>66 byte&0xF0 0xd0 1664 | #>99 byte&0xF0 0xd0 1665 | #>132 byte&0xF0 0xd0 GSM 06.10 compressed audio 1666 | 1667 | # lzop from 1668 | 0 string \x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a lzop compressed data 1669 | >9 beshort <0x0940 1670 | >>9 byte&0xf0 =0x00 - version 0. 1671 | >>9 beshort&0x0fff x \b%03x, 1672 | >>13 byte 1 LZO1X-1, 1673 | >>13 byte 2 LZO1X-1(15), 1674 | >>13 byte 3 LZO1X-999, 1675 | ## >>22 bedate >0 last modified: %s, 1676 | >>14 byte =0x00 os: MS-DOS 1677 | >>14 byte =0x01 os: Amiga 1678 | >>14 byte =0x02 os: VMS 1679 | >>14 byte =0x03 os: Unix 1680 | >>14 byte =0x05 os: Atari 1681 | >>14 byte =0x06 os: OS/2 1682 | >>14 byte =0x07 os: MacOS 1683 | >>14 byte =0x0A os: Tops/20 1684 | >>14 byte =0x0B os: WinNT 1685 | >>14 byte =0x0E os: Win32 1686 | >9 beshort >0x0939 1687 | >>9 byte&0xf0 =0x00 - version 0. 1688 | >>9 byte&0xf0 =0x10 - version 1. 1689 | >>9 byte&0xf0 =0x20 - version 2. 1690 | >>9 beshort&0x0fff x \b%03x, 1691 | >>15 byte 1 LZO1X-1, 1692 | >>15 byte 2 LZO1X-1(15), 1693 | >>15 byte 3 LZO1X-999, 1694 | ## >>25 bedate >0 last modified: %s, 1695 | >>17 byte =0x00 os: MS-DOS 1696 | >>17 byte =0x01 os: Amiga 1697 | >>17 byte =0x02 os: VMS 1698 | >>17 byte =0x03 os: Unix 1699 | >>17 byte =0x05 os: Atari 1700 | >>17 byte =0x06 os: OS/2 1701 | >>17 byte =0x07 os: MacOS 1702 | >>17 byte =0x0A os: Tops/20 1703 | >>17 byte =0x0B os: WinNT 1704 | >>17 byte =0x0E os: Win32 1705 | 1706 | # 4.3BSD-Quasijarus Strong Compression 1707 | # https://minnie.tuhs.org/Quasijarus/compress.html 1708 | 0 string \037\241 Quasijarus strong compressed data 1709 | 1710 | # From: Cory Dikkers 1711 | 0 string XPKF Amiga xpkf.library compressed data 1712 | 0 string PP11 Power Packer 1.1 compressed data 1713 | 0 string PP20 Power Packer 2.0 compressed data, 1714 | >4 belong 0x09090909 fast compression 1715 | >4 belong 0x090A0A0A mediocre compression 1716 | >4 belong 0x090A0B0B good compression 1717 | >4 belong 0x090A0C0C very good compression 1718 | >4 belong 0x090A0C0D best compression 1719 | 1720 | # 7-zip archiver, from Thomas Klausner (wiz@danbala.tuwien.ac.at) 1721 | # https://www.7-zip.org or DOC/7zFormat.txt 1722 | # 1723 | 0 string 7z\274\257\047\034 7-zip archive data, 1724 | >6 byte x version %d 1725 | >7 byte x \b.%d 1726 | !:mime application/x-7z-compressed 1727 | #!:ext 7z/cb7 1728 | 1729 | # Type: LZMA 1730 | 0 lelong&0xffffff =0x5d 1731 | >12 leshort 0xff lzma compressed data, 1732 | !:mime application/x-lzma 1733 | >>5 lequad =0xffffffffffffffff streamed 1734 | >>5 lequad !0xffffffffffffffff non-streamed, size %lld 1735 | >12 leshort 0 lzma compressed data, 1736 | >>5 lequad =0xffffffffffffffff streamed 1737 | >>5 lequad !0xffffffffffffffff non-streamed, size %lld 1738 | 1739 | # http://tukaani.org/xz/xz-file-format.txt 1740 | 0 ustring \xFD7zXZ\x00 xz compressed data, checksum 1741 | >7 byte&0xf 0x0 NONE 1742 | >7 byte&0xf 0x1 CRC32 1743 | >7 byte&0xf 0x4 CRC64 1744 | >7 byte&0xf 0xa SHA-256 1745 | 1746 | !:strength * 2 1747 | !:mime application/x-xz 1748 | 1749 | # https://github.com/ckolivas/lrzip/blob/master/doc/magic.header.txt 1750 | 0 string LRZI LRZIP compressed data 1751 | >4 byte x - version %d 1752 | >5 byte x \b.%d 1753 | !:mime application/x-lrzip 1754 | 1755 | # https://fastcompression.blogspot.fi/2013/04/lz4-streaming-format-final.html 1756 | 0 lelong 0x184d2204 lz4 compressed data (v1.4+) 1757 | !:mime application/x-lz4 1758 | # Added by osm0sis@xda-developers.com 1759 | 0 lelong 0x184c2103 lz4 compressed data (v1.0-v1.3) 1760 | !:mime application/x-lz4 1761 | 0 lelong 0x184c2102 lz4-l compressed data (v0.1-v0.9) 1762 | !:mime application/x-lz4 1763 | 1764 | # Zstandard/LZ4 skippable frames 1765 | # https://github.com/facebook/zstd/blob/dev/zstd_compression_format.md 1766 | 0 lelong&0xFFFFFFF0 0x184D2A50 1767 | >(4.l+8) indirect x 1768 | 1769 | # https://github.com/facebook/zstd/blob/dev/zstd_compression_format.md 1770 | 0 lelong 0xEC30A437 Zstandard dictionary 1771 | !:mime application/x-std-dictionary 1772 | >4 lelong x (ID %u) 1773 | 1774 | # AFX compressed files (Wolfram Kleff) 1775 | 2 string -afx- AFX compressed file data 1776 | 1777 | # Supplementary magic data for the file(1) command to support 1778 | # rzip(1). The format is described in magic(5). 1779 | # 1780 | # Copyright (C) 2003 by Andrew Tridgell. You may do whatever you want with 1781 | # this file. 1782 | # 1783 | 0 string RZIP rzip compressed data 1784 | >4 byte x - version %d 1785 | >5 byte x \b.%d 1786 | >6 belong x (%d bytes) 1787 | 1788 | 0 string ArC\x01 FreeArc archive 1789 | 1790 | # Type: DACT compressed files 1791 | 0 long 0x444354C3 DACT compressed data 1792 | >4 byte >-1 (version %i. 1793 | >5 byte >-1 %i. 1794 | >6 byte >-1 %i) 1795 | >7 long >0 , original size: %i bytes 1796 | >15 long >30 , block size: %i bytes 1797 | 1798 | # Valve Pack (VPK) files 1799 | 0 lelong 0x55aa1234 Valve Pak file 1800 | >0x4 lelong x \b, version %u 1801 | >0x8 lelong x \b, %u entries 1802 | 1803 | # Snappy framing format 1804 | # https://code.google.com/p/snappy/source/browse/trunk/framing_format.txt 1805 | 0 string \377\006\0\0sNaPpY snappy framed data 1806 | !:mime application/x-snappy-framed 1807 | 1808 | # qpress, https://www.quicklz.com/ 1809 | 0 string qpress10 qpress compressed data 1810 | !:mime application/x-qpress 1811 | 1812 | # Zlib https://www.ietf.org/rfc/rfc6713.txt 1813 | 0 string/b x 1814 | >0 beshort%31 =0 1815 | >>0 byte&0xf =8 1816 | >>>0 byte&0x80 =0 zlib compressed data 1817 | !:mime application/zlib 1818 | 1819 | # BWC compression 1820 | 0 string BWC 1821 | >3 byte 0 BWC compressed data 1822 | 1823 | # UCL compression 1824 | 0 bequad 0x00e955434cff011a UCL compressed data 1825 | 1826 | # Softlib archive 1827 | 0 string SLIB Softlib archive 1828 | >4 leshort x \b, version %d 1829 | >6 leshort x (contains %d files) 1830 | 1831 | # URL: https://github.com/lzfse/lzfse/blob/master/src/lzfse_internal.h#L276 1832 | # From: Eric Hall 1833 | 0 string bvx- lzfse encoded, no compression 1834 | 0 string bvx1 lzfse compressed, uncompressed tables 1835 | 0 string bvx2 lzfse compressed, compressed tables 1836 | 0 string bvxn lzfse encoded, lzvn compressed 1837 | 1838 | # pcxLib.exe compression program 1839 | # http://www.shikadi.net/moddingwiki/PCX_Library 1840 | 0 string/b pcxLib 1841 | 1842 | #------------------------------------------------------------ 1843 | # $File: android,v 1.18 2021/02/23 00:51:10 christos Exp $ 1844 | # Various android related magic entries 1845 | #------------------------------------------------------------ 1846 | 1847 | # Dalvik .dex format. http://retrodev.com/android/dexformat.html 1848 | # From "Mike Fleming" 1849 | # Fixed to avoid regexec 17 errors on some dex files 1850 | # From "Tim Strazzere" 1851 | 0 string dex\n 1852 | >0 regex dex\n[0-9]{2}\0 Dalvik dex file 1853 | >4 string >000 version %s 1854 | 0 string dey\n 1855 | >0 regex dey\n[0-9]{2}\0 Dalvik dex file (optimized for host) 1856 | >4 string >000 version %s 1857 | 1858 | # Android bootimg format 1859 | # From https://android.googlesource.com/\ 1860 | # platform/system/core/+/master/mkbootimg/bootimg.h 1861 | # https://github.com/djrbliss/loki/blob/master/loki.h#L43 1862 | 0 string ANDROID! Android bootimg 1863 | >1024 string LOKI \b, LOKI'd 1864 | >>1028 lelong 0 \b (boot) 1865 | >>1028 lelong 1 \b (recovery) 1866 | >8 lelong >0 \b, kernel 1867 | >>12 lelong >0 \b (0x%x) 1868 | >16 lelong >0 \b, ramdisk 1869 | >>20 lelong >0 \b (0x%x) 1870 | >24 lelong >0 \b, second stage 1871 | >>28 lelong >0 \b (0x%x) 1872 | >36 lelong >0 \b, page size: %d 1873 | >38 string >0 \b, name: %s 1874 | >64 string >0 \b, cmdline (%s) 1875 | 1876 | # Android sparse img format 1877 | # From https://android.googlesource.com/\ 1878 | # platform/system/core/+/master/libsparse/sparse_format.h 1879 | 0 lelong 0xed26ff3a Android sparse image 1880 | >4 leshort x \b, version: %d 1881 | >6 leshort x \b.%d 1882 | >16 lelong x \b, Total of %d 1883 | >12 lelong x \b %d-byte output blocks in 1884 | >20 lelong x \b %d input chunks. 1885 | 1886 | # Android binary XML magic 1887 | # In include/androidfw/ResourceTypes.h: 1888 | # RES_XML_TYPE = 0x0003 followed by the size of the header (ResXMLTree_header), 1889 | # which is 8 bytes (2 bytes type + 2 bytes header size + 4 bytes size). 1890 | 0 lelong 0x00080003 Android binary XML 1891 | 1892 | # Android cryptfs footer 1893 | # From https://android.googlesource.com/\ 1894 | # platform/system/vold/+/refs/heads/master/cryptfs.h 1895 | 0 lelong 0xd0b5b1c4 Android cryptfs footer 1896 | >4 leshort x \b, version: %d 1897 | >6 leshort x \b.%d 1898 | 1899 | # Android Vdex format 1900 | # From https://android.googlesource.com/\ 1901 | # platform/art/+/master/runtime/vdex_file.h 1902 | 0 string vdex Android vdex file, 1903 | >4 string >000 verifier deps version: %s, 1904 | >8 string >000 dex section version: %s, 1905 | >12 lelong >0 number of dex files: %d, 1906 | >16 lelong >0 verifier deps size: %d 1907 | 1908 | # Android Vdex format, dexfile is currently being updated 1909 | # by android system 1910 | # From https://android.googlesource.com/\ 1911 | # platform/art/+/master/dex2oat/dex2oat.cc 1912 | 0 string wdex Android vdex file, being processed by dex2oat, 1913 | >4 string >000 verifier deps version: %s, 1914 | >8 string >000 dex section version: %s, 1915 | >12 lelong >0 number of dex files: %d, 1916 | >16 lelong >0 verifier deps size: %d 1917 | -------------------------------------------------------------------------------- /authors.txt: -------------------------------------------------------------------------------- 1 | mkbootimg, unpackbootimg: 2 | https://github.com/CyanogenMod/android_system_core/tree/cm-10.2/mkbootimg (initial sources) 3 | https://github.com/huaixzk/unpackbootimg (makefiles) 4 | https://github.com/osm0sis/mkbootimg (patches) 5 | 6 | pxa-mkbootimg, pxa-unpackbootimg: 7 | https://github.com/AKuHAK/pxa-mkbootimg (initial source) 8 | https://github.com/osm0sis/pxa-mkbootimg (patches) 9 | 10 | elftool: 11 | https://bitbucket.org/srl3gx/elftool (initial source) 12 | https://github.com/osm0sis/elftool (patches) 13 | 14 | unpackelf: 15 | https://github.com/tobiaswaldvogel/and_boot_tools/tree/master/bootimg (initial source) 16 | https://github.com/osm0sis/unpackelf (patches) 17 | 18 | mboot: 19 | https://github.com/osm0sis/mboot 20 | 21 | dumpimage, mkimage: 22 | https://www.denx.de/wiki/U-Boot/WebHome 23 | 24 | mkmtkhdr: 25 | https://github.com/omnirom/android_device_oppo_r819/tree/android-4.4/mkmtkbootimg (initial source) 26 | https://github.com/osm0sis/mkmtkhdr (patches) 27 | 28 | loki_tool: 29 | https://github.com/djrbliss/loki 30 | 31 | futility: 32 | https://github.com/jcadduono/platform_external_vboot_reference (initial source) 33 | https://github.com/osm0sis/futility (patches) 34 | 35 | boot_signer.jar (requires JRE 8+): 36 | https://forum.xda-developers.com/android/software-hacking/signing-boot-images-android-verified-t3600606 37 | 38 | blobpack, blobunpack: 39 | https://github.com/AndroidRoot/BlobTools 40 | 41 | dhtbsign: 42 | https://github.com/chiefwigms/degas-mkbootimg/tree/galaxy_tab_a_smt285 (initial source) 43 | https://github.com/osm0sis/dhtbsign (patches) 44 | 45 | rkcrc: 46 | https://github.com/rockchip-linux/rkflashtool 47 | 48 | sony_dump: 49 | https://forum.xda-developers.com/crossdevice-dev/sony/tool-unpack-format-sony-kernel-image-t3530077 50 | 51 | bzip2, cat, chmod, cpio, cut, dd, file, find, gzip, hexdump, lzop, printf, tail, truncate, xz; 52 | cygbz2-1, cygcrypto-1.1, cyggcc_s-1, cygiconv-2, cygintl-8, cyglzma-5, cyglzo2-2, cygmagic-1, cygncursesw-10.dll, cygstdc++-6.dll, cygssl-1.1, cygwin1, cygz: 53 | https://cygwin.com/ 54 | 55 | lz4: 56 | https://lz4.github.io/lz4/ 57 | 58 | sudo: 59 | https://github.com/mattn/sudo 60 | 61 | magic: 62 | https://www.darwinsys.com/file/ 63 | 64 | androidbootimg.magic: 65 | osm0sis @ xda-developers 66 | 67 | batch scripts: 68 | osm0sis @ xda-developers (scripting) 69 | Peteragent5, alansj & iridaki @ xda-developers (general method) 70 | SuperR. & tobias.waldvogel @ xda-developers (kernel.elf to boot.img general method) 71 | _that & rayman @ xda-developers (boot.blob general method) 72 | Chainfire @ xda-developers (ChromeOS and SEAndroid general methods) 73 | cybojenix @ xda-developers (Bump general method) 74 | xyz` & k4y0z @ xda-developers (amonet general method) 75 | -------------------------------------------------------------------------------- /cleanup.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | set CYGWIN=nodosfilewarning 4 | 5 | set "bin=%~dp0\android_win_tools" 6 | 7 | if "%~1" == "--help" echo usage: cleanup.bat [--local] & goto end 8 | if not "%~1" == "--local" ( 9 | %~d0 10 | cd "%~p0" 11 | ) 12 | 13 | "%bin%"\chmod -fR +rw ramdisk split_img >nul 2>&1 14 | rd /s /q ramdisk >nul 2>&1 15 | rd /s /q split_img >nul 2>&1 16 | del *new.* >nul 2>&1 17 | echo %cmdcmdline% | findstr /i pushd >nul 18 | if not errorlevel 1 echo Working directory cleaned. & echo. 19 | 20 | :end 21 | -------------------------------------------------------------------------------- /repackimg.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | set CYGWIN=nodosfilewarning 4 | 5 | set "bin=%~dp0\android_win_tools" 6 | set "cur=%cd%" 7 | 8 | if "%~1" == "--help" echo usage: repackimg.bat [--local] [--original] [--origsize] [--level ^<0-9^>] [--avbkey ^] [--forceelf] & goto end 9 | if "%~1" == "--local" ( 10 | shift 11 | ) else ( 12 | %~d0 13 | cd "%~p0" 14 | ) 15 | dir /a-d split_img >nul 2>&1 || goto nofiles 16 | for /f "delims=" %%a in ('dir /b split_img\*-*ramdiskcomp') do @set "ramdiskcname=%%a" 17 | for /f "delims=" %%a in ('type "split_img\%ramdiskcname%"') do @set "ramdiskcomp=%%a" 18 | dir /a ramdisk >nul 2>&1 || if not "%ramdiskcomp%" == "empty" goto nofiles 19 | 20 | echo Android Image Kitchen - RepackImg Script 21 | echo by osm0sis @ xda-developers 22 | echo. 23 | 24 | if exist *-new.* ( 25 | echo Warning: Overwriting existing files! 26 | echo. 27 | ) 28 | del *-new.* 2>nul 29 | 30 | :parseargs 31 | if not "[%~1]" == "[]" ( 32 | if "%~1" == "--original" ( 33 | set "original=1" 34 | echo Repacking with original ramdisk . . . 35 | ) 36 | if "%~1" == "--origsize" ( 37 | set "origsize=1" 38 | ) 39 | if "%~1" == "--forceelf" ( 40 | set "repackelf=1" 41 | ) 42 | if "%~1" == "--level" ( 43 | if not "[%~2]" == "[]" ( 44 | set "lvltest=" & for /f "delims=0123456789" %%a in ("%~2") do @set "lvltest=%%a" 45 | if not defined lvltest ( 46 | set "level=-%~2" 47 | set "lvltxt= - Level: %~2" 48 | shift 49 | ) 50 | ) 51 | ) 52 | if "%~1" == "--avbkey" ( 53 | if not "[%~2]" == "[]" ( 54 | if exist "%~2.pk8" if exist "%~2.x509."* set "avbkey=%~2" & set "avbtxt= - Key: %~2" 55 | if exist "%cur%\%~2.pk8" if exist "%cur%\%~2.x509."* set "avbkey=%cur%\%~2" & set "avbtxt= - Key: %~2" 56 | shift 57 | ) 58 | ) 59 | shift 60 | goto parseargs 61 | ) 62 | 63 | if defined original goto skipramdisk 64 | if "%ramdiskcomp%" == "empty" ( 65 | echo Warning: Using empty ramdisk for repack! 66 | set "compext=.empty" 67 | copy /y nul ramdisk-new.cpio.empty >nul 68 | goto skipramdisk 69 | ) 70 | "%bin%"\find ramdisk >nul 2>&1 71 | if errorlevel == 1 ( 72 | set "sumsg= (as root)" 73 | ) else ( 74 | "%bin%"\find ramdisk 2>&1 | "%bin%"\cpio --quiet -o >nul 2>&1 75 | if errorlevel == 1 set "sumsg= (as root)" 76 | ) 77 | echo Packing ramdisk%sumsg% . . . 78 | echo. 79 | if not "[%sumsg%]" == "[]" ( 80 | if not exist "%bin%"\sudo.exe ( 81 | echo Windows sudo required but not found. 82 | set "nosudo=1" 83 | ) else ( 84 | "%bin%"\sudo.exe --help >nul 2>&1 85 | if not errorlevel == 2 ( 86 | echo Windows sudo required but unable to run. 87 | set "nosudo=1" 88 | ) 89 | ) 90 | if defined nosudo ( 91 | echo. 92 | echo *** Reinstall Android Image Kitchen, then add *** 93 | echo *** sudo.exe to your antivirus exceptions! *** 94 | echo. 95 | goto error 96 | ) 97 | ) 98 | 99 | echo Using compression: %ramdiskcomp%%lvltxt% 100 | if not defined level if "%ramdiskcomp%" == "xz" set "level=-1" 101 | if not defined level if "%ramdiskcomp%" == "lz4" set "level=-9" 102 | if not defined level if "%ramdiskcomp%" == "lz4-l" set "level=-9" 103 | set "repackcmd=%ramdiskcomp% %level%" 104 | set "compext=%ramdiskcomp%" 105 | if "%ramdiskcomp%" == "gzip" set "compext=gz" 106 | if "%ramdiskcomp%" == "lzop" set "compext=lzo" 107 | if "%ramdiskcomp%" == "lzma" set "repackcmd=xz -Flzma %level%" 108 | if "%ramdiskcomp%" == "xz" set "repackcmd=xz %level% -Ccrc32" 109 | if "%ramdiskcomp%" == "bzip2" set "compext=bz2" 110 | if "%ramdiskcomp%" == "lz4-l" set "repackcmd=lz4 %level% -l" & set "compext=lz4" 111 | if "%ramdiskcomp%" == "cpio" set "repackcmd=cat" & set "compext=" 112 | if defined compext set "compext=.%compext%" 113 | cd ramdisk 114 | if "[%sumsg%]" == "[]" ( 115 | "%bin%"\find . | "%bin%"\cpio -H newc -R 0:0 -o -F ..\ramdisk-new.cpio 2>nul 116 | ) else ( 117 | "%bin%"\sudo "%bin%"\find2cpio.bat >nul 118 | ) 119 | if errorlevel == 1 goto error 120 | cd .. 121 | if not "%ramdiskcomp%" == "cpio" ( 122 | type ramdisk-new.cpio | "%bin%"\%repackcmd% > ramdisk-new.cpio%compext% 123 | del ramdisk-new.cpio 124 | ) 125 | if errorlevel == 1 goto error 126 | :skipramdisk 127 | echo. 128 | 129 | echo Getting build information . . . 130 | echo. 131 | 132 | for /f "delims=" %%a in ('dir /b split_img\*-imgtype') do @set "imgtypename=%%a" 133 | for /f "delims=" %%a in ('type "split_img\%imgtypename%"') do @set "imgtype=%%a" 134 | 135 | if "%imgtype%" == "AOSP_VNDR" ( 136 | set "vendor=vendor_" 137 | goto skipkern 138 | ) 139 | if "%imgtype%" == "KRNL" goto skipkern 140 | if not exist "split_img\*-kernel" goto skipkern 141 | for /f "delims=" %%a in ('dir /b split_img\*-kernel') do @set "kernelname=%%a" 142 | echo kernel = %kernelname% & set "kernel=split_img/%kernelname%" 143 | :skipkern 144 | for /f "delims=" %%a in ('dir /b split_img\*-*ramdisk.cpio*') do @set "ramdiskname=%%a" 145 | if not defined original ( 146 | set "ramdiskname=ramdisk-new.cpio%compext%" 147 | set "ramdisk=ramdisk-new.cpio%compext%" 148 | goto skiporig 149 | ) 150 | echo %vendor%ramdisk = %ramdiskname% 151 | set "ramdisk=split_img/"%ramdiskname%"" 152 | :skiporig 153 | if "%imgtype%" == "KRNL" ( 154 | for %%i in (%ramdisk%) do @echo ramdisk_size = %%~z%i 155 | ) 156 | 157 | if not "%imgtype%" == "OSIP" goto skipos 158 | for /f "delims=" %%a in ('dir /b split_img\*-*cmdline') do @set "cmdname=%%a" 159 | for /f "delims=" %%a in ('type "split_img\%cmdname%"') do @set "cmdline=%%a" 160 | echo cmdline = %cmdline% 161 | goto skipaosp 162 | 163 | :skipos 164 | if not "%imgtype%" == "U-Boot" goto skipuboot 165 | for /f "delims=" %%a in ('dir /b split_img\*-name') do @set "namename=%%a" 166 | for /f "delims=" %%a in ('type "split_img\%namename%"') do @set "name=%%a" 167 | echo name = %name% 168 | for /f "delims=" %%a in ('dir /b split_img\*-arch') do @set "archname=%%a" 169 | for /f "delims=" %%a in ('type "split_img\%archname%"') do @set "arch=%%a" 170 | for /f "delims=" %%a in ('dir /b split_img\*-os') do @set "osname=%%a" 171 | for /f "delims=" %%a in ('type "split_img\%osname%"') do @set "os=%%a" 172 | for /f "delims=" %%a in ('dir /b split_img\*-type') do @set "typename=%%a" 173 | for /f "delims=" %%a in ('type "split_img\%typename%"') do @set "type=%%a" 174 | for /f "delims=" %%a in ('dir /b split_img\*-comp') do @set "compname=%%a" 175 | for /f "delims=" %%a in ('type "split_img\%compname%"') do @set "comp=%%a" 176 | echo type = %arch% %os% %type% (%comp%) 177 | if "%comp%" == "uncompressed" set "comp=none" 178 | for /f "delims=" %%a in ('dir /b split_img\*-addr') do @set "addrname=%%a" 179 | for /f "delims=" %%a in ('type "split_img\%addrname%"') do @set "addr=%%a" 180 | echo load_addr = %addr% 181 | for /f "delims=" %%a in ('dir /b split_img\*-ep') do @set "epname=%%a" 182 | for /f "delims=" %%a in ('type "split_img\%epname%"') do @set "ep=%%a" 183 | echo entry_point = %ep% 184 | goto skipaosp 185 | 186 | :skipuboot 187 | if "%imgtype%" == "KRNL" goto skipaosp 188 | if not exist "split_img\*-second" goto skipsecond 189 | for /f "delims=" %%a in ('dir /b split_img\*-second') do @set "second=%%a" 190 | echo second = %second% & set "second=--second "split_img/%second%"" 191 | :skipsecond 192 | if not exist "split_img\*-dtb" goto skipdtb 193 | for /f "delims=" %%a in ('dir /b split_img\*-dtb') do @set "dtb=%%a" 194 | echo dtb = %dtb% & set "dtb=--dtb "split_img/%dtb%"" 195 | :skipdtb 196 | if not exist "split_img\*-recovery_dtbo" goto skiprecdtbo 197 | for /f "delims=" %%a in ('dir /b split_img\*-recovery_dtbo') do @set "recoverydtbo=%%a" 198 | echo recovery_dtbo = %recoverydtbo% & set "recoverydtbo=--recovery_dtbo "split_img/%recoverydtbo%"" 199 | :skiprecdtbo 200 | if not exist "split_img\*-*cmdline" goto skipcmd 201 | for /f "delims=" %%a in ('dir /b split_img\*-*cmdline') do @set "cmdname=%%a" 202 | for /f "delims=" %%a in ('type "split_img\%cmdname%"') do @set "cmdline=%%a" 203 | set "cmd="split_img/%cmdname%"@cmdline" 204 | echo %vendor%cmdline = %cmdline% 205 | if defined cmdline set "cmdline=%cmdline:"=\"%" 206 | :skipcmd 207 | if not exist "split_img\*-board" goto skipboard 208 | for /f "delims=" %%a in ('dir /b split_img\*-board') do @set "boardname=%%a" 209 | for /f "delims=" %%a in ('type "split_img\%boardname%"') do @set "board=%%a" 210 | echo board = %board% 211 | if defined board set board=%board:"=\"% 212 | :skipboard 213 | if not exist "split_img\*-base" goto skipbase 214 | for /f "delims=" %%a in ('dir /b split_img\*-base') do @set "basename=%%a" 215 | for /f "delims=" %%a in ('type "split_img\%basename%"') do @set "base=%%a" 216 | echo base = %base% 217 | :skipbase 218 | if not exist "split_img\*-pagesize" goto skippage 219 | for /f "delims=" %%a in ('dir /b split_img\*-pagesize') do @set "pagename=%%a" 220 | for /f "delims=" %%a in ('type "split_img\%pagename%"') do @set "pagesize=%%a" 221 | echo pagesize = %pagesize% 222 | :skippage 223 | if not exist "split_img\*-kernel_offset" goto skipkoff 224 | for /f "delims=" %%a in ('dir /b split_img\*-kernel_offset') do @set "koffname=%%a" 225 | for /f "delims=" %%a in ('type "split_img\%koffname%"') do @set "kerneloff=%%a" 226 | echo kernel_offset = %kerneloff% 227 | :skipkoff 228 | if not exist "split_img\*-ramdisk_offset" goto skiproff 229 | for /f "delims=" %%a in ('dir /b split_img\*-ramdisk_offset') do @set "roffname=%%a" 230 | for /f "delims=" %%a in ('type "split_img\%roffname%"') do @set "ramdiskoff=%%a" 231 | echo ramdisk_offset = %ramdiskoff% 232 | :skiproff 233 | if not exist "split_img\*-second_offset" goto skipsoff 234 | for /f "delims=" %%a in ('dir /b split_img\*-second_offset') do @set "soffname=%%a" 235 | for /f "delims=" %%a in ('type "split_img\%soffname%"') do @set "secondoff=%%a" 236 | echo second_offset = %secondoff% 237 | :skipsoff 238 | if not exist "split_img\*-tags_offset" goto skiptoff 239 | for /f "delims=" %%a in ('dir /b split_img\*-tags_offset') do @set "toffname=%%a" 240 | for /f "delims=" %%a in ('type "split_img\%toffname%"') do @set "tagsoff=%%a" 241 | echo tags_offset = %tagsoff% 242 | :skiptoff 243 | if not exist "split_img\*-dtb_offset" goto skipdoff 244 | for /f "delims=" %%a in ('dir /b split_img\*-dtb_offset') do @set "doffname=%%a" 245 | for /f "delims=" %%a in ('type "split_img\%doffname%"') do @set "dtboff=%%a" 246 | echo dtb_offset = %dtboff% 247 | :skipdoff 248 | if not exist "split_img\*-os_version" goto skiposver 249 | for /f "delims=" %%a in ('dir /b split_img\*-os_version') do @set "osvname=%%a" 250 | for /f "delims=" %%a in ('type "split_img\%osvname%"') do @set "osver=%%a" 251 | echo os_version = %osver% 252 | :skiposver 253 | if not exist "split_img\*-os_patch_level" goto skiposlvl 254 | for /f "delims=" %%a in ('dir /b split_img\*-os_patch_level') do @set "oslname=%%a" 255 | for /f "delims=" %%a in ('type "split_img\%oslname%"') do @set "oslvl=%%a" 256 | echo os_patch_level = %oslvl% 257 | :skiposlvl 258 | if not exist "split_img\*-header_version" goto skiphdrver 259 | for /f "delims=" %%a in ('dir /b split_img\*-header_version') do @set "hdrvname=%%a" 260 | for /f "delims=" %%a in ('type "split_img\%hdrvname%"') do @set "hdrver=%%a" 261 | echo header_version = %hdrver% 262 | :skiphdrver 263 | if not exist "split_img\*-hashtype" goto skiphash 264 | for /f "delims=" %%a in ('dir /b split_img\*-hashtype') do @set "hashname=%%a" 265 | for /f "delims=" %%a in ('type "split_img\%hashname%"') do @set "hashtype=%%a" 266 | echo hashtype = %hashtype% & set "hashtype=--hashtype %hashtype%" 267 | :skiphash 268 | if not exist "split_img\*-dt" goto skipdt 269 | for /f "delims=" %%a in ('dir /b split_img\*-dttype') do @set "dtname=%%a" 270 | for /f "delims=" %%a in ('type "split_img\%dtname%"') do @set "dttype=%%a" 271 | for /f "delims=" %%a in ('dir /b split_img\*-dt') do @set "dt=%%a" 272 | echo dt = %dt% & set "rpm="split_img/%dt%",rpm" & set "dt=--dt "split_img/%dt%"" 273 | :skipdt 274 | if not exist "split_img\*-unknown" goto skipunknown 275 | for /f "delims=" %%a in ('dir /b split_img\*-unknown') do @set "unkname=%%a" 276 | for /f "delims=" %%a in ('type "split_img\%unkname%"') do @set "unknown=%%a" 277 | echo unknown = %unknown% 278 | :skipunknown 279 | if exist "split_img\*-header" ( 280 | for /f "delims=" %%a in ('dir /b split_img\*-header') do @set "header=%%a" 281 | ) 282 | :skipaosp 283 | echo. 284 | 285 | if not exist "split_img\*-mtktype" goto skipmtk 286 | for /f "delims=" %%a in ('dir /b split_img\*-mtktype') do @set "mtktypename=%%a" 287 | for /f "delims=" %%a in ('type "split_img\%mtktypename%"') do @set "mtktype=%%a" 288 | echo Generating MTK headers . . . 289 | echo. 290 | echo Using ramdisk type: %mtktype% 291 | "%bin%"\mkmtkhdr --kernel "%kernel%" --%mtktype% "%ramdisk%" >nul 292 | if errorlevel == 1 goto error 293 | move /y "%kernelname%-mtk" kernel-new.mtk >nul 294 | move /y "%ramdiskname%-mtk" %mtktype%-new.mtk >nul 295 | set "kernel=kernel-new.mtk" 296 | set "ramdisk=%mtktype%-new.mtk" 297 | echo. 298 | 299 | :skipmtk 300 | if exist "split_img\*-sigtype" ( 301 | set "outname=unsigned-new.img" 302 | ) else ( 303 | set "outname=image-new.img" 304 | ) 305 | if "%dttype%" == "ELF" set "repackelf=1" 306 | if "%imgtype%" == "ELF" if not "[%header%]" == "[]" if defined repackelf ( 307 | set "buildcmd=elftool pack -o %outname% header="split_img/%header%" "%kernel%" "%ramdisk%",ramdisk %rpm% %cmd% >nul" 308 | ) 309 | if "%imgtype%" == "ELF" if not defined buildcmd set "imgtype=AOSP" & echo Warning: ELF format without RPM detected; will be repacked using AOSP format! & echo. 310 | if "%imgtype%" == "AOSP_VNDR" set "buildcmd=mkbootimg --vendor_ramdisk "%ramdisk%" %dtb% --vendor_cmdline "%cmdline%" --board "%board%" --base %base% --pagesize %pagesize% --kernel_offset %kerneloff% --ramdisk_offset %ramdiskoff% --tags_offset "%tagsoff%" --dtb_offset "%dtboff%" --os_version "%osver%" --os_patch_level "%oslvl%" --header_version "%hdrver%" --vendor_boot %outname%" 311 | if "%imgtype%" == "AOSP" set "buildcmd=mkbootimg --kernel "%kernel%" --ramdisk "%ramdisk%" %second% %dtb% %recoverydtbo% --cmdline "%cmdline%" --board "%board%" --base %base% --pagesize %pagesize% --kernel_offset %kerneloff% --ramdisk_offset %ramdiskoff% --second_offset "%secondoff%" --tags_offset "%tagsoff%" --dtb_offset "%dtboff%" --os_version "%osver%" --os_patch_level "%oslvl%" --header_version "%hdrver%" %hashtype% %dt% -o %outname%" 312 | if "%imgtype%" == "AOSP-PXA" set "buildcmd=pxa-mkbootimg --kernel "%kernel%" --ramdisk "%ramdisk%" %second% --cmdline "%cmdline%" --board "%board%" --base %base% --pagesize %pagesize% --kernel_offset %kerneloff% --ramdisk_offset %ramdiskoff% --second_offset "%secondoff%" --tags_offset "%tagsoff%" --unknown "%unknown%" %dt% -o %outname%" 313 | if "%imgtype%" == "KRNL" set "buildcmd=rkcrc -k "%ramdisk%" %outname%" 314 | if "%imgtype%" == "OSIP" ( 315 | md split_img\temp 2>nul 316 | copy /b split_img\*-header split_img\temp\hdr >nul 2>&1 317 | copy /b split_img\*-sig split_img\temp\sig >nul 2>&1 318 | copy /b split_img\*-*cmdline split_img\temp\cmdline.txt >nul 319 | copy /b split_img\*-parameter split_img\temp\parameter >nul 320 | copy /b split_img\*-bootstub split_img\temp\bootstub >nul 321 | copy /b split_img\*-kernel split_img\temp\kernel >nul 322 | "%bin%"\cat "%ramdisk%" > split_img\temp\ramdisk.cpio.gz 323 | ) 324 | if "%imgtype%" == "OSIP" set "buildcmd=mboot -d split_img\temp -f %outname%" 325 | if "%imgtype%" == "U-Boot" ( 326 | set "part0=%kernel%" 327 | if "%type%" == "Multi" set "part1=:%ramdisk%" 328 | if "%type%" == "RAMDisk" set "part0=%ramdisk%" 329 | ) 330 | if "%imgtype%" == "U-Boot" set "buildcmd=mkimage -A %arch% -O %os% -T %type% -C %comp% -a %addr% -e %ep% -n "%name%" -d "%part0%"%part1% %outname% >nul" 331 | 332 | echo Building image . . . 333 | echo. 334 | echo Using format: %imgtype% 335 | echo. 336 | if not defined buildcmd echo Unsupported format. & goto error 337 | "%bin%"\%buildcmd% 338 | if errorlevel == 1 goto error 339 | 340 | rd /s /q split_img\temp >nul 2>&1 341 | 342 | if not exist "split_img\*-sigtype" goto skipsign 343 | for /f "delims=" %%a in ('dir /b split_img\*-sigtype') do @set "sigtypename=%%a" 344 | for /f "delims=" %%a in ('type "split_img\%sigtypename%"') do @set "sigtype=%%a" 345 | if not exist "split_img\*-avbtype" goto skipavb 346 | for /f "delims=" %%a in ('dir /b split_img\*-avbtype') do @set "avbtypename=%%a" 347 | for /f "delims=" %%a in ('type "split_img\%avbtypename%"') do @set "avbtype=%%a" 348 | :skipavb 349 | if not exist "split_img\*-blobtype" goto skipblob 350 | for /f "delims=" %%a in ('dir /b split_img\*-blobtype') do @set "blobtypename=%%a" 351 | for /f "delims=" %%a in ('type "split_img\%blobtypename%"') do @set "blobtype=%%a" 352 | :skipblob 353 | echo Signing new image . . . 354 | echo. 355 | echo Using signature: %sigtype% %avbtype%%avbtxt%%blobtype% 356 | echo. 357 | if not defined avbkey set "avbkey=%bin%\avb\verity" 358 | if "%sigtype%" == "AVBv1" java -jar "%bin%"\boot_signer.jar /%avbtype% unsigned-new.img "%avbkey%.pk8" "%avbkey%.x509."* image-new.img 2>nul 359 | if "%sigtype%" == "BLOB" ( 360 | "%bin%"\printf '-SIGNED-BY-SIGNBLOB-\00\00\00\00\00\00\00\00' > image-new.img 361 | "%bin%"\blobpack blob.tmp %blobtype% unsigned-new.img >nul 362 | type blob.tmp >> image-new.img 363 | del /q blob.tmp >nul 364 | ) 365 | if "%sigtype%" == "CHROMEOS" "%bin%"\futility vbutil_kernel --pack image-new.img --keyblock "%bin%\chromeos\kernel.keyblock" --signprivate "%bin%\chromeos\kernel_data_key.vbprivk" --version 1 --vmlinuz unsigned-new.img --bootloader "%bin%\chromeos\empty" --config "%bin%\chromeos\empty" --arch arm --flags 0x1 366 | if "%sigtype%" == "DHTB" "%bin%"\dhtbsign -i unsigned-new.img -o image-new.img >nul & del split_img\*-tailtype 2>nul 367 | if "%sigtype%" == "NOOK" type "split_img\*-master_boot.key" unsigned-new.img > image-new.img 2>nul 368 | if "%sigtype%" == "NOOKTAB" type "split_img\*-master_boot.key" unsigned-new.img > image-new.img 2>nul 369 | if errorlevel == 1 goto error 370 | 371 | :skipsign 372 | if not exist "split_img\*-lokitype" goto skiploki 373 | for /f "delims=" %%a in ('dir /b split_img\*-lokitype') do @set "lokitypename=%%a" 374 | for /f "delims=" %%a in ('type "split_img\%lokitypename%"') do @set "lokitype=%%a" 375 | echo Loki patching new image . . . 376 | echo. 377 | echo Using type: %lokitype% 378 | echo. 379 | move /y image-new.img unlokied-new.img >nul 380 | if exist aboot.img ( 381 | "%bin%"\loki_tool patch %lokitype% aboot.img unlokied-new.img image-new.img >nul 382 | if errorlevel == 1 echo Patching failed. & goto error 383 | ) else ( 384 | echo Device aboot.img required in script directory to find Loki patch offset. 385 | goto error 386 | ) 387 | 388 | :skiploki 389 | if not exist "split_img\*-microloader.bin" goto skipamonet 390 | echo Amonet patching new image . . . 391 | echo. 392 | copy /b image-new.img unamonet-new.img >nul 393 | copy /b split_img\*-microloader.bin microloader.tmp >nul 394 | "%bin%"\dd bs=1024 count=1 conv=notrunc if=unamonet-new.img of=head.tmp 2>nul 395 | "%bin%"\dd bs=1024 seek=1 conv=notrunc if=head.tmp of=image-new.img 2>nul 396 | "%bin%"\dd conv=notrunc if=microloader.tmp of=image-new.img 2>nul 397 | del /q head.tmp microloader.tmp >nul 398 | 399 | :skipamonet 400 | if not exist "split_img\*-tailtype" goto skiptail 401 | for /f "delims=" %%a in ('dir /b split_img\*-tailtype') do @set "tailtypename=%%a" 402 | for /f "delims=" %%a in ('type "split_img\%tailtypename%"') do @set "tailtype=%%a" 403 | echo Appending footer . . . 404 | echo. 405 | echo Using type: %tailtype% 406 | echo. 407 | if "%tailtype%" == "Bump" "%bin%"\printf '\x41\xA9\xE4\x67\x74\x4D\x1D\x1B\xA4\x29\xF2\xEC\xEA\x65\x52\x79' >> image-new.img 408 | if "%tailtype%" == "SEAndroid" "%bin%"\printf 'SEANDROIDENFORCE' >> image-new.img 409 | 410 | :skiptail 411 | if not defined origsize goto skippad 412 | if not exist "split_img\*-origsize" goto skippad 413 | for /f "delims=" %%a in ('dir /b split_img\*-origsize') do @set "origsizename=%%a" 414 | for /f "delims=" %%a in ('type "split_img\%origsizename%"') do @set "filesize=%%a" 415 | echo Padding to original size . . . 416 | echo. 417 | copy /b image-new.img unpadded-new.img >nul 418 | "%bin%"\truncate -s %filesize% image-new.img 419 | 420 | :skippad 421 | echo Done! 422 | goto end 423 | 424 | :nofiles 425 | echo No files found to be packed/built. 426 | 427 | :error 428 | echo Error! 429 | set "exitcode=1" 430 | 431 | :end 432 | echo. 433 | echo %cmdcmdline% | findstr /i pushd >nul 434 | if errorlevel 1 pause 435 | exit /b %exitcode% 436 | -------------------------------------------------------------------------------- /unpackimg.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | set CYGWIN=nodosfilewarning 4 | 5 | set "aik=%~dp0" 6 | set "bin=%~dp0\android_win_tools" 7 | set "cur=%cd%" 8 | 9 | if "%~1" == "--help" echo usage: unpackimg.bat [--local] ^ & goto end 10 | if "%~1" == "--local" ( 11 | set "local=--local" 12 | shift 13 | ) else ( 14 | %~d0 15 | cd "%~p0" 16 | ) 17 | if "[%~1]" == "[]" ( 18 | for /f "delims=" %%a in ('dir /b /o *.elf *.img *.sin 2^>nul') do ( 19 | if not "%%a" == "aboot.img" if not "%%a" == "image-new.img" if not "%%a" == "unlokied-new.img" if not "%%a" == "unsigned-new.img" ( 20 | set "img=%%a" 21 | goto imgset 22 | ) 23 | ) 24 | ) else ( 25 | set "img=%~1" 26 | ) 27 | :imgset 28 | if "[%img%]" == "[]" goto noargs 29 | if exist "%cur%\%img%" set "img=%cur%\%img%" 30 | call :main "%img%" & exit /b 31 | :main 32 | set attr=%~a1 33 | set dirattr=%attr:~0,1% 34 | if /i "%dirattr%"=="d" goto noargs 35 | set "file=%~dsp1%~nx1" 36 | if not exist "%file%" goto noargs 37 | 38 | echo Android Image Kitchen - UnpackImg Script 39 | echo by osm0sis @ xda-developers 40 | echo. 41 | 42 | echo Supplied image: %~nx1 43 | echo. 44 | 45 | if exist split_img\nul set "noclean=1" 46 | if exist ramdisk\nul set "noclean=1" 47 | if defined noclean ( 48 | echo Removing old work folders and files . . . 49 | echo. 50 | call "%aik%\cleanup.bat" %local% >nul 51 | ) 52 | 53 | echo Setting up work folders . . . 54 | echo. 55 | md split_img 56 | if errorlevel == 1 call "%aik%\cleanup.bat" %local% >nul & goto error 57 | md ramdisk 58 | if errorlevel == 1 call "%aik%\cleanup.bat" %local% >nul & goto error 59 | icacls ramdisk /inheritance:d >nul 2>&1 60 | icacls ramdisk /remove:g "NT AUTHORITY\Authenticated Users" >nul 2>&1 61 | icacls ramdisk /remove:g "BUILTIN\Users" >nul 2>&1 62 | icacls ramdisk /grant %userdomain%\%username%:(OI)(CI)(F) >nul 2>&1 63 | 64 | cd split_img 65 | for /f "usebackq" %%a in ('%file%') do @set "filesize=%%~za" 66 | echo %filesize%>"%~nx1-origsize" 67 | "%bin%"\file -m "%bin%\androidbootimg.magic" "%file%" 2>nul | "%bin%"\cut -d: -f2- | "%bin%"\cut -d: -f2 | "%bin%"\cut -d" " -f3 | "%bin%"\cut -d, -f1 > "%~nx1-imgtype" 68 | for /f "delims=" %%a in ('type "%~nx1-imgtype"') do @set "imgtest=%%a" 69 | if "%imgtest%" == "signing" ( 70 | "%bin%"\file -m "%bin%\androidbootimg.magic" "%file%" 2>nul | "%bin%"\cut -d: -f2- | "%bin%"\cut -d: -f2 | "%bin%"\cut -d" " -f2 > "%~nx1-sigtype" 71 | for /f "delims=" %%a in ('type "%~nx1-sigtype"') do @set "sigtype=%%a" & echo Signature with "%%a" type detected, removing . . . 72 | echo. 73 | ) 74 | if "%sigtype%" == "BLOB" ( 75 | copy /b "%file%" . >nul 76 | "%bin%"\blobunpack "%~nx1" | findstr "Name:" | "%bin%"\cut -d" " -f2 > "%~nx1-blobtype" 2>nul 77 | move /y "%~nx1.LNX" "%~nx1" >nul 2>&1 78 | move /y "%~nx1.SOS" "%~nx1" >nul 2>&1 79 | set "file=%~nx1" 80 | ) 81 | if "%sigtype%" == "CHROMEOS" "%bin%"\futility vbutil_kernel --get-vmlinuz "%file%" --vmlinuz-out "%~nx1" & set "file=%~nx1" 82 | if "%sigtype%" == "DHTB" "%bin%"\dd bs=4096 skip=512 iflag=skip_bytes conv=notrunc if="%file%" of="%~nx1" 2>nul & set "file=%~nx1" 83 | if "%sigtype%" == "NOOK" ( 84 | "%bin%"\dd bs=1048576 count=1 conv=notrunc if="%file%" of="%~nx1-master_boot.key" 2>nul 85 | "%bin%"\dd bs=1048576 skip=1 conv=notrunc if="%file%" of="%~nx1" 2>nul 86 | set "file=%~nx1" 87 | ) 88 | if "%sigtype%" == "NOOKTAB" ( 89 | "%bin%"\dd bs=262144 count=1 conv=notrunc if="%file%" of="%~nx1-master_boot.key" 2>nul 90 | "%bin%"\dd bs=262144 skip=1 conv=notrunc if="%file%" of="%~nx1" 2>nul 91 | set "file=%~nx1" 92 | ) 93 | if "%sigtype%" == "SINv1" set "sigtype=SIN" 94 | if "%sigtype%" == "SINv2" set "sigtype=SIN" 95 | if "%sigtype%" == "SINv3" set "sigtype=SIN" 96 | if "%sigtype%" == "SIN" ( 97 | "%bin%"\sony_dump . "%file%" >nul 98 | move /y "%~nx1."* "%~nx1" >nul 2>&1 99 | set "file=%~nx1" 100 | del "%~nx1-sigtype" 101 | ) 102 | 103 | "%bin%"\file -m "%bin%\androidbootimg.magic" "%file%" 2>nul | "%bin%"\cut -d: -f2- | "%bin%"\cut -d: -f2 | "%bin%"\cut -d" " -f3 | "%bin%"\cut -d, -f1 > "%~nx1-imgtype" 104 | for /f "delims=" %%a in ('type "%~nx1-imgtype"') do @set "imgtest=%%a" 105 | if "%imgtest%" == "bootimg" ( 106 | set "imgtest=" 107 | "%bin%"\file -m "%bin%\androidbootimg.magic" "%file%" 2>nul | "%bin%"\cut -d: -f2- | "%bin%"\cut -d: -f2 | "%bin%"\cut -d" " -f4 > "%~nx1-imgtype" 108 | for /f "delims=" %%a in ('type "%~nx1-imgtype"') do ( 109 | if "%%a" == "PXA" set "imgtest=-%%a" 110 | ) 111 | "%bin%"\file -m "%bin%\androidbootimg.magic" "%file%" 2>nul | "%bin%"\cut -d: -f2- | "%bin%"\cut -d: -f2 | "%bin%"\cut -d" " -f2 > "%~nx1-imgtype" 112 | for /f "delims=" %%a in ('type "%~nx1-imgtype"') do @set "imgtype=%%a" 113 | ) else ( 114 | cd .. 115 | call "%aik%\cleanup.bat" %local% >nul 116 | echo Unrecognized format. 117 | goto error 118 | ) 119 | set "imgtype=%imgtype%%imgtest%" 120 | echo %imgtype%>"%~nx1-imgtype" 121 | echo Image type: %imgtype% 122 | echo. 123 | 124 | if "%imgtype%" == "AOSP_VNDR" set "supported=1" 125 | if "%imgtype%" == "AOSP" set "supported=1" 126 | if "%imgtype%" == "AOSP-PXA" set "supported=1" 127 | if "%imgtype%" == "ELF" set "supported=1" 128 | if "%imgtype%" == "KRNL" set "supported=1" 129 | if "%imgtype%" == "OSIP" set "supported=1" 130 | if "%imgtype%" == "U-Boot" set "supported=1" 131 | if not defined supported ( 132 | cd .. 133 | call "%aik%\cleanup.bat" %local% >nul 134 | echo Unsupported format. 135 | goto error 136 | ) 137 | 138 | "%bin%"\file -m "%bin%\androidbootimg.magic" "%file%" 2>nul | "%bin%"\cut -d: -f2- | "%bin%"\cut -d: -f2 | "%bin%"\cut -d" " -f4 > "%~nx1-aosphacktype" 139 | for /f "delims=" %%a in ('type "%~nx1-aosphacktype"') do @set "aosphacktest=%%a" 140 | if "%aosphacktest%" == "LOKI" ( 141 | move /y "%~nx1-aosphacktype" "%~nx1-lokitype" >nul 142 | "%bin%"\file -m "%bin%\androidbootimg.magic" "%file%" 2>nul | "%bin%"\cut -d: -f2- | "%bin%"\cut -d: -f2 | "%bin%"\cut -d( -f2 | "%bin%"\cut -d^) -f1 > "%~nx1-lokitype" 143 | for /f "delims=" %%a in ('type "%~nx1-lokitype"') do @echo Loki patch with "%%a" type detected, reverting . . . 144 | echo. 145 | echo Warning: A dump of your device's aboot.img is required to re-Loki! 146 | "%bin%"\loki_tool unlok "%file%" "%~nx1" >nul 147 | echo. 148 | set "file=%~nx1" 149 | ) else if "%aosphacktest%" == "AMONET" ( 150 | echo Amonet patch detected, reverting . . . 151 | echo. 152 | "%bin%"\dd bs=2048 count=1 conv=notrunc if="%file%" of="%~nx1-microloader.bin" 2>nul 153 | "%bin%"\dd bs=1024 skip=1 conv=notrunc if="%~nx1-microloader.bin" of="%~nx1-head" 2>nul 154 | "%bin%"\truncate -s 1024 "%~nx1-microloader.bin" 155 | "%bin%"\truncate -s 2048 "%~nx1-head" 156 | "%bin%"\dd bs=2048 skip=1 conv=notrunc if="%file%" of="%~nx1-tail" 2>nul 157 | copy /b "%~nx1-head"+"%~nx1-tail" "%~nx1" >nul 158 | set "file=%~nx1" 159 | del "%~nx1-aosphacktype" "%~nx1-head" "%~nx1-tail" 160 | ) else ( 161 | del "%~nx1-aosphacktype" 162 | ) 163 | 164 | for %%i in ("%file%") do @set /a "tailoffset=%%~z%i - 8192" 165 | "%bin%"\dd if="%file%" iflag=skip_bytes skip=%tailoffset% bs=8192 count=1 2>nul | "%bin%"\file -m "%bin%\androidbootimg.magic" - 2>nul | "%bin%"\cut -d: -f2 | "%bin%"\cut -d" " -f2 > "%~nx1-tailtype" 166 | for /f "delims=" %%a in ('type "%~nx1-tailtype"') do @set "tailtype=%%a" 167 | if "%tailtype%" == "data" ( 168 | "%bin%"\tail -n50 "%file%" 2>nul | "%bin%"\file -m "%bin%\androidbootimg.magic" - 2>nul | "%bin%"\cut -d: -f2 | "%bin%"\cut -d" " -f2 > "%~nx1-tailtype" 169 | for /f "delims=" %%a in ('type "%~nx1-tailtype"') do @set "tailtype=%%a" 170 | ) 171 | if not "%tailtype%" == "AVBv1" if not "%tailtype%" == "Bump" if not "%tailtype%" == "SEAndroid" del "%~nx1-tailtype" 172 | if not "%tailtype%" == "AVBv1" if not "%tailtype%" == "AVBv2" goto skipavb 173 | if "%tailtype%" == "AVBv1" ( 174 | "%bin%"\tail -n50 "%file%" 2>nul | "%bin%"\file -m "%bin%\androidbootimg.magic" - 2>nul | "%bin%"\cut -d: -f2 | "%bin%"\cut -d" " -f5 > "%~nx1-avbtype" 175 | move /y "%~nx1-tailtype" "%~nx1-sigtype" >nul 176 | ) 177 | echo Signature with "%tailtype%" type detected. & echo. 178 | :skipavb 179 | if exist "*-tailtype" echo Footer with "%tailtype%" type detected. & echo. 180 | 181 | if not "%imgtype%" == "U-Boot" goto skiptrim 182 | "%bin%"\hexdump -n 4 -s 12 -e '16/1 "%%02x""\n"' "%file%" > "%~nx1-sizetest" 183 | for /f "delims=" %%a in ('type "%~nx1-sizetest"') do @"%bin%"\printf '%%d\n' 0x%%a > "%~nx1-sizetest" 184 | for /f "delims=" %%a in ('type "%~nx1-sizetest"') do @set /a "imgsize = %%a + 64" 185 | if not "%imgsize%" == "%filesize%" ( 186 | echo Trimming . . . 187 | echo. 188 | for /f "delims=" %%a in ('call echo %%imgsize%%') do @"%bin%"\dd bs=%%a count=1 conv=notrunc if="%file%" of="%~nx1" 2>nul 189 | set "file=%~nx1" 190 | ) 191 | del "%~nx1-sizetest" 192 | 193 | :skiptrim 194 | echo Splitting image to "split_img/" . . . 195 | echo. 196 | if "%imgtype%" == "AOSP_VNDR" "%bin%"\unpackbootimg -i "%file%" & set "vendor=vendor_" 197 | if "%imgtype%" == "AOSP" "%bin%"\unpackbootimg -i "%file%" 198 | if "%imgtype%" == "AOSP-PXA" "%bin%"\pxa-unpackbootimg -i "%file%" 199 | if "%imgtype%" == "ELF" ( 200 | md elftool_out 201 | "%bin%"\elftool unpack -i "%file%" -o elftool_out >nul 202 | move /y elftool_out\header "%~nx1-header" >nul 2>&1 203 | rd /s /q elftool_out >nul 2>&1 204 | "%bin%"\unpackelf -i "%file%" 205 | ) 206 | if "%imgtype%" == "KRNL" "%bin%"\dd bs=4096 skip=8 iflag=skip_bytes conv=notrunc if="%file%" of="%~nx1-ramdisk" 2>&1 | "%bin%"\tail -n+3 | "%bin%"\cut -d" " -f1-2 207 | if "%imgtype%" == "OSIP" ( 208 | "%bin%"\mboot -u -f "%file%" 209 | if errorlevel == 1 set "error=1" 210 | move /y hdr "%~nx1-header" >nul 2>&1 211 | move /y sig "%~nx1-sig" >nul 2>&1 212 | move /y cmdline.txt "%~nx1-cmdline" >nul 2>&1 213 | move /y parameter "%~nx1-parameter" >nul 2>&1 214 | move /y bootstub "%~nx1-bootstub" >nul 2>&1 215 | move /y kernel "%~nx1-kernel" >nul 2>&1 216 | move /y ramdisk.cpio.gz "%~nx1-ramdisk" >nul 2>&1 217 | ) 218 | if "%imgtype%" == "U-Boot" ( 219 | "%bin%"\dumpimage -l "%file%" 220 | "%bin%"\dumpimage -l "%file%" > "%~nx1-header" 221 | type "%~nx1-header" | findstr "Name:" | "%bin%"\cut -c15- > "%~nx1-name" 222 | type "%~nx1-header" | findstr "Type:" | "%bin%"\cut -c15- | "%bin%"\cut -d" " -f1 > "%~nx1-arch" 223 | type "%~nx1-header" | findstr "Type:" | "%bin%"\cut -c15- | "%bin%"\cut -d" " -f2 > "%~nx1-os" 224 | type "%~nx1-header" | findstr "Type:" | "%bin%"\cut -c15- | "%bin%"\cut -d" " -f3 | "%bin%"\cut -d- -f1 > "%~nx1-type" 225 | type "%~nx1-header" | findstr "Type:" | "%bin%"\cut -d^( -f2 | "%bin%"\cut -d^) -f1 | "%bin%"\cut -d" " -f1 | "%bin%"\cut -d- -f1 > "%~nx1-comp" 226 | type "%~nx1-header" | findstr "Address:" | "%bin%"\cut -c15- > "%~nx1-addr" 227 | type "%~nx1-header" | findstr "Point:" | "%bin%"\cut -c15- > "%~nx1-ep" 228 | del "%~nx1-header" 229 | "%bin%"\dumpimage -p 0 -o "%~nx1-kernel" "%file%" 230 | if errorlevel == 1 set "error=1" 231 | for /f "delims=" %%a in ('type "%~nx1-type"') do ( 232 | if "%%a" == "Multi" ( 233 | "%bin%"\dumpimage -p 1 -o "%~nx1-ramdisk" "%file%" 234 | ) else if "%%a" == "RAMDisk" ( 235 | move /y "%~nx1-kernel" "%~nx1-ramdisk" >nul 2>&1 236 | ) else ( 237 | copy /y nul "%~nx1-ramdisk" >nul 238 | ) 239 | ) 240 | ) 241 | if errorlevel == 1 set "error=1" 242 | if "%error%" == "1" ( 243 | cd .. 244 | call "%aik%\cleanup.bat" %local% >nul 245 | goto error 246 | ) 247 | echo. 248 | 249 | if exist "*-kernel" ( 250 | "%bin%"\file -m "%bin%\androidbootimg.magic" *-kernel 2>nul | "%bin%"\cut -d: -f2 | "%bin%"\cut -d" " -f2 > "%~nx1-mtktest" 251 | for /f "delims=" %%a in ('type "%~nx1-mtktest"') do @set "mtktest=%%a" 252 | ) 253 | if "%mtktest%" == "MTK" ( 254 | set "mtk=1" 255 | echo MTK header found in kernel, removing . . . 256 | "%bin%"\dd bs=512 skip=1 conv=notrunc if="%~nx1-kernel" of="tempkern" 2>nul 257 | move /y tempkern "%~nx1-kernel" >nul 258 | ) 259 | for /f "delims=" %%a in ('dir /b *-*ramdisk') do @set "ramdiskname=%%a" 260 | "%bin%"\file -m "%bin%\androidbootimg.magic" "%ramdiskname%" 2>nul | "%bin%"\cut -d: -f2 | "%bin%"\cut -d" " -f2 > "%~nx1-mtktest" 261 | for /f "delims=" %%a in ('type "%~nx1-mtktest"') do @set "mtktest=%%a" 262 | "%bin%"\file -m "%bin%\androidbootimg.magic" "%ramdiskname%" 2>nul | "%bin%"\cut -d: -f2 | "%bin%"\cut -d" " -f4 > "%~nx1-mtktype" 263 | for /f "delims=" %%a in ('type "%~nx1-mtktype"') do @set "mtktype=%%a" 264 | if "%mtktest%" == "MTK" ( 265 | if not defined mtk echo Warning: No MTK header found in kernel! & set "mtk=1" 266 | echo MTK header found in "%mtktype%" type ramdisk, removing . . . 267 | "%bin%"\dd bs=512 skip=1 conv=notrunc if="%ramdiskname%" of="temprd" 2>nul 268 | move /y temprd "%ramdiskname%" >nul 269 | ) else ( 270 | if defined mtk ( 271 | if "[%mtktype%]" == "[]" ( 272 | echo Warning: No MTK header found in ramdisk, assuming "rootfs" type! 273 | echo rootfs>"%~nx1-mtktype" 274 | ) 275 | ) else ( 276 | del "%~nx1-mtktype" 277 | ) 278 | ) 279 | del "%~nx1-mtktest" 280 | if defined mtk echo. 281 | 282 | if exist "*-dt" ( 283 | "%bin%"\file -m "%bin%\androidbootimg.magic" *-dt 2>nul | "%bin%"\cut -d: -f2 | "%bin%"\cut -d" " -f2 > "%~nx1-dttype" 284 | for /f "delims=" %%a in ('type "%~nx1-dttype"') do ( 285 | if "%imgtype%" == "ELF" if not "%%a" == "QCDT" if not "%%a" == "ELF" ( 286 | echo Non-QC DTB found, packing kernel and appending . . . 287 | echo. 288 | "%bin%"\gzip --no-name -9 "%~nx1-kernel" 289 | copy /b "%~nx1-kernel.gz"+"%~nx1-dt" "%~nx1-kernel" >nul 290 | del "%~nx1-dt"* "%~nx1-kernel.gz" 291 | ) 292 | ) 293 | ) 294 | 295 | "%bin%"\file -m "%bin%\magic" *-*ramdisk 2>nul | "%bin%"\cut -d: -f2 | "%bin%"\cut -d" " -f2 > "%~nx1-%vendor%ramdiskcomp" 296 | for /f "delims=" %%a in ('type "%~nx1-%vendor%ramdiskcomp"') do @set "ramdiskcomp=%%a" 297 | set "unpackcmd=%ramdiskcomp% -dc" 298 | set "compext=%ramdiskcomp%" 299 | if "%ramdiskcomp%" == "gzip" set "unpackcmd=gzip -dcq" & set "compext=gz" 300 | if "%ramdiskcomp%" == "lzop" set "compext=lzo" 301 | if "%ramdiskcomp%" == "lzma" set "unpackcmd=xz -dc" 302 | if "%ramdiskcomp%" == "bzip2" set "compext=bz2" 303 | if "%ramdiskcomp%" == "lz4" set "unpackcmd=lz4 -dcq" 304 | if "%ramdiskcomp%" == "lz4-l" set "unpackcmd=lz4 -dcq" & set "compext=lz4" 305 | if "%ramdiskcomp%" == "cpio" set "unpackcmd=cat" & set "compext=" 306 | if "%ramdiskcomp%" == "empty" set "compext=empty" 307 | if defined compext set "compext=.%compext%" 308 | ren *-*ramdisk *-*ramdisk.cpio%compext% 309 | cd .. 310 | if "%ramdiskcomp%" == "data" echo Unrecognized format. & goto error 311 | 312 | if "%ramdiskcomp%" == "empty" if not "%ramdiskcomp%" == "cpio" echo Warning: No ramdisk found to be unpacked! & goto nord 313 | echo Unpacking ramdisk to "ramdisk/" . . . 314 | echo. 315 | cd ramdisk 316 | if errorlevel == 1 goto error 317 | echo Compression used: %ramdiskcomp% 318 | if not defined compext if not "%ramdiskcomp%" == "cpio" echo. & echo Unsupported format. & goto error 319 | "%bin%"\%unpackcmd% "..\split_img\%~nx1-%vendor%ramdisk.cpio%compext%" | "%bin%"\cpio -i -d --no-absolute-filenames 320 | if errorlevel == 1 goto error 321 | cd .. 322 | :nord 323 | "%bin%"\chmod -f 755 ramdisk >nul 2>&1 324 | echo. 325 | 326 | echo Done! 327 | goto end 328 | 329 | :noargs 330 | echo No image file supplied. 331 | 332 | :error 333 | echo Error! 334 | set "exitcode=1" 335 | 336 | :end 337 | echo. 338 | echo %cmdcmdline% | findstr /i pushd >nul 339 | if errorlevel 1 pause 340 | exit /b %exitcode% 341 | --------------------------------------------------------------------------------