1ZIPDETAILS(1) User Contributed Perl Documentation ZIPDETAILS(1)
2
3
4
6 zipdetails - display the internal structure of zip files
7
9 zipdetails [-v][--scan][--redact][--utc] zipfile.zip
10 zipdetails -h
11 zipdetails --version
12
14 This program creates a detailed report on the internal structure of zip
15 files. For each item of metadata within a zip file the program will
16 output
17
18 the offset into the zip file where the item is located.
19 a textual representation for the item.
20 an optional hex dump of the item.
21
22 The program assumes a prior understanding of the internal structure of
23 Zip files. You should have a copy of the Zip APPNOTE.TXT
24 <http://www.pkware.com/documents/casestudies/APPNOTE.TXT> file at hand
25 to help understand the output from this program.
26
27 Default Behaviour
28 By default the program expects to be given a well-formed zip file. It
29 will navigate the Zip file by first parsing the zip central directory
30 at the end of the file. If that is found, it will then walk through
31 the zip records starting at the beginning of the file. Any badly formed
32 zip data structures encountered are likely to terminate the program.
33
34 If the program finds any structural problems with the zip file it will
35 print a summary at the end of the output report. The set of error cases
36 reported is very much a work in progress, so don't rely on this feature
37 to find all the possible errors in a zip file. If you have suggestions
38 for use-cases where this could be enhanced please consider creating an
39 enhancement request (see "SUPPORT").
40
41 Date/time fields are found in zip files are displayed in local time.
42 Use the "--utc" option to display these fields in Coordinated Universal
43 Time (UTC).
44
45 Scan-Mode
46 If you do have a potentially corrupt zip file, particulatly where the
47 central directory at the end of the file is absent/incomplete, you can
48 try usng the "--scan" option to search for zip records that are still
49 present.
50
51 When Scan-mode is enabled, the program will walk the zip file from the
52 start, blindly looking for the 4-byte signatures that preceed each of
53 the zip data structures. If it finds any of the recognised signatures
54 it will attempt to dump the associated zip record. For very large zip
55 files, this operation can take a long time to run.
56
57 Note that the 4-byte signatures used in zip files can sometimes match
58 with random data stored in the zip file, so care is needed interpreting
59 the results.
60
61 OPTIONS
62 -h Display help
63
64 --redact
65 Obscure filenames in the output. Handy for the use case where the
66 zip files contains sensitive data that cannot be shared.
67
68 --scan
69 Walk the zip file loking for possible zip records. Can be error-
70 prone. See "Scan-Mode"
71
72 --utc
73 By default, date/time fields are displayed in local time. Use this
74 option to display them in in Coordinated Universal Time (UTC).
75
76 -v Enable Verbose mode. See "Verbose Output".
77
78 --version
79 Display version number of the program and exit.
80
81 Default Output
82 By default zipdetails will output the details of the zip file in three
83 columns.
84
85 Column 1
86 This contains the offset from the start of the file in hex.
87
88 Column 2
89 This contains a textual description of the field.
90
91 Column 3
92 If the field contains a numeric value it will be displayed in hex.
93 Zip stores most numbers in little-endian format - the value
94 displayed will have the little-endian encoding removed.
95
96 Next, is an optional description of what the value means.
97
98 For example, assuming you have a zip file with two entries, like this
99
100 $ unzip -l test.zip
101 Archive: setup/test.zip
102 Length Date Time Name
103 --------- ---------- ----- ----
104 6 2021-03-23 18:52 latters.txt
105 6 2021-03-23 18:52 numbers.txt
106 --------- -------
107 12 2 files
108
109 Running "zipdetails" will gives this output
110
111 $ zipdetails test.zip
112
113 0000 LOCAL HEADER #1 04034B50
114 0004 Extract Zip Spec 0A '1.0'
115 0005 Extract OS 00 'MS-DOS'
116 0006 General Purpose Flag 0000
117 0008 Compression Method 0000 'Stored'
118 000A Last Mod Time 5277983D 'Tue Mar 23 19:01:58 2021'
119 000E CRC 0F8A149C
120 0012 Compressed Length 00000006
121 0016 Uncompressed Length 00000006
122 001A Filename Length 000B
123 001C Extra Length 0000
124 001E Filename 'letters.txt'
125 0029 PAYLOAD abcde.
126
127 002F LOCAL HEADER #2 04034B50
128 0033 Extract Zip Spec 0A '1.0'
129 0034 Extract OS 00 'MS-DOS'
130 0035 General Purpose Flag 0000
131 0037 Compression Method 0000 'Stored'
132 0039 Last Mod Time 5277983D 'Tue Mar 23 19:01:58 2021'
133 003D CRC 261DAFE6
134 0041 Compressed Length 00000006
135 0045 Uncompressed Length 00000006
136 0049 Filename Length 000B
137 004B Extra Length 0000
138 004D Filename 'numbers.txt'
139 0058 PAYLOAD 12345.
140
141 005E CENTRAL HEADER #1 02014B50
142 0062 Created Zip Spec 1E '3.0'
143 0063 Created OS 03 'Unix'
144 0064 Extract Zip Spec 0A '1.0'
145 0065 Extract OS 00 'MS-DOS'
146 0066 General Purpose Flag 0000
147 0068 Compression Method 0000 'Stored'
148 006A Last Mod Time 5277983D 'Tue Mar 23 19:01:58 2021'
149 006E CRC 0F8A149C
150 0072 Compressed Length 00000006
151 0076 Uncompressed Length 00000006
152 007A Filename Length 000B
153 007C Extra Length 0000
154 007E Comment Length 0000
155 0080 Disk Start 0000
156 0082 Int File Attributes 0001
157 [Bit 0] 1 Text Data
158 0084 Ext File Attributes 81B40000
159 0088 Local Header Offset 00000000
160 008C Filename 'letters.txt'
161
162 0097 CENTRAL HEADER #2 02014B50
163 009B Created Zip Spec 1E '3.0'
164 009C Created OS 03 'Unix'
165 009D Extract Zip Spec 0A '1.0'
166 009E Extract OS 00 'MS-DOS'
167 009F General Purpose Flag 0000
168 00A1 Compression Method 0000 'Stored'
169 00A3 Last Mod Time 5277983D 'Tue Mar 23 19:01:58 2021'
170 00A7 CRC 261DAFE6
171 00AB Compressed Length 00000006
172 00AF Uncompressed Length 00000006
173 00B3 Filename Length 000B
174 00B5 Extra Length 0000
175 00B7 Comment Length 0000
176 00B9 Disk Start 0000
177 00BB Int File Attributes 0001
178 [Bit 0] 1 Text Data
179 00BD Ext File Attributes 81B40000
180 00C1 Local Header Offset 0000002F
181 00C5 Filename 'numbers.txt'
182
183 00D0 END CENTRAL HEADER 06054B50
184 00D4 Number of this disk 0000
185 00D6 Central Dir Disk no 0000
186 00D8 Entries in this disk 0002
187 00DA Total Entries 0002
188 00DC Size of Central Dir 00000072
189 00E0 Offset to Central Dir 0000005E
190 00E4 Comment Length 0000
191 Done
192
193 Verbose Output
194 If the "-v" option is present, column 1 is expanded to include
195
196 • The offset from the start of the file in hex.
197
198 • The length of the field in hex.
199
200 • A hex dump of the bytes in field in the order they are stored in
201 the zip file.
202
203 Here is the same zip file dumped using the "zipdetails" "-v" option:
204
205 $ zipdetails -v test.zip
206
207 0000 0004 50 4B 03 04 LOCAL HEADER #1 04034B50
208 0004 0001 0A Extract Zip Spec 0A '1.0'
209 0005 0001 00 Extract OS 00 'MS-DOS'
210 0006 0002 00 00 General Purpose Flag 0000
211 0008 0002 00 00 Compression Method 0000 'Stored'
212 000A 0004 3D 98 77 52 Last Mod Time 5277983D 'Tue Mar 23 19:01:58 2021'
213 000E 0004 9C 14 8A 0F CRC 0F8A149C
214 0012 0004 06 00 00 00 Compressed Length 00000006
215 0016 0004 06 00 00 00 Uncompressed Length 00000006
216 001A 0002 0B 00 Filename Length 000B
217 001C 0002 00 00 Extra Length 0000
218 001E 000B 6C 65 74 74 Filename 'letters.txt'
219 65 72 73 2E
220 74 78 74
221 0029 0006 61 62 63 64 PAYLOAD abcde.
222 65 0A
223
224 002F 0004 50 4B 03 04 LOCAL HEADER #2 04034B50
225 0033 0001 0A Extract Zip Spec 0A '1.0'
226 0034 0001 00 Extract OS 00 'MS-DOS'
227 0035 0002 00 00 General Purpose Flag 0000
228 0037 0002 00 00 Compression Method 0000 'Stored'
229 0039 0004 3D 98 77 52 Last Mod Time 5277983D 'Tue Mar 23 19:01:58 2021'
230 003D 0004 E6 AF 1D 26 CRC 261DAFE6
231 0041 0004 06 00 00 00 Compressed Length 00000006
232 0045 0004 06 00 00 00 Uncompressed Length 00000006
233 0049 0002 0B 00 Filename Length 000B
234 004B 0002 00 00 Extra Length 0000
235 004D 000B 6E 75 6D 62 Filename 'numbers.txt'
236 65 72 73 2E
237 74 78 74
238 0058 0006 31 32 33 34 PAYLOAD 12345.
239 35 0A
240
241 005E 0004 50 4B 01 02 CENTRAL HEADER #1 02014B50
242 0062 0001 1E Created Zip Spec 1E '3.0'
243 0063 0001 03 Created OS 03 'Unix'
244 0064 0001 0A Extract Zip Spec 0A '1.0'
245 0065 0001 00 Extract OS 00 'MS-DOS'
246 0066 0002 00 00 General Purpose Flag 0000
247 0068 0002 00 00 Compression Method 0000 'Stored'
248 006A 0004 3D 98 77 52 Last Mod Time 5277983D 'Tue Mar 23 19:01:58 2021'
249 006E 0004 9C 14 8A 0F CRC 0F8A149C
250 0072 0004 06 00 00 00 Compressed Length 00000006
251 0076 0004 06 00 00 00 Uncompressed Length 00000006
252 007A 0002 0B 00 Filename Length 000B
253 007C 0002 00 00 Extra Length 0000
254 007E 0002 00 00 Comment Length 0000
255 0080 0002 00 00 Disk Start 0000
256 0082 0002 01 00 Int File Attributes 0001
257 [Bit 0] 1 Text Data
258 0084 0004 00 00 B4 81 Ext File Attributes 81B40000
259 0088 0004 00 00 00 00 Local Header Offset 00000000
260 008C 000B 6C 65 74 74 Filename 'letters.txt'
261 65 72 73 2E
262 74 78 74
263
264 0097 0004 50 4B 01 02 CENTRAL HEADER #2 02014B50
265 009B 0001 1E Created Zip Spec 1E '3.0'
266 009C 0001 03 Created OS 03 'Unix'
267 009D 0001 0A Extract Zip Spec 0A '1.0'
268 009E 0001 00 Extract OS 00 'MS-DOS'
269 009F 0002 00 00 General Purpose Flag 0000
270 00A1 0002 00 00 Compression Method 0000 'Stored'
271 00A3 0004 3D 98 77 52 Last Mod Time 5277983D 'Tue Mar 23 19:01:58 2021'
272 00A7 0004 E6 AF 1D 26 CRC 261DAFE6
273 00AB 0004 06 00 00 00 Compressed Length 00000006
274 00AF 0004 06 00 00 00 Uncompressed Length 00000006
275 00B3 0002 0B 00 Filename Length 000B
276 00B5 0002 00 00 Extra Length 0000
277 00B7 0002 00 00 Comment Length 0000
278 00B9 0002 00 00 Disk Start 0000
279 00BB 0002 01 00 Int File Attributes 0001
280 [Bit 0] 1 Text Data
281 00BD 0004 00 00 B4 81 Ext File Attributes 81B40000
282 00C1 0004 2F 00 00 00 Local Header Offset 0000002F
283 00C5 000B 6E 75 6D 62 Filename 'numbers.txt'
284 65 72 73 2E
285 74 78 74
286
287 00D0 0004 50 4B 05 06 END CENTRAL HEADER 06054B50
288 00D4 0002 00 00 Number of this disk 0000
289 00D6 0002 00 00 Central Dir Disk no 0000
290 00D8 0002 02 00 Entries in this disk 0002
291 00DA 0002 02 00 Total Entries 0002
292 00DC 0004 72 00 00 00 Size of Central Dir 00000072
293 00E0 0004 5E 00 00 00 Offset to Central Dir 0000005E
294 00E4 0002 00 00 Comment Length 0000
295 Done
296
298 The following zip file features are not supported by this program:
299
300 • Multi-part archives.
301
302 • The strong encryption features defined in the APPNOTE.TXT
303 <http://www.pkware.com/documents/casestudies/APPNOTE.TXT>
304 document.
305
307 Error handling is a work in progress. If the program encounters a
308 problem reading a zip file it is likely to terminate with an unhelpful
309 error message.
310
312 General feedback/questions/bug reports should be sent to
313 <https://github.com/pmqs/zipdetails/issues>.
314
316 The primary reference for Zip files is APPNOTE.TXT
317 <http://www.pkware.com/documents/casestudies/APPNOTE.TXT>.
318
319 An alternative reference is the Info-Zip appnote. This is available
320 from <ftp://ftp.info-zip.org/pub/infozip/doc/>
321
322 For details of WinZip AES encryption see AES Encryption Information:
323 Encryption Specification AE-1 and AE-2
324 <https://www.winzip.com/win/es/aes_info.html>.
325
326 The "zipinfo" program that comes with the info-zip distribution
327 (<http://www.info-zip.org/>) can also display details of the structure
328 of a zip file.
329
331 Paul Marquess pmqs@cpan.org.
332
334 Copyright (c) 2011-2022 Paul Marquess. All rights reserved.
335
336 This program is free software; you can redistribute it and/or modify it
337 under the same terms as Perl itself.
338
339
340
341perl v5.38.0 2023-07-26 ZIPDETAILS(1)