mirror of
https://github.com/wader/fq.git
synced 2024-11-25 23:13:19 +03:00
a83cac6021
MSDOS time/date was read in wrong order and also did not take into account that the bit ranges in the shortis are in little-endian. Remodel modification_time/date to be one struct with fat_time, fat_date LE shorts and then synthetic values for day, hours, minute etc and also a unix field with the timestamp as unix time. Also refactor and clenaup extra fields/extended code a bit. Fixes #792
131 lines
14 KiB
Plaintext
131 lines
14 KiB
Plaintext
# from https://github.com/nih-at/libzip/blob/main/regress/zip64.zip
|
|
$ fq -o uncompress=false dv bigzero-zip.zip
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: bigzero-zip.zip (zip) 0x0-0x28fa (10490)
|
|
| | | local_files[0:1]: 0x0-0x2893 (10387)
|
|
| | | [0]{}: local_file 0x0-0x2893 (10387)
|
|
0x0000|50 4b 03 04 |PK.. | signature: raw bits (valid) 0x0-0x4 (4)
|
|
0x0000| 14 00 | .. | version_needed: 20 0x4-0x6 (2)
|
|
| | | flags{}: 0x6-0x8 (2)
|
|
0x0000| 02 | . | unused0: 0 0x6-0x6.1 (0.1)
|
|
0x0000| 02 | . | strong_encryption: false 0x6.1-0x6.2 (0.1)
|
|
0x0000| 02 | . | compressed_patched_data: false 0x6.2-0x6.3 (0.1)
|
|
0x0000| 02 | . | enhanced_deflation: false 0x6.3-0x6.4 (0.1)
|
|
0x0000| 02 | . | data_descriptor: false 0x6.4-0x6.5 (0.1)
|
|
0x0000| 02 | . | compression0: false 0x6.5-0x6.6 (0.1)
|
|
0x0000| 02 | . | compression1: true 0x6.6-0x6.7 (0.1)
|
|
0x0000| 02 | . | encrypted: false 0x6.7-0x7 (0.1)
|
|
0x0000| 00 | . | reserved0: 0 0x7-0x7.2 (0.2)
|
|
0x0000| 00 | . | mask_header_values: false 0x7.2-0x7.3 (0.1)
|
|
0x0000| 00 | . | reserved1: false 0x7.3-0x7.4 (0.1)
|
|
0x0000| 00 | . | language_encoding: false 0x7.4-0x7.5 (0.1)
|
|
0x0000| 00 | . | unused1: 0 0x7.5-0x8 (0.3)
|
|
0x0000| 08 00 | .. | compression_method: "deflated" (8) 0x8-0xa (2)
|
|
| | | last_modification{}: 0xa-0xe (4)
|
|
0x0000| c8 78 | .x | fat_time: 0x78c8 0xa-0xc (2)
|
|
| | | second: 16 (8)
|
|
| | | minute: 6
|
|
| | | hour: 15
|
|
0x0000| 84 45 | .E | fat_date: 0x4584 0xc-0xe (2)
|
|
| | | day: 4
|
|
| | | month: 12
|
|
| | | year: 2014 (34)
|
|
| | | unix_guess: 1417705576 (2014-12-04T15:06:16)
|
|
0x0000| 54 81| T.| crc32_uncompressed: 0xae158154 0xe-0x12 (4)
|
|
0x0010|15 ae |.. |
|
|
0x0010| 4e 28 00 00 | N(.. | compressed_size: 10318 0x12-0x16 (4)
|
|
0x0010| b9 9a 3f 00 | ..?. | uncompressed_size: 4168377 0x16-0x1a (4)
|
|
0x0010| 0b 00 | .. | file_name_length: 11 0x1a-0x1c (2)
|
|
0x0010| 1c 00 | .. | extra_field_length: 28 0x1c-0x1e (2)
|
|
0x0010| 62 69| bi| file_name: "bigzero.zip" 0x1e-0x29 (11)
|
|
0x0020|67 7a 65 72 6f 2e 7a 69 70 |gzero.zip |
|
|
| | | extra_fields[0:2]: 0x29-0x45 (28)
|
|
| | | [0]{}: extra_field 0x29-0x36 (13)
|
|
0x0020| 55 54 | UT | tag: 0x5455 (extended timestamp) 0x29-0x2b (2)
|
|
0x0020| 09 00 | .. | size: 9 0x2b-0x2d (2)
|
|
| | | flags{}: 0x2d-0x2e (1)
|
|
0x0020| 03 | . | unused: 0 0x2d-0x2d.5 (0.5)
|
|
0x0020| 03 | . | creation_time_present: false 0x2d.5-0x2d.6 (0.1)
|
|
0x0020| 03 | . | access_time_present: true 0x2d.6-0x2d.7 (0.1)
|
|
0x0020| 03 | . | modification_time_present: true 0x2d.7-0x2e (0.1)
|
|
0x0020| 57 6a| Wj| modification_time: 1417701975 (2014-12-04T14:06:15Z) 0x2e-0x32 (4)
|
|
0x0030|80 54 |.T |
|
|
0x0030| 7e 6a 80 54 | ~j.T | access_time: 1417702014 (2014-12-04T14:06:54Z) 0x32-0x36 (4)
|
|
| | | [1]{}: extra_field 0x36-0x45 (15)
|
|
0x0030| 75 78 | ux | tag: 0x7875 (UNIX UID/GID) 0x36-0x38 (2)
|
|
0x0030| 0b 00 | .. | size: 11 0x38-0x3a (2)
|
|
0x0030| 01 04 74 00 00 00| ..t...| data: raw bits 0x3a-0x45 (11)
|
|
0x0040|04 14 00 00 00 |..... |
|
|
0x0040| ed dd bf aa 03 df bf df e7 ef 9c| ...........| compressed: raw bits 0x45-0x2893 (10318)
|
|
0x0050|59 39 e7 60 8c fe 40 94 66 1a 5d 40 4e af 46 9c|Y9.`..@.f.]@N.F.|
|
|
* |until 0x2892.7 (10318) | |
|
|
| | | central_directories[0:1]: 0x2893-0x28e4 (81)
|
|
| | | [0]{}: central_directory 0x2893-0x28e4 (81)
|
|
0x2890| 50 4b 01 02 | PK.. | signature: raw bits (valid) 0x2893-0x2897 (4)
|
|
0x2890| 1e 03 | .. | version_made_by: 798 0x2897-0x2899 (2)
|
|
0x2890| 14 00 | .. | version_needed: 20 0x2899-0x289b (2)
|
|
| | | flags{}: 0x289b-0x289d (2)
|
|
0x2890| 02 | . | unused0: 0 0x289b-0x289b.1 (0.1)
|
|
0x2890| 02 | . | strong_encryption: false 0x289b.1-0x289b.2 (0.1)
|
|
0x2890| 02 | . | compressed_patched_data: false 0x289b.2-0x289b.3 (0.1)
|
|
0x2890| 02 | . | enhanced_deflation: false 0x289b.3-0x289b.4 (0.1)
|
|
0x2890| 02 | . | data_descriptor: false 0x289b.4-0x289b.5 (0.1)
|
|
0x2890| 02 | . | compression0: false 0x289b.5-0x289b.6 (0.1)
|
|
0x2890| 02 | . | compression1: true 0x289b.6-0x289b.7 (0.1)
|
|
0x2890| 02 | . | encrypted: false 0x289b.7-0x289c (0.1)
|
|
0x2890| 00 | . | reserved0: 0 0x289c-0x289c.2 (0.2)
|
|
0x2890| 00 | . | mask_header_values: false 0x289c.2-0x289c.3 (0.1)
|
|
0x2890| 00 | . | reserved1: false 0x289c.3-0x289c.4 (0.1)
|
|
0x2890| 00 | . | language_encoding: false 0x289c.4-0x289c.5 (0.1)
|
|
0x2890| 00 | . | unused1: 0 0x289c.5-0x289d (0.3)
|
|
0x2890| 08 00 | .. | compression_method: "deflated" (8) 0x289d-0x289f (2)
|
|
| | | last_modification{}: 0x289f-0x28a3 (4)
|
|
0x2890| c8| .| fat_time: 0x78c8 0x289f-0x28a1 (2)
|
|
0x28a0|78 |x |
|
|
| | | second: 16 (8)
|
|
| | | minute: 6
|
|
| | | hour: 15
|
|
0x28a0| 84 45 | .E | fat_date: 0x4584 0x28a1-0x28a3 (2)
|
|
| | | day: 4
|
|
| | | month: 12
|
|
| | | year: 2014 (34)
|
|
| | | unix_guess: 1417705576 (2014-12-04T15:06:16)
|
|
0x28a0| 54 81 15 ae | T... | crc32_uncompressed: 0xae158154 0x28a3-0x28a7 (4)
|
|
0x28a0| 4e 28 00 00 | N(.. | compressed_size: 10318 0x28a7-0x28ab (4)
|
|
0x28a0| b9 9a 3f 00 | ..?. | uncompressed_size: 4168377 0x28ab-0x28af (4)
|
|
0x28a0| 0b| .| file_name_length: 11 0x28af-0x28b1 (2)
|
|
0x28b0|00 |. |
|
|
0x28b0| 18 00 | .. | extra_field_length: 24 0x28b1-0x28b3 (2)
|
|
0x28b0| 00 00 | .. | file_comment_length: 0 0x28b3-0x28b5 (2)
|
|
0x28b0| 00 00 | .. | disk_number_where_file_starts: 0 0x28b5-0x28b7 (2)
|
|
0x28b0| 00 00 | .. | internal_file_attributes: 0 0x28b7-0x28b9 (2)
|
|
0x28b0| 00 00 b4 81 | .... | external_file_attributes: 2176057344 0x28b9-0x28bd (4)
|
|
0x28b0| 00 00 00| ...| relative_offset_of_local_file_header: 0 0x28bd-0x28c1 (4)
|
|
0x28c0|00 |. |
|
|
0x28c0| 62 69 67 7a 65 72 6f 2e 7a 69 70 | bigzero.zip | file_name: "bigzero.zip" 0x28c1-0x28cc (11)
|
|
| | | extra_fields[0:2]: 0x28cc-0x28e4 (24)
|
|
| | | [0]{}: extra_field 0x28cc-0x28d5 (9)
|
|
0x28c0| 55 54 | UT | tag: 0x5455 (extended timestamp) 0x28cc-0x28ce (2)
|
|
0x28c0| 05 00| ..| size: 5 0x28ce-0x28d0 (2)
|
|
| | | flags{}: 0x28d0-0x28d1 (1)
|
|
0x28d0|03 |. | unused: 0 0x28d0-0x28d0.5 (0.5)
|
|
0x28d0|03 |. | creation_time_present: false 0x28d0.5-0x28d0.6 (0.1)
|
|
0x28d0|03 |. | access_time_present: true 0x28d0.6-0x28d0.7 (0.1)
|
|
0x28d0|03 |. | modification_time_present: true 0x28d0.7-0x28d1 (0.1)
|
|
0x28d0| 57 6a 80 54 | Wj.T | modification_time: 1417701975 (2014-12-04T14:06:15Z) 0x28d1-0x28d5 (4)
|
|
| | | [1]{}: extra_field 0x28d5-0x28e4 (15)
|
|
0x28d0| 75 78 | ux | tag: 0x7875 (UNIX UID/GID) 0x28d5-0x28d7 (2)
|
|
0x28d0| 0b 00 | .. | size: 11 0x28d7-0x28d9 (2)
|
|
0x28d0| 01 04 74 00 00 00 04| ..t....| data: raw bits 0x28d9-0x28e4 (11)
|
|
0x28e0|14 00 00 00 |.... |
|
|
| | | file_comment: "" 0x28e4-0x28e4 (0)
|
|
| | | end_of_central_directory_record{}: 0x28e4-0x28fa (22)
|
|
0x28e0| 50 4b 05 06 | PK.. | signature: raw bits (valid) 0x28e4-0x28e8 (4)
|
|
0x28e0| 00 00 | .. | disk_nr: 0 0x28e8-0x28ea (2)
|
|
0x28e0| 00 00 | .. | central_directory_start_disk_nr: 0 0x28ea-0x28ec (2)
|
|
0x28e0| 01 00 | .. | nr_of_central_directory_records_on_disk: 1 0x28ec-0x28ee (2)
|
|
0x28e0| 01 00| ..| nr_of_central_directory_records: 1 0x28ee-0x28f0 (2)
|
|
0x28f0|51 00 00 00 |Q... | size_of_central_directory: 81 0x28f0-0x28f4 (4)
|
|
0x28f0| 93 28 00 00 | .(.. | offset_of_start_of_central_directory: 10387 0x28f4-0x28f8 (4)
|
|
0x28f0| 00 00| | ..| | comment_length: 0 0x28f8-0x28fa (2)
|
|
| | | comment: "" 0x28fa-0x28fa (0)
|