Compare commits
132 Commits
6387109495
...
d5b1a91154
Author | SHA1 | Date | |
---|---|---|---|
|
d5b1a91154 | ||
|
496849daa5 | ||
|
ebf063d1c0 | ||
|
b8eec4078f | ||
|
6e13b4b550 | ||
|
9eee65072f | ||
|
6db6a54d13 | ||
|
08ced4515f | ||
|
6059b9ee1b | ||
|
f746dab7b2 | ||
|
b482556025 | ||
|
4674060dfe | ||
|
ad2c032c7e | ||
|
d30755b06e | ||
|
2b12258eba | ||
|
efa847faf1 | ||
|
ee2ee24dbb | ||
|
d04a846f10 | ||
|
79992b341a | ||
|
ff718d8071 | ||
|
70b1b0d6a3 | ||
|
a3f5e29d8f | ||
|
f6609ccb0f | ||
|
4f90a2eaae | ||
|
63f7d79c32 | ||
|
240ae7f57d | ||
|
ebffb3be7b | ||
|
ad33225f20 | ||
|
208b3e6bf2 | ||
|
837de9f658 | ||
|
87b6c4dd6a | ||
|
5cbda8fbb0 | ||
|
8d31040fd2 | ||
|
8009b6f661 | ||
|
1784c43824 | ||
|
2f858b1c90 | ||
|
c8f9cdc9d7 | ||
|
b6ac25cb39 | ||
|
daba6b5497 | ||
|
1d6e6f590d | ||
|
b45d7d621c | ||
|
b2aa59f759 | ||
|
15a7060bff | ||
|
c2f0189371 | ||
|
2476330deb | ||
|
a0a5460cf6 | ||
|
33c93918ba | ||
|
77c000e6e9 | ||
|
0afb5b592e | ||
|
93eb6e83ef | ||
|
ed6851163f | ||
|
b67ce0268c | ||
|
c5e84236df | ||
|
bf7fa07c41 | ||
|
c6165c0caf | ||
|
48351028c5 | ||
|
4ac96a67e0 | ||
|
b542ff1d6c | ||
|
621d7f2c22 | ||
|
56cd9e83ed | ||
|
f5fd587350 | ||
|
90c0d9be94 | ||
|
7625b97a09 | ||
|
14aeab0b73 | ||
|
a3b63b1037 | ||
|
a00cfe0342 | ||
|
80bccc91ed | ||
|
ae519be2fd | ||
|
e26704049f | ||
|
3c93e21cfd | ||
|
689e9cc49a | ||
|
72b4569b15 | ||
|
4f55b6afc6 | ||
|
c364e1b661 | ||
|
b8be180e31 | ||
|
82d96cf990 | ||
|
94e80864d7 | ||
|
8f3c9cef20 | ||
|
2ea70c42ac | ||
|
961101ad0d | ||
|
ed3a126f0a | ||
|
853f78decc | ||
|
36e8287c2b | ||
|
8855d7addf | ||
|
f3b54042b1 | ||
|
b5a96e06e1 | ||
|
87052733e6 | ||
|
79e7c71c73 | ||
|
0db671f626 | ||
|
1e88b9d2c0 | ||
|
354f7eaabc | ||
|
2657988daf | ||
|
9aa99b47a3 | ||
|
ac596de1ad | ||
|
85f60df2a7 | ||
|
28ccfdd079 | ||
|
d30a8fe7bf | ||
|
ba9ecb5418 | ||
|
043f067f27 | ||
|
f7815d4c41 | ||
|
08df7f45c8 | ||
|
77b2c0225f | ||
|
735256b905 | ||
|
e8b28a6d39 | ||
|
aaa43dfb81 | ||
|
e6f98ae148 | ||
|
7500a8b767 | ||
|
ae296218cb | ||
|
3f5996171b | ||
|
a577c3987c | ||
|
1c24f64d9b | ||
|
a8dd146cb2 | ||
|
e741ca7888 | ||
|
e1da76df6c | ||
|
225fd50783 | ||
|
4f2cdce290 | ||
|
f7b067b6ba | ||
|
8ebe5da6a7 | ||
|
15ed1611b8 | ||
|
7ca701d950 | ||
|
76307e4d33 | ||
|
2a90479fb7 | ||
|
788088f84d | ||
|
f7ae961e1e | ||
|
55470deb99 | ||
|
5684bc43c5 | ||
|
6219d57c35 | ||
|
33e5851d03 | ||
|
88622804f7 | ||
|
54c6f0cdc1 | ||
|
46dbf5b7da | ||
|
bfcaa63192 |
6
.github/workflows/ci.yml
vendored
@ -7,7 +7,7 @@ on:
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
GOLANGCILINT_VERSION: "1.56.1"
|
||||
GOLANGCILINT_VERSION: "1.57.2"
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
@ -15,7 +15,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: "1.22.0"
|
||||
go-version: "1.22.2"
|
||||
- uses: actions/checkout@v3
|
||||
- uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
@ -47,7 +47,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: "1.22.0"
|
||||
go-version: "1.22.2"
|
||||
- name: Test
|
||||
env:
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
|
4
.github/workflows/release.yml
vendored
@ -15,8 +15,8 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: "1.22.0"
|
||||
- uses: goreleaser/goreleaser-action@v2
|
||||
go-version: "1.22.2"
|
||||
- uses: goreleaser/goreleaser-action@v5
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
|
@ -23,6 +23,8 @@ linters:
|
||||
- unconvert
|
||||
- unparam
|
||||
- wastedassign
|
||||
- staticcheck
|
||||
- govet
|
||||
|
||||
linters-settings:
|
||||
revive:
|
||||
@ -41,6 +43,13 @@ linters-settings:
|
||||
- rela
|
||||
- equalisation
|
||||
- synchronisation
|
||||
govet:
|
||||
enable-all: true
|
||||
disable:
|
||||
- fieldalignment
|
||||
- shadow
|
||||
staticcheck:
|
||||
checks: ["all"]
|
||||
|
||||
run:
|
||||
timeout: 5m
|
||||
|
@ -59,7 +59,7 @@ brews:
|
||||
repository:
|
||||
owner: wader
|
||||
name: homebrew-tap
|
||||
folder: Formula
|
||||
directory: Formula
|
||||
homepage: https://github.com/wader/fq
|
||||
description: jq for binary formats
|
||||
license: MIT
|
||||
|
223
CHANGES.md
@ -1,3 +1,226 @@
|
||||
# 0.11.0
|
||||
|
||||
New iNES/NES 2.0 ROM decoder (thanks @mlofjard) and basic JPEG 2000 format support. jq language improvements and fixes from gojq. And as always various decoder improvements and fixes.
|
||||
|
||||
## Changes
|
||||
|
||||
- Add `string_truncate` option to configure how to truncate long strings when displaying a decode value tree. `dd`, `dv` etc set truncate length to zero to not truncate. #919
|
||||
- gojq updates from upstream:
|
||||
- Implement `ltrim`, `rtrim`, and `trim` functions
|
||||
- Fix object construction with duplicate keys (`{x:0,y:1} | {a:.x,a:.y}`)
|
||||
- Fix `halt` and `halt_error` functions to stop the command execution immediately
|
||||
- Fix variable scope of binding syntax (`"a" as $v | def f: $v; "b" as $v | f`)
|
||||
- Fix `ltrimstr` and `rtrimstr` functions to emit error on non-string input
|
||||
- Fix `nearbyint` and `rint` functions to round ties to even
|
||||
- Improve parser to allow `reduce`, `foreach`, `if`, `try`-`catch` syntax as object values
|
||||
- Remove `pow10` in favor of `exp10`, define `scalbn` and `scalbln` by `ldexp`
|
||||
- Fix issue using decode value with `ltrimstr`/`rtrimstr`.
|
||||
|
||||
## Format changes
|
||||
|
||||
- `fit`
|
||||
- Skip array fields on pre read messages. #878
|
||||
- Fixed subfield referencing fields below self in message. #877
|
||||
- `jp2c` New JPEG 2000 codestream decoder. #928
|
||||
- `icc_profile` Strip whitespace in header and tag strings. #912
|
||||
- `mp4`
|
||||
- Add `jp2c`, `jp2h`, `ihdr` `jP` JPEG 2000 related boxes support. #928
|
||||
- Add `thmb` box support. #897
|
||||
- Turns out for qt brand `hdlr` component name might be zero bytes. #896
|
||||
- `nes` New iNES/NES 2.0 ROM decoder (thanks @mlofjard). #893
|
||||
|
||||
## Changelog
|
||||
|
||||
* f7b067b6 Fixed subfield referencing fields below self in message
|
||||
* 9aa99b47 Update docker-golang to 1.22.1 from 1.22.0
|
||||
* 0afb5b59 Update docker-golang to 1.22.2 from 1.22.1
|
||||
* 2657988d Update github-go-version to 1.22.1 from 1.22.0
|
||||
* 33c93918 Update github-go-version to 1.22.2 from 1.22.1
|
||||
* a577c398 Update github-golangci-lint to 1.56.2 from 1.56.1
|
||||
* 82d96cf9 Update github-golangci-lint to 1.57.0 from 1.56.2
|
||||
* 72b4569b Update github-golangci-lint to 1.57.1 from 1.57.0
|
||||
* 14aeab0b Update github-golangci-lint to 1.57.2 from 1.57.1
|
||||
* 735256b9 Update gomod-golang-x-crypto to 0.20.0 from 0.19.0
|
||||
* 043f067f Update gomod-golang-x-crypto to 0.21.0 from 0.20.0
|
||||
* 15a7060b Update gomod-golang-x-crypto to 0.22.0 from 0.21.0
|
||||
* 85f60df2 Update gomod-golang-x-net to 0.22.0 from 0.21.0
|
||||
* 77c000e6 Update gomod-golang-x-net to 0.23.0 from 0.22.0
|
||||
* daba6b54 Update gomod-golang-x-net to 0.24.0 from 0.23.0
|
||||
* ba9ecb54 Update gomod-golang-x-term to 0.18.0 from 0.17.0
|
||||
* b2aa59f7 Update gomod-golang-x-term to 0.19.0 from 0.18.0
|
||||
* 1c24f64d Update make-golangci-lint to 1.56.2 from 1.56.1
|
||||
* 94e80864 Update make-golangci-lint to 1.57.0 from 1.56.2
|
||||
* 4f55b6af Update make-golangci-lint to 1.57.1 from 1.57.0
|
||||
* a3b63b10 Update make-golangci-lint to 1.57.2 from 1.57.1
|
||||
* 208b3e6b chore: fix function name in comment
|
||||
* 621d7f2c decode: Align some heavily used structs to save space
|
||||
* ee2ee24d decode: Cleanup io panic a bit
|
||||
* e741ca78 doc: Add ImHex to related tools
|
||||
* 36e8287c doc: Regenerate after nes and new ansisvg
|
||||
* 225fd507 fit: Skip array fields on pre read messages
|
||||
* 7500a8b7 fq: Sort formats
|
||||
* bf7fa07c fq: Use go 1.20 and cleanup
|
||||
* e2670404 gojq: Update fq fork
|
||||
* f5fd5873 gojq: Update fq fork
|
||||
* ed685116 icc_profile: Strip whitespace in header and tag strings
|
||||
* c8f9cdc9 interp: Add string_truncate option
|
||||
* 0db671f6 interp: Add todo test for eval error in path
|
||||
* ebffb3be jp2c: Add jpeg2000 codestream format
|
||||
* 79992b34 jp2c: Fail probe faster
|
||||
* 63f7d79c jp2c: Support probe
|
||||
* b542ff1d lint: More linters and some fixes
|
||||
* c6165c0c mod: go get non-bump tracked modules
|
||||
* 1784c438 mp4,avi: Trim spaces for type
|
||||
* 2ea70c42 mp4: Add thmb box support
|
||||
* 4f90a2ea mp4: Decode jP box
|
||||
* 70b1b0d6 mp4: Decode uinf box
|
||||
* 87b6c4dd mp4: Fix jp2 test
|
||||
* 8009b6f6 mp4: JPEG200 boxes jp2h and ihdr
|
||||
* ed3a126f mp4: Turns out for qt brand hdlr component name might be zero bytes
|
||||
* f3b54042 nes: Add support for iNES/NES 2.0 ROM files
|
||||
* 80bccc91 opus,vorbis: More sym snake_case
|
||||
* 08df7f45 pkg/cli/test_exp.sh: use command -v
|
||||
* 87052733 pssh_playready: Use snake_case sym values
|
||||
* aaa43dfb test: Replace pmezard/go-difflib with go's internal diff
|
||||
|
||||
# 0.10.0
|
||||
|
||||
Adds support for various LevelDB formats (thanks @mikez) and Garmin Flexible and Interoperable Data Transfer format (FIT) (thanks @mlofjard).
|
||||
|
||||
And as usual some small fixes and dependency updates.
|
||||
|
||||
## Changes
|
||||
|
||||
- On macOS fq now reads init script from `~/.config/fq` in addition to `~/Library/Application Support/fq`. #871
|
||||
- Switch readline module from own fork to https://github.com/ergochat/readline #854
|
||||
- Updated gojq fork. Notable changes from upstream below. #844
|
||||
- Fix pre-defined variables to be available in initial modules
|
||||
- Fix object construction with duplicate keys
|
||||
|
||||
## Format changes
|
||||
|
||||
- `aac_frame` Decode instance tag and common window flag. #859
|
||||
- `fit` Add support for Garmin Flexible and Interoperable Data Transfer decoder. Thanks @mlofjard #874
|
||||
- This format is used by various GPS tracking devices to record location, speed etc.
|
||||
- Example of converting position information to KML:
|
||||
```jq
|
||||
# to_kml.jq
|
||||
# convert locations in a fit structure to KML
|
||||
def to_kml:
|
||||
( [ .data_records[].data_message as {position_lat: $lat, position_long: $long}
|
||||
| select($lat and $long)
|
||||
| [$long, $lat, 0]
|
||||
| join(",")
|
||||
]
|
||||
| join(". ")
|
||||
| { kml: {"@xmlns":"http://earth.google.com/kml/2.0"
|
||||
, Document: {Placemark: {LineString: {coordinates: .}}}}
|
||||
}
|
||||
| to_xml({indent:2})
|
||||
);
|
||||
```
|
||||
Usage:
|
||||
```sh
|
||||
# -L to add current directory to library path
|
||||
# -r for raw string output
|
||||
# 'include "to_ml";' to include to_kml.jq
|
||||
# to_kml calls to_kml function
|
||||
$ fq -L . -r 'include "to_kml"; to_kml' file.fit > file.kml
|
||||
```
|
||||
|
||||
- `hevc_sps` Fix some incorrect profile_tier_level decoding. #829
|
||||
- `html` Fix issue parsing elements including SOLIDUS "/". #870
|
||||
- Upstream issue https://github.com/golang/go/issues/63402
|
||||
- `mpeg_es` Support ES_ID_Inc and decode descriptors for IOD tags
|
||||
- `leveldb_descriptor`, `leveldb_log`, `leveldb_table` Add support for LevelDB. Thanks @mikez #824
|
||||
- This format is used by many database backends and applications like Google chrome.
|
||||
- `pcapng` Decode all section headers instead of just the first. #860
|
||||
- `png` Fix incorrect decoding of type flags. #847
|
||||
- `hevc_sps` Fix incorrect decoding of profile_tier_level. #829
|
||||
- `tls` Fix field name typos. #839
|
||||
- `mp4`
|
||||
- Don't try decode samples for a track that has an external reference. #834
|
||||
- Use box structure instead of track id to keep track for sample table data. #833
|
||||
- `ctts` box v0 sample offset seems to be signed in practice but not in spec. #832
|
||||
- `webp` Decode width, height and flags for lossless WebP. #857
|
||||
|
||||
## Changelog
|
||||
|
||||
* 6c3914aa Add DFDL acronym to README.md
|
||||
* 43c76937 Update docker-golang to 1.21.5 from 1.21.4
|
||||
* 836af78a Update docker-golang to 1.21.6 from 1.21.5
|
||||
* f9e1e759 Update docker-golang to 1.22.0 from 1.21.6
|
||||
* 54da5efc Update ergochat-readline to 81f0f2329ad3 from cca60bf24c9f
|
||||
* bed912c3 Update github-go-version to 1.21.5 from 1.21.4
|
||||
* 3f48e3be Update github-go-version to 1.21.6 from 1.21.5
|
||||
* 5bfb2bb1 Update github-go-version to 1.22.0 from 1.21.6
|
||||
* 888b0be0 Update github-golangci-lint to 1.56.0 from 1.55.2
|
||||
* 283380ba Update github-golangci-lint to 1.56.1 from 1.56.0
|
||||
* be79c193 Update gomod-golang-x-crypto to 0.16.0 from 0.15.0
|
||||
* 6aba928f Update gomod-golang-x-crypto to 0.17.0 from 0.16.0
|
||||
* 561fed97 Update gomod-golang-x-crypto to 0.18.0 from 0.17.0
|
||||
* b5388eaa Update gomod-golang-x-crypto to 0.19.0 from 0.18.0
|
||||
* 0200a4ee Update gomod-golang-x-net to 0.19.0 from 0.18.0
|
||||
* 2e22e1b8 Update gomod-golang-x-net to 0.20.0 from 0.19.0
|
||||
* 40bcb194 Update gomod-golang-x-net to 0.21.0 from 0.20.0
|
||||
* 2a1d9707 Update gomod-golang-x-term to 0.16.0 from 0.15.0
|
||||
* 310c78ea Update gomod-golang-x-term to 0.17.0 from 0.16.0
|
||||
* 536583cf Update make-golangci-lint to 1.56.0 from 1.55.2
|
||||
* 5369576d Update make-golangci-lint to 1.56.1 from 1.56.0
|
||||
* e51c746d aac_frame: CPE: Decode instance tag and common window flag
|
||||
* f5f8e93c bson: Fix jq style a bit
|
||||
* d0a1b301 bump readline to 0.1.0-rc1
|
||||
* b56258cf bump,readline: Add bump config and update to latest master
|
||||
* 0070e389 bump,readline: Skip bump until not rc
|
||||
* 63e0aa3c doc: Fix weird wording in README.md
|
||||
* e5fd1eb4 doc: Generate svgs with new ansisvg
|
||||
* 55470deb doc: Update docs to include fit format
|
||||
* c47756dc doc: Update svgs after ansisvg update
|
||||
* 54c6f0cd fit: Added support for "invalid" value checking.
|
||||
* 46dbf5b7 fit: Added support for ANT+ FIT format (used by Garmin devices)
|
||||
* 6219d57c fit: Added support for dynamic subfields
|
||||
* 33e5851d fit: Fix field casing to snake_case. Misc cleanup.
|
||||
* 76307e4d fit: Formatted date/time description for timestamp fields
|
||||
* 88622804 fit: Made long/lat present as float64
|
||||
* 788088f8 fit: Show crc as hex, lower case "invalid" and some style harmonization
|
||||
* a07ce117 fq: Relicense float80 code to MIT
|
||||
* 5829c6b4 gojq: Update fq fork
|
||||
* d155c80c gojq: Update fq fork
|
||||
* a793d109 goreleaser: Fix deprecated options
|
||||
* 919e0795 hevc_sps: Fix some incorrect profile_tier_level decoding
|
||||
* 69ae7659 interp: Fix crash when using line_bytes=0
|
||||
* 21766000 interp: Support ~/.config/fq as fallback on macOS
|
||||
* fb910bd4 ldb: first draft
|
||||
* efc59a81 ldb: uncompression support
|
||||
* 41f27a13 leveldb: add `torepr` for descriptor
|
||||
* 2df0f0fb leveldb: add log and descriptor decoders
|
||||
* b05aa997 leveldb: address PR comments
|
||||
* 2f5f1831 leveldb: decode unfragmented .log files further; fix UTF8 decoding
|
||||
* e826f097 leveldb: fix Errorf arguments
|
||||
* 42830911 leveldb: fix all.fqtest failures
|
||||
* 287ed366 leveldb: fix metaindex keys, refactoring, and jq syntax per PR
|
||||
* 8665df56 leveldb: fix table's data blocks' internal keys decoding
|
||||
* 08e3d2d2 leveldb: improve `stringify` by preallocating result
|
||||
* 3a396e15 leveldb: improve log documentation
|
||||
* 1ba8dec5 leveldb: in some properties, change spaces to underscores
|
||||
* e735cead leveldb: propagate error
|
||||
* 07ad9401 leveldb: rename "suffix" to "sequence_number_suffix"
|
||||
* 78a3e94b leveldb: rename functions and add comments
|
||||
* cc0d5a8b leveldb: update docs
|
||||
* fe1099b9 leveldb: updates per PR comments
|
||||
* 0d06e0a4 mp4: Don't decode samples if track has external data reference
|
||||
* d2c5ce55 mp4: Use box structure instead of track id to keep track for sample table data
|
||||
* aadf26f6 mp4: ctts v0 sample_offset seems to be signed in practice
|
||||
* fca55b2c mpeg_es: Support ES_ID_Inc and decode descriptors for IOD tags
|
||||
* e3af4670 pcapng: Decode all section headers, clenaup descriptions
|
||||
* 38b4412a png: Type flags were off-by-one bit
|
||||
* fb1c625a readline,bump: Fix version compare link
|
||||
* 41226f48 readline: Switch to ergochat/readline
|
||||
* cd572d3a readline: Update to 0.1.0 and add bump config
|
||||
* 7906f33d test: Support to more common -update flag
|
||||
* 3b7cc1f4 tls: Fix field name typos
|
||||
* b0421dfc webp: Decode width, height and flags for lossless webp
|
||||
|
||||
# 0.9.0
|
||||
|
||||
## Changes
|
||||
|
@ -1,5 +1,5 @@
|
||||
# bump: docker-golang /FROM golang:([\d.]+)/ docker:golang|^1
|
||||
FROM golang:1.22.0-bookworm AS base
|
||||
FROM golang:1.22.2-bookworm AS base
|
||||
|
||||
# expect is used to test cli
|
||||
RUN \
|
||||
|
2
Makefile
@ -61,7 +61,7 @@ gogenerate: always
|
||||
lint: always
|
||||
# bump: make-golangci-lint /golangci-lint@v([\d.]+)/ git:https://github.com/golangci/golangci-lint.git|^1
|
||||
# bump: make-golangci-lint link "Release notes" https://github.com/golangci/golangci-lint/releases/tag/v$LATEST
|
||||
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.1 run
|
||||
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2 run
|
||||
|
||||
depgraph.svg: always
|
||||
go run github.com/kisielk/godepgraph@latest github.com/wader/fq | dot -Tsvg -o godepgraph.svg
|
||||
|
30
README.md
@ -2,25 +2,23 @@
|
||||
|
||||
Tool, language and decoders for working with binary data.
|
||||
|
||||
TLDR: it aims to be jq, hexdump, dd and gdb for files combined into one.
|
||||
|
||||
![fq demo](doc/demo.svg)
|
||||
|
||||
Basic usage is `fq . file` or `fq d file`.
|
||||
Basic usage is `fq . file`, `fq d file` or `fq 'some query' file ...`.
|
||||
|
||||
For details see [usage.md](doc/usage.md).
|
||||
|
||||
### Background
|
||||
|
||||
fq is inspired by the well known jq tool and language that allows you to work with binary formats the same way you would using jq. In addition it can present data like a hex viewer, transform, slice and concatenate binary data. It also supports nested formats and has an interactive REPL with auto-completion.
|
||||
fq is inspired by the [jq](https://jqlang.github.io/jq/) tool and language and allows you to work with binary formats in the same way. In addition to using jq expressions it can also present decoded tree structures, transform, slice and concatenate binary data. It also supports nested formats and features an interactive REPL with auto-completion of functions and names.
|
||||
|
||||
It was originally designed to query, inspect and debug media codecs and containers like mp4, flac, mp3, jpeg. But since then it has been extended to support a variety of formats like executables, packet captures (with TCP reassembly) and serialization formats like JSON, YAML, XML, ASN1 BER, Avro, CBOR, protobuf. In addition it also has functions to work with URLs, convert to/from hex, number bases, search for things etc.
|
||||
|
||||
In summary it aims to be jq, hexdump, dd and gdb for files combined into one.
|
||||
|
||||
**NOTE:** fq is still early in development so things might change, be broken or do not make sense. That also means that there is a great opportunity to help out!
|
||||
It was originally designed to query, inspect and debug media codecs and containers like MP4, FLAC and JPEG but has since been extended to support a variety of formats like executables, packet captures (with TCP reassembly) and serialization formats like JSON, YAML, XML, CBOR, protobuf. In addition it also has functions to work with URLs, convert to/from hex, number bases, search for patterns etc.
|
||||
|
||||
### Goals
|
||||
|
||||
- Make binaries accessible, queryable and sliceable.
|
||||
- Make binaries more accessible, queryable and sliceable.
|
||||
- Nested formats and bit-oriented decoding.
|
||||
- Quick and comfortable CLI tool.
|
||||
- Bits and bytes transformations.
|
||||
@ -75,6 +73,7 @@ elf,
|
||||
ether8023_frame,
|
||||
exif,
|
||||
fairplay_spc,
|
||||
[fit](doc/formats.md#fit),
|
||||
flac,
|
||||
[flac_frame](doc/formats.md#flac_frame),
|
||||
flac_metadatablock,
|
||||
@ -99,6 +98,7 @@ id3v11,
|
||||
id3v2,
|
||||
ipv4_packet,
|
||||
ipv6_packet,
|
||||
jp2c,
|
||||
jpeg,
|
||||
json,
|
||||
jsonl,
|
||||
@ -123,6 +123,7 @@ mpeg_pes_packet,
|
||||
mpeg_spu,
|
||||
mpeg_ts,
|
||||
[msgpack](doc/formats.md#msgpack),
|
||||
[nes](doc/formats.md#nes),
|
||||
ogg,
|
||||
ogg_page,
|
||||
[opentimestamps](doc/formats.md#opentimestamps),
|
||||
@ -238,9 +239,9 @@ apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/testing fq
|
||||
|
||||
### Build from source
|
||||
|
||||
Make sure you have [go](https://go.dev) 1.18 or later installed.
|
||||
Make sure you have [go](https://go.dev) 1.20 or later installed.
|
||||
|
||||
To install directly from git repository (no clone needed):
|
||||
To install directly from git repository (no git clone needed):
|
||||
```sh
|
||||
# build and install latest release
|
||||
go install github.com/wader/fq@latest
|
||||
@ -264,10 +265,6 @@ go build -o fq .
|
||||
make test fq
|
||||
```
|
||||
|
||||
## TODO and ideas
|
||||
|
||||
See [TODO.md](doc/TODO.md)
|
||||
|
||||
## Development and adding a new decoder
|
||||
|
||||
See [dev.md](doc/dev.md)
|
||||
@ -284,6 +281,7 @@ for inventing the [jq](https://github.com/stedolan/jq) language.
|
||||
#### Tools
|
||||
|
||||
- [HexFiend](https://github.com/HexFiend/HexFiend) - Hex editor for macOS with format template support.
|
||||
- [ImHex](https://github.com/WerWolv/ImHex) - A Hex Editor for Reverse Engineers.
|
||||
- [binspector](https://github.com/binspector/binspector) - Binary format analysis tool with query language and REPL.
|
||||
- [kaitai](https://kaitai.io) - Declarative binary format parsing.
|
||||
- [Wireshark](https://www.wireshark.org) - Decodes network traffic (tip: `tshark -T json`).
|
||||
@ -302,6 +300,10 @@ for inventing the [jq](https://github.com/stedolan/jq) language.
|
||||
- [Sustainability of Digital Formats](https://www.loc.gov/preservation/digital/formats/) at Library of Congress.
|
||||
- [Data Format Description Language (DFDL)](https://en.wikipedia.org/wiki/Data_Format_Description_Language).
|
||||
|
||||
## TODO and ideas
|
||||
|
||||
See [TODO.md](doc/TODO.md)
|
||||
|
||||
## License
|
||||
|
||||
`fq` is distributed under the terms of the MIT License.
|
||||
|
@ -1,3 +1,5 @@
|
||||
//go:build exclude
|
||||
|
||||
// tool to convert go fuzz input files to bytes
|
||||
// Usage: cat format/testdata/fuzz/FuzzFormats/144bde49b40c90fd05d302ec90b6ddb2b6d6aea553bad520a8b954797e40fe72 | go run dev/fuzzbytes.go | go run .
|
||||
package main
|
||||
|
@ -1,3 +1,5 @@
|
||||
//go:build exclude
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
102
doc/demo.svg
@ -10,49 +10,65 @@
|
||||
white-space: pre;
|
||||
fill: #bbbbbb;
|
||||
}
|
||||
.bg {
|
||||
stroke-width: "0.5px";
|
||||
}
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
.underline {
|
||||
text-decoration: underline;
|
||||
}
|
||||
<!-- Foreground ANSI colors -->
|
||||
.fa2 { fill: #00bb00; }
|
||||
.fa3 { fill: #bbbb00; }
|
||||
.fa6 { fill: #00bbbb; }
|
||||
.fa8 { fill: #555555; }
|
||||
.fa12 { fill: #5555ff; }
|
||||
.fa15 { fill: #ffffff; }
|
||||
</style>
|
||||
<rect width="100%" height="100%" x="0" y="0" style="fill: #000000"/>
|
||||
<text x="0" y="0.5em"><tspan style="fill:#ffffff"># Overview of mp3 file</tspan></text>
|
||||
<text x="0" y="1.5em"><tspan>$ fq . file.mp3</tspan></text>
|
||||
<text x="0" y="2.5em"><tspan> │</tspan><tspan style="fill:#bbbb00" text-decoration="underline">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan style="fill:#bbbb00" text-decoration="underline">0123456789abcdef</tspan><tspan>│.{}: file.mp3 (mp3)</tspan></text>
|
||||
<text x="0" y="3.5em"><tspan style="fill:#bbbb00">0x000</tspan><tspan>│49 44 33 </tspan><tspan style="font-weight:bold">04</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="font-weight:bold">15</tspan><tspan> 39 54 53 53 45 </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan>│ID3</tspan><tspan style="font-weight:bold">.</tspan><tspan style="fill:#555555">....</tspan><tspan style="font-weight:bold">.</tspan><tspan>9TSSE</tspan><tspan style="fill:#555555">..</tspan><tspan>│ </tspan><tspan style="fill:#5555ff">headers</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">0</tspan><tspan>:</tspan><tspan style="fill:#00bbbb">1</tspan><tspan>]:</tspan></text>
|
||||
<text x="0" y="4.5em"><tspan style="fill:#bbbb00">*</tspan><tspan> │until 0xac2.7 (2755) │ │</tspan></text>
|
||||
<text x="0" y="5.5em"><tspan style="fill:#bbbb00">0xac0</tspan><tspan>│ </tspan><tspan style="font-weight:bold">ff</tspan><tspan> </tspan><tspan style="font-weight:bold">fb</tspan><tspan> 40 </tspan><tspan style="font-weight:bold">c0</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan>│ </tspan><tspan style="font-weight:bold">..</tspan><tspan>@</tspan><tspan style="font-weight:bold">.</tspan><tspan style="fill:#555555">.........</tspan><tspan>│ </tspan><tspan style="fill:#5555ff">frames</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">0</tspan><tspan>:</tspan><tspan style="fill:#00bbbb">3</tspan><tspan>]:</tspan></text>
|
||||
<text x="0" y="6.5em"><tspan style="fill:#bbbb00">0xad0</tspan><tspan>│</tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> 49 6e 66 6f </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="font-weight:bold">0f</tspan><tspan>│</tspan><tspan style="fill:#555555">........</tspan><tspan>Info</tspan><tspan style="fill:#555555">...</tspan><tspan style="font-weight:bold">.</tspan><tspan>│</tspan></text>
|
||||
<text x="0" y="7.5em"><tspan style="fill:#bbbb00">*</tspan><tspan> │until 0xd19.7 (end) (599) │ │</tspan></text>
|
||||
<text x="0" y="8.5em"><tspan> │ │ │ </tspan><tspan style="fill:#5555ff">footers</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">0</tspan><tspan>:</tspan><tspan style="fill:#00bbbb">0</tspan><tspan>]:</tspan></text>
|
||||
<text x="0" y="10.5em"><tspan style="fill:#ffffff"># Show header of first ID3v2 tag inside mp3 file</tspan></text>
|
||||
<text x="0" y="11.5em"><tspan>$ fq '.headers[0].header' file.mp3</tspan></text>
|
||||
<text x="0" y="12.5em"><tspan> │</tspan><tspan style="fill:#bbbb00" text-decoration="underline">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan style="fill:#bbbb00" text-decoration="underline">0123456789abcdef</tspan><tspan>│.</tspan><tspan style="fill:#5555ff">headers</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">0</tspan><tspan>].</tspan><tspan style="fill:#5555ff">header</tspan><tspan>{}:</tspan></text>
|
||||
<text x="0" y="13.5em"><tspan style="fill:#bbbb00">0x0</tspan><tspan>│49 44 33 │ID3 │ </tspan><tspan style="fill:#5555ff">magic</tspan><tspan>: </tspan><tspan style="fill:#00bb00">"ID3"</tspan><tspan> (valid)</tspan></text>
|
||||
<text x="0" y="14.5em"><tspan style="fill:#bbbb00">0x0</tspan><tspan>│ </tspan><tspan style="font-weight:bold">04</tspan><tspan> │ </tspan><tspan style="font-weight:bold">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">version</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">4</tspan><tspan> (valid)</tspan></text>
|
||||
<text x="0" y="15.5em"><tspan style="fill:#bbbb00">0x0</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> │ </tspan><tspan style="fill:#555555">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">revision</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">0</tspan></text>
|
||||
<text x="0" y="16.5em"><tspan style="fill:#bbbb00">0x0</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> │ </tspan><tspan style="fill:#555555">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">flags</tspan><tspan>{}:</tspan></text>
|
||||
<text x="0" y="17.5em"><tspan style="fill:#bbbb00">0x0</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="font-weight:bold">15</tspan><tspan> 39 │ </tspan><tspan style="fill:#555555">..</tspan><tspan style="font-weight:bold">.</tspan><tspan>9 │ </tspan><tspan style="fill:#5555ff">size</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">2745</tspan></text>
|
||||
<text x="0" y="19.5em"><tspan style="fill:#ffffff"># Show encoder software used</tspan></text>
|
||||
<text x="0" y="20.5em"><tspan>$ fq -r '.frames[0].tag.encoder | tovalue' file.mp3</tspan></text>
|
||||
<text x="0" y="21.5em"><tspan>Lavc58.13</tspan></text>
|
||||
<text x="0" y="23.5em"><tspan style="fill:#ffffff"># Decode at two offsets as mp3_frame and show bitrate</tspan></text>
|
||||
<text x="0" y="24.5em"><tspan>$ fq -d bytes '.[0xb79,0xc49:] | mp3_frame.header.bitrate' file.mp3</tspan></text>
|
||||
<text x="0" y="25.5em"><tspan> │</tspan><tspan style="fill:#bbbb00" text-decoration="underline">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan style="fill:#bbbb00" text-decoration="underline">0123456789abcdef</tspan><tspan>│</tspan></text>
|
||||
<text x="0" y="26.5em"><tspan style="fill:#bbbb00">0xb70</tspan><tspan>│ 50 │ P │.</tspan><tspan style="fill:#5555ff">header</tspan><tspan>.</tspan><tspan style="fill:#5555ff">bitrate</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">64000</tspan><tspan> (</tspan><tspan style="fill:#00bbbb">5</tspan><tspan>)</tspan></text>
|
||||
<text x="0" y="27.5em"><tspan> │</tspan><tspan style="fill:#bbbb00" text-decoration="underline">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan style="fill:#bbbb00" text-decoration="underline">0123456789abcdef</tspan><tspan>│</tspan></text>
|
||||
<text x="0" y="28.5em"><tspan style="fill:#bbbb00">0xc40</tspan><tspan>│ 52 │ R │.</tspan><tspan style="fill:#5555ff">header</tspan><tspan>.</tspan><tspan style="fill:#5555ff">bitrate</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">64000</tspan><tspan> (</tspan><tspan style="fill:#00bbbb">5</tspan><tspan>)</tspan></text>
|
||||
<text x="0" y="30.5em"><tspan style="fill:#ffffff"># Extract PNG file</tspan></text>
|
||||
<text x="0" y="31.5em"><tspan>$ fq '.headers[].frames[] | select(.id == "APIC")?.picture | tobits' file.mp3 >file.png</tspan></text>
|
||||
<text x="0" y="32.5em"><tspan>$ file file.png</tspan></text>
|
||||
<text x="0" y="33.5em"><tspan>file.png: PNG image data, 320 x 240, 8-bit/color RGB, non-interlaced</tspan></text>
|
||||
<text x="0" y="35.5em"><tspan style="fill:#ffffff"># Resolution of embedded PNG cover art as YAML</tspan></text>
|
||||
<text x="0" y="36.5em"><tspan>$ fq -r '.headers[0].frames[] | grep_by(.id == "APIC") | grep_by(.type == "IHDR") | {res: {width, height}} | to_yaml' file.mp3</tspan></text>
|
||||
<text x="0" y="37.5em"><tspan>res:</tspan></text>
|
||||
<text x="0" y="38.5em"><tspan> height: 240</tspan></text>
|
||||
<text x="0" y="39.5em"><tspan> width: 320</tspan></text>
|
||||
<text x="0" y="41.5em"><tspan style="fill:#ffffff"># Add query parameter to URL</tspan></text>
|
||||
<text x="0" y="42.5em"><tspan>$ echo 'http://host?a=b' | fq -Rr 'from_url | .query.b = "a b c" | to_url'</tspan></text>
|
||||
<text x="0" y="43.5em"><tspan>http://host?a=b&b=a+b+c</tspan></text>
|
||||
<text x="0" y="45.5em"><tspan style="fill:#ffffff"># Extract JSON and base64 encoded query parameter p</tspan></text>
|
||||
<text x="0" y="46.5em"><tspan>$ echo 'https://host?p=eyJhIjoiaGVsbG8ifQ%3D%3D' | fq -R 'from_url.query.p | from_base64 | fromjson'</tspan></text>
|
||||
<text x="0" y="47.5em"><tspan>{</tspan></text>
|
||||
<text x="0" y="48.5em"><tspan> </tspan><tspan style="fill:#5555ff">"a"</tspan><tspan>: </tspan><tspan style="fill:#00bb00">"hello"</tspan></text>
|
||||
<text x="0" y="49.5em"><tspan>}</tspan></text>
|
||||
<text x="0ch" y="0.5em"><tspan class="fa15"># Overview of mp3 file</tspan></text>
|
||||
<text x="0ch" y="1.5em"><tspan>$ fq . file.mp3</tspan></text>
|
||||
<text x="0ch" y="2.5em"><tspan> │</tspan><tspan class="underline fa3">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan class="underline fa3">0123456789abcdef</tspan><tspan>│.{}: file.mp3 (mp3)</tspan></text>
|
||||
<text x="0ch" y="3.5em"><tspan class="fa3">0x000</tspan><tspan>│49 44 33 </tspan><tspan class="bold">04 </tspan><tspan class="fa8">00 00 00 00 </tspan><tspan class="bold">15 </tspan><tspan>39 54 53 53 45 </tspan><tspan class="fa8">00 00</tspan><tspan>│ID3</tspan><tspan class="bold">.</tspan><tspan class="fa8">....</tspan><tspan class="bold">.</tspan><tspan>9TSSE</tspan><tspan class="fa8">..</tspan><tspan>│ </tspan><tspan class="fa12">headers</tspan><tspan>[</tspan><tspan class="fa6">0</tspan><tspan>:</tspan><tspan class="fa6">1</tspan><tspan>]:</tspan></text>
|
||||
<text x="0ch" y="4.5em"><tspan class="fa3">* </tspan><tspan>│until 0xac2.7 (2755) │ │</tspan></text>
|
||||
<text x="0ch" y="5.5em"><tspan class="fa3">0xac0</tspan><tspan>│ </tspan><tspan class="bold">ff fb </tspan><tspan>40 </tspan><tspan class="bold">c0 </tspan><tspan class="fa8">00 00 00 00 00 00 00 00 00</tspan><tspan>│ </tspan><tspan class="bold">..</tspan><tspan>@</tspan><tspan class="bold">.</tspan><tspan class="fa8">.........</tspan><tspan>│ </tspan><tspan class="fa12">frames</tspan><tspan>[</tspan><tspan class="fa6">0</tspan><tspan>:</tspan><tspan class="fa6">3</tspan><tspan>]:</tspan></text>
|
||||
<text x="0ch" y="6.5em"><tspan class="fa3">0xad0</tspan><tspan>│</tspan><tspan class="fa8">00 00 00 00 00 00 00 00 </tspan><tspan>49 6e 66 6f </tspan><tspan class="fa8">00 00 00 </tspan><tspan class="bold">0f</tspan><tspan>│</tspan><tspan class="fa8">........</tspan><tspan>Info</tspan><tspan class="fa8">...</tspan><tspan class="bold">.</tspan><tspan>│</tspan></text>
|
||||
<text x="0ch" y="7.5em"><tspan class="fa3">* </tspan><tspan>│until 0xd19.7 (end) (599) │ │</tspan></text>
|
||||
<text x="0ch" y="8.5em"><tspan> │ │ │ </tspan><tspan class="fa12">footers</tspan><tspan>[</tspan><tspan class="fa6">0</tspan><tspan>:</tspan><tspan class="fa6">0</tspan><tspan>]:</tspan></text>
|
||||
<text x="0ch" y="10.5em"><tspan class="fa15"># Show header of first ID3v2 tag inside mp3 file</tspan></text>
|
||||
<text x="0ch" y="11.5em"><tspan>$ fq '.headers[0].header' file.mp3</tspan></text>
|
||||
<text x="0ch" y="12.5em"><tspan> │</tspan><tspan class="underline fa3">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan class="underline fa3">0123456789abcdef</tspan><tspan>│.</tspan><tspan class="fa12">headers</tspan><tspan>[</tspan><tspan class="fa6">0</tspan><tspan>].</tspan><tspan class="fa12">header</tspan><tspan>{}:</tspan></text>
|
||||
<text x="0ch" y="13.5em"><tspan class="fa3">0x0</tspan><tspan>│49 44 33 │ID3 │ </tspan><tspan class="fa12">magic</tspan><tspan>: </tspan><tspan class="fa2">"ID3" </tspan><tspan>(valid)</tspan></text>
|
||||
<text x="0ch" y="14.5em"><tspan class="fa3">0x0</tspan><tspan>│ </tspan><tspan class="bold">04 </tspan><tspan>│ </tspan><tspan class="bold">. </tspan><tspan>│ </tspan><tspan class="fa12">version</tspan><tspan>: </tspan><tspan class="fa6">4 </tspan><tspan>(valid)</tspan></text>
|
||||
<text x="0ch" y="15.5em"><tspan class="fa3">0x0</tspan><tspan>│ </tspan><tspan class="fa8">00 </tspan><tspan>│ </tspan><tspan class="fa8">. </tspan><tspan>│ </tspan><tspan class="fa12">revision</tspan><tspan>: </tspan><tspan class="fa6">0</tspan></text>
|
||||
<text x="0ch" y="16.5em"><tspan class="fa3">0x0</tspan><tspan>│ </tspan><tspan class="fa8">00 </tspan><tspan>│ </tspan><tspan class="fa8">. </tspan><tspan>│ </tspan><tspan class="fa12">flags</tspan><tspan>{}:</tspan></text>
|
||||
<text x="0ch" y="17.5em"><tspan class="fa3">0x0</tspan><tspan>│ </tspan><tspan class="fa8">00 00 </tspan><tspan class="bold">15 </tspan><tspan>39 │ </tspan><tspan class="fa8">..</tspan><tspan class="bold">.</tspan><tspan>9 │ </tspan><tspan class="fa12">size</tspan><tspan>: </tspan><tspan class="fa6">2745</tspan></text>
|
||||
<text x="0ch" y="19.5em"><tspan class="fa15"># Show encoder software used</tspan></text>
|
||||
<text x="0ch" y="20.5em"><tspan>$ fq -r '.frames[0].tag.encoder | tovalue' file.mp3</tspan></text>
|
||||
<text x="0ch" y="21.5em"><tspan>Lavc58.13</tspan></text>
|
||||
<text x="0ch" y="23.5em"><tspan class="fa15"># Decode at two offsets as mp3_frame and show bitrate</tspan></text>
|
||||
<text x="0ch" y="24.5em"><tspan>$ fq -d bytes '.[0xb79,0xc49:] | mp3_frame.header.bitrate' file.mp3</tspan></text>
|
||||
<text x="0ch" y="25.5em"><tspan> │</tspan><tspan class="underline fa3">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan class="underline fa3">0123456789abcdef</tspan><tspan>│</tspan></text>
|
||||
<text x="0ch" y="26.5em"><tspan class="fa3">0xb70</tspan><tspan>│ 50 │ P │.</tspan><tspan class="fa12">header</tspan><tspan>.</tspan><tspan class="fa12">bitrate</tspan><tspan>: </tspan><tspan class="fa6">64000 </tspan><tspan>(</tspan><tspan class="fa6">5</tspan><tspan>)</tspan></text>
|
||||
<text x="0ch" y="27.5em"><tspan> │</tspan><tspan class="underline fa3">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan class="underline fa3">0123456789abcdef</tspan><tspan>│</tspan></text>
|
||||
<text x="0ch" y="28.5em"><tspan class="fa3">0xc40</tspan><tspan>│ 52 │ R │.</tspan><tspan class="fa12">header</tspan><tspan>.</tspan><tspan class="fa12">bitrate</tspan><tspan>: </tspan><tspan class="fa6">64000 </tspan><tspan>(</tspan><tspan class="fa6">5</tspan><tspan>)</tspan></text>
|
||||
<text x="0ch" y="30.5em"><tspan class="fa15"># Extract PNG file</tspan></text>
|
||||
<text x="0ch" y="31.5em"><tspan>$ fq '.headers[].frames[] | select(.id == "APIC")?.picture | tobits' file.mp3 >file.png</tspan></text>
|
||||
<text x="0ch" y="32.5em"><tspan>$ file file.png</tspan></text>
|
||||
<text x="0ch" y="33.5em"><tspan>file.png: PNG image data, 320 x 240, 8-bit/color RGB, non-interlaced</tspan></text>
|
||||
<text x="0ch" y="35.5em"><tspan class="fa15"># Resolution of embedded PNG cover art as YAML</tspan></text>
|
||||
<text x="0ch" y="36.5em"><tspan>$ fq -r '.headers[0].frames[] | grep_by(.id == "APIC") | grep_by(.type == "IHDR") | {res: {width, height}} | to_yaml' file.mp3</tspan></text>
|
||||
<text x="0ch" y="37.5em"><tspan>res:</tspan></text>
|
||||
<text x="0ch" y="38.5em"><tspan> height: 240</tspan></text>
|
||||
<text x="0ch" y="39.5em"><tspan> width: 320</tspan></text>
|
||||
<text x="0ch" y="41.5em"><tspan class="fa15"># Add query parameter to URL</tspan></text>
|
||||
<text x="0ch" y="42.5em"><tspan>$ echo 'http://host?a=b' | fq -Rr 'from_url | .query.b = "a b c" | to_url'</tspan></text>
|
||||
<text x="0ch" y="43.5em"><tspan>http://host?a=b&b=a+b+c</tspan></text>
|
||||
<text x="0ch" y="45.5em"><tspan class="fa15"># Extract JSON and base64 encoded query parameter p</tspan></text>
|
||||
<text x="0ch" y="46.5em"><tspan>$ echo 'https://host?p=eyJhIjoiaGVsbG8ifQ%3D%3D' | fq -R 'from_url.query.p | from_base64 | fromjson'</tspan></text>
|
||||
<text x="0ch" y="47.5em"><tspan>{</tspan></text>
|
||||
<text x="0ch" y="48.5em"><tspan> </tspan><tspan class="fa12">"a"</tspan><tspan>: </tspan><tspan class="fa2">"hello"</tspan></text>
|
||||
<text x="0ch" y="49.5em"><tspan>}</tspan></text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 8.7 KiB |
@ -236,8 +236,8 @@ make test
|
||||
go test ./...
|
||||
# run all tests for one format
|
||||
go test -run TestFormats/mp4 ./format/
|
||||
# update all actual outputs in tests
|
||||
go test ./... -update
|
||||
# update all expected outputs for tests
|
||||
go test ./pkg/interp ./format -update
|
||||
# update actual output for specific tests
|
||||
go run ./format -run TestFormats/elf -update
|
||||
# color diff
|
||||
|
@ -10,16 +10,31 @@
|
||||
white-space: pre;
|
||||
fill: #bbbbbb;
|
||||
}
|
||||
.bg {
|
||||
stroke-width: "0.5px";
|
||||
}
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
.underline {
|
||||
text-decoration: underline;
|
||||
}
|
||||
<!-- Foreground ANSI colors -->
|
||||
.fa2 { fill: #00bb00; }
|
||||
.fa3 { fill: #bbbb00; }
|
||||
.fa6 { fill: #00bbbb; }
|
||||
.fa8 { fill: #555555; }
|
||||
.fa12 { fill: #5555ff; }
|
||||
</style>
|
||||
<rect width="100%" height="100%" x="0" y="0" style="fill: #000000"/>
|
||||
<text x="0" y="0.5em"><tspan>$ fq 'first(grep_by(.type == "elst"))' file.mp4</tspan></text>
|
||||
<text x="0" y="1.5em"><tspan> │</tspan><tspan style="fill:#bbbb00" text-decoration="underline">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan style="fill:#bbbb00" text-decoration="underline">0123456789abcdef</tspan><tspan>│.</tspan><tspan style="fill:#5555ff">boxes</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">3</tspan><tspan>].</tspan><tspan style="fill:#5555ff">boxes</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">1</tspan><tspan>].</tspan><tspan style="fill:#5555ff">boxes</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">1</tspan><tspan>].</tspan><tspan style="fill:#5555ff">boxes</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">0</tspan><tspan>]{}: box</tspan></text>
|
||||
<text x="0" y="2.5em"><tspan style="fill:#bbbb00">0xd60</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="font-weight:bold">1c</tspan><tspan> │ </tspan><tspan style="fill:#555555">...</tspan><tspan style="font-weight:bold">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">size</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">28</tspan></text>
|
||||
<text x="0" y="3.5em"><tspan style="fill:#bbbb00">0xd60</tspan><tspan>│ 65 6c 73 74 │ elst │ </tspan><tspan style="fill:#5555ff">type</tspan><tspan>: </tspan><tspan style="fill:#00bb00">"elst"</tspan><tspan> (An edit list)</tspan></text>
|
||||
<text x="0" y="4.5em"><tspan style="fill:#bbbb00">0xd60</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> │ </tspan><tspan style="fill:#555555">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">version</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">0</tspan></text>
|
||||
<text x="0" y="5.5em"><tspan style="fill:#bbbb00">0xd60</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan>│ </tspan><tspan style="fill:#555555">..</tspan><tspan>│ </tspan><tspan style="fill:#5555ff">flags</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">0</tspan></text>
|
||||
<text x="0" y="6.5em"><tspan style="fill:#bbbb00">0xd70</tspan><tspan>│</tspan><tspan style="fill:#555555">00</tspan><tspan> │</tspan><tspan style="fill:#555555">.</tspan><tspan> │</tspan></text>
|
||||
<text x="0" y="7.5em"><tspan style="fill:#bbbb00">0xd70</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="font-weight:bold">01</tspan><tspan> │ </tspan><tspan style="fill:#555555">...</tspan><tspan style="font-weight:bold">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">entry_count</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">1</tspan></text>
|
||||
<text x="0" y="8.5em"><tspan style="fill:#bbbb00">0xd70</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> 28 </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="font-weight:bold">01</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan>│ </tspan><tspan style="fill:#555555">...</tspan><tspan>(</tspan><tspan style="fill:#555555">.....</tspan><tspan style="font-weight:bold">.</tspan><tspan style="fill:#555555">.</tspan><tspan>│ </tspan><tspan style="fill:#5555ff">entries</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">0</tspan><tspan>:</tspan><tspan style="fill:#00bbbb">1</tspan><tspan>]:</tspan></text>
|
||||
<text x="0" y="9.5em"><tspan style="fill:#bbbb00">0xd80</tspan><tspan>│</tspan><tspan style="fill:#555555">00</tspan><tspan> │</tspan><tspan style="fill:#555555">.</tspan><tspan> │</tspan></text>
|
||||
<text x="0ch" y="0.5em"><tspan>$ fq 'first(grep_by(.type == "elst"))' file.mp4</tspan></text>
|
||||
<text x="0ch" y="1.5em"><tspan> │</tspan><tspan class="underline fa3">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan class="underline fa3">0123456789abcdef</tspan><tspan>│.</tspan><tspan class="fa12">boxes</tspan><tspan>[</tspan><tspan class="fa6">3</tspan><tspan>].</tspan><tspan class="fa12">boxes</tspan><tspan>[</tspan><tspan class="fa6">1</tspan><tspan>].</tspan><tspan class="fa12">boxes</tspan><tspan>[</tspan><tspan class="fa6">1</tspan><tspan>].</tspan><tspan class="fa12">boxes</tspan><tspan>[</tspan><tspan class="fa6">0</tspan><tspan>]{}: box</tspan></text>
|
||||
<text x="0ch" y="2.5em"><tspan class="fa3">0xd60</tspan><tspan>│ </tspan><tspan class="fa8">00 00 00 </tspan><tspan class="bold">1c </tspan><tspan>│ </tspan><tspan class="fa8">...</tspan><tspan class="bold">. </tspan><tspan>│ </tspan><tspan class="fa12">size</tspan><tspan>: </tspan><tspan class="fa6">28</tspan></text>
|
||||
<text x="0ch" y="3.5em"><tspan class="fa3">0xd60</tspan><tspan>│ 65 6c 73 74 │ elst │ </tspan><tspan class="fa12">type</tspan><tspan>: </tspan><tspan class="fa2">"elst" </tspan><tspan>(An edit list)</tspan></text>
|
||||
<text x="0ch" y="4.5em"><tspan class="fa3">0xd60</tspan><tspan>│ </tspan><tspan class="fa8">00 </tspan><tspan>│ </tspan><tspan class="fa8">. </tspan><tspan>│ </tspan><tspan class="fa12">version</tspan><tspan>: </tspan><tspan class="fa6">0</tspan></text>
|
||||
<text x="0ch" y="5.5em"><tspan class="fa3">0xd60</tspan><tspan>│ </tspan><tspan class="fa8">00 00</tspan><tspan>│ </tspan><tspan class="fa8">..</tspan><tspan>│ </tspan><tspan class="fa12">flags</tspan><tspan>: </tspan><tspan class="fa6">0</tspan></text>
|
||||
<text x="0ch" y="6.5em"><tspan class="fa3">0xd70</tspan><tspan>│</tspan><tspan class="fa8">00 </tspan><tspan>│</tspan><tspan class="fa8">. </tspan><tspan>│</tspan></text>
|
||||
<text x="0ch" y="7.5em"><tspan class="fa3">0xd70</tspan><tspan>│ </tspan><tspan class="fa8">00 00 00 </tspan><tspan class="bold">01 </tspan><tspan>│ </tspan><tspan class="fa8">...</tspan><tspan class="bold">. </tspan><tspan>│ </tspan><tspan class="fa12">entry_count</tspan><tspan>: </tspan><tspan class="fa6">1</tspan></text>
|
||||
<text x="0ch" y="8.5em"><tspan class="fa3">0xd70</tspan><tspan>│ </tspan><tspan class="fa8">00 00 00 </tspan><tspan>28 </tspan><tspan class="fa8">00 00 00 00 00 </tspan><tspan class="bold">01 </tspan><tspan class="fa8">00</tspan><tspan>│ </tspan><tspan class="fa8">...</tspan><tspan>(</tspan><tspan class="fa8">.....</tspan><tspan class="bold">.</tspan><tspan class="fa8">.</tspan><tspan>│ </tspan><tspan class="fa12">entries</tspan><tspan>[</tspan><tspan class="fa6">0</tspan><tspan>:</tspan><tspan class="fa6">1</tspan><tspan>]:</tspan></text>
|
||||
<text x="0ch" y="9.5em"><tspan class="fa3">0xd80</tspan><tspan>│</tspan><tspan class="fa8">00 </tspan><tspan>│</tspan><tspan class="fa8">. </tspan><tspan>│</tspan></text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.2 KiB |
@ -10,20 +10,35 @@
|
||||
white-space: pre;
|
||||
fill: #bbbbbb;
|
||||
}
|
||||
.bg {
|
||||
stroke-width: "0.5px";
|
||||
}
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
.underline {
|
||||
text-decoration: underline;
|
||||
}
|
||||
<!-- Foreground ANSI colors -->
|
||||
.fa2 { fill: #00bb00; }
|
||||
.fa3 { fill: #bbbb00; }
|
||||
.fa6 { fill: #00bbbb; }
|
||||
.fa8 { fill: #555555; }
|
||||
.fa12 { fill: #5555ff; }
|
||||
</style>
|
||||
<rect width="100%" height="100%" x="0" y="0" style="fill: #000000"/>
|
||||
<text x="0" y="0.5em"><tspan>$ fq 'first(grep_by(.type == "elst")) | d' file.mp4</tspan></text>
|
||||
<text x="0" y="1.5em"><tspan> │</tspan><tspan style="fill:#bbbb00" text-decoration="underline">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan style="fill:#bbbb00" text-decoration="underline">0123456789abcdef</tspan><tspan>│.</tspan><tspan style="fill:#5555ff">boxes</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">3</tspan><tspan>].</tspan><tspan style="fill:#5555ff">boxes</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">1</tspan><tspan>].</tspan><tspan style="fill:#5555ff">boxes</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">1</tspan><tspan>].</tspan><tspan style="fill:#5555ff">boxes</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">0</tspan><tspan>]{}: box</tspan></text>
|
||||
<text x="0" y="2.5em"><tspan style="fill:#bbbb00">0xd60</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="font-weight:bold">1c</tspan><tspan> │ </tspan><tspan style="fill:#555555">...</tspan><tspan style="font-weight:bold">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">size</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">28</tspan></text>
|
||||
<text x="0" y="3.5em"><tspan style="fill:#bbbb00">0xd60</tspan><tspan>│ 65 6c 73 74 │ elst │ </tspan><tspan style="fill:#5555ff">type</tspan><tspan>: </tspan><tspan style="fill:#00bb00">"elst"</tspan><tspan> (An edit list)</tspan></text>
|
||||
<text x="0" y="4.5em"><tspan style="fill:#bbbb00">0xd60</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> │ </tspan><tspan style="fill:#555555">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">version</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">0</tspan></text>
|
||||
<text x="0" y="5.5em"><tspan style="fill:#bbbb00">0xd60</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan>│ </tspan><tspan style="fill:#555555">..</tspan><tspan>│ </tspan><tspan style="fill:#5555ff">flags</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">0</tspan></text>
|
||||
<text x="0" y="6.5em"><tspan style="fill:#bbbb00">0xd70</tspan><tspan>│</tspan><tspan style="fill:#555555">00</tspan><tspan> │</tspan><tspan style="fill:#555555">.</tspan><tspan> │</tspan></text>
|
||||
<text x="0" y="7.5em"><tspan style="fill:#bbbb00">0xd70</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="font-weight:bold">01</tspan><tspan> │ </tspan><tspan style="fill:#555555">...</tspan><tspan style="font-weight:bold">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">entry_count</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">1</tspan></text>
|
||||
<text x="0" y="8.5em"><tspan> │ │ │ </tspan><tspan style="fill:#5555ff">entries</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">0</tspan><tspan>:</tspan><tspan style="fill:#00bbbb">1</tspan><tspan>]:</tspan></text>
|
||||
<text x="0" y="9.5em"><tspan> │ │ │ [</tspan><tspan style="fill:#00bbbb">0</tspan><tspan>]{}: entry</tspan></text>
|
||||
<text x="0" y="10.5em"><tspan style="fill:#bbbb00">0xd70</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> 28 │ </tspan><tspan style="fill:#555555">...</tspan><tspan>( │ </tspan><tspan style="fill:#5555ff">segment_duration</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">40</tspan></text>
|
||||
<text x="0" y="11.5em"><tspan style="fill:#bbbb00">0xd70</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> │ </tspan><tspan style="fill:#555555">....</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">media_time</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">0</tspan></text>
|
||||
<text x="0" y="12.5em"><tspan style="fill:#bbbb00">0xd70</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="font-weight:bold">01</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan>│ </tspan><tspan style="fill:#555555">.</tspan><tspan style="font-weight:bold">.</tspan><tspan style="fill:#555555">.</tspan><tspan>│ </tspan><tspan style="fill:#5555ff">media_rate</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">1</tspan></text>
|
||||
<text x="0" y="13.5em"><tspan style="fill:#bbbb00">0xd80</tspan><tspan>│</tspan><tspan style="fill:#555555">00</tspan><tspan> │</tspan><tspan style="fill:#555555">.</tspan><tspan> │</tspan></text>
|
||||
<text x="0ch" y="0.5em"><tspan>$ fq 'first(grep_by(.type == "elst")) | d' file.mp4</tspan></text>
|
||||
<text x="0ch" y="1.5em"><tspan> │</tspan><tspan class="underline fa3">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan class="underline fa3">0123456789abcdef</tspan><tspan>│.</tspan><tspan class="fa12">boxes</tspan><tspan>[</tspan><tspan class="fa6">3</tspan><tspan>].</tspan><tspan class="fa12">boxes</tspan><tspan>[</tspan><tspan class="fa6">1</tspan><tspan>].</tspan><tspan class="fa12">boxes</tspan><tspan>[</tspan><tspan class="fa6">1</tspan><tspan>].</tspan><tspan class="fa12">boxes</tspan><tspan>[</tspan><tspan class="fa6">0</tspan><tspan>]{}: box</tspan></text>
|
||||
<text x="0ch" y="2.5em"><tspan class="fa3">0xd60</tspan><tspan>│ </tspan><tspan class="fa8">00 00 00 </tspan><tspan class="bold">1c </tspan><tspan>│ </tspan><tspan class="fa8">...</tspan><tspan class="bold">. </tspan><tspan>│ </tspan><tspan class="fa12">size</tspan><tspan>: </tspan><tspan class="fa6">28</tspan></text>
|
||||
<text x="0ch" y="3.5em"><tspan class="fa3">0xd60</tspan><tspan>│ 65 6c 73 74 │ elst │ </tspan><tspan class="fa12">type</tspan><tspan>: </tspan><tspan class="fa2">"elst" </tspan><tspan>(An edit list)</tspan></text>
|
||||
<text x="0ch" y="4.5em"><tspan class="fa3">0xd60</tspan><tspan>│ </tspan><tspan class="fa8">00 </tspan><tspan>│ </tspan><tspan class="fa8">. </tspan><tspan>│ </tspan><tspan class="fa12">version</tspan><tspan>: </tspan><tspan class="fa6">0</tspan></text>
|
||||
<text x="0ch" y="5.5em"><tspan class="fa3">0xd60</tspan><tspan>│ </tspan><tspan class="fa8">00 00</tspan><tspan>│ </tspan><tspan class="fa8">..</tspan><tspan>│ </tspan><tspan class="fa12">flags</tspan><tspan>: </tspan><tspan class="fa6">0</tspan></text>
|
||||
<text x="0ch" y="6.5em"><tspan class="fa3">0xd70</tspan><tspan>│</tspan><tspan class="fa8">00 </tspan><tspan>│</tspan><tspan class="fa8">. </tspan><tspan>│</tspan></text>
|
||||
<text x="0ch" y="7.5em"><tspan class="fa3">0xd70</tspan><tspan>│ </tspan><tspan class="fa8">00 00 00 </tspan><tspan class="bold">01 </tspan><tspan>│ </tspan><tspan class="fa8">...</tspan><tspan class="bold">. </tspan><tspan>│ </tspan><tspan class="fa12">entry_count</tspan><tspan>: </tspan><tspan class="fa6">1</tspan></text>
|
||||
<text x="0ch" y="8.5em"><tspan> │ │ │ </tspan><tspan class="fa12">entries</tspan><tspan>[</tspan><tspan class="fa6">0</tspan><tspan>:</tspan><tspan class="fa6">1</tspan><tspan>]:</tspan></text>
|
||||
<text x="0ch" y="9.5em"><tspan> │ │ │ [</tspan><tspan class="fa6">0</tspan><tspan>]{}: entry</tspan></text>
|
||||
<text x="0ch" y="10.5em"><tspan class="fa3">0xd70</tspan><tspan>│ </tspan><tspan class="fa8">00 00 00 </tspan><tspan>28 │ </tspan><tspan class="fa8">...</tspan><tspan>( │ </tspan><tspan class="fa12">segment_duration</tspan><tspan>: </tspan><tspan class="fa6">40</tspan></text>
|
||||
<text x="0ch" y="11.5em"><tspan class="fa3">0xd70</tspan><tspan>│ </tspan><tspan class="fa8">00 00 00 00 </tspan><tspan>│ </tspan><tspan class="fa8">.... </tspan><tspan>│ </tspan><tspan class="fa12">media_time</tspan><tspan>: </tspan><tspan class="fa6">0</tspan></text>
|
||||
<text x="0ch" y="12.5em"><tspan class="fa3">0xd70</tspan><tspan>│ </tspan><tspan class="fa8">00 </tspan><tspan class="bold">01 </tspan><tspan class="fa8">00</tspan><tspan>│ </tspan><tspan class="fa8">.</tspan><tspan class="bold">.</tspan><tspan class="fa8">.</tspan><tspan>│ </tspan><tspan class="fa12">media_rate</tspan><tspan>: </tspan><tspan class="fa6">1</tspan></text>
|
||||
<text x="0ch" y="13.5em"><tspan class="fa3">0xd80</tspan><tspan>│</tspan><tspan class="fa8">00 </tspan><tspan>│</tspan><tspan class="fa8">. </tspan><tspan>│</tspan></text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.2 KiB |
@ -10,20 +10,35 @@
|
||||
white-space: pre;
|
||||
fill: #bbbbbb;
|
||||
}
|
||||
.bg {
|
||||
stroke-width: "0.5px";
|
||||
}
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
.underline {
|
||||
text-decoration: underline;
|
||||
}
|
||||
<!-- Foreground ANSI colors -->
|
||||
.fa2 { fill: #00bb00; }
|
||||
.fa3 { fill: #bbbb00; }
|
||||
.fa6 { fill: #00bbbb; }
|
||||
.fa8 { fill: #555555; }
|
||||
.fa12 { fill: #5555ff; }
|
||||
</style>
|
||||
<rect width="100%" height="100%" x="0" y="0" style="fill: #000000"/>
|
||||
<text x="0" y="0.5em"><tspan>$ fq 'first(grep_by(.type == "elst")) | dv' file.mp4</tspan></text>
|
||||
<text x="0" y="1.5em"><tspan> │</tspan><tspan style="fill:#bbbb00" text-decoration="underline">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan style="fill:#bbbb00" text-decoration="underline">0123456789abcdef</tspan><tspan>│.</tspan><tspan style="fill:#5555ff">boxes</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">3</tspan><tspan>].</tspan><tspan style="fill:#5555ff">boxes</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">1</tspan><tspan>].</tspan><tspan style="fill:#5555ff">boxes</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">1</tspan><tspan>].</tspan><tspan style="fill:#5555ff">boxes</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">0</tspan><tspan>]{}: box 0xd65-0xd81 (28)</tspan></text>
|
||||
<text x="0" y="2.5em"><tspan style="fill:#bbbb00">0xd60</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="font-weight:bold">1c</tspan><tspan> │ </tspan><tspan style="fill:#555555">...</tspan><tspan style="font-weight:bold">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">size</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">28</tspan><tspan> 0xd65-0xd69 (4)</tspan></text>
|
||||
<text x="0" y="3.5em"><tspan style="fill:#bbbb00">0xd60</tspan><tspan>│ 65 6c 73 74 │ elst │ </tspan><tspan style="fill:#5555ff">type</tspan><tspan>: </tspan><tspan style="fill:#00bb00">"elst"</tspan><tspan> (An edit list) 0xd69-0xd6d (4)</tspan></text>
|
||||
<text x="0" y="4.5em"><tspan style="fill:#bbbb00">0xd60</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> │ </tspan><tspan style="fill:#555555">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">version</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">0</tspan><tspan> 0xd6d-0xd6e (1)</tspan></text>
|
||||
<text x="0" y="5.5em"><tspan style="fill:#bbbb00">0xd60</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan>│ </tspan><tspan style="fill:#555555">..</tspan><tspan>│ </tspan><tspan style="fill:#5555ff">flags</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">0</tspan><tspan> 0xd6e-0xd71 (3)</tspan></text>
|
||||
<text x="0" y="6.5em"><tspan style="fill:#bbbb00">0xd70</tspan><tspan>│</tspan><tspan style="fill:#555555">00</tspan><tspan> │</tspan><tspan style="fill:#555555">.</tspan><tspan> │</tspan></text>
|
||||
<text x="0" y="7.5em"><tspan style="fill:#bbbb00">0xd70</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="font-weight:bold">01</tspan><tspan> │ </tspan><tspan style="fill:#555555">...</tspan><tspan style="font-weight:bold">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">entry_count</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">1</tspan><tspan> 0xd71-0xd75 (4)</tspan></text>
|
||||
<text x="0" y="8.5em"><tspan> │ │ │ </tspan><tspan style="fill:#5555ff">entries</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">0</tspan><tspan>:</tspan><tspan style="fill:#00bbbb">1</tspan><tspan>]: 0xd75-0xd81 (12)</tspan></text>
|
||||
<text x="0" y="9.5em"><tspan> │ │ │ [</tspan><tspan style="fill:#00bbbb">0</tspan><tspan>]{}: entry 0xd75-0xd81 (12)</tspan></text>
|
||||
<text x="0" y="10.5em"><tspan style="fill:#bbbb00">0xd70</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> 28 │ </tspan><tspan style="fill:#555555">...</tspan><tspan>( │ </tspan><tspan style="fill:#5555ff">segment_duration</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">40</tspan><tspan> 0xd75-0xd79 (4)</tspan></text>
|
||||
<text x="0" y="11.5em"><tspan style="fill:#bbbb00">0xd70</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan> │ </tspan><tspan style="fill:#555555">....</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">media_time</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">0</tspan><tspan> 0xd79-0xd7d (4)</tspan></text>
|
||||
<text x="0" y="12.5em"><tspan style="fill:#bbbb00">0xd70</tspan><tspan>│ </tspan><tspan style="fill:#555555">00</tspan><tspan> </tspan><tspan style="font-weight:bold">01</tspan><tspan> </tspan><tspan style="fill:#555555">00</tspan><tspan>│ </tspan><tspan style="fill:#555555">.</tspan><tspan style="font-weight:bold">.</tspan><tspan style="fill:#555555">.</tspan><tspan>│ </tspan><tspan style="fill:#5555ff">media_rate</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">1</tspan><tspan> 0xd7d-0xd81 (4)</tspan></text>
|
||||
<text x="0" y="13.5em"><tspan style="fill:#bbbb00">0xd80</tspan><tspan>│</tspan><tspan style="fill:#555555">00</tspan><tspan> │</tspan><tspan style="fill:#555555">.</tspan><tspan> │</tspan></text>
|
||||
<text x="0ch" y="0.5em"><tspan>$ fq 'first(grep_by(.type == "elst")) | dv' file.mp4</tspan></text>
|
||||
<text x="0ch" y="1.5em"><tspan> │</tspan><tspan class="underline fa3">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan class="underline fa3">0123456789abcdef</tspan><tspan>│.</tspan><tspan class="fa12">boxes</tspan><tspan>[</tspan><tspan class="fa6">3</tspan><tspan>].</tspan><tspan class="fa12">boxes</tspan><tspan>[</tspan><tspan class="fa6">1</tspan><tspan>].</tspan><tspan class="fa12">boxes</tspan><tspan>[</tspan><tspan class="fa6">1</tspan><tspan>].</tspan><tspan class="fa12">boxes</tspan><tspan>[</tspan><tspan class="fa6">0</tspan><tspan>]{}: box 0xd65-0xd81 (28)</tspan></text>
|
||||
<text x="0ch" y="2.5em"><tspan class="fa3">0xd60</tspan><tspan>│ </tspan><tspan class="fa8">00 00 00 </tspan><tspan class="bold">1c </tspan><tspan>│ </tspan><tspan class="fa8">...</tspan><tspan class="bold">. </tspan><tspan>│ </tspan><tspan class="fa12">size</tspan><tspan>: </tspan><tspan class="fa6">28 </tspan><tspan>0xd65-0xd69 (4)</tspan></text>
|
||||
<text x="0ch" y="3.5em"><tspan class="fa3">0xd60</tspan><tspan>│ 65 6c 73 74 │ elst │ </tspan><tspan class="fa12">type</tspan><tspan>: </tspan><tspan class="fa2">"elst" </tspan><tspan>(An edit list) 0xd69-0xd6d (4)</tspan></text>
|
||||
<text x="0ch" y="4.5em"><tspan class="fa3">0xd60</tspan><tspan>│ </tspan><tspan class="fa8">00 </tspan><tspan>│ </tspan><tspan class="fa8">. </tspan><tspan>│ </tspan><tspan class="fa12">version</tspan><tspan>: </tspan><tspan class="fa6">0 </tspan><tspan>0xd6d-0xd6e (1)</tspan></text>
|
||||
<text x="0ch" y="5.5em"><tspan class="fa3">0xd60</tspan><tspan>│ </tspan><tspan class="fa8">00 00</tspan><tspan>│ </tspan><tspan class="fa8">..</tspan><tspan>│ </tspan><tspan class="fa12">flags</tspan><tspan>: </tspan><tspan class="fa6">0 </tspan><tspan>0xd6e-0xd71 (3)</tspan></text>
|
||||
<text x="0ch" y="6.5em"><tspan class="fa3">0xd70</tspan><tspan>│</tspan><tspan class="fa8">00 </tspan><tspan>│</tspan><tspan class="fa8">. </tspan><tspan>│</tspan></text>
|
||||
<text x="0ch" y="7.5em"><tspan class="fa3">0xd70</tspan><tspan>│ </tspan><tspan class="fa8">00 00 00 </tspan><tspan class="bold">01 </tspan><tspan>│ </tspan><tspan class="fa8">...</tspan><tspan class="bold">. </tspan><tspan>│ </tspan><tspan class="fa12">entry_count</tspan><tspan>: </tspan><tspan class="fa6">1 </tspan><tspan>0xd71-0xd75 (4)</tspan></text>
|
||||
<text x="0ch" y="8.5em"><tspan> │ │ │ </tspan><tspan class="fa12">entries</tspan><tspan>[</tspan><tspan class="fa6">0</tspan><tspan>:</tspan><tspan class="fa6">1</tspan><tspan>]: 0xd75-0xd81 (12)</tspan></text>
|
||||
<text x="0ch" y="9.5em"><tspan> │ │ │ [</tspan><tspan class="fa6">0</tspan><tspan>]{}: entry 0xd75-0xd81 (12)</tspan></text>
|
||||
<text x="0ch" y="10.5em"><tspan class="fa3">0xd70</tspan><tspan>│ </tspan><tspan class="fa8">00 00 00 </tspan><tspan>28 │ </tspan><tspan class="fa8">...</tspan><tspan>( │ </tspan><tspan class="fa12">segment_duration</tspan><tspan>: </tspan><tspan class="fa6">40 </tspan><tspan>0xd75-0xd79 (4)</tspan></text>
|
||||
<text x="0ch" y="11.5em"><tspan class="fa3">0xd70</tspan><tspan>│ </tspan><tspan class="fa8">00 00 00 00 </tspan><tspan>│ </tspan><tspan class="fa8">.... </tspan><tspan>│ </tspan><tspan class="fa12">media_time</tspan><tspan>: </tspan><tspan class="fa6">0 </tspan><tspan>0xd79-0xd7d (4)</tspan></text>
|
||||
<text x="0ch" y="12.5em"><tspan class="fa3">0xd70</tspan><tspan>│ </tspan><tspan class="fa8">00 </tspan><tspan class="bold">01 </tspan><tspan class="fa8">00</tspan><tspan>│ </tspan><tspan class="fa8">.</tspan><tspan class="bold">.</tspan><tspan class="fa8">.</tspan><tspan>│ </tspan><tspan class="fa12">media_rate</tspan><tspan>: </tspan><tspan class="fa6">1 </tspan><tspan>0xd7d-0xd81 (4)</tspan></text>
|
||||
<text x="0ch" y="13.5em"><tspan class="fa3">0xd80</tspan><tspan>│</tspan><tspan class="fa8">00 </tspan><tspan>│</tspan><tspan class="fa8">. </tspan><tspan>│</tspan></text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 5.4 KiB |
@ -10,22 +10,36 @@
|
||||
white-space: pre;
|
||||
fill: #bbbbbb;
|
||||
}
|
||||
.bg {
|
||||
stroke-width: "0.5px";
|
||||
}
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
.underline {
|
||||
text-decoration: underline;
|
||||
}
|
||||
<!-- Foreground ANSI colors -->
|
||||
.fa2 { fill: #00bb00; }
|
||||
.fa3 { fill: #bbbb00; }
|
||||
.fa6 { fill: #00bbbb; }
|
||||
.fa12 { fill: #5555ff; }
|
||||
</style>
|
||||
<rect width="100%" height="100%" x="0" y="0" style="fill: #000000"/>
|
||||
<text x="0" y="0.5em"><tspan>$ fq '.frames[1].header | dv' file.mp3</tspan></text>
|
||||
<text x="0" y="1.5em"><tspan> │</tspan><tspan style="fill:#bbbb00" text-decoration="underline">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan style="fill:#bbbb00" text-decoration="underline">0123456789abcdef</tspan><tspan>│.</tspan><tspan style="fill:#5555ff">frames</tspan><tspan>[</tspan><tspan style="fill:#00bbbb">1</tspan><tspan>].</tspan><tspan style="fill:#5555ff">header</tspan><tspan>{}: 0xb79-0xb7d (4)</tspan></text>
|
||||
<text x="0" y="2.5em"><tspan style="fill:#bbbb00">0xb70</tspan><tspan>│ </tspan><tspan style="font-weight:bold">ff</tspan><tspan> </tspan><tspan style="font-weight:bold">fb</tspan><tspan> │ </tspan><tspan style="font-weight:bold">..</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">sync</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">0b11111111111</tspan><tspan> (valid) 0xb79-0xb7a.3 (1.3)</tspan></text>
|
||||
<text x="0" y="3.5em"><tspan style="fill:#bbbb00">0xb70</tspan><tspan>│ </tspan><tspan style="font-weight:bold">fb</tspan><tspan> │ </tspan><tspan style="font-weight:bold">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">mpeg_version</tspan><tspan>: </tspan><tspan style="fill:#00bb00">"1"</tspan><tspan> (</tspan><tspan style="fill:#00bbbb">3</tspan><tspan>) (MPEG Version 1) 0xb7a.3-0xb7a.5 (0.2)</tspan></text>
|
||||
<text x="0" y="4.5em"><tspan style="fill:#bbbb00">0xb70</tspan><tspan>│ </tspan><tspan style="font-weight:bold">fb</tspan><tspan> │ </tspan><tspan style="font-weight:bold">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">layer</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">3</tspan><tspan> (</tspan><tspan style="fill:#00bbbb">1</tspan><tspan>) (MPEG Layer 3) 0xb7a.5-0xb7a.7 (0.2)</tspan></text>
|
||||
<text x="0" y="5.5em"><tspan> │ │ │ </tspan><tspan style="fill:#5555ff">sample_count</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">1152</tspan></text>
|
||||
<text x="0" y="6.5em"><tspan style="fill:#bbbb00">0xb70</tspan><tspan>│ </tspan><tspan style="font-weight:bold">fb</tspan><tspan> │ </tspan><tspan style="font-weight:bold">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">protection_absent</tspan><tspan>: </tspan><tspan style="fill:#bbbb00">true</tspan><tspan> (No CRC) 0xb7a.7-0xb7b (0.1)</tspan></text>
|
||||
<text x="0" y="7.5em"><tspan style="fill:#bbbb00">0xb70</tspan><tspan>│ 50 │ P │ </tspan><tspan style="fill:#5555ff">bitrate</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">64000</tspan><tspan> (</tspan><tspan style="fill:#00bbbb">5</tspan><tspan>) 0xb7b-0xb7b.4 (0.4)</tspan></text>
|
||||
<text x="0" y="8.5em"><tspan style="fill:#bbbb00">0xb70</tspan><tspan>│ 50 │ P │ </tspan><tspan style="fill:#5555ff">sample_rate</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">44100</tspan><tspan> (</tspan><tspan style="fill:#00bbbb">0</tspan><tspan>) 0xb7b.4-0xb7b.6 (0.2)</tspan></text>
|
||||
<text x="0" y="9.5em"><tspan style="fill:#bbbb00">0xb70</tspan><tspan>│ 50 │ P │ </tspan><tspan style="fill:#5555ff">padding</tspan><tspan>: </tspan><tspan style="fill:#00bb00">"not_padded"</tspan><tspan> (</tspan><tspan style="fill:#00bbbb">0b0</tspan><tspan>) 0xb7b.6-0xb7b.7 (0.1)</tspan></text>
|
||||
<text x="0" y="10.5em"><tspan style="fill:#bbbb00">0xb70</tspan><tspan>│ 50 │ P │ </tspan><tspan style="fill:#5555ff">private</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">0</tspan><tspan> 0xb7b.7-0xb7c (0.1)</tspan></text>
|
||||
<text x="0" y="11.5em"><tspan style="fill:#bbbb00">0xb70</tspan><tspan>│ </tspan><tspan style="font-weight:bold">c4</tspan><tspan> │ </tspan><tspan style="font-weight:bold">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">channels</tspan><tspan>: </tspan><tspan style="fill:#00bb00">"mono"</tspan><tspan> (</tspan><tspan style="fill:#00bbbb">0b11</tspan><tspan>) 0xb7c-0xb7c.2 (0.2)</tspan></text>
|
||||
<text x="0" y="12.5em"><tspan style="fill:#bbbb00">0xb70</tspan><tspan>│ </tspan><tspan style="font-weight:bold">c4</tspan><tspan> │ </tspan><tspan style="font-weight:bold">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">channel_mode</tspan><tspan>: </tspan><tspan style="fill:#00bb00">"none"</tspan><tspan> (</tspan><tspan style="fill:#00bbbb">0b0</tspan><tspan>) 0xb7c.2-0xb7c.4 (0.2)</tspan></text>
|
||||
<text x="0" y="13.5em"><tspan style="fill:#bbbb00">0xb70</tspan><tspan>│ </tspan><tspan style="font-weight:bold">c4</tspan><tspan> │ </tspan><tspan style="font-weight:bold">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">copyright</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">0</tspan><tspan> 0xb7c.4-0xb7c.5 (0.1)</tspan></text>
|
||||
<text x="0" y="14.5em"><tspan style="fill:#bbbb00">0xb70</tspan><tspan>│ </tspan><tspan style="font-weight:bold">c4</tspan><tspan> │ </tspan><tspan style="font-weight:bold">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">original</tspan><tspan>: </tspan><tspan style="fill:#00bbbb">1</tspan><tspan> 0xb7c.5-0xb7c.6 (0.1)</tspan></text>
|
||||
<text x="0" y="15.5em"><tspan style="fill:#bbbb00">0xb70</tspan><tspan>│ </tspan><tspan style="font-weight:bold">c4</tspan><tspan> │ </tspan><tspan style="font-weight:bold">.</tspan><tspan> │ </tspan><tspan style="fill:#5555ff">emphasis</tspan><tspan>: </tspan><tspan style="fill:#00bb00">"none"</tspan><tspan> (</tspan><tspan style="fill:#00bbbb">0b0</tspan><tspan>) 0xb7c.6-0xb7d (0.2)</tspan></text>
|
||||
<text x="0ch" y="0.5em"><tspan>$ fq '.frames[1].header | dv' file.mp3</tspan></text>
|
||||
<text x="0ch" y="1.5em"><tspan> │</tspan><tspan class="underline fa3">00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f</tspan><tspan>│</tspan><tspan class="underline fa3">0123456789abcdef</tspan><tspan>│.</tspan><tspan class="fa12">frames</tspan><tspan>[</tspan><tspan class="fa6">1</tspan><tspan>].</tspan><tspan class="fa12">header</tspan><tspan>{}: 0xb79-0xb7d (4)</tspan></text>
|
||||
<text x="0ch" y="2.5em"><tspan class="fa3">0xb70</tspan><tspan>│ </tspan><tspan class="bold">ff fb </tspan><tspan>│ </tspan><tspan class="bold">.. </tspan><tspan>│ </tspan><tspan class="fa12">sync</tspan><tspan>: </tspan><tspan class="fa6">0b11111111111 </tspan><tspan>(valid) 0xb79-0xb7a.3 (1.3)</tspan></text>
|
||||
<text x="0ch" y="3.5em"><tspan class="fa3">0xb70</tspan><tspan>│ </tspan><tspan class="bold">fb </tspan><tspan>│ </tspan><tspan class="bold">. </tspan><tspan>│ </tspan><tspan class="fa12">mpeg_version</tspan><tspan>: </tspan><tspan class="fa2">"1" </tspan><tspan>(</tspan><tspan class="fa6">3</tspan><tspan>) (MPEG Version 1) 0xb7a.3-0xb7a.5 (0.2)</tspan></text>
|
||||
<text x="0ch" y="4.5em"><tspan class="fa3">0xb70</tspan><tspan>│ </tspan><tspan class="bold">fb </tspan><tspan>│ </tspan><tspan class="bold">. </tspan><tspan>│ </tspan><tspan class="fa12">layer</tspan><tspan>: </tspan><tspan class="fa6">3 </tspan><tspan>(</tspan><tspan class="fa6">1</tspan><tspan>) (MPEG Layer 3) 0xb7a.5-0xb7a.7 (0.2)</tspan></text>
|
||||
<text x="0ch" y="5.5em"><tspan> │ │ │ </tspan><tspan class="fa12">sample_count</tspan><tspan>: </tspan><tspan class="fa6">1152</tspan></text>
|
||||
<text x="0ch" y="6.5em"><tspan class="fa3">0xb70</tspan><tspan>│ </tspan><tspan class="bold">fb </tspan><tspan>│ </tspan><tspan class="bold">. </tspan><tspan>│ </tspan><tspan class="fa12">protection_absent</tspan><tspan>: </tspan><tspan class="fa3">true </tspan><tspan>(No CRC) 0xb7a.7-0xb7b (0.1)</tspan></text>
|
||||
<text x="0ch" y="7.5em"><tspan class="fa3">0xb70</tspan><tspan>│ 50 │ P │ </tspan><tspan class="fa12">bitrate</tspan><tspan>: </tspan><tspan class="fa6">64000 </tspan><tspan>(</tspan><tspan class="fa6">5</tspan><tspan>) 0xb7b-0xb7b.4 (0.4)</tspan></text>
|
||||
<text x="0ch" y="8.5em"><tspan class="fa3">0xb70</tspan><tspan>│ 50 │ P │ </tspan><tspan class="fa12">sample_rate</tspan><tspan>: </tspan><tspan class="fa6">44100 </tspan><tspan>(</tspan><tspan class="fa6">0</tspan><tspan>) 0xb7b.4-0xb7b.6 (0.2)</tspan></text>
|
||||
<text x="0ch" y="9.5em"><tspan class="fa3">0xb70</tspan><tspan>│ 50 │ P │ </tspan><tspan class="fa12">padding</tspan><tspan>: </tspan><tspan class="fa2">"not_padded" </tspan><tspan>(</tspan><tspan class="fa6">0b0</tspan><tspan>) 0xb7b.6-0xb7b.7 (0.1)</tspan></text>
|
||||
<text x="0ch" y="10.5em"><tspan class="fa3">0xb70</tspan><tspan>│ 50 │ P │ </tspan><tspan class="fa12">private</tspan><tspan>: </tspan><tspan class="fa6">0 </tspan><tspan>0xb7b.7-0xb7c (0.1)</tspan></text>
|
||||
<text x="0ch" y="11.5em"><tspan class="fa3">0xb70</tspan><tspan>│ </tspan><tspan class="bold">c4 </tspan><tspan>│ </tspan><tspan class="bold">. </tspan><tspan>│ </tspan><tspan class="fa12">channels</tspan><tspan>: </tspan><tspan class="fa2">"mono" </tspan><tspan>(</tspan><tspan class="fa6">0b11</tspan><tspan>) 0xb7c-0xb7c.2 (0.2)</tspan></text>
|
||||
<text x="0ch" y="12.5em"><tspan class="fa3">0xb70</tspan><tspan>│ </tspan><tspan class="bold">c4 </tspan><tspan>│ </tspan><tspan class="bold">. </tspan><tspan>│ </tspan><tspan class="fa12">channel_mode</tspan><tspan>: </tspan><tspan class="fa2">"none" </tspan><tspan>(</tspan><tspan class="fa6">0b0</tspan><tspan>) 0xb7c.2-0xb7c.4 (0.2)</tspan></text>
|
||||
<text x="0ch" y="13.5em"><tspan class="fa3">0xb70</tspan><tspan>│ </tspan><tspan class="bold">c4 </tspan><tspan>│ </tspan><tspan class="bold">. </tspan><tspan>│ </tspan><tspan class="fa12">copyright</tspan><tspan>: </tspan><tspan class="fa6">0 </tspan><tspan>0xb7c.4-0xb7c.5 (0.1)</tspan></text>
|
||||
<text x="0ch" y="14.5em"><tspan class="fa3">0xb70</tspan><tspan>│ </tspan><tspan class="bold">c4 </tspan><tspan>│ </tspan><tspan class="bold">. </tspan><tspan>│ </tspan><tspan class="fa12">original</tspan><tspan>: </tspan><tspan class="fa6">1 </tspan><tspan>0xb7c.5-0xb7c.6 (0.1)</tspan></text>
|
||||
<text x="0ch" y="15.5em"><tspan class="fa3">0xb70</tspan><tspan>│ </tspan><tspan class="bold">c4 </tspan><tspan>│ </tspan><tspan class="bold">. </tspan><tspan>│ </tspan><tspan class="fa12">emphasis</tspan><tspan>: </tspan><tspan class="fa2">"none" </tspan><tspan>(</tspan><tspan class="fa6">0b0</tspan><tspan>) 0xb7c.6-0xb7d (0.2)</tspan></text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.2 KiB |
@ -10,10 +10,15 @@
|
||||
white-space: pre;
|
||||
fill: #bbbbbb;
|
||||
}
|
||||
.bg {
|
||||
stroke-width: "0.5px";
|
||||
}
|
||||
<!-- Foreground ANSI colors -->
|
||||
.fa2 { fill: #00bb00; }
|
||||
</style>
|
||||
<rect width="100%" height="100%" x="0" y="0" style="fill: #000000"/>
|
||||
<text x="0" y="0.5em"><tspan>$ fq -n '"hello"'</tspan></text>
|
||||
<text x="0" y="1.5em"><tspan style="fill:#00bb00">"hello"</tspan></text>
|
||||
<text x="0" y="3.5em"><tspan>$ fq -n '"hello" | d'</tspan></text>
|
||||
<text x="0" y="4.5em"><tspan style="fill:#00bb00">"hello"</tspan></text>
|
||||
<text x="0ch" y="0.5em"><tspan>$ fq -n '"hello"'</tspan></text>
|
||||
<text x="0ch" y="1.5em"><tspan class="fa2">"hello"</tspan></text>
|
||||
<text x="0ch" y="3.5em"><tspan>$ fq -n '"hello" | d'</tspan></text>
|
||||
<text x="0ch" y="4.5em"><tspan class="fa2">"hello"</tspan></text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 825 B After Width: | Height: | Size: 946 B |
@ -45,6 +45,7 @@
|
||||
|`ether8023_frame` |Ethernet 802.3 frame |<sub>`inet_packet`</sub>|
|
||||
|`exif` |Exchangeable Image File Format |<sub></sub>|
|
||||
|`fairplay_spc` |FairPlay Server Playback Context |<sub></sub>|
|
||||
|[`fit`](#fit) |Garmin Flexible and Interoperable Data Transfer |<sub></sub>|
|
||||
|`flac` |Free Lossless Audio Codec file |<sub>`flac_metadatablocks` `flac_frame`</sub>|
|
||||
|[`flac_frame`](#flac_frame) |FLAC frame |<sub></sub>|
|
||||
|`flac_metadatablock` |FLAC metadatablock |<sub>`flac_streaminfo` `flac_picture` `vorbis_comment`</sub>|
|
||||
@ -69,6 +70,7 @@
|
||||
|`id3v2` |ID3v2 metadata |<sub>`image`</sub>|
|
||||
|`ipv4_packet` |Internet protocol v4 packet |<sub>`ip_packet`</sub>|
|
||||
|`ipv6_packet` |Internet protocol v6 packet |<sub>`ip_packet`</sub>|
|
||||
|`jp2c` |JPEG 2000 codestream |<sub></sub>|
|
||||
|`jpeg` |Joint Photographic Experts Group file |<sub>`exif` `icc_profile`</sub>|
|
||||
|`json` |JavaScript Object Notation |<sub></sub>|
|
||||
|`jsonl` |JavaScript Object Notation Lines |<sub></sub>|
|
||||
@ -85,7 +87,7 @@
|
||||
|`mp3_frame` |MPEG audio layer 3 frame |<sub>`mp3_frame_tags`</sub>|
|
||||
|`mp3_frame_vbri` |MP3 frame Fraunhofer encoder variable bitrate tag |<sub></sub>|
|
||||
|`mp3_frame_xing` |MP3 frame Xing/Info tag |<sub></sub>|
|
||||
|[`mp4`](#mp4) |ISOBMFF, QuickTime and similar |<sub>`aac_frame` `av1_ccr` `av1_frame` `avc_au` `avc_dcr` `flac_frame` `flac_metadatablocks` `hevc_au` `hevc_dcr` `icc_profile` `id3v2` `image` `jpeg` `mp3_frame` `mpeg_es` `mpeg_pes_packet` `opus_packet` `png` `prores_frame` `protobuf_widevine` `pssh_playready` `vorbis_packet` `vp9_frame` `vpx_ccr`</sub>|
|
||||
|[`mp4`](#mp4) |ISOBMFF, QuickTime and similar |<sub>`aac_frame` `av1_ccr` `av1_frame` `avc_au` `avc_dcr` `flac_frame` `flac_metadatablocks` `hevc_au` `hevc_dcr` `icc_profile` `id3v2` `image` `jp2c` `jpeg` `mp3_frame` `mpeg_es` `mpeg_pes_packet` `opus_packet` `png` `prores_frame` `protobuf_widevine` `pssh_playready` `vorbis_packet` `vp9_frame` `vpx_ccr`</sub>|
|
||||
|`mpeg_asc` |MPEG-4 Audio Specific Config |<sub></sub>|
|
||||
|`mpeg_es` |MPEG Elementary Stream |<sub>`mpeg_asc` `vorbis_packet`</sub>|
|
||||
|`mpeg_pes` |MPEG Packetized elementary stream |<sub>`mpeg_pes_packet` `mpeg_spu`</sub>|
|
||||
@ -93,6 +95,7 @@
|
||||
|`mpeg_spu` |Sub Picture Unit (DVD subtitle) |<sub></sub>|
|
||||
|`mpeg_ts` |MPEG Transport Stream |<sub></sub>|
|
||||
|[`msgpack`](#msgpack) |MessagePack |<sub></sub>|
|
||||
|[`nes`](#nes) |iNES/NES 2.0 cartridge ROM format |<sub></sub>|
|
||||
|`ogg` |OGG file |<sub>`ogg_page` `vorbis_packet` `opus_packet` `flac_metadatablock` `flac_frame`</sub>|
|
||||
|`ogg_page` |OGG page |<sub></sub>|
|
||||
|[`opentimestamps`](#opentimestamps) |OpenTimestamps file |<sub></sub>|
|
||||
@ -129,12 +132,12 @@
|
||||
|[`xml`](#xml) |Extensible Markup Language |<sub></sub>|
|
||||
|`yaml` |YAML Ain't Markup Language |<sub></sub>|
|
||||
|[`zip`](#zip) |ZIP archive |<sub>`probe`</sub>|
|
||||
|`image` |Group |<sub>`gif` `jpeg` `mp4` `png` `tiff` `webp`</sub>|
|
||||
|`image` |Group |<sub>`gif` `jp2c` `jpeg` `mp4` `png` `tiff` `webp`</sub>|
|
||||
|`inet_packet` |Group |<sub>`ipv4_packet` `ipv6_packet`</sub>|
|
||||
|`ip_packet` |Group |<sub>`icmp` `icmpv6` `tcp_segment` `udp_datagram`</sub>|
|
||||
|`link_frame` |Group |<sub>`bsd_loopback_frame` `ether8023_frame` `ipv4_packet` `ipv6_packet` `sll2_packet` `sll_packet`</sub>|
|
||||
|`mp3_frame_tags` |Group |<sub>`mp3_frame_vbri` `mp3_frame_xing`</sub>|
|
||||
|`probe` |Group |<sub>`adts` `aiff` `apple_bookmark` `ar` `avi` `avro_ocf` `bitcoin_blkdat` `bplist` `bzip2` `caff` `elf` `flac` `gif` `gzip` `html` `jpeg` `json` `jsonl` `leveldb_table` `luajit` `macho` `macho_fat` `matroska` `moc3` `mp3` `mp4` `mpeg_ts` `ogg` `opentimestamps` `pcap` `pcapng` `png` `tar` `tiff` `toml` `tzif` `wasm` `wav` `webp` `xml` `yaml` `zip`</sub>|
|
||||
|`probe` |Group |<sub>`adts` `aiff` `apple_bookmark` `ar` `avi` `avro_ocf` `bitcoin_blkdat` `bplist` `bzip2` `caff` `elf` `fit` `flac` `gif` `gzip` `html` `jp2c` `jpeg` `json` `jsonl` `leveldb_table` `luajit` `macho` `macho_fat` `matroska` `moc3` `mp3` `mp4` `mpeg_ts` `nes` `ogg` `opentimestamps` `pcap` `pcapng` `png` `tar` `tiff` `toml` `tzif` `wasm` `wav` `webp` `xml` `yaml` `zip`</sub>|
|
||||
|`tcp_stream` |Group |<sub>`dns_tcp` `rtmp` `tls`</sub>|
|
||||
|`udp_payload` |Group |<sub>`dns`</sub>|
|
||||
|
||||
@ -570,6 +573,28 @@ $ fq -d csv -o comma="\t" to_csv file.tsv
|
||||
$ fq -d csv '.[0] as $t | .[1:] | map(with_entries(.key = $t[.key]))' file.csv
|
||||
```
|
||||
|
||||
## fit
|
||||
|
||||
### Limitations
|
||||
|
||||
- Fields with subcomponents, such as "compressed_speed_distance" field on globalMessageNumber 20 is not represented correctly.
|
||||
The field is read as 3 separate bytes where the first 12 bits are speed and the last 12 bits are distance.
|
||||
- There are still lots of UNKOWN fields due to gaps in Garmins SDK Profile documentation. (Currently FIT SDK 21.126)
|
||||
- Compressed timestamp messages are not accumulated against last known full timestamp.
|
||||
|
||||
### Convert stream of data messages to JSON array
|
||||
|
||||
```
|
||||
$ fq '[.data_records[] | select(.record_header.message_type == "data").data_message]' file.fit
|
||||
```
|
||||
|
||||
### Authors
|
||||
- Mikael Lofjärd mikael.lofjard@gmail.com, original author
|
||||
|
||||
### References
|
||||
- https://developer.garmin.com/fit/protocol/
|
||||
- https://developer.garmin.com/fit/cookbook/decoding-activity-files/
|
||||
|
||||
## flac_frame
|
||||
|
||||
### Options
|
||||
@ -917,6 +942,42 @@ $ fq -d msgpack torepr file.msgpack
|
||||
### References
|
||||
- https://github.com/msgpack/msgpack/blob/master/spec.md
|
||||
|
||||
## nes
|
||||
|
||||
### Limitations
|
||||
|
||||
- `prg_rom`, `chr_rom` and `trainer` fields may contain data that is just random
|
||||
junk from the memory chips, since they are of a fixed size.
|
||||
- The `nes_toasm` function outputs ALL opcodes, including the unofficial ones,
|
||||
which means that none of the regular assemblers can recompile it.
|
||||
- The `nes_tokitty` function works on tiles in `chr_rom` but only outputs a Kitty
|
||||
graphics compatible string. You need to manually `printf` that string to get
|
||||
Kitty (or another compatible terminal) to output the graphics.
|
||||
|
||||
### Decompile PRG ROM
|
||||
```
|
||||
$ fq -r '.prg_rom[] | nes_toasm' file.nes
|
||||
```
|
||||
|
||||
### Print out first CHR ROM tile in Kitty (or Konsole, wayst, WezTerm) at size 5
|
||||
```
|
||||
$ printf $(fq -r -d nes '.chr_rom[0] | nes_tokitty(5)' file.nes)
|
||||
```
|
||||
|
||||
### Print out all CHR ROM tiles in Kitty (with Bash) at size 5
|
||||
```
|
||||
$ for line in $(fq -r '.chr_rom[] | nes_tokitty(5)' file.nes);do printf "%b%s" "$line";done
|
||||
```
|
||||
|
||||
### Authors
|
||||
- Mikael Lofjärd mikael.lofjard@gmail.com, original author
|
||||
|
||||
### References
|
||||
- https://www.nesdev.org/wiki/INES
|
||||
- https://www.nesdev.org/wiki/NES_2.0
|
||||
- https://www.nesdev.org/wiki/CPU
|
||||
- https://bugzmanov.github.io/nes_ebook/chapter_6_3.html
|
||||
|
||||
## opentimestamps
|
||||
|
||||
### View a full OpenTimestamps file
|
||||
|
2146
doc/formats.svg
Before Width: | Height: | Size: 154 KiB After Width: | Height: | Size: 156 KiB |
534
doc/guides/fra-pcap-challange-2021-09/README.md
Normal file
@ -0,0 +1,534 @@
|
||||
## Solving part of the FRA pcap challenge 2021-09 using fq
|
||||
|
||||
**CAUTION:** fq is still in early development so things might change but i will try to keep the guide updated.
|
||||
|
||||
This guide will show how to work with fq and how to use the jq language. It will also show some useful things from the standard library of jq and fq. We will walk thru one of the challenges from [FRA challenge](https://challenge.fra.se/) that are challenges [FRA](https://www.fra.se/) (~Swedish NSA) published as part of their recruitment effort. The challenge can be downloaded from [pcap-challenge-2021-09.tgz](https://challenge.fra.se/pcap-challenge-2021-09.tgz) but it can also be found in the same directory as this README file.
|
||||
|
||||
Start by running fq on the file to get an overview:
|
||||
|
||||
```
|
||||
$ fq . pcap-challenge-2021-09.tgz
|
||||
│00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f│0123456789abcdef│.{}: pcap-challenge-2021-09.tgz (gzip)
|
||||
0x0000000│1f 8b │.. │ identification: raw bits (valid)
|
||||
0x0000000│ 08 │ . │ compression_method: "deflate" (8)
|
||||
0x0000000│ 00 │ . │ flags{}:
|
||||
0x0000000│ 00 00 00 00 │ .... │ mtime: 0
|
||||
0x0000000│ 00 │ . │ extra_flags: 0
|
||||
0x0000000│ 03 │ . │ os: "Unix" (3)
|
||||
0x000000│74 72 69 61 6e 67 6c 65 2e 70 63 61 70 00 00 00│triangle.pcap...│ uncompressed{}: (tar)
|
||||
* │until 0x4fafff.7 (end) (5222400) │ │
|
||||
0x0000000│ ec 9c 09 90 1c d5│ ......│ compressed: raw bits
|
||||
0x0000010│79 c7 47 2b a1 15 42 c8 40 44 02 8b 84 57 4b 62│y.G+..B.@D...WKb│
|
||||
* │until 0x3b602.7 (243193) │ │
|
||||
0x003b600│ 1e 41 08 b4 │ .A.. │ crc32: 0xb408411e (valid)
|
||||
0x003b600│ 00 b0 4f 00│ │ ..O.│ │ isize: 5222400
|
||||
```
|
||||
|
||||
The first columns shows the start address of each line, second and third a hex and ASCII dump and the forth a hierarchical tree representation of the decoded values. At the top we see that the file was detected as `gzip`. The tree shows various compression details and that fq has detected that the uncompressed bytes are a `tar` archive, also the `{}` hints that there are more values inside the uncompressed field.
|
||||
|
||||
Of course it's probably easiest to just extract the archive instead using fq but for the case of learning it's probably useful to use something familiar to show how to navigate it using fq.
|
||||
|
||||
Now start an interactive [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) (`-i`):
|
||||
```
|
||||
$ fq -i . pcap-challenge-2021-09.tgz
|
||||
gzip>
|
||||
```
|
||||
|
||||
The First thing we see is a prompt indicating the current "input" which is the root of the gzip file. If we type `.`, it will show the same output as above. `.` is the "identity" function in jq which does nothing, it just outputs what it gets as input. By default fq:s REPL will try to display what the expression is evaluated to in some useful way.
|
||||
|
||||
To recursively display the whole tree we can use `d` (short for `display`) or `f` (short for `display({array_truncate: 0})`) which will do the same but not truncate long arrays.
|
||||
|
||||
Note that the REPL supports auto-completion of functions and fields using tab, there is history support using arrow keys and the prompt supports basic readline shortcuts (same as bash etc).
|
||||
|
||||
To look into the tar archive we can do:
|
||||
|
||||
```
|
||||
gzip> .uncompressed
|
||||
│00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f│0123456789abcdef│.uncompressed{}: (tar)
|
||||
0x000000│74 72 69 61 6e 67 6c 65 2e 70 63 61 70 00 00 00│triangle.pcap...│ files[0:3]:
|
||||
0x000010│00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00│................│
|
||||
* │until 0x4f9dff.7 (5217792) │ │
|
||||
0x4f9e00│00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00│................│ end_marker: raw bits
|
||||
0x4f9e10│00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00│................│
|
||||
* │until 0x4fafff.7 (end) (4608) │ │
|
||||
```
|
||||
|
||||
`files[0:3]` mean that `files` is an array with 3 values, shown using the jq "slice" syntax `start:end`.
|
||||
|
||||
To look at the first file we can use:
|
||||
|
||||
```
|
||||
gzip> .uncompressed.files[0]
|
||||
│00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f│0123456789abcdef│.uncompressed.files[0]{}:
|
||||
0x000000│74 72 69 61 6e 67 6c 65 2e 70 63 61 70 00 00 00│triangle.pcap...│ name: "triangle.pcap"
|
||||
* │until 0x63.7 (100) │ │
|
||||
0x000060│ 30 30 30 30 36 34 34 00 │ 0000644. │ mode: 420 ("0000644")
|
||||
0x000060│ 30 30 30 30│ 0000│ uid: 0 ("0000000")
|
||||
0x000070│30 30 30 00 │000. │
|
||||
0x000070│ 30 30 30 30 30 30 30 00 │ 0000000. │ gid: 0 ("0000000")
|
||||
0x000070│ 30 30 30 32│ 0002│ size: 5207688 ("00023673210")
|
||||
0x000080│33 36 37 33 32 31 30 00 │3673210. │
|
||||
0x000080│ 31 34 31 30 35 32 31 35│ 14105215│ mtime: 1628773280 ("14105215640")
|
||||
0x000090│36 34 30 00 │640. │
|
||||
0x000090│ 30 31 32 32 34 32 00 20 │ 012242. │ chksum: 5282 ("012242")
|
||||
0x000090│ 30 │ 0 │ typeflag: "0"
|
||||
0x000090│ 00 00 00│ ...│ linkname: ""
|
||||
0x0000a0│00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00│................│
|
||||
* │until 0x100.7 (100) │ │
|
||||
0x000100│ 75 73 74 61 72 20 │ ustar │ magic: "ustar"
|
||||
0x000100│ 20 00 │ . │ version: " "
|
||||
0x000100│ 72 6f 6f 74 00 00 00│ root...│ uname: "root"
|
||||
0x000110│00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00│................│
|
||||
0x000120│00 00 00 00 00 00 00 00 00 │......... │
|
||||
0x000120│ 72 6f 6f 74 00 00 00│ root...│ gname: "root"
|
||||
0x000130│00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00│................│
|
||||
0x000140│00 00 00 00 00 00 00 00 00 │......... │
|
||||
0x000140│ 00 00 00 00 00 00 00│ .......│ devmajor: ""
|
||||
0x000150│00 │. │
|
||||
0x000150│ 00 00 00 00 00 00 00 00 │ ........ │ devminor: ""
|
||||
0x000150│ 00 00 00 00 00 00 00│ .......│ prefix: ""
|
||||
0x000160│00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00│................│
|
||||
* │until 0x1f3.7 (155) │ │
|
||||
0x0001f0│ 00 00 00 00 00 00 00 00 00 00 00 00│ ............│ header_block_padding: raw bits (all zero)
|
||||
0x000200│d4 c3 b2 a1 02 00 04 00 00 00 00 00 00 00 00 00│................│ data{}: (pcap)
|
||||
* │until 0x4f7887.7 (5207688) │ │
|
||||
0x4f7880│ 00 00 00 00 00 00 00 00│ ........│ data_block_padding: raw bits (all zero)
|
||||
0x4f7890│00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00│................│
|
||||
* │until 0x4f79ff.7 (376) │ │
|
||||
```
|
||||
|
||||
It seems to be a PCAP file. To iterate and display all file names we caN do:
|
||||
|
||||
```
|
||||
gzip> .uncompressed.files[].name
|
||||
│00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f│0123456789abcdef│
|
||||
0x00│74 72 69 61 6e 67 6c 65 2e 70 63 61 70 00 00 00│triangle.pcap...│.uncompressed.files[0].name: "triangle.pcap"
|
||||
* │until 0x63.7 (100) │ │
|
||||
│00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f│0123456789abcdef│
|
||||
0x4f7a00│74 72 69 61 6e 67 6c 65 73 2e 70 79 00 00 00 00│triangles.py....│.uncompressed.files[1].name: "triangles.py"
|
||||
* │until 0x4f7a63.7 (100) │ │
|
||||
│00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f│0123456789abcdef│
|
||||
0x4f9a00│52 45 41 44 4d 45 2e 74 78 74 00 00 00 00 00 00│README.txt......│.uncompressed.files[2].name: "README.txt"
|
||||
* │until 0x4f9a63.7 (100) │ │
|
||||
```
|
||||
|
||||
This uses the jq "each" operator `[]` which will output all values in an array (or object), then we use `.name` on each output to get the name.
|
||||
|
||||
If we want to access just the name and not display the hexdump columns etc, we can use the "pipe" operator and filter each value thru `tovalue` which will convert it into some JSON compatible.
|
||||
|
||||
```
|
||||
gzip> .uncompressed.files[].name | tovalue
|
||||
"triangle.pcap"
|
||||
"triangles.py"
|
||||
"README.txt"
|
||||
```
|
||||
|
||||
Or if we want to have the names in an array:
|
||||
|
||||
```
|
||||
gzip> [.uncompressed.files[].name]
|
||||
[
|
||||
"triangle.pcap",
|
||||
"triangles.py",
|
||||
"README.txt"
|
||||
]
|
||||
```
|
||||
|
||||
Here we use the `[...]` array constructor which will collect all outputs from the expression between the brackets. `tovalue` is not needed in this case as the `.name` decode values in the array knows how to behave as JSON values. But note that the values still are decode values. Consider the difference:
|
||||
|
||||
```
|
||||
gzip> [.uncompressed.files[].name][1]
|
||||
│00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f│0123456789abcdef│
|
||||
0x4f7a00│74 72 69 61 6e 67 6c 65 73 2e 70 79 00 00 00 00│triangles.py....│.uncompressed.files[1].name: "triangles.py"
|
||||
* │until 0x4f7a63.7 (100) │ │
|
||||
gzip> [.uncompressed.files[].name | tovalue][1]
|
||||
"triangles.py"
|
||||
```
|
||||
|
||||
As a side note jq's standard library has a `map` function that does exactly this `.uncompressed.files | map(.name)`. To learn more one can look at [how map is implemented](https://github.com/stedolan/jq/blob/master/src/builtin.jq), look for `def map(f):`.
|
||||
|
||||
Back to the challenge and have a look at content of the `README.txt` file:
|
||||
|
||||
```
|
||||
gzip> .uncompressed.files[2].data | println
|
||||
FRA Pcap Challenge 2021-09
|
||||
==========================
|
||||
|
||||
1. Spara skärmdump av rymdskeppet
|
||||
2. Spara skärmdump av när skeppet flyger runt
|
||||
3. Spara skärmdump av en sten och en blomma
|
||||
4. Spara en skärmdump som täcker hela området som skeppet flugit
|
||||
|
||||
Lycka till!
|
||||
```
|
||||
|
||||
It's instructions in Swedish telling us to take various screenshots of a space ship flying around in space.
|
||||
|
||||
Here we used `println` which convert it's input to a string and prints it to stdout (and outputs nothing, more on that later).
|
||||
|
||||
Let's have a look at the PCAP file:
|
||||
|
||||
```
|
||||
gzip> .uncompressed.files[0].data
|
||||
│00 01 02 03 04 05 06 07 08 09 0a 0b│0123456789ab│.uncompressed.files[0].data{}: (pcap)
|
||||
0x0001f8│ d4 c3 b2 a1│ ....│ magic: "little_endian" (0xd4c3b2a1) (valid)
|
||||
0x000204│02 00 │.. │ version_major: 2
|
||||
0x000204│ 04 00 │ .. │ version_minor: 4
|
||||
0x000204│ 00 00 00 00 │ .... │ thiszone: 0
|
||||
0x000204│ 00 00 00 00│ ....│ sigfigs: 0
|
||||
0x000210│00 00 04 00 │.... │ snaplen: 262144
|
||||
0x000210│ 71 00 00 00 │ q... │ network: "linux_sll" (113) (Linux "cooked" capture encapsulation)
|
||||
0x000210│ 92 1a 15 61│ ...a│ packets[0:5705]:
|
||||
0x00021c│7a e4 07 00 4c 00 00 00 4c 00 00 00│z...L...L...│
|
||||
* │until 0x4f7887.7 (5207664) │ │
|
||||
│ │ │ ipv4_reassembled[0:0]:
|
||||
│ │ │ tcp_connections[0:1]:
|
||||
```
|
||||
|
||||
It has 5705 captured packets, no IPv4 fragments and there was one reassembled TCP connection.
|
||||
|
||||
First time I ran fq on this pcap it could not decode much as it did not support "linux_ssl". It was not that much work to add support, which is a reminder that if fq does not support something it might not be that far away from supporting it.
|
||||
|
||||
Now have a look at the streams from the TCP connection:
|
||||
|
||||
```
|
||||
gzip> .uncompressed.files[0].data.tcp_connections[0]
|
||||
│00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f│0123456789abcdef│.uncompressed.files[0].data.tcp_connections[0]{}:
|
||||
0x000000│7a 7a 7a 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d 6d│zzzmmmmmmmmmmmmm│ client_stream: raw bits
|
||||
* │until 0x31e.7 (end) (799) │ │
|
||||
0x000000│7b 22 6d 73 67 5f 74 79 70 65 22 3a 20 22 63 6f│{"msg_type": "co│ server_stream: raw bits
|
||||
* │until 0x48234c.7 (end) (4727629) │ │
|
||||
│ │ │ source_ip: "127.0.0.1"
|
||||
│ │ │ source_port: 57040
|
||||
│ │ │ destination_ip: "127.0.0.1"
|
||||
│ │ │ destination_port: 4372
|
||||
```
|
||||
|
||||
Looks like the client sent lots of "z" and "m ", maybe key strokes to control a ship? The server has responded with something that looks like 4727629 bytes of JSON. it's probably a bad idea to display the whole string, let's show the first 2000 bytes as a string.
|
||||
|
||||
```
|
||||
gzip> .uncompressed.files[0].data.tcp_connections[0].server_stream[0:2000]
|
||||
"{\"msg_type\": \"code\", \"encoding\": \"ascii\", \"data\": \"class Player(Object):\\n def __init__(self, x, y):\\n
|
||||
Object.__init__(self, x, y)\\n\\n self.MAX_ROTATION_SPEED=7\\n self.MAX_SPEED=0.1\\n self.MAX_THRUS
|
||||
T=0.01\\n self.SPEED_REDUCTION=1.01\\n\\n d
|
||||
ef render(self, buf, center_x, center_y):\\n self.buf=buf\\n self.img=Image.new(mode='RGB', size=(IMAGE_RE
|
||||
SOLUTION['X'], IMAGE_RESOLUTION['Y']))\\n\\n
|
||||
d=ImageDraw.Draw(self.img)\\n\\n d.polygon(((IMAGE_RESOLUTION['X']/2, IMAGE_RESOLUTION['Y']/2-50),
|
||||
(IMAGE_RESOLUTION['X']/2+25, IMAGE_RESOLUTION
|
||||
['Y']/2+50), (IMAGE_RESOLUTION['X']/2, IMAGE_RESOLUTION['Y']/2+20), (IMAGE_RESOLUTIO
|
||||
N['X']/2-25, IMAGE_RESOLUTION['Y']/2+50),
|
||||
), outline='green', fill='cyan')\\n\\n self.image2ascii(self.img, self.game2image(self.x, sel
|
||||
f.y, center_x, center_y))\\n return self
|
||||
.buf\\n \", \"md5\": \"5997afe4ac36467ffa0b4a7875a3627a\"}\n{\"msg_type\": \"code\", \"encoding\": \"long_xor\", \"da
|
||||
ta\": \"241e00051a542b290c194b2a251804151d5d434c4f52434523170756362b102806063c3a6f01041a0f58593e43521a4967110e1a06060a7b
|
||||
3455041722170f5145545e31071b1700602f4d56191b10281b015e3e74474d47594455775d424f5477424d415c584076325b596f6752415649545966
|
||||
2010090024064f29361d172f1b2d3c4d34170d104554016a4f0b4a6f67524156495459661c170f0369020e1f07000a7b1f1d0a0b33016b5649545966
|
||||
4f524316221e07580a1b15291d015e06281e0e041a7e59664f524345675212130512573400065e17261c0519045a0b2701160a0b335a515a5a41406f
|
||||
65784345675205130f540b23011606176f01041a0f5859241a144f4524170f020c06263e4352000029060404360d507c655243456752415649071c2a
|
||||
095c0110214f03030f7e59664f524345675212130512572f02155e2c2a130613471a1c31471f0c01224f46242e365e6a4f010a1f224f493f24353e03
|
||||
30202636083e3422203b371d482a44386b52283b28333c193d37302a0b27353f263a226136553e4c6e786b56495459664f5243017a3b0c170e113d34
|
||||
0e054d213513165e1a111520411b0e026e786b7c495459664f524345241d0e040d07441d473b2e2400373e242c27360a3a262a2a0"
|
||||
```
|
||||
|
||||
We use the slice syntax to slice from character 0 to 2000. We use the word characters (UTF-8 codepoints) here as raw bits are by default represented as strings in fq. To get access to raw bits there are functions like `tobytes` etc.
|
||||
|
||||
There are two `{"msg_type": ... }` and the first one ends with `... }\n` so it's probably JSON lines. Let's split on `\n` and have a look:
|
||||
|
||||
```
|
||||
gzip> .uncompressed.files[0].data.tcp_connections[0].server_stream | split("\n") | .[0,1,-2,-1]
|
||||
"{\"msg_type\": \"code\", \"encoding\": \"ascii\", \"data\": \"class Player(Object):\\n def __init__(self, x, y):\\n Object.__init__(self, x, y)\\n\\n self.MAX_ROTATION_SPEED=7\\n self.MAX_SPEED=0.1\\n self.MAX_THRUST=0.01\\n self.SPEED_REDUCTION=1.01\\n\\n def render(self, buf, center_x, center_y):\\n self.buf=buf\\n self.img=Image.new(mode='RGB', size=(IMAGE_RESOLUTION['X'], IMAGE_RESOLUTION['Y']))\\n\\n d=ImageDraw.Draw(self.img)\\n\\n d.polygon(((IMAGE_RESOLUTION['X']/2, IMAGE_RESOLUTION['Y']/2-50), (IMAGE_RESOLUTION['X']/2+25, IMAGE_RESOLUTION['Y']/2+50), (IMAGE_RESOLUTION['X']/2, IMAGE_RESOLUTION['Y']/2+20), (IMAGE_RESOLUTION['X']/2-25, IMAGE_RESOLUTION['Y']/2+50), ), outline='green', fill='cyan')\\n\\n self.image2ascii(self.img, self.game2image(self.x, self.y, center_x, center_y))\\n return self.buf\\n \", \"md5\": \"5997afe4ac36467ffa0b4a7875a3627a\"}"
|
||||
"{\"msg_type\": \"code\", \"encoding\": \"long_xor\", \"data\": \"241e00051a542b290c194b2a251804151d5d434c4f52434523170756362b102806063c3a6f01041a0f58593e43521a4967110e1a06060a7b3455041722170f5145545e31071b1700602f4d56191b10281b015e3e74474d47594455775d424f5477424d415c584076325b596f67524156495459662010090024064f29361d172f1b2d3c4d34170d104554016a4f0b4a6f67524156495459661c170f0369020e1f07000a7b1f1d0a0b33016b56495459664f524316221e07580a1b15291d015e06281e0e041a7e59664f524345675212130512573400065e17261c0519045a0b2701160a0b335a515a5a41406f65784345675205130f540b23011606176f01041a0f5859241a144f4524170f020c06263e4352000029060404360d507c655243456752415649071c2a095c0110214f03030f7e59664f524345675212130512572f02155e2c2a130613471a1c31471f0c01224f46242e365e6a4f010a1f224f493f24353e0330202636083e3422203b371d482a44386b52283b28333c193d37302a0b27353f263a226136553e4c6e786b56495459664f5243017a3b0c170e113d340e054d213513165e1a111520411b0e026e786b7c495459664f524345241d0e040d07441d473b2e2400373e242c27360a3a262a2a0929462e4e29567444130e152b580c171d1c5735061c4b172616485a203938012a2d3120143d2d233d3d360834553a421a5d535b0819092a451f02112f5c02191a5c0b270b5b4a45211d13564106182243130e152b5b411f0754032f1f5a380c6d404b1b080011681f1b4c09221c49050c181f681f1d0a0b330148560f1b0b6606520a0b670000180e11512a0a1c4b16221e0758191b10281b014a4c1a5e41050c181f681f1d0a0b3301482b637e59664f52434567520558191b153f081d0d4d241d0e040d0755664f52434567524156495459664f5243452807151a001a1c7b1c170f0369110e1a06060a1d5f2f4f45211b0d1a54071c2a095c000a2b1d1305324524664678696f67524156495459661c170f03691b0c170e114b271c110a0c6f01041a0f5a102b085e4316221e07580e1514235d1b0e04201749050c181f68175e4316221e0758105859250a1c1700352d195a49171c281b17113a3e5b487c495459664f524345351715031b1a59350a1e054b2507077c635459664f\", \"md5\": \"e9514a2de33051b9c6174d31e35b7584\"}"
|
||||
"{\"msg_type\": \"update\", \"encoding\": \"ascii\", \"data\": \"{\\\"id\\\": 1, \\\"type\\\": \\\"Player\\\", \\\"x\\\": 253.65325300861684, \\\"y\\\": 352.330474276039, \\\"rot\\\": 308}\", \"md5\": \"caa8fb32ac8426f29d32da8c46b843ad\"}"
|
||||
""
|
||||
```
|
||||
|
||||
`split("\n")` splits a string on some boundary, "\n" in this case, and output AN array with all the parts. We then use `.[0,1,-2,-1]` to get the first, second, second from the end and last string from the array (negative indexes counts from the end).
|
||||
|
||||
Here we VERB MISSING the output operator `,` which is a way in jq to return or "output" more than one value. What happens is that for each value `0`,`1`, `-2` and `-1` the program "forks" and continueS to run and then aT some point it will "backtrack" back to THE next value and so on. To learn more one can read all about it on
|
||||
[jq internals](https://github.com/stedolan/jq/wiki/Internals%3A-backtracking).
|
||||
|
||||
This is also how jq arrays are expressed, remember `[...]`? let's try `[0,1,-2,-1]`:
|
||||
|
||||
```
|
||||
gzip> [0,1,-2,-1]
|
||||
[
|
||||
0,
|
||||
1,
|
||||
-2,
|
||||
-1
|
||||
]
|
||||
```
|
||||
|
||||
`[...]` "collects" the output from the expression `0,1-2,-1` and to show that what is inside the brackets is just an expression we can do:
|
||||
|
||||
```
|
||||
gzip> [(0,(1,2))]
|
||||
[
|
||||
0,
|
||||
1,
|
||||
2
|
||||
]
|
||||
```
|
||||
|
||||
and to go full circle we can use a multiple output expression as a array index:
|
||||
|
||||
```
|
||||
gzip> [1,2,3][0,1,2]
|
||||
1
|
||||
2
|
||||
3
|
||||
```
|
||||
|
||||
first we build an array by collecting `1,2,3` and then we index into it using `0,1,2`, getting the values at index `0`, `1` and `2`.
|
||||
|
||||
Now back to the JSON lines. We see that the last is just an empty string, probably because the streams end with a new line. Let's filter it out, convert the other lines into useable values and then make things a bit more comfortable by starting a new REPL.
|
||||
|
||||
```
|
||||
gzip> .uncompressed.files[0].data.tcp_connections[0].server_stream | split("\n") | map(select(. != "") | fromjson) | repl
|
||||
> [object, ...][13842][]>
|
||||
```
|
||||
|
||||
We `map` here to do something for each line. `select` is A function that given a condition will output its input or otherwise it will return `empty`, in this case removing all empty strings. Then we pipe all the non-empty lines to `fromjson`, which converts JSON represention into a jq value. Lastly we pipe the result to `repl`, which will start a new nested REPL.
|
||||
|
||||
The prompt tells us that the input is an array with 13842 values, the first value is an object.
|
||||
|
||||
Let's have look using `.[0,1,-2,-1]` again. `.` here is the current input.
|
||||
|
||||
```
|
||||
> [object, ...][13842][]> .[0,1,-2,-1]
|
||||
{
|
||||
"data": "class Player(Object):\n def __init__(self, x, y):\n Object.__init__(self, x, y)\n\n self.MAX_ROTATION_SPEED=7\n self.MAX_SPEED=0.1\n self.MAX_THRUST=0.01\n self.SPEED_REDUCTION=1.01\n\n def render(self, buf, center_x, center_y):\n self.buf=buf\n self.img=Image.new(mode='RGB', size=(IMAGE_RESOLUTION['X'], IMAGE_RESOLUTION['Y']))\n\n d=ImageDraw.Draw(self.img)\n\n d.polygon(((IMAGE_RESOLUTION['X']/2, IMAGE_RESOLUTION['Y']/2-50), (IMAGE_RESOLUTION['X']/2+25, IMAGE_RESOLUTION['Y']/2+50), (IMAGE_RESOLUTION['X']/2, IMAGE_RESOLUTION['Y']/2+20), (IMAGE_RESOLUTION['X']/2-25, IMAGE_RESOLUTION['Y']/2+50), ), outline='green', fill='cyan')\n\n self.image2ascii(self.img, self.game2image(self.x, self.y, center_x, center_y))\n return self.buf\n ",
|
||||
"encoding": "ascii",
|
||||
"md5": "5997afe4ac36467ffa0b4a7875a3627a",
|
||||
"msg_type": "code"
|
||||
}
|
||||
{
|
||||
"data": "241e00051a542b290c194b2a251804151d5d434c4f52434523170756362b102806063c3a6f01041a0f58593e43521a4967110e1a06060a7b3455041722170f5145545e31071b1700602f4d56191b10281b015e3e74474d47594455775d424f5477424d415c584076325b596f67524156495459662010090024064f29361d172f1b2d3c4d34170d104554016a4f0b4a6f67524156495459661c170f0369020e1f07000a7b1f1d0a0b33016b56495459664f524316221e07580a1b15291d015e06281e0e041a7e59664f524345675212130512573400065e17261c0519045a0b2701160a0b335a515a5a41406f65784345675205130f540b23011606176f01041a0f5859241a144f4524170f020c06263e4352000029060404360d507c655243456752415649071c2a095c0110214f03030f7e59664f524345675212130512572f02155e2c2a130613471a1c31471f0c01224f46242e365e6a4f010a1f224f493f24353e0330202636083e3422203b371d482a44386b52283b28333c193d37302a0b27353f263a226136553e4c6e786b56495459664f5243017a3b0c170e113d340e054d213513165e1a111520411b0e026e786b7c495459664f524345241d0e040d07441d473b2e2400373e242c27360a3a262a2a0929462e4e29567444130e152b580c171d1c5735061c4b172616485a203938012a2d3120143d2d233d3d360834553a421a5d535b0819092a451f02112f5c02191a5c0b270b5b4a45211d13564106182243130e152b5b411f0754032f1f5a380c6d404b1b080011681f1b4c09221c49050c181f681f1d0a0b330148560f1b0b6606520a0b670000180e11512a0a1c4b16221e0758191b10281b014a4c1a5e41050c181f681f1d0a0b3301482b637e59664f52434567520558191b153f081d0d4d241d0e040d0755664f52434567524156495459664f5243452807151a001a1c7b1c170f0369110e1a06060a1d5f2f4f45211b0d1a54071c2a095c000a2b1d1305324524664678696f67524156495459661c170f03691b0c170e114b271c110a0c6f01041a0f5a102b085e4316221e07580e1514235d1b0e04201749050c181f68175e4316221e0758105859250a1c1700352d195a49171c281b17113a3e5b487c495459664f524345351715031b1a59350a1e054b2507077c635459664f",
|
||||
"encoding": "long_xor",
|
||||
"md5": "e9514a2de33051b9c6174d31e35b7584",
|
||||
"msg_type": "code"
|
||||
}
|
||||
{
|
||||
"data": "3c652e23657d6776777077757e6b6765333e3722657d6765012b28302235656b67653f657d6775747769776b67653e657d6774737769776b6765352833657d67773a",
|
||||
"encoding": "xor",
|
||||
"md5": "a80484425bfb3c32a6108ac3d37bd3b8",
|
||||
"msg_type": "update"
|
||||
}
|
||||
{
|
||||
"data": "{\"id\": 1, \"type\": \"Player\", \"x\": 253.65325300861684, \"y\": 352.330474276039, \"rot\": 308}",
|
||||
"encoding": "ascii",
|
||||
"md5": "caa8fb32ac8426f29d32da8c46b843ad",
|
||||
"msg_type": "update"
|
||||
}
|
||||
```
|
||||
|
||||
Looks like nested JSON and some of the values are encrypted.
|
||||
|
||||
Maybe we can get some overview by filtering out things that seems to change in each message and see what is left:
|
||||
|
||||
```
|
||||
> [object, ...][13842]> count_by(del(.md5) | del(.data))
|
||||
[
|
||||
[
|
||||
{
|
||||
"encoding": "ascii",
|
||||
"msg_type": "code"
|
||||
},
|
||||
1
|
||||
],
|
||||
[
|
||||
{
|
||||
"encoding": "ascii",
|
||||
"msg_type": "update"
|
||||
},
|
||||
708
|
||||
],
|
||||
[
|
||||
{
|
||||
"encoding": "long_xor",
|
||||
"msg_type": "code"
|
||||
},
|
||||
2
|
||||
],
|
||||
[
|
||||
{
|
||||
"encoding": "xor",
|
||||
"msg_type": "update"
|
||||
},
|
||||
13131
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
Here we use `count_by` which is a fq function similar to the jq function `unique_by` but instead of groping all unique values it just counts them, returning an array with `[unique value, count]` pairs. In jq `_by` is convension used by some functions to allow ad-hoc transform something before using it. For example `count` count number of unique values but `count_by` will count unique values after from transformation, in this case the transformation `del(.md5) | del(.data)` which will remove the keys `md5` and `data` from an object.
|
||||
|
||||
How does the first two "xor" encoded messages looks like:
|
||||
|
||||
```
|
||||
> [object, ...][0:13842]> map(select(.encoding == "xor")) | .[0:2]
|
||||
[
|
||||
{
|
||||
"data": "3c652e23657d6774757e7f767f6b6765333e3722657d67651528242c656b67653f657d67757e776b67653e657d677671776b6765352833657d677f736b676524282b283534657d671c652035222229656b6765302f2e3322651a6b676537282e293334657d671c74776b6773776b6773776b6776776b6773771a3a",
|
||||
"encoding": "xor",
|
||||
"md5": "2074c8a4effcbaa0ceec11754cfa66c3",
|
||||
"msg_type": "update"
|
||||
},
|
||||
{
|
||||
"data": "3c652e23657d67717373707f736b6765333e3722657d67651528242c656b67653f657d677474776b67653e657d67767f776b6765352833657d677476716b676524282b283534657d671c652035222229656b6765302f2e3322651a6b676537282e293334657d671c74776b6773776b6773776b6776776b6773771a3a",
|
||||
"encoding": "xor",
|
||||
"md5": "8f772df87dd20c5a41109b6ed84efb46",
|
||||
"msg_type": "update"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
The common `3c652e23657d67` prefix is suspicious and looks hex encoded and probably some encrypted form of `{"id": ` judging by how other "update" messages look. There was "long_xor" so maybe this is just per byte xor? XOR is symmetric so we should get the key if we encrypt some known plaintext with its encrypted version.
|
||||
|
||||
```
|
||||
> [object, ...][13842]> bxor(("{" | explode)[0]; ("3c" | hex | explode)[0])
|
||||
71
|
||||
```
|
||||
|
||||
`explode` is a jq functions that turn a string into an array of its codepoints. `hex` decodes a hex string into a bytes buffer but we use it as string here. We then bitwise XOR using `bxor` and get the key `71`.
|
||||
|
||||
Notice that jq uses the argument separator `;` not `,`.
|
||||
|
||||
Now try bitwise XOR all codepoints with `71`:
|
||||
|
||||
```
|
||||
> [object, ...][13842]> .[-2].data | hex | explode | map(bxor(.; 71)) | implode
|
||||
"{\"id\": 107029, \"type\": \"Flower\", \"x\": 230.0, \"y\": 340.0, \"rot\": 0}"
|
||||
```
|
||||
|
||||
Ok that looks like JSON to me. Now let's have a look at "long_xor" with "msg_type" "code", maybe it starts with `class `?.
|
||||
|
||||
```
|
||||
> [object, ...][13842]> ["class " | explode, ("241e00051a54" | hex | explode)] | transpose | map(bxor(.[0]; .[1])) | implode
|
||||
"Gravit"
|
||||
```
|
||||
|
||||
That looks like it could be a start of a key. I noticed earlier while poking around that the hex decoded data for a "code" message has parts that looks like english text.
|
||||
|
||||
```
|
||||
> [object, ...][0:13842]> .[1].data | hex | tostring | scan("\\w*force\\w*"; "i")
|
||||
"YfORCEgR"
|
||||
"YfORCEgR"
|
||||
"ITYfORCE"
|
||||
"YfORCEgR"
|
||||
"UfORCEgRAVITYfORCE"
|
||||
"ITYfORCE5"
|
||||
```
|
||||
|
||||
`scan` is jq function that outputs all non-overlapping strings matching a regexp. `"i"` is to match case-insensitive.
|
||||
|
||||
A good guess is probably that the key is `"GravityForce"` repeated. Why it shows up and have weird casing is probably because the plain text has long streaks of whitespace `0x32` which happens to be the bit in encoding ASCII encoding changing between upper/lower case.
|
||||
|
||||
Let's try decrypt it using it:
|
||||
|
||||
```
|
||||
> [object, ...][13842]> .[1].data | hex | [., ("GravityForce"*100)[0:length]] | map(explode) | transpose | map(bxor(.[0]; .[1])) | implode
|
||||
"class Rock(Object):\n def __init__(self, x, y, colors=['green', 'white'], points=[35,100,120,100,75,90]):\n Object.__init__(self, x, y)\n self.points=points\n self.colors=colors\n self.rot=random.randint(0,359)\n\n def render(self, buf, center_x, center_y):\n self.buf=buf\n self.img=Image.new(mode='RGB', size=(IMAGE_RESOLUTION['X'], IMAGE_RESOLUTION['Y']))\n\n d=ImageDraw.Draw(self.img)\n\n\n coords=[(IMAGE_RESOLUTION['X']/2+ampl*math.sin(rad),IMAGE_RESOLUTION['Y']/2-ampl*math.cos(rad)) for (rad,ampl) in zip([i*2*math.pi/len(self.points) for i in range(len(self.points))], self.points)]\n\n d.polygon(coords, outline=self.colors[0], fill=self.colors[1] )\n\n\n self.image2ascii(self.img, self.game2image(self.x, self.y, center_x, center_y))\n return self.buf\n\n "
|
||||
```
|
||||
|
||||
Looks like python to me.
|
||||
|
||||
`("GravityForce"*100)[0:length]` is a quick trick to make sure the key is repeated and has the same length as the encrypted message. `length` is a function that returns the length of its input.
|
||||
|
||||
Now decrypt all data strings and use `fromjson` again and start a new REPL:
|
||||
|
||||
```
|
||||
> [object, ...][0:13842]> map(if .encoding == "xor" then .data |= (hex | explode | map(bxor(.; 71)) | implode) elif .encoding == "long_xor" then .data |= (hex | [., ("GravityForce"*100)[0:length]] | map(explode) | transpose | map(bxor(.[0]; .[1])) | implode) end | if .msg_type == "update" then .data |= fromjson end) | repl
|
||||
>> [object, ...][0:13842]>
|
||||
```
|
||||
|
||||
We can break this down a bit:
|
||||
```
|
||||
map(
|
||||
( if .encoding == "xor" then
|
||||
.data |= (hex | explode | map(bxor(.; 71)) | implode)
|
||||
elif .encoding == "long_xor" then
|
||||
.data |= (hex | [., ("GravityForce"*100)[0:length]] | map(explode) | transpose | map(bxor(.[0]; .[1])) | implode)
|
||||
end
|
||||
| if .msg_type == "update" then .data |= fromjson end
|
||||
)
|
||||
) | repl
|
||||
```
|
||||
|
||||
TODO: break this down more
|
||||
|
||||
A few new things here. `if` is A plain old if-statement, conditionally do something, that can have optional `elif`/`else` branches. `.key |= ...` is a shorthand for `.key = (.key | ...)` which will update a keys value in an object using the current value as input.
|
||||
|
||||
Now have a look at `.[0,1,-2,-1]` again:
|
||||
|
||||
```
|
||||
>> [object, ...][0:13842]> .[0,1,-2,-1]
|
||||
{
|
||||
"data": "class Player(Object):\n def __init__(self, x, y):\n Object.__init__(self, x, y)\n\n self.MAX_ROTATION_SPEED=7\n self.MAX_SPEED=0.1\n self.MAX_THRUST=0.01\n self.SPEED_REDUCTION=1.01\n\n def render(self, buf, center_x, center_y):\n self.buf=buf\n self.img=Image.new(mode='RGB', size=(IMAGE_RESOLUTION['X'], IMAGE_RESOLUTION['Y']))\n\n d=ImageDraw.Draw(self.img)\n\n d.polygon(((IMAGE_RESOLUTION['X']/2, IMAGE_RESOLUTION['Y']/2-50), (IMAGE_RESOLUTION['X']/2+25, IMAGE_RESOLUTION['Y']/2+50), (IMAGE_RESOLUTION['X']/2, IMAGE_RESOLUTION['Y']/2+20), (IMAGE_RESOLUTION['X']/2-25, IMAGE_RESOLUTION['Y']/2+50), ), outline='green', fill='cyan')\n\n self.image2ascii(self.img, self.game2image(self.x, self.y, center_x, center_y))\n return self.buf\n ",
|
||||
"encoding": "ascii",
|
||||
"md5": "5997afe4ac36467ffa0b4a7875a3627a",
|
||||
"msg_type": "code"
|
||||
}
|
||||
{
|
||||
"data": "class Rock(Object):\n def __init__(self, x, y, colors=['green', 'white'], points=[35,100,120,100,75,90]):\n Object.__init__(self, x, y)\n self.points=points\n self.colors=colors\n self.rot=random.randint(0,359)\n\n def render(self, buf, center_x, center_y):\n self.buf=buf\n self.img=Image.new(mode='RGB', size=(IMAGE_RESOLUTION['X'], IMAGE_RESOLUTION['Y']))\n\n d=ImageDraw.Draw(self.img)\n\n\n coords=[(IMAGE_RESOLUTION['X']/2+ampl*math.sin(rad),IMAGE_RESOLUTION['Y']/2-ampl*math.cos(rad)) for (rad,ampl) in zip([i*2*math.pi/len(self.points) for i in range(len(self.points))], self.points)]\n\n d.polygon(coords, outline=self.colors[0], fill=self.colors[1] )\n\n\n self.image2ascii(self.img, self.game2image(self.x, self.y, center_x, center_y))\n return self.buf\n\n ",
|
||||
"encoding": "long_xor",
|
||||
"md5": "e9514a2de33051b9c6174d31e35b7584",
|
||||
"msg_type": "code"
|
||||
}
|
||||
{
|
||||
"data": {
|
||||
"id": 107029,
|
||||
"rot": 0,
|
||||
"type": "Flower",
|
||||
"x": 230,
|
||||
"y": 340
|
||||
},
|
||||
"encoding": "xor",
|
||||
"md5": "a80484425bfb3c32a6108ac3d37bd3b8",
|
||||
"msg_type": "update"
|
||||
}
|
||||
{
|
||||
"data": {
|
||||
"id": 1,
|
||||
"rot": 308,
|
||||
"type": "Player",
|
||||
"x": 253.65325300861684,
|
||||
"y": 352.330474276039
|
||||
},
|
||||
"encoding": "ascii",
|
||||
"md5": "caa8fb32ac8426f29d32da8c46b843ad",
|
||||
"msg_type": "update"
|
||||
}
|
||||
```
|
||||
|
||||
Much better. So it's information what shapes to draw and position and rotation updates per object. Maybe try collect the final state for all objects so that we can draw an ending "screenshot"?
|
||||
|
||||
```
|
||||
>> [object, ...][0:13842]> reduce (.[] | select(.msg_type == "update")) as $msg ({}; .[$msg.data.id | tostring] = $msg.data) | repl
|
||||
>>> object> length
|
||||
26
|
||||
>>> object> map({type, x, y}) | first
|
||||
{
|
||||
"type": "Player",
|
||||
"x": 253.65325300861684,
|
||||
"y": 352.330474276039
|
||||
}
|
||||
```
|
||||
|
||||
Here we use `reduce` which is a special expression to "accumulate" something, the syntax is `reduce <generator> as $var (<init>; <update>)`. As generator we select all "update" messages and let each output be named `$msg`, our init value is `{}` an empty object and for each messagee we update the object using the object id found in the message with the data for that message.
|
||||
|
||||
This should be enough to draw something. To make things a bit more manageable there is cleaned up version of all that also has some helper functions to generates a screenshot as a SVG file. It also shows how to use fq as a script interpreter.
|
||||
|
||||
TODO: how to create own functions?
|
||||
|
||||
Have a look at [pcap-challenge-2021-09.jq](pcap-challenge-2021-09.jq).
|
||||
|
||||
To run the script do something like this, assuming you have fq in `PATH`:
|
||||
|
||||
```
|
||||
$ ./pcap-challenge-2021-09.jq pcap-challenge-2021-09.tgz > pcap-challenge-2021-09.svg
|
||||
```
|
||||
|
||||
And it should produce this SVG as output:
|
||||
|
||||
![pcap challenge render](pcap-challenge-2021-09.svg)
|
||||
|
91
doc/guides/fra-pcap-challange-2021-09/pcap-challenge-2021-09.jq
Executable file
@ -0,0 +1,91 @@
|
||||
#!/usr/bin/env fq -rf
|
||||
|
||||
# xor input array with key array
|
||||
# key will be repeated to fit length of input
|
||||
def xor_array($key):
|
||||
# [1,2,3] | repeat(7) -> [1,2,3,1,2,3,1]
|
||||
def repeat($len):
|
||||
( length as $l
|
||||
| [.[range($len) % $l]]
|
||||
);
|
||||
( . as $input
|
||||
# [$input, $key repeated]
|
||||
| [ $input
|
||||
, ($key | repeat($input | length))
|
||||
]
|
||||
# [[$input[0], $key[0], ...]
|
||||
| transpose
|
||||
| map(bxor(.[0]; .[1]))
|
||||
);
|
||||
|
||||
( first(.uncompressed.files[] | select(.name == "triangle.pcap"))
|
||||
| .data.tcp_connections[0].server.stream
|
||||
| fromjsonl
|
||||
| map(
|
||||
( if .encoding == "xor" then
|
||||
.data |= (fromhex | explode | xor_array([71])| implode)
|
||||
end
|
||||
| if .encoding == "long_xor" then
|
||||
( .data |=
|
||||
( fromhex
|
||||
| explode
|
||||
| xor_array("GravityForce" | explode)
|
||||
| implode
|
||||
)
|
||||
)
|
||||
end
|
||||
| if .msg_type == "update" then .data |= fromjson end
|
||||
)
|
||||
) as $msgs
|
||||
| { "svg": {
|
||||
# move viewbox to where the objects are
|
||||
"@viewBox": "50 120 350 350",
|
||||
"@width": 350,
|
||||
"@height": 350,
|
||||
"@xmlns": "http://www.w3.org/2000/svg",
|
||||
"rect": [
|
||||
{ "#seq": -1,
|
||||
"@fill": "#101010",
|
||||
"@x": 50,
|
||||
"@y": 120,
|
||||
"@width": 350,
|
||||
"@height": 350
|
||||
}
|
||||
# gather last update for all objects and draw them
|
||||
, ( reduce ($msgs[] | select(.msg_type == "update")) as $msg (
|
||||
{};
|
||||
# use tostring as object keys can only be strings
|
||||
.[$msg.data.id | tostring] = $msg.data
|
||||
)
|
||||
| { Player: {style: "fill: #0000ff", size: 15},
|
||||
Flower: {style: "fill: #00d000", size: 10},
|
||||
Rock: {style: "fill: #a0a0a0", size: 8}
|
||||
} as $types
|
||||
| .[]
|
||||
| $types[.type] as $t
|
||||
| { "@width": $t.size,
|
||||
"@height": $t.size,
|
||||
"@style": $t.style,
|
||||
"@transform": "rotate(\(.rot) \(.x-$t.size/2) \(.y-$t.size/2))",
|
||||
"@x": (.x-$t.size/2),
|
||||
"@y": (.y-$t.size/2)
|
||||
}
|
||||
)
|
||||
],
|
||||
"polyline": {
|
||||
"#seq": 1,
|
||||
"@fill": "none",
|
||||
"@stroke": "#5050d0",
|
||||
"@stroke-dasharray": "5 10",
|
||||
"@points":
|
||||
( [ $msgs[]
|
||||
| select(.msg_type == "update" and .data.type == "Player")
|
||||
| .data.x, .data.y
|
||||
]
|
||||
| join(" ")
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
| toxml({indent: 2})
|
||||
)
|
After Width: | Height: | Size: 28 KiB |
BIN
doc/guides/fra-pcap-challange-2021-09/pcap-challenge-2021-09.tgz
Normal file
@ -1,3 +1,9 @@
|
||||
//go:build exclude
|
||||
|
||||
package bts2022
|
||||
|
||||
import "github.com/wader/fq/pkg/decode"
|
||||
|
||||
func avcHdrParameters(d *decode.D) {
|
||||
cpbCnt := d.FieldUintFn("cpb_cnt", uEV, scalar.UAdd(1))
|
||||
d.FieldU4("bit_rate_scale")
|
||||
@ -15,4 +21,4 @@ func avcHdrParameters(d *decode.D) {
|
||||
d.FieldU5("cpb_removal_delay_length", scalar.UAdd(1))
|
||||
d.FieldU5("dpb_output_delay_length", scalar.UAdd(1))
|
||||
d.FieldU5("time_offset_length")
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
//go:build exclude
|
||||
|
||||
package bts2022
|
||||
|
||||
func decode(d *decode.D) any {
|
||||
d.FieldArray("headers", func(d *decode.D) {
|
||||
for !d.End() {
|
||||
|
15
doc/usage.md
@ -168,9 +168,9 @@ Here the `sync` pattern starts at `0xb79` (bit `0`) and ends at `0xb7a.3` (exclu
|
||||
|
||||
There are also some other `display` aliases:
|
||||
- `da` is `display({array_truncate: 0})` don't truncate arrays.
|
||||
- `dd` is `display({array_truncate: 0, display_bytes: 0})` don't truncate arrays and raw bytes.
|
||||
- `dv` is `display({array_truncate: 0, verbose: true})` don't truncate arrays and display verbosely.
|
||||
- `ddv` is `display({array_truncate: 0, display_bytes: 0 verbose: true})` don't truncate arrays and raw bytes. and display verbosely.
|
||||
- `dd` is `display({array_truncate: 0, string_truncate: 0, display_bytes: 0})` don't truncate arrays and raw bytes.
|
||||
- `dv` is `display({array_truncate: 0, string_truncate: 0, verbose: true})` don't truncate arrays and display verbosely.
|
||||
- `ddv` is `display({array_truncate: 0, string_truncate: 0, display_bytes: 0 verbose: true})` don't truncate arrays and raw bytes. and display verbosely.
|
||||
|
||||
## Interactive REPL
|
||||
|
||||
@ -844,6 +844,15 @@ In query
|
||||
tovalue({skip_gaps: true})
|
||||
```
|
||||
|
||||
### `-o array_truncate=<number>`
|
||||
|
||||
By default truncate long array when displaying decode value tree. Use `dd` or `d({array_truncate: 0})` to not truncate.
|
||||
|
||||
### `-o string_truncate=<number>`
|
||||
|
||||
By default truncate long strings when displaying decode value tree. Use `dd` or `d({string_truncate: 0})` to not truncate.
|
||||
|
||||
|
||||
## Color and unicode output
|
||||
|
||||
fq by default tries to use colors if possible, this can be disabled with `-M`. You can also
|
||||
|
@ -10,9 +10,11 @@ $ fq -n _registry.groups.probe
|
||||
"bzip2",
|
||||
"caff",
|
||||
"elf",
|
||||
"fit",
|
||||
"flac",
|
||||
"gif",
|
||||
"gzip",
|
||||
"jp2c",
|
||||
"jpeg",
|
||||
"leveldb_table",
|
||||
"luajit",
|
||||
@ -21,6 +23,7 @@ $ fq -n _registry.groups.probe
|
||||
"matroska",
|
||||
"moc3",
|
||||
"mp4",
|
||||
"nes",
|
||||
"ogg",
|
||||
"opentimestamps",
|
||||
"pcap",
|
||||
@ -85,6 +88,7 @@ elf Executable and Linkable Format
|
||||
ether8023_frame Ethernet 802.3 frame
|
||||
exif Exchangeable Image File Format
|
||||
fairplay_spc FairPlay Server Playback Context
|
||||
fit Garmin Flexible and Interoperable Data Transfer
|
||||
flac Free Lossless Audio Codec file
|
||||
flac_frame FLAC frame
|
||||
flac_metadatablock FLAC metadatablock
|
||||
@ -109,6 +113,7 @@ id3v11 ID3v1.1 metadata
|
||||
id3v2 ID3v2 metadata
|
||||
ipv4_packet Internet protocol v4 packet
|
||||
ipv6_packet Internet protocol v6 packet
|
||||
jp2c JPEG 2000 codestream
|
||||
jpeg Joint Photographic Experts Group file
|
||||
json JavaScript Object Notation
|
||||
jsonl JavaScript Object Notation Lines
|
||||
@ -133,6 +138,7 @@ mpeg_pes_packet MPEG Packetized elementary stream packet
|
||||
mpeg_spu Sub Picture Unit (DVD subtitle)
|
||||
mpeg_ts MPEG Transport Stream
|
||||
msgpack MessagePack
|
||||
nes iNES/NES 2.0 cartridge ROM format
|
||||
ogg OGG file
|
||||
ogg_page OGG page
|
||||
opentimestamps OpenTimestamps file
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
_ "github.com/wader/fq/format/dns"
|
||||
_ "github.com/wader/fq/format/elf"
|
||||
_ "github.com/wader/fq/format/fairplay"
|
||||
_ "github.com/wader/fq/format/fit"
|
||||
_ "github.com/wader/fq/format/flac"
|
||||
_ "github.com/wader/fq/format/gif"
|
||||
_ "github.com/wader/fq/format/gzip"
|
||||
@ -40,6 +41,7 @@ import (
|
||||
_ "github.com/wader/fq/format/mp4"
|
||||
_ "github.com/wader/fq/format/mpeg"
|
||||
_ "github.com/wader/fq/format/msgpack"
|
||||
_ "github.com/wader/fq/format/nes"
|
||||
_ "github.com/wader/fq/format/ogg"
|
||||
_ "github.com/wader/fq/format/opentimestamps"
|
||||
_ "github.com/wader/fq/format/opus"
|
||||
|
30
format/apple/bplist/testdata/Info.fqtest
vendored
@ -80,7 +80,7 @@ $ fq dv Info.plist
|
||||
0x220| 10 | . | exponent: 0 0x224.4-0x225 (0.4)
|
||||
0x220| 37 | 7 | size_bigint: 55 0x225-0x226 (1)
|
||||
| | | size: 55
|
||||
0x220| 43 6f 70 79 72 69 67 68 74 20| Copyright | value: "Copyright (c) 2011-2021 Apple Inc. All rights r..." 0x226-0x25d (55)
|
||||
0x220| 43 6f 70 79 72 69 67 68 74 20| Copyright | value: "Copyright (c) 2011-2021 Apple Inc. All rights reserved." 0x226-0x25d (55)
|
||||
0x230|28 63 29 20 32 30 31 31 2d 32 30 32 31 20 41 70|(c) 2011-2021 Ap|
|
||||
* |until 0x25c.7 (55) | |
|
||||
| | | [4]{}: entry 0xf-0x264 (597)
|
||||
@ -492,7 +492,7 @@ $ fq dv Info.plist
|
||||
0x410| 10 | . | exponent: 0 0x41a.4-0x41b (0.4)
|
||||
0x410| 33 | 3 | size_bigint: 51 0x41b-0x41c (1)
|
||||
| | | size: 51
|
||||
0x410| 63 6f 6d 2e| com.| value: "com.apple.videotoolbox.videodecoder.prores.embe..." 0x41c-0x44f (51)
|
||||
0x410| 63 6f 6d 2e| com.| value: "com.apple.videotoolbox.videodecoder.prores.embedded" 0x41c-0x44f (51)
|
||||
0x420|61 70 70 6c 65 2e 76 69 64 65 6f 74 6f 6f 6c 62|apple.videotoolb|
|
||||
* |until 0x44e.7 (51) | |
|
||||
| | | [5]{}: entry 0x313-0x45f (332)
|
||||
@ -533,7 +533,7 @@ $ fq dv Info.plist
|
||||
0x220| 10 | . | exponent: 0 0x224.4-0x225 (0.4)
|
||||
0x220| 37 | 7 | size_bigint: 55 0x225-0x226 (1)
|
||||
| | | size: 55
|
||||
0x220| 43 6f 70 79 72 69 67 68 74 20| Copyright | value: "Copyright (c) 2011-2021 Apple Inc. All rights r..." 0x226-0x25d (55)
|
||||
0x220| 43 6f 70 79 72 69 67 68 74 20| Copyright | value: "Copyright (c) 2011-2021 Apple Inc. All rights reserved." 0x226-0x25d (55)
|
||||
0x230|28 63 29 20 32 30 31 31 2d 32 30 32 31 20 41 70|(c) 2011-2021 Ap|
|
||||
* |until 0x25c.7 (55) | |
|
||||
0x310| 33 | 3 | key_index: 51 0x314-0x315 (1)
|
||||
@ -735,7 +735,7 @@ $ fq dv Info.plist
|
||||
0x540| 10| .| exponent: 0 0x54f.4-0x550 (0.4)
|
||||
0x550|3a |: | size_bigint: 58 0x550-0x551 (1)
|
||||
| | | size: 58
|
||||
0x550| 63 6f 6d 2e 61 70 70 6c 65 2e 76 69 64 65 6f| com.apple.video| value: "com.apple.videotoolbox.videoencoder.prores-4444..." 0x551-0x58b (58)
|
||||
0x550| 63 6f 6d 2e 61 70 70 6c 65 2e 76 69 64 65 6f| com.apple.video| value: "com.apple.videotoolbox.videoencoder.prores-4444xq.embedded" 0x551-0x58b (58)
|
||||
0x560|74 6f 6f 6c 62 6f 78 2e 76 69 64 65 6f 65 6e 63|toolbox.videoenc|
|
||||
* |until 0x58a.7 (58) | |
|
||||
| | | [5]{}: entry 0x4cc-0x54e (130)
|
||||
@ -810,7 +810,7 @@ $ fq dv Info.plist
|
||||
0x220| 10 | . | exponent: 0 0x224.4-0x225 (0.4)
|
||||
0x220| 37 | 7 | size_bigint: 55 0x225-0x226 (1)
|
||||
| | | size: 55
|
||||
0x220| 43 6f 70 79 72 69 67 68 74 20| Copyright | value: "Copyright (c) 2011-2021 Apple Inc. All rights r..." 0x226-0x25d (55)
|
||||
0x220| 43 6f 70 79 72 69 67 68 74 20| Copyright | value: "Copyright (c) 2011-2021 Apple Inc. All rights reserved." 0x226-0x25d (55)
|
||||
0x230|28 63 29 20 32 30 31 31 2d 32 30 32 31 20 41 70|(c) 2011-2021 Ap|
|
||||
* |until 0x25c.7 (55) | |
|
||||
| | | key{}: 0x3b4-0x3c0 (12)
|
||||
@ -975,7 +975,7 @@ $ fq dv Info.plist
|
||||
0x600| 10 | . | exponent: 0 0x601.4-0x602 (0.4)
|
||||
0x600| 38 | 8 | size_bigint: 56 0x602-0x603 (1)
|
||||
| | | size: 56
|
||||
0x600| 63 6f 6d 2e 61 70 70 6c 65 2e 76 69 64| com.apple.vid| value: "com.apple.videotoolbox.videoencoder.prores-4444..." 0x603-0x63b (56)
|
||||
0x600| 63 6f 6d 2e 61 70 70 6c 65 2e 76 69 64| com.apple.vid| value: "com.apple.videotoolbox.videoencoder.prores-4444.embedded" 0x603-0x63b (56)
|
||||
0x610|65 6f 74 6f 6f 6c 62 6f 78 2e 76 69 64 65 6f 65|eotoolbox.videoe|
|
||||
* |until 0x63a.7 (56) | |
|
||||
| | | [5]{}: entry 0x4e9-0x600 (279)
|
||||
@ -1050,7 +1050,7 @@ $ fq dv Info.plist
|
||||
0x220| 10 | . | exponent: 0 0x224.4-0x225 (0.4)
|
||||
0x220| 37 | 7 | size_bigint: 55 0x225-0x226 (1)
|
||||
| | | size: 55
|
||||
0x220| 43 6f 70 79 72 69 67 68 74 20| Copyright | value: "Copyright (c) 2011-2021 Apple Inc. All rights r..." 0x226-0x25d (55)
|
||||
0x220| 43 6f 70 79 72 69 67 68 74 20| Copyright | value: "Copyright (c) 2011-2021 Apple Inc. All rights reserved." 0x226-0x25d (55)
|
||||
0x230|28 63 29 20 32 30 31 31 2d 32 30 32 31 20 41 70|(c) 2011-2021 Ap|
|
||||
* |until 0x25c.7 (55) | |
|
||||
| | | key{}: 0x3b4-0x3c0 (12)
|
||||
@ -1216,7 +1216,7 @@ $ fq dv Info.plist
|
||||
0x680| 10| .| exponent: 0 0x68f.4-0x690 (0.4)
|
||||
0x690|39 |9 | size_bigint: 57 0x690-0x691 (1)
|
||||
| | | size: 57
|
||||
0x690| 63 6f 6d 2e 61 70 70 6c 65 2e 76 69 64 65 6f| com.apple.video| value: "com.apple.videotoolbox.videoencoder.prores-422h..." 0x691-0x6ca (57)
|
||||
0x690| 63 6f 6d 2e 61 70 70 6c 65 2e 76 69 64 65 6f| com.apple.video| value: "com.apple.videotoolbox.videoencoder.prores-422hq.embedded" 0x691-0x6ca (57)
|
||||
0x6a0|74 6f 6f 6c 62 6f 78 2e 76 69 64 65 6f 65 6e 63|toolbox.videoenc|
|
||||
* |until 0x6c9.7 (57) | |
|
||||
| | | [5]{}: entry 0x4e9-0x68e (421)
|
||||
@ -1291,7 +1291,7 @@ $ fq dv Info.plist
|
||||
0x220| 10 | . | exponent: 0 0x224.4-0x225 (0.4)
|
||||
0x220| 37 | 7 | size_bigint: 55 0x225-0x226 (1)
|
||||
| | | size: 55
|
||||
0x220| 43 6f 70 79 72 69 67 68 74 20| Copyright | value: "Copyright (c) 2011-2021 Apple Inc. All rights r..." 0x226-0x25d (55)
|
||||
0x220| 43 6f 70 79 72 69 67 68 74 20| Copyright | value: "Copyright (c) 2011-2021 Apple Inc. All rights reserved." 0x226-0x25d (55)
|
||||
0x230|28 63 29 20 32 30 31 31 2d 32 30 32 31 20 41 70|(c) 2011-2021 Ap|
|
||||
* |until 0x25c.7 (55) | |
|
||||
| | | key{}: 0x3b4-0x3c0 (12)
|
||||
@ -1457,7 +1457,7 @@ $ fq dv Info.plist
|
||||
0x710| 10 | . | exponent: 0 0x718.4-0x719 (0.4)
|
||||
0x710| 37 | 7 | size_bigint: 55 0x719-0x71a (1)
|
||||
| | | size: 55
|
||||
0x710| 63 6f 6d 2e 61 70| com.ap| value: "com.apple.videotoolbox.videoencoder.prores-422...." 0x71a-0x751 (55)
|
||||
0x710| 63 6f 6d 2e 61 70| com.ap| value: "com.apple.videotoolbox.videoencoder.prores-422.embedded" 0x71a-0x751 (55)
|
||||
0x720|70 6c 65 2e 76 69 64 65 6f 74 6f 6f 6c 62 6f 78|ple.videotoolbox|
|
||||
* |until 0x750.7 (55) | |
|
||||
| | | [5]{}: entry 0x4e9-0x717 (558)
|
||||
@ -1532,7 +1532,7 @@ $ fq dv Info.plist
|
||||
0x220| 10 | . | exponent: 0 0x224.4-0x225 (0.4)
|
||||
0x220| 37 | 7 | size_bigint: 55 0x225-0x226 (1)
|
||||
| | | size: 55
|
||||
0x220| 43 6f 70 79 72 69 67 68 74 20| Copyright | value: "Copyright (c) 2011-2021 Apple Inc. All rights r..." 0x226-0x25d (55)
|
||||
0x220| 43 6f 70 79 72 69 67 68 74 20| Copyright | value: "Copyright (c) 2011-2021 Apple Inc. All rights reserved." 0x226-0x25d (55)
|
||||
0x230|28 63 29 20 32 30 31 31 2d 32 30 32 31 20 41 70|(c) 2011-2021 Ap|
|
||||
* |until 0x25c.7 (55) | |
|
||||
| | | key{}: 0x3b4-0x3c0 (12)
|
||||
@ -1697,7 +1697,7 @@ $ fq dv Info.plist
|
||||
0x7a0| 10 | . | exponent: 0 0x7a5.4-0x7a6 (0.4)
|
||||
0x7a0| 39 | 9 | size_bigint: 57 0x7a6-0x7a7 (1)
|
||||
| | | size: 57
|
||||
0x7a0| 63 6f 6d 2e 61 70 70 6c 65| com.apple| value: "com.apple.videotoolbox.videoencoder.prores-422l..." 0x7a7-0x7e0 (57)
|
||||
0x7a0| 63 6f 6d 2e 61 70 70 6c 65| com.apple| value: "com.apple.videotoolbox.videoencoder.prores-422lt.embedded" 0x7a7-0x7e0 (57)
|
||||
0x7b0|2e 76 69 64 65 6f 74 6f 6f 6c 62 6f 78 2e 76 69|.videotoolbox.vi|
|
||||
* |until 0x7df.7 (57) | |
|
||||
| | | [5]{}: entry 0x4e9-0x7a4 (699)
|
||||
@ -1772,7 +1772,7 @@ $ fq dv Info.plist
|
||||
0x220| 10 | . | exponent: 0 0x224.4-0x225 (0.4)
|
||||
0x220| 37 | 7 | size_bigint: 55 0x225-0x226 (1)
|
||||
| | | size: 55
|
||||
0x220| 43 6f 70 79 72 69 67 68 74 20| Copyright | value: "Copyright (c) 2011-2021 Apple Inc. All rights r..." 0x226-0x25d (55)
|
||||
0x220| 43 6f 70 79 72 69 67 68 74 20| Copyright | value: "Copyright (c) 2011-2021 Apple Inc. All rights reserved." 0x226-0x25d (55)
|
||||
0x230|28 63 29 20 32 30 31 31 2d 32 30 32 31 20 41 70|(c) 2011-2021 Ap|
|
||||
* |until 0x25c.7 (55) | |
|
||||
| | | key{}: 0x3b4-0x3c0 (12)
|
||||
@ -1937,7 +1937,7 @@ $ fq dv Info.plist
|
||||
0x830| 10 | . | exponent: 0 0x83a.4-0x83b (0.4)
|
||||
0x830| 3c | < | size_bigint: 60 0x83b-0x83c (1)
|
||||
| | | size: 60
|
||||
0x830| 63 6f 6d 2e| com.| value: "com.apple.videotoolbox.videoencoder.prores-422p..." 0x83c-0x878 (60)
|
||||
0x830| 63 6f 6d 2e| com.| value: "com.apple.videotoolbox.videoencoder.prores-422proxy.embedded" 0x83c-0x878 (60)
|
||||
0x840|61 70 70 6c 65 2e 76 69 64 65 6f 74 6f 6f 6c 62|apple.videotoolb|
|
||||
* |until 0x877.7 (60) | |
|
||||
| | | [5]{}: entry 0x4e9-0x839 (848)
|
||||
@ -2012,7 +2012,7 @@ $ fq dv Info.plist
|
||||
0x220| 10 | . | exponent: 0 0x224.4-0x225 (0.4)
|
||||
0x220| 37 | 7 | size_bigint: 55 0x225-0x226 (1)
|
||||
| | | size: 55
|
||||
0x220| 43 6f 70 79 72 69 67 68 74 20| Copyright | value: "Copyright (c) 2011-2021 Apple Inc. All rights r..." 0x226-0x25d (55)
|
||||
0x220| 43 6f 70 79 72 69 67 68 74 20| Copyright | value: "Copyright (c) 2011-2021 Apple Inc. All rights reserved." 0x226-0x25d (55)
|
||||
0x230|28 63 29 20 32 30 31 31 2d 32 30 32 31 20 41 70|(c) 2011-2021 Ap|
|
||||
* |until 0x25c.7 (55) | |
|
||||
| | | key{}: 0x3b4-0x3c0 (12)
|
||||
|
@ -281,7 +281,7 @@ func decodeASN1BERValue(d *decode.D, bib *bitio.Buffer, sb *strings.Builder, par
|
||||
if bib != nil {
|
||||
// TODO: helper?
|
||||
if _, err := bitio.Copy(bib, br); err != nil {
|
||||
d.IOPanic(err, "bitio.Copy")
|
||||
d.IOPanic(err, "value", "bitio.Copy")
|
||||
}
|
||||
}
|
||||
if unusedBitsCount > 0 {
|
||||
@ -292,7 +292,7 @@ func decodeASN1BERValue(d *decode.D, bib *bitio.Buffer, sb *strings.Builder, par
|
||||
if bib != nil {
|
||||
// TODO: helper?
|
||||
if _, err := bitio.Copy(bib, br); err != nil {
|
||||
d.IOPanic(err, "bitio.Copy")
|
||||
d.IOPanic(err, "value", "bitio.Copy")
|
||||
}
|
||||
}
|
||||
case class == classUniversal && tag == universalTypeNull:
|
||||
|
2
format/avro/testdata/allDataTypes.fqtest
vendored
@ -14,7 +14,7 @@ $ fq dv allDataTypes.avro
|
||||
0x010|61 |a |
|
||||
| | | value{}: 0x11-0x3fd (1004)
|
||||
0x010| d4 0f | .. | length: 1002 0x11-0x13 (2)
|
||||
0x010| 7b 22 66 69 65 6c 64 73 22 3a 5b 7b 22| {"fields":[{"| data: "{\"fields\":[{\"name\":\"null\",\"type\":\"null\"},{\"name..." 0x13-0x3fd (1002)
|
||||
0x010| 7b 22 66 69 65 6c 64 73 22 3a 5b 7b 22| {"fields":[{"| data: "{\"fields\":[{\"name\":\"null\",\"type\":\"null\"},{\"name\":\"boolean\",\"type\":\"boolean\"},{\"name\":\"int\",\"type\":\"int\"},{\"name\":\"long\",\"type\":\"long\"},{\"name\":\"float\",\"type\":\"float\"},{\"name\":\"double\",\"type\":\"double\"},{\"name\":\"bytes\",\"type\":\"bytes\"},{\"name\":\"string\",\"type\":\"string\"},{\"name\":\"enum\",\"type\":{\"name\":\"enum\",\"symbols\":[\"A\",\"B\",\"C\"],\"type\":\"enum\"}},{\"name\":\"array\",\"type\":{\"items\":\"string\",\"name\":\"array\",\"type\":\"array\"}},{\"name\":\"map\",\"type\":{\"name\":\"map\",\"type\":\"map\",\"values\":\"string\"}},{\"name\":\"union\",\"type\":[\"int\",\"string\"]},{\"name\":\"fixed\",\"type\":{\"name\":\"fixed\",\"size\":16,\"type\":\"fixed\"}},{\"name\":\"date\",\"type\":{\"logicalType\":\"date\",\"type\":\"int\"}},{\"name\":\"timeMillis\",\"type\":{\"logicalType\":\"time-millis\",\"type\":\"long\"}},{\"name\":\"timeMicros\",\"type\":{\"logicalType\":\"time-micros\",\"type\":\"long\"}},{\"name\":\"timestampMillis\",\"type\":{\"logicalType\":\"timestamp-millis\",\"type\":\"long\"}},{\"name\":\"timestampMicros\",\"type\":{\"logicalType\":\"timestamp-micros\",\"type\":\"long\"}}],\"name\":\"AllDataTypes\",\"type\":\"record\"}" 0x13-0x3fd (1002)
|
||||
0x020|6e 61 6d 65 22 3a 22 6e 75 6c 6c 22 2c 22 74 79|name":"null","ty|
|
||||
* |until 0x3fc.7 (1002) | |
|
||||
| | | [1]{}: entry 0x3fd-0x40d (16)
|
||||
|
@ -21,7 +21,7 @@ $ fq 'dv({array_truncate: 5})' quickstop-deflate.avro
|
||||
0x000020|68 65 6d 61 |hema |
|
||||
| | | value{}: 0x24-0x119 (245)
|
||||
0x000020| e6 03 | .. | length: 243 0x24-0x26 (2)
|
||||
0x000020| 7b 22 74 79 70 65 22 3a 22 72| {"type":"r| data: "{\"type\":\"record\",\"name\":\"Person\",\"fields\":[{\"na..." 0x26-0x119 (243)
|
||||
0x000020| 7b 22 74 79 70 65 22 3a 22 72| {"type":"r| data: "{\"type\":\"record\",\"name\":\"Person\",\"fields\":[{\"name\":\"ID\",\"type\":{\"type\":\"long\"}},{\"name\":\"First\",\"type\":{\"type\":\"string\"}},{\"name\":\"Last\",\"type\":{\"type\":\"string\"}},{\"name\":\"Phone\",\"type\":{\"type\":\"string\"}},{\"name\":\"Age\",\"type\":{\"type\":\"int\"}}]}" 0x26-0x119 (243)
|
||||
0x000030|65 63 6f 72 64 22 2c 22 6e 61 6d 65 22 3a 22 50|ecord","name":"P|
|
||||
* |until 0x118.7 (243) | |
|
||||
| | | [1]{}: block 0x119-0x11a (1)
|
||||
|
2
format/avro/testdata/snappy.fqtest
vendored
@ -14,7 +14,7 @@ $ fq 'dv({array_truncate: 25})' snappy.avro
|
||||
0x00010|61 |a |
|
||||
| | | value{}: 0x11-0x3fd (1004)
|
||||
0x00010| d4 0f | .. | length: 1002 0x11-0x13 (2)
|
||||
0x00010| 7b 22 66 69 65 6c 64 73 22 3a 5b 7b 22| {"fields":[{"| data: "{\"fields\":[{\"name\":\"null\",\"type\":\"null\"},{\"name..." 0x13-0x3fd (1002)
|
||||
0x00010| 7b 22 66 69 65 6c 64 73 22 3a 5b 7b 22| {"fields":[{"| data: "{\"fields\":[{\"name\":\"null\",\"type\":\"null\"},{\"name\":\"boolean\",\"type\":\"boolean\"},{\"name\":\"int\",\"type\":\"int\"},{\"name\":\"long\",\"type\":\"long\"},{\"name\":\"float\",\"type\":\"float\"},{\"name\":\"double\",\"type\":\"double\"},{\"name\":\"bytes\",\"type\":\"bytes\"},{\"name\":\"string\",\"type\":\"string\"},{\"name\":\"enum\",\"type\":{\"name\":\"enum\",\"symbols\":[\"A\",\"B\",\"C\"],\"type\":\"enum\"}},{\"name\":\"array\",\"type\":{\"items\":\"string\",\"name\":\"array\",\"type\":\"array\"}},{\"name\":\"map\",\"type\":{\"name\":\"map\",\"type\":\"map\",\"values\":\"string\"}},{\"name\":\"union\",\"type\":[\"int\",\"string\"]},{\"name\":\"fixed\",\"type\":{\"name\":\"fixed\",\"size\":16,\"type\":\"fixed\"}},{\"name\":\"date\",\"type\":{\"logicalType\":\"date\",\"type\":\"int\"}},{\"name\":\"timeMillis\",\"type\":{\"logicalType\":\"time-millis\",\"type\":\"long\"}},{\"name\":\"timeMicros\",\"type\":{\"logicalType\":\"time-micros\",\"type\":\"long\"}},{\"name\":\"timestampMillis\",\"type\":{\"logicalType\":\"timestamp-millis\",\"type\":\"long\"}},{\"name\":\"timestampMicros\",\"type\":{\"logicalType\":\"timestamp-micros\",\"type\":\"long\"}}],\"name\":\"AllDataTypes\",\"type\":\"record\"}" 0x13-0x3fd (1002)
|
||||
0x00020|6e 61 6d 65 22 3a 22 6e 75 6c 6c 22 2c 22 74 79|name":"null","ty|
|
||||
* |until 0x3fc.7 (1002) | |
|
||||
| | | [1]{}: entry 0x3fd-0x40f (18)
|
||||
|
2
format/avro/testdata/twitter.fqtest
vendored
@ -14,7 +14,7 @@ $ fq dv twitter.avro
|
||||
0x010|61 |a |
|
||||
| | | value{}: 0x11-0x187 (374)
|
||||
0x010| e8 05 | .. | length: 372 0x11-0x13 (2)
|
||||
0x010| 7b 22 74 79 70 65 22 3a 22 72 65 63 6f| {"type":"reco| data: "{\"type\":\"record\",\"name\":\"twitter_schema\",\"names..." 0x13-0x187 (372)
|
||||
0x010| 7b 22 74 79 70 65 22 3a 22 72 65 63 6f| {"type":"reco| data: "{\"type\":\"record\",\"name\":\"twitter_schema\",\"namespace\":\"com.miguno.avro\",\"fields\":[{\"name\":\"username\",\"type\":\"string\",\"doc\":\"Name of the user account on Twitter.com\"},{\"name\":\"tweet\",\"type\":\"string\",\"doc\":\"The content of the user's Twitter message\"},{\"name\":\"timestamp\",\"type\":\"long\",\"doc\":\"Unix epoch time in seconds\"}],\"doc:\":\"A basic schema for storing Twitter messages\"}" 0x13-0x187 (372)
|
||||
0x020|72 64 22 2c 22 6e 61 6d 65 22 3a 22 74 77 69 74|rd","name":"twit|
|
||||
* |until 0x186.7 (372) | |
|
||||
| | | [1]{}: entry 0x187-0x197 (16)
|
||||
|
6
format/bencode/testdata/bbb.fqtest
vendored
@ -1,4 +1,4 @@
|
||||
$ fq -d bencode dv bbb.torrent
|
||||
$ fq -d bencode 'dv({string_truncate: 50})' bbb.torrent
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: bbb.torrent (bencode) 0x0-0x3796 (14230)
|
||||
0x0000|64 |d | type: "dictionary" ("d") 0x0-0x1 (1)
|
||||
| | | pairs[0:9]: 0x1-0x3795 (14228)
|
||||
@ -181,7 +181,7 @@ $ fq -d bencode dv bbb.torrent
|
||||
0x01a0| 31 33| 13| length: 13580 0x1ae-0x1b3 (5)
|
||||
0x01b0|35 38 30 |580 |
|
||||
0x01b0| 3a | : | separator: ":" (valid) 0x1b3-0x1b4 (1)
|
||||
0x01b0| 99 71 9b 2c 2e aa b6 80 df fa 1f 36| .q.,.......6| value: "<22>q<EFBFBD>,.<2E><><EFBFBD><EFBFBD><EFBFBD>\x1f6\x0e<30>LS<4C>x<EFBFBD><78><EFBFBD>)\xef..." 0x1b4-0x36c0 (13580)
|
||||
0x01b0| 99 71 9b 2c 2e aa b6 80 df fa 1f 36| .q.,.......6| value: "<22>q<EFBFBD>,.<2E><><EFBFBD><EFBFBD><EFBFBD>\x1f6\x0e<30>LS<4C>x<EFBFBD><78><EFBFBD>)<EFBFBD>><3E><><EFBFBD><EFBFBD>\x03\x19%<25>\x04\x04<30>}<7D>\v<>Ķ{\rB<72><42><EFBFBD>wT\r<>" 0x1b4-0x36c0 (13580)
|
||||
0x01c0|0e e0 4c 53 f3 78 bb 84 82 29 c8 3e 98 91 93 f9|..LS.x...).>....|
|
||||
* |until 0x36bf.7 (13580) | |
|
||||
| | | [6]{}: pair 0x36c0-0x3701 (65)
|
||||
@ -257,7 +257,7 @@ $ fq -d bencode dv bbb.torrent
|
||||
0x3700| 39 | 9 | type: "string" ("9") 0x370d-0x370e (1)
|
||||
0x3700| 39 30 | 90 | length: 90 0x370d-0x370f (2)
|
||||
0x3700| 3a| :| separator: ":" (valid) 0x370f-0x3710 (1)
|
||||
0x3710|68 74 74 70 3a 2f 2f 64 69 73 74 72 69 62 75 74|http://distribut| value: "http://distribution.bbb3d.renderfarming.net/vid..." 0x3710-0x376a (90)
|
||||
0x3710|68 74 74 70 3a 2f 2f 64 69 73 74 72 69 62 75 74|http://distribut| value: "http://distribution.bbb3d.renderfarming.net/video/" 0x3710-0x376a (90)
|
||||
* |until 0x3769.7 (90) | |
|
||||
0x3760| 65 | e | end: "e" (valid) 0x376a-0x376b (1)
|
||||
| | | [8]{}: pair 0x376b-0x3795 (42)
|
||||
|
6
format/bitcoin/testdata/genesis.fqtest
vendored
@ -5,10 +5,10 @@ $ fq dd genesis.dat
|
||||
0x000| 1d 01 00 00 | .... | size: 285
|
||||
| | | header{}:
|
||||
0x000| 01 00 00 00 | .... | version: 0x1
|
||||
0x000| 00 00 00 00| ....| previous_block_hash: "00000000000000000000000000000000000000000000000..." (raw bits)
|
||||
0x000| 00 00 00 00| ....| previous_block_hash: "0000000000000000000000000000000000000000000000000000000000000000" (raw bits)
|
||||
0x010|00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................|
|
||||
0x020|00 00 00 00 00 00 00 00 00 00 00 00 |............ |
|
||||
0x020| 3b a3 ed fd| ;...| merkle_root: "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77..." (raw bits)
|
||||
0x020| 3b a3 ed fd| ;...| merkle_root: "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b" (raw bits)
|
||||
0x030|7a 7b 12 b2 7a c7 2c 3e 67 76 8f 61 7f c8 1b c3|z{..z.,>gv.a....|
|
||||
0x040|88 8a 51 32 3a 9f b8 aa 4b 1e 5e 4a |..Q2:...K.^J |
|
||||
0x040| 29 ab 5f 49| )._I| time: 1231006505 (2009-01-03T18:15:05Z)
|
||||
@ -21,7 +21,7 @@ $ fq dd genesis.dat
|
||||
0x050| 01 | . | input_count: 1
|
||||
| | | inputs[0:1]:
|
||||
| | | [0]{}: input
|
||||
0x050| 00 00| ..| txid: "00000000000000000000000000000000000000000000000..." (raw bits) (coinbase)
|
||||
0x050| 00 00| ..| txid: "0000000000000000000000000000000000000000000000000000000000000000" (raw bits) (coinbase)
|
||||
0x060|00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................|
|
||||
0x070|00 00 00 00 00 00 00 00 00 00 00 00 00 00 |.............. |
|
||||
0x070| ff ff| ..| vout: 4294967295
|
||||
|
2
format/bitcoin/testdata/tx_b941ddad.fqtest
vendored
@ -6,7 +6,7 @@ $ fq -d bitcoin_transaction dv tx_b941ddad.dat
|
||||
0x000| 01 | . | input_count: 1 0x6-0x7 (1)
|
||||
| | | inputs[0:1]: 0x7-0x30 (41)
|
||||
| | | [0]{}: input 0x7-0x30 (41)
|
||||
0x000| 05 89 f2 e6 c0 7d 7c d7 d0| .....}|..| txid: "1efe0f1537ddd0b2f94d93b56d14f30f570b7495cfbf6cd..." (raw bits) 0x7-0x27 (32)
|
||||
0x000| 05 89 f2 e6 c0 7d 7c d7 d0| .....}|..| txid: "1efe0f1537ddd0b2f94d93b56d14f30f570b7495cfbf6cd0d77c7dc0e6f28905" (raw bits) 0x7-0x27 (32)
|
||||
0x010|6c bf cf 95 74 0b 57 0f f3 14 6d b5 93 4d f9 b2|l...t.W...m..M..|
|
||||
0x020|d0 dd 37 15 0f fe 1e |..7.... |
|
||||
0x020| 00 00 00 00 | .... | vout: 0 0x27-0x2b (4)
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/wader/fq/format"
|
||||
"github.com/wader/fq/internal/mathex"
|
||||
"github.com/wader/fq/internal/mathx"
|
||||
"github.com/wader/fq/pkg/bitio"
|
||||
"github.com/wader/fq/pkg/decode"
|
||||
"github.com/wader/fq/pkg/interp"
|
||||
@ -117,7 +117,7 @@ func decodeCBORValue(d *decode.D) any {
|
||||
}},
|
||||
majorTypeNegativeInt: {s: scalar.Uint{Sym: "negative_int"}, d: func(d *decode.D, shortCount uint64, count uint64) any {
|
||||
n := new(big.Int)
|
||||
n.SetUint64(count).Neg(n).Sub(n, mathex.BigIntOne)
|
||||
n.SetUint64(count).Neg(n).Sub(n, mathx.BigIntOne)
|
||||
d.FieldValueBigInt("value", n)
|
||||
return nil
|
||||
}},
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/wader/fq/format"
|
||||
"github.com/wader/fq/internal/gojqex"
|
||||
"github.com/wader/fq/internal/gojqx"
|
||||
"github.com/wader/fq/pkg/bitio"
|
||||
"github.com/wader/fq/pkg/decode"
|
||||
"github.com/wader/fq/pkg/interp"
|
||||
@ -83,11 +83,11 @@ func toCSV(_ *interp.Interp, c []any, opts ToCSVOpts) any {
|
||||
w.Comma = rune(opts.Comma[0])
|
||||
}
|
||||
for _, row := range c {
|
||||
rs, ok := gojqex.Cast[[]any](row)
|
||||
rs, ok := gojqx.Cast[[]any](row)
|
||||
if !ok {
|
||||
return fmt.Errorf("expected row to be an array, got %s", gojqex.TypeErrorPreview(row))
|
||||
return fmt.Errorf("expected row to be an array, got %s", gojqx.TypeErrorPreview(row))
|
||||
}
|
||||
vs, ok := gojqex.NormalizeToStrings(rs).([]any)
|
||||
vs, ok := gojqx.NormalizeToStrings(rs).([]any)
|
||||
if !ok {
|
||||
panic("not array")
|
||||
}
|
||||
@ -95,7 +95,7 @@ func toCSV(_ *interp.Interp, c []any, opts ToCSVOpts) any {
|
||||
for _, v := range vs {
|
||||
s, ok := v.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("expected row record to be scalars, got %s", gojqex.TypeErrorPreview(v))
|
||||
return fmt.Errorf("expected row record to be scalars, got %s", gojqx.TypeErrorPreview(v))
|
||||
}
|
||||
ss = append(ss, s)
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ $ fq -d elf dv a_dynamic
|
||||
0x3d30|04 00 00 00 |.... | addralign: 4 0x3d30-0x3d34 (4)
|
||||
0x3d30| 10 00 00 00 | .... | entsize: 16 0x3d34-0x3d38 (4)
|
||||
| | | [5]{}: section_header 0x2c8-0x3d60 (15000)
|
||||
0x02c0| 00 70 75 74 73 00 5f 5f| .puts.__| string: "\x00puts\x00__cxa_finalize\x00__register_frame_info_base..." 0x2c8-0x393 (203)
|
||||
0x02c0| 00 70 75 74 73 00 5f 5f| .puts.__| string: "\x00puts\x00__cxa_finalize\x00__register_frame_info_bases\x00_ITM_registerTMCloneTable\x00__deregister_frame_info_bases\x00_ITM_deregisterTMCloneTable\x00_init\x00_fini\x00libbbb_bbb\x00__libc_start_main\x00libbbb.so\x00libc.musl-x86.so.1\x00" 0x2c8-0x393 (203)
|
||||
0x02d0|63 78 61 5f 66 69 6e 61 6c 69 7a 65 00 5f 5f 72|cxa_finalize.__r|
|
||||
* |until 0x392.7 (203) | |
|
||||
0x3d30| 48 00 00 00 | H... | name: ".dynstr" (72) 0x3d38-0x3d3c (4)
|
||||
@ -1686,7 +1686,7 @@ $ fq -d elf dv a_dynamic
|
||||
0x4160| 04 00 00 00 | .... | addralign: 4 0x4168-0x416c (4)
|
||||
0x4160| 10 00 00 00| ....| entsize: 16 0x416c-0x4170 (4)
|
||||
| | | [32]{}: section_header 0x38f0-0x4198 (2216)
|
||||
0x38f0|00 53 63 72 74 31 2e 63 00 63 72 74 73 74 75 66|.Scrt1.c.crtstuf| string: "\x00Scrt1.c\x00crtstuff.c\x00__CTOR_LIST__\x00__DTOR_LIST__..." 0x38f0-0x3b41 (593)
|
||||
0x38f0|00 53 63 72 74 31 2e 63 00 63 72 74 73 74 75 66|.Scrt1.c.crtstuf| string: "\x00Scrt1.c\x00crtstuff.c\x00__CTOR_LIST__\x00__DTOR_LIST__\x00__EH_FRAME_BEGIN__\x00deregister_tm_clones\x00__do_global_dtors_aux\x00completed.2\x00dtor_idx.1\x00frame_dummy\x00object.0\x00__CTOR_END__\x00__FRAME_END__\x00__do_global_ctors_aux\x00a.c\x00_DYNAMIC\x00__GNU_EH_FRAME_HDR\x00_GLOBAL_OFFSET_TABLE_\x00__x86.get_pc_thunk.di\x00__TMC_END__\x00__DTOR_END__\x00puts\x00__cxa_finalize\x00__x86.get_pc_thunk.ax\x00__dso_handle\x00aaa\x00__x86.get_pc_thunk.dx\x00_init\x00__register_frame_info_bases\x00_ITM_registerTMCloneTable\x00__deregister_frame_info_bases\x00_start_c\x00__x86.get_pc_thunk.bx\x00_ITM_deregisterTMCloneTable\x00__bss_start\x00_fini\x00_edata\x00_end\x00libbbb_bbb\x00__libc_start_main\x00" 0x38f0-0x3b41 (593)
|
||||
* |until 0x3b40.7 (593) | |
|
||||
0x4170|09 00 00 00 |.... | name: ".strtab" (9) 0x4170-0x4174 (4)
|
||||
0x4170| 03 00 00 00 | .... | type: "strtab" (0x3) (String table) 0x4174-0x4178 (4)
|
||||
@ -1713,7 +1713,7 @@ $ fq -d elf dv a_dynamic
|
||||
0x4190|01 00 00 00 |.... | addralign: 1 0x4190-0x4194 (4)
|
||||
0x4190| 00 00 00 00 | .... | entsize: 0 0x4194-0x4198 (4)
|
||||
| | | [33]{}: section_header 0x3b41-0x41c0 (1663)
|
||||
0x3b40| 00 2e 73 79 6d 74 61 62 00 2e 73 74 72 74 61| ..symtab..strta| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.interp\x00.note.gnu.pr..." 0x3b41-0x3c6f (302)
|
||||
0x3b40| 00 2e 73 79 6d 74 61 62 00 2e 73 74 72 74 61| ..symtab..strta| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.interp\x00.note.gnu.property\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.rel.dyn\x00.rel.plt\x00.init\x00.plt.got\x00.text\x00.fini\x00.rodata\x00.eh_frame_hdr\x00.eh_frame\x00.ctors\x00.dtors\x00.dynamic\x00.data\x00.bss\x00.comment\x00.debug_aranges\x00.debug_info\x00.debug_abbrev\x00.debug_line\x00.debug_frame\x00.debug_str\x00.debug_loc\x00.debug_ranges\x00" 0x3b41-0x3c6f (302)
|
||||
0x3b50|62 00 2e 73 68 73 74 72 74 61 62 00 2e 69 6e 74|b..shstrtab..int|
|
||||
* |until 0x3c6e.7 (302) | |
|
||||
0x4190| 11 00 00 00 | .... | name: ".shstrtab" (17) 0x4198-0x419c (4)
|
||||
|
@ -2088,7 +2088,7 @@ $ fq -d elf dv a_static
|
||||
0x11700| 04 00 00 00 | .... | addralign: 4 0x11708-0x1170c (4)
|
||||
0x11700| 10 00 00 00| ....| entsize: 16 0x1170c-0x11710 (4)
|
||||
| | | [23]{}: section_header 0x10c40-0x11738 (2808)
|
||||
0x10c40|00 63 72 74 31 2e 63 00 63 72 74 73 74 75 66 66|.crt1.c.crtstuff| string: "\x00crt1.c\x00crtstuff.c\x00__CTOR_LIST__\x00__DTOR_LIST__\x00..." 0x10c40-0x1128b (1611)
|
||||
0x10c40|00 63 72 74 31 2e 63 00 63 72 74 73 74 75 66 66|.crt1.c.crtstuff| string: "\x00crt1.c\x00crtstuff.c\x00__CTOR_LIST__\x00__DTOR_LIST__\x00__EH_FRAME_BEGIN__\x00deregister_tm_clones\x00__do_global_dtors_aux\x00completed.2\x00dtor_idx.1\x00frame_dummy\x00object.0\x00__CTOR_END__\x00__FRAME_END__\x00__do_global_ctors_aux\x00a.c\x00libbbb.c\x00__libc_start_main.c\x00dummy1\x00libc_start_main_stage2\x00libc.c\x00stdout.c\x00buf\x00__environ.c\x00__init_tls.c\x00static_init_tls\x00main_tls\x00builtin_tls\x00_Exit.c\x00__lockfile.c\x00__overflow.c\x00__stdio_close.c\x00__stdio_seek.c\x00__stdout_write.c\x00__towrite.c\x00fputs.c\x00fwrite.c\x00strlen.c\x00default_attr.c\x00lseek.c\x00syscall_ret.c\x00__stdio_exit.c\x00close_file\x00dummy_file\x00__stdio_write.c\x00ofl.c\x00ofl_head\x00__lock.c\x00__errno_location.c\x00__fini_array_end\x00__fini_array_start\x00__init_array_end\x00_GLOBAL_OFFSET_TABLE_\x00__init_array_start\x00__thread_list_lock\x00__stdout_used\x00stdout\x00__x86.get_pc_thunk.si\x00__init_libc\x00__syscall_ret\x00__stdout_write\x00__ofl_unlock\x00__unlockfile\x00__hwcap\x00__stdio_write\x00__towrite\x00memcpy\x00__ofl_lock\x00__TMC_END__\x00__unlock\x00__DTOR_END__\x00__overflow\x00__libc\x00__x86.get_pc_thunk.ax\x00__dso_handle\x00__set_thread_area\x00__stdin_used\x00__copy_tls\x00__stdio_seek\x00__lockfile\x00___errno_location\x00aaa\x00_Exit\x00__towrite_needs_stdio_exit\x00__init_tls\x00__funcs_on_exit\x00__memcpy_fwd\x00__stdio_ofl_lockptr\x00fputs_unlocked\x00___environ\x00__progname\x00_start_c\x00__stdout_FILE\x00program_invocation_short_name\x00__libc_start_init\x00__init_tp\x00__x86.get_pc_thunk.bx\x00__init_ssp\x00__fwritex\x00__x86.get_pc_thunk.bp\x00__bss_start\x00__stdio_exit\x00__lock\x00__aio_close\x00__lseek\x00__libc_exit_fini\x00fwrite_unlocked\x00fwrite\x00_edata\x00__stdio_close\x00__stderr_used\x00__stdio_exit_needed\x00libbbb_bbb\x00__libc_start_main\x00strlen\x00lseek64\x00program_invocation_name\x00__default_stacksize\x00fputs\x00__default_guardsize\x00__sysinfo\x00__progname_full\x00" 0x10c40-0x1128b (1611)
|
||||
* |until 0x1128a.7 (1611) | |
|
||||
0x11710|09 00 00 00 |.... | name: ".strtab" (9) 0x11710-0x11714 (4)
|
||||
0x11710| 03 00 00 00 | .... | type: "strtab" (0x3) (String table) 0x11714-0x11718 (4)
|
||||
@ -2115,7 +2115,7 @@ $ fq -d elf dv a_static
|
||||
0x11730|01 00 00 00 |.... | addralign: 1 0x11730-0x11734 (4)
|
||||
0x11730| 00 00 00 00 | .... | entsize: 0 0x11734-0x11738 (4)
|
||||
| | | [24]{}: section_header 0x1128b-0x11760 (1237)
|
||||
0x11280| 00 2e 73 79 6d| ..sym| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.note.gnu.property\x00...." 0x1128b-0x11377 (236)
|
||||
0x11280| 00 2e 73 79 6d| ..sym| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.note.gnu.property\x00.init\x00.text\x00.fini\x00.rodata\x00.eh_frame\x00.ctors\x00.dtors\x00.data.rel.ro\x00.got\x00.data\x00.bss\x00.comment\x00.debug_aranges\x00.debug_info\x00.debug_abbrev\x00.debug_line\x00.debug_frame\x00.debug_str\x00.debug_loc\x00.debug_ranges\x00" 0x1128b-0x11377 (236)
|
||||
0x11290|74 61 62 00 2e 73 74 72 74 61 62 00 2e 73 68 73|tab..strtab..shs|
|
||||
* |until 0x11376.7 (236) | |
|
||||
0x11730| 11 00 00 00 | .... | name: ".shstrtab" (17) 0x11738-0x1173c (4)
|
||||
|
@ -470,7 +470,7 @@ $ fq -d elf dv a_stripped
|
||||
0x31b0|04 00 00 00 |.... | addralign: 4 0x31b0-0x31b4 (4)
|
||||
0x31b0| 10 00 00 00 | .... | entsize: 16 0x31b4-0x31b8 (4)
|
||||
| | | [5]{}: section_header 0x2c8-0x31e0 (12056)
|
||||
0x02c0| 00 70 75 74 73 00 5f 5f| .puts.__| string: "\x00puts\x00__cxa_finalize\x00__register_frame_info_base..." 0x2c8-0x393 (203)
|
||||
0x02c0| 00 70 75 74 73 00 5f 5f| .puts.__| string: "\x00puts\x00__cxa_finalize\x00__register_frame_info_bases\x00_ITM_registerTMCloneTable\x00__deregister_frame_info_bases\x00_ITM_deregisterTMCloneTable\x00_init\x00_fini\x00libbbb_bbb\x00__libc_start_main\x00libbbb.so\x00libc.musl-x86.so.1\x00" 0x2c8-0x393 (203)
|
||||
0x02d0|63 78 61 5f 66 69 6e 61 6c 69 7a 65 00 5f 5f 72|cxa_finalize.__r|
|
||||
* |until 0x392.7 (203) | |
|
||||
0x31b0| 38 00 00 00 | 8... | name: ".dynstr" (56) 0x31b8-0x31bc (4)
|
||||
@ -1024,7 +1024,7 @@ $ fq -d elf dv a_stripped
|
||||
0x3480|01 00 00 00 |.... | addralign: 1 0x3480-0x3484 (4)
|
||||
0x3480| 01 00 00 00 | .... | entsize: 1 0x3484-0x3488 (4)
|
||||
| | | [23]{}: section_header 0x3035-0x34b0 (1147)
|
||||
0x3030| 00 2e 73 68 73 74 72 74 61 62 00| ..shstrtab.| string: "\x00.shstrtab\x00.interp\x00.note.gnu.property\x00.gnu.hash..." 0x3035-0x30ed (184)
|
||||
0x3030| 00 2e 73 68 73 74 72 74 61 62 00| ..shstrtab.| string: "\x00.shstrtab\x00.interp\x00.note.gnu.property\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.rel.dyn\x00.rel.plt\x00.init\x00.plt.got\x00.text\x00.fini\x00.rodata\x00.eh_frame_hdr\x00.eh_frame\x00.ctors\x00.dtors\x00.dynamic\x00.data\x00.bss\x00.comment\x00" 0x3035-0x30ed (184)
|
||||
0x3040|2e 69 6e 74 65 72 70 00 2e 6e 6f 74 65 2e 67 6e|.interp..note.gn|
|
||||
* |until 0x30ec.7 (184) | |
|
||||
0x3480| 01 00 00 00 | .... | name: ".shstrtab" (1) 0x3488-0x348c (4)
|
||||
|
@ -553,7 +553,7 @@ $ fq -d ar dv libbbb.a
|
||||
0x590| 04 00 00 00 | .... | addralign: 4 0x596-0x59a (4)
|
||||
0x590| 10 00 00 00 | .... | entsize: 16 0x59a-0x59e (4)
|
||||
| | | [14]{}: section_header 0x25e-0x5c6 (872)
|
||||
0x250| 00 6c| .l| string: "\x00libbbb.c\x00libbbb_bbb\x00__x86.get_pc_thunk.ax\x00_GLO..." 0x25e-0x2a4 (70)
|
||||
0x250| 00 6c| .l| string: "\x00libbbb.c\x00libbbb_bbb\x00__x86.get_pc_thunk.ax\x00_GLOBAL_OFFSET_TABLE_\x00puts\x00" 0x25e-0x2a4 (70)
|
||||
0x260|69 62 62 62 62 2e 63 00 6c 69 62 62 62 62 5f 62|ibbbb.c.libbbb_b|
|
||||
* |until 0x2a3.7 (70) | |
|
||||
0x590| 09 00| ..| name: ".strtab" (9) 0x59e-0x5a2 (4)
|
||||
@ -584,7 +584,7 @@ $ fq -d ar dv libbbb.a
|
||||
0x5c0|00 00 |.. |
|
||||
0x5c0| 00 00 00 00 | .... | entsize: 0 0x5c2-0x5c6 (4)
|
||||
| | | [15]{}: section_header 0x2d6-0x5ee (792)
|
||||
0x2d0| 00 2e 73 79 6d 74 61 62 00 2e| ..symtab..| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.rel.text\x00.data\x00.bss..." 0x2d6-0x36b (149)
|
||||
0x2d0| 00 2e 73 79 6d 74 61 62 00 2e| ..symtab..| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.rel.text\x00.data\x00.bss\x00.rodata\x00.text.__x86.get_pc_thunk.ax\x00.comment\x00.note.GNU-stack\x00.note.gnu.property\x00.rel.eh_frame\x00.group\x00" 0x2d6-0x36b (149)
|
||||
0x2e0|73 74 72 74 61 62 00 2e 73 68 73 74 72 74 61 62|strtab..shstrtab|
|
||||
* |until 0x36a.7 (149) | |
|
||||
0x5c0| 11 00 00 00 | .... | name: ".shstrtab" (17) 0x5c6-0x5ca (4)
|
||||
|
@ -377,7 +377,7 @@ $ fq -d elf dv libbbb.so
|
||||
0x3800| 04 00 00 00 | .... | addralign: 4 0x3808-0x380c (4)
|
||||
0x3800| 10 00 00 00| ....| entsize: 16 0x380c-0x3810 (4)
|
||||
| | | [3]{}: section_header 0x240-0x3838 (13816)
|
||||
0x0240|00 5f 69 6e 69 74 00 5f 66 69 6e 69 00 5f 49 54|._init._fini._IT| string: "\x00_init\x00_fini\x00_ITM_deregisterTMCloneTable\x00_ITM_r..." 0x240-0x2ef (175)
|
||||
0x0240|00 5f 69 6e 69 74 00 5f 66 69 6e 69 00 5f 49 54|._init._fini._IT| string: "\x00_init\x00_fini\x00_ITM_deregisterTMCloneTable\x00_ITM_registerTMCloneTable\x00__cxa_finalize\x00__deregister_frame_info_bases\x00__register_frame_info_bases\x00libbbb_bbb\x00puts\x00libc.musl-x86.so.1\x00" 0x240-0x2ef (175)
|
||||
* |until 0x2ee.7 (175) | |
|
||||
0x3810|2d 00 00 00 |-... | name: ".dynstr" (45) 0x3810-0x3814 (4)
|
||||
0x3810| 03 00 00 00 | .... | type: "strtab" (0x3) (String table) 0x3814-0x3818 (4)
|
||||
@ -1475,7 +1475,7 @@ $ fq -d elf dv libbbb.so
|
||||
0x3c10| 04 00 00 00 | .... | addralign: 4 0x3c18-0x3c1c (4)
|
||||
0x3c10| 10 00 00 00| ....| entsize: 16 0x3c1c-0x3c20 (4)
|
||||
| | | [29]{}: section_header 0x3470-0x3c48 (2008)
|
||||
0x3470|00 63 72 74 73 74 75 66 66 2e 63 00 5f 5f 43 54|.crtstuff.c.__CT| string: "\x00crtstuff.c\x00__CTOR_LIST__\x00__DTOR_LIST__\x00__EH_FR..." 0x3470-0x3687 (535)
|
||||
0x3470|00 63 72 74 73 74 75 66 66 2e 63 00 5f 5f 43 54|.crtstuff.c.__CT| string: "\x00crtstuff.c\x00__CTOR_LIST__\x00__DTOR_LIST__\x00__EH_FRAME_BEGIN__\x00deregister_tm_clones\x00__do_global_dtors_aux\x00completed.2\x00dtor_idx.1\x00frame_dummy\x00object.0\x00__CTOR_END__\x00__FRAME_END__\x00__do_global_ctors_aux\x00libbbb.c\x00__x86.get_pc_thunk.di\x00_DYNAMIC\x00__TMC_END__\x00__DTOR_END__\x00__x86.get_pc_thunk.ax\x00__dso_handle\x00__x86.get_pc_thunk.dx\x00__x86.get_pc_thunk.bx\x00__GNU_EH_FRAME_HDR\x00_GLOBAL_OFFSET_TABLE_\x00puts\x00__cxa_finalize\x00_init\x00__register_frame_info_bases\x00_ITM_registerTMCloneTable\x00__deregister_frame_info_bases\x00_ITM_deregisterTMCloneTable\x00_fini\x00libbbb_bbb\x00" 0x3470-0x3687 (535)
|
||||
* |until 0x3686.7 (535) | |
|
||||
0x3c20|09 00 00 00 |.... | name: ".strtab" (9) 0x3c20-0x3c24 (4)
|
||||
0x3c20| 03 00 00 00 | .... | type: "strtab" (0x3) (String table) 0x3c24-0x3c28 (4)
|
||||
@ -1502,7 +1502,7 @@ $ fq -d elf dv libbbb.so
|
||||
0x3c40|01 00 00 00 |.... | addralign: 1 0x3c40-0x3c44 (4)
|
||||
0x3c40| 00 00 00 00 | .... | entsize: 0 0x3c44-0x3c48 (4)
|
||||
| | | [30]{}: section_header 0x3687-0x3c70 (1513)
|
||||
0x3680| 00 2e 73 79 6d 74 61 62 00| ..symtab.| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.gnu.hash\x00.dynsym\x00.d..." 0x3687-0x3795 (270)
|
||||
0x3680| 00 2e 73 79 6d 74 61 62 00| ..symtab.| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.rel.dyn\x00.rel.plt\x00.init\x00.plt.got\x00.text\x00.fini\x00.rodata\x00.eh_frame_hdr\x00.eh_frame\x00.note.gnu.property\x00.ctors\x00.dtors\x00.dynamic\x00.data\x00.bss\x00.comment\x00.debug_aranges\x00.debug_info\x00.debug_abbrev\x00.debug_line\x00.debug_str\x00.debug_ranges\x00" 0x3687-0x3795 (270)
|
||||
0x3690|2e 73 74 72 74 61 62 00 2e 73 68 73 74 72 74 61|.strtab..shstrta|
|
||||
* |until 0x3794.7 (270) | |
|
||||
0x3c40| 11 00 00 00 | .... | name: ".shstrtab" (17) 0x3c48-0x3c4c (4)
|
||||
|
@ -476,7 +476,7 @@ $ fq -d elf dv a_dynamic
|
||||
0x3fc0|08 00 00 00 00 00 00 00 |........ | addralign: 8 0x3fc0-0x3fc8 (8)
|
||||
0x3fc0| 18 00 00 00 00 00 00 00| ........| entsize: 24 0x3fc8-0x3fd0 (8)
|
||||
| | | [5]{}: section_header 0x468-0x4010 (15272)
|
||||
0x0460| 00 70 75 74 73 00 5f 5f| .puts.__| string: "\x00puts\x00__cxa_finalize\x00__deregister_frame_info\x00_I..." 0x468-0x52a (194)
|
||||
0x0460| 00 70 75 74 73 00 5f 5f| .puts.__| string: "\x00puts\x00__cxa_finalize\x00__deregister_frame_info\x00_ITM_registerTMCloneTable\x00_ITM_deregisterTMCloneTable\x00__register_frame_info\x00_init\x00_fini\x00libbbb_bbb\x00__libc_start_main\x00libbbb.so\x00libc.musl-x86_64.so.1\x00" 0x468-0x52a (194)
|
||||
0x0470|63 78 61 5f 66 69 6e 61 6c 69 7a 65 00 5f 5f 64|cxa_finalize.__d|
|
||||
* |until 0x529.7 (194) | |
|
||||
0x3fd0|48 00 00 00 |H... | name: ".dynstr" (72) 0x3fd0-0x3fd4 (4)
|
||||
@ -1678,7 +1678,7 @@ $ fq -d elf dv a_dynamic
|
||||
0x4680|08 00 00 00 00 00 00 00 |........ | addralign: 8 0x4680-0x4688 (8)
|
||||
0x4680| 18 00 00 00 00 00 00 00| ........| entsize: 24 0x4688-0x4690 (8)
|
||||
| | | [32]{}: section_header 0x3b70-0x46d0 (2912)
|
||||
0x3b70|00 53 63 72 74 31 2e 63 00 63 72 74 73 74 75 66|.Scrt1.c.crtstuf| string: "\x00Scrt1.c\x00crtstuff.c\x00__CTOR_LIST__\x00__DTOR_LIST__..." 0x3b70-0x3d5d (493)
|
||||
0x3b70|00 53 63 72 74 31 2e 63 00 63 72 74 73 74 75 66|.Scrt1.c.crtstuf| string: "\x00Scrt1.c\x00crtstuff.c\x00__CTOR_LIST__\x00__DTOR_LIST__\x00__EH_FRAME_BEGIN__\x00deregister_tm_clones\x00__do_global_dtors_aux\x00completed.2\x00dtor_idx.1\x00frame_dummy\x00object.0\x00__CTOR_END__\x00__FRAME_END__\x00__do_global_ctors_aux\x00a.c\x00_DYNAMIC\x00__GNU_EH_FRAME_HDR\x00_GLOBAL_OFFSET_TABLE_\x00__TMC_END__\x00__DTOR_END__\x00puts\x00__cxa_finalize\x00__dso_handle\x00aaa\x00_init\x00__deregister_frame_info\x00_ITM_registerTMCloneTable\x00_start_c\x00_ITM_deregisterTMCloneTable\x00__bss_start\x00_fini\x00_edata\x00_end\x00libbbb_bbb\x00__libc_start_main\x00__register_frame_info\x00" 0x3b70-0x3d5d (493)
|
||||
* |until 0x3d5c.7 (493) | |
|
||||
0x4690|09 00 00 00 |.... | name: ".strtab" (9) 0x4690-0x4694 (4)
|
||||
0x4690| 03 00 00 00 | .... | type: "strtab" (0x3) (String table) 0x4694-0x4698 (4)
|
||||
@ -1706,7 +1706,7 @@ $ fq -d elf dv a_dynamic
|
||||
0x46c0|01 00 00 00 00 00 00 00 |........ | addralign: 1 0x46c0-0x46c8 (8)
|
||||
0x46c0| 00 00 00 00 00 00 00 00| ........| entsize: 0 0x46c8-0x46d0 (8)
|
||||
| | | [33]{}: section_header 0x3d5d-0x4710 (2483)
|
||||
0x3d50| 00 2e 73| ..s| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.interp\x00.note.gnu.pr..." 0x3d5d-0x3e8d (304)
|
||||
0x3d50| 00 2e 73| ..s| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.interp\x00.note.gnu.property\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.rela.dyn\x00.rela.plt\x00.init\x00.plt.got\x00.text\x00.fini\x00.rodata\x00.eh_frame_hdr\x00.eh_frame\x00.ctors\x00.dtors\x00.dynamic\x00.data\x00.bss\x00.comment\x00.debug_aranges\x00.debug_info\x00.debug_abbrev\x00.debug_line\x00.debug_frame\x00.debug_str\x00.debug_loc\x00.debug_ranges\x00" 0x3d5d-0x3e8d (304)
|
||||
0x3d60|79 6d 74 61 62 00 2e 73 74 72 74 61 62 00 2e 73|ymtab..strtab..s|
|
||||
* |until 0x3e8c.7 (304) | |
|
||||
0x46d0|11 00 00 00 |.... | name: ".shstrtab" (17) 0x46d0-0x46d4 (4)
|
||||
|
@ -2037,7 +2037,7 @@ $ fq -d elf dv a_static
|
||||
0x14410|08 00 00 00 00 00 00 00 |........ | addralign: 8 0x14410-0x14418 (8)
|
||||
0x14410| 18 00 00 00 00 00 00 00| ........| entsize: 24 0x14418-0x14420 (8)
|
||||
| | | [22]{}: section_header 0x137c8-0x14460 (3224)
|
||||
0x137c0| 00 63 72 74 31 2e 63 00| .crt1.c.| string: "\x00crt1.c\x00crtstuff.c\x00__CTOR_LIST__\x00__DTOR_LIST__\x00..." 0x137c8-0x13db2 (1514)
|
||||
0x137c0| 00 63 72 74 31 2e 63 00| .crt1.c.| string: "\x00crt1.c\x00crtstuff.c\x00__CTOR_LIST__\x00__DTOR_LIST__\x00__EH_FRAME_BEGIN__\x00deregister_tm_clones\x00__do_global_dtors_aux\x00completed.2\x00dtor_idx.1\x00frame_dummy\x00object.0\x00__CTOR_END__\x00__FRAME_END__\x00__do_global_ctors_aux\x00a.c\x00libbbb.c\x00__libc_start_main.c\x00dummy1\x00libc_start_main_stage2\x00defsysinfo.c\x00libc.c\x00stdout.c\x00buf\x00__environ.c\x00__init_tls.c\x00static_init_tls\x00main_tls\x00builtin_tls\x00_Exit.c\x00__lockfile.c\x00__overflow.c\x00__stdio_close.c\x00__stdio_seek.c\x00__stdout_write.c\x00__towrite.c\x00fputs.c\x00fwrite.c\x00strlen.c\x00default_attr.c\x00lseek.c\x00syscall_ret.c\x00__stdio_exit.c\x00close_file\x00dummy_file\x00__stdio_write.c\x00ofl.c\x00ofl_head\x00__lock.c\x00__errno_location.c\x00__fini_array_end\x00__fini_array_start\x00__init_array_end\x00__init_array_start\x00__thread_list_lock\x00__stdout_used\x00stdout\x00__init_libc\x00__syscall_ret\x00__stdout_write\x00__ofl_unlock\x00__unlockfile\x00__hwcap\x00__stdio_write\x00__towrite\x00memcpy\x00__ofl_lock\x00__TMC_END__\x00__unlock\x00__DTOR_END__\x00__overflow\x00__libc\x00__dso_handle\x00__set_thread_area\x00__stdin_used\x00__copy_tls\x00__stdio_seek\x00__lockfile\x00___errno_location\x00aaa\x00_Exit\x00__towrite_needs_stdio_exit\x00__init_tls\x00__funcs_on_exit\x00__memcpy_fwd\x00__stdio_ofl_lockptr\x00fputs_unlocked\x00___environ\x00__progname\x00_start_c\x00__stdout_FILE\x00program_invocation_short_name\x00__libc_start_init\x00__init_tp\x00__init_ssp\x00__fwritex\x00__bss_start\x00__stdio_exit\x00__lock\x00__aio_close\x00__lseek\x00__libc_exit_fini\x00fwrite_unlocked\x00fwrite\x00_edata\x00__stdio_close\x00__stderr_used\x00__stdio_exit_needed\x00libbbb_bbb\x00__libc_start_main\x00strlen\x00lseek64\x00program_invocation_name\x00__default_stacksize\x00fputs\x00__default_guardsize\x00__sysinfo\x00__progname_full\x00" 0x137c8-0x13db2 (1514)
|
||||
0x137d0|63 72 74 73 74 75 66 66 2e 63 00 5f 5f 43 54 4f|crtstuff.c.__CTO|
|
||||
* |until 0x13db1.7 (1514) | |
|
||||
0x14420|09 00 00 00 |.... | name: ".strtab" (9) 0x14420-0x14424 (4)
|
||||
@ -2066,7 +2066,7 @@ $ fq -d elf dv a_static
|
||||
0x14450|01 00 00 00 00 00 00 00 |........ | addralign: 1 0x14450-0x14458 (8)
|
||||
0x14450| 00 00 00 00 00 00 00 00| ........| entsize: 0 0x14458-0x14460 (8)
|
||||
| | | [23]{}: section_header 0x13db2-0x144a0 (1774)
|
||||
0x13db0| 00 2e 73 79 6d 74 61 62 00 2e 73 74 72 74| ..symtab..strt| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.note.gnu.property\x00...." 0x13db2-0x13e99 (231)
|
||||
0x13db0| 00 2e 73 79 6d 74 61 62 00 2e 73 74 72 74| ..symtab..strt| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.note.gnu.property\x00.init\x00.text\x00.fini\x00.rodata\x00.eh_frame\x00.ctors\x00.dtors\x00.data.rel.ro\x00.data\x00.bss\x00.comment\x00.debug_aranges\x00.debug_info\x00.debug_abbrev\x00.debug_line\x00.debug_frame\x00.debug_str\x00.debug_loc\x00.debug_ranges\x00" 0x13db2-0x13e99 (231)
|
||||
0x13dc0|61 62 00 2e 73 68 73 74 72 74 61 62 00 2e 6e 6f|ab..shstrtab..no|
|
||||
* |until 0x13e98.7 (231) | |
|
||||
0x14460|11 00 00 00 |.... | name: ".shstrtab" (17) 0x14460-0x14464 (4)
|
||||
|
@ -476,7 +476,7 @@ $ fq -d elf dv a_stripped
|
||||
0x3220| 08 00 00 00 00 00 00 00| ........| addralign: 8 0x3228-0x3230 (8)
|
||||
0x3230|18 00 00 00 00 00 00 00 |........ | entsize: 24 0x3230-0x3238 (8)
|
||||
| | | [5]{}: section_header 0x468-0x3278 (11792)
|
||||
0x0460| 00 70 75 74 73 00 5f 5f| .puts.__| string: "\x00puts\x00__cxa_finalize\x00__deregister_frame_info\x00_I..." 0x468-0x52a (194)
|
||||
0x0460| 00 70 75 74 73 00 5f 5f| .puts.__| string: "\x00puts\x00__cxa_finalize\x00__deregister_frame_info\x00_ITM_registerTMCloneTable\x00_ITM_deregisterTMCloneTable\x00__register_frame_info\x00_init\x00_fini\x00libbbb_bbb\x00__libc_start_main\x00libbbb.so\x00libc.musl-x86_64.so.1\x00" 0x468-0x52a (194)
|
||||
0x0470|63 78 61 5f 66 69 6e 61 6c 69 7a 65 00 5f 5f 64|cxa_finalize.__d|
|
||||
* |until 0x529.7 (194) | |
|
||||
0x3230| 38 00 00 00 | 8... | name: ".dynstr" (56) 0x3238-0x323c (4)
|
||||
@ -1046,7 +1046,7 @@ $ fq -d elf dv a_stripped
|
||||
0x36a0| 01 00 00 00 00 00 00 00| ........| addralign: 1 0x36a8-0x36b0 (8)
|
||||
0x36b0|01 00 00 00 00 00 00 00 |........ | entsize: 1 0x36b0-0x36b8 (8)
|
||||
| | | [23]{}: section_header 0x3039-0x36f8 (1727)
|
||||
0x3030| 00 2e 73 68 73 74 72| ..shstr| string: "\x00.shstrtab\x00.interp\x00.note.gnu.property\x00.gnu.hash..." 0x3039-0x30f3 (186)
|
||||
0x3030| 00 2e 73 68 73 74 72| ..shstr| string: "\x00.shstrtab\x00.interp\x00.note.gnu.property\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.rela.dyn\x00.rela.plt\x00.init\x00.plt.got\x00.text\x00.fini\x00.rodata\x00.eh_frame_hdr\x00.eh_frame\x00.ctors\x00.dtors\x00.dynamic\x00.data\x00.bss\x00.comment\x00" 0x3039-0x30f3 (186)
|
||||
0x3040|74 61 62 00 2e 69 6e 74 65 72 70 00 2e 6e 6f 74|tab..interp..not|
|
||||
* |until 0x30f2.7 (186) | |
|
||||
0x36b0| 01 00 00 00 | .... | name: ".shstrtab" (1) 0x36b8-0x36bc (4)
|
||||
|
@ -517,7 +517,7 @@ $ fq -d ar dv libbbb.a
|
||||
0x630|00 00 00 00 |.... |
|
||||
0x630| 00 00 00 00 00 00 00 00 | ........ | entsize: 0 0x634-0x63c (8)
|
||||
| | | [13]{}: section_header 0x284-0x67c (1016)
|
||||
0x280| 00 2e 73 79 6d 74 61 62 00 2e 73 74| ..symtab..st| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.rela.text\x00.data\x00.bs..." 0x284-0x2f8 (116)
|
||||
0x280| 00 2e 73 79 6d 74 61 62 00 2e 73 74| ..symtab..st| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.rela.text\x00.data\x00.bss\x00.rodata\x00.comment\x00.note.GNU-stack\x00.note.gnu.property\x00.rela.eh_frame\x00" 0x284-0x2f8 (116)
|
||||
0x290|72 74 61 62 00 2e 73 68 73 74 72 74 61 62 00 2e|rtab..shstrtab..|
|
||||
* |until 0x2f7.7 (116) | |
|
||||
0x630| 11 00 00 00| ....| name: ".shstrtab" (17) 0x63c-0x640 (4)
|
||||
|
@ -379,7 +379,7 @@ $ fq -d elf dv libbbb.so
|
||||
0x3940|08 00 00 00 00 00 00 00 |........ | addralign: 8 0x3940-0x3948 (8)
|
||||
0x3940| 18 00 00 00 00 00 00 00| ........| entsize: 24 0x3948-0x3950 (8)
|
||||
| | | [3]{}: section_header 0x390-0x3990 (13824)
|
||||
0x0390|00 5f 69 6e 69 74 00 5f 66 69 6e 69 00 5f 49 54|._init._fini._IT| string: "\x00_init\x00_fini\x00_ITM_deregisterTMCloneTable\x00_ITM_r..." 0x390-0x436 (166)
|
||||
0x0390|00 5f 69 6e 69 74 00 5f 66 69 6e 69 00 5f 49 54|._init._fini._IT| string: "\x00_init\x00_fini\x00_ITM_deregisterTMCloneTable\x00_ITM_registerTMCloneTable\x00__cxa_finalize\x00__deregister_frame_info\x00__register_frame_info\x00libbbb_bbb\x00puts\x00libc.musl-x86_64.so.1\x00" 0x390-0x436 (166)
|
||||
* |until 0x435.7 (166) | |
|
||||
0x3950|2d 00 00 00 |-... | name: ".dynstr" (45) 0x3950-0x3954 (4)
|
||||
0x3950| 03 00 00 00 | .... | type: "strtab" (0x3) (String table) 0x3954-0x3958 (4)
|
||||
@ -1466,7 +1466,7 @@ $ fq -d elf dv libbbb.so
|
||||
0x3fc0|08 00 00 00 00 00 00 00 |........ | addralign: 8 0x3fc0-0x3fc8 (8)
|
||||
0x3fc0| 18 00 00 00 00 00 00 00| ........| entsize: 24 0x3fc8-0x3fd0 (8)
|
||||
| | | [29]{}: section_header 0x35c8-0x4010 (2632)
|
||||
0x35c0| 00 63 72 74 73 74 75 66| .crtstuf| string: "\x00crtstuff.c\x00__CTOR_LIST__\x00__DTOR_LIST__\x00__EH_FR..." 0x35c8-0x377b (435)
|
||||
0x35c0| 00 63 72 74 73 74 75 66| .crtstuf| string: "\x00crtstuff.c\x00__CTOR_LIST__\x00__DTOR_LIST__\x00__EH_FRAME_BEGIN__\x00deregister_tm_clones\x00__do_global_dtors_aux\x00completed.2\x00dtor_idx.1\x00frame_dummy\x00object.0\x00__CTOR_END__\x00__FRAME_END__\x00__do_global_ctors_aux\x00libbbb.c\x00_DYNAMIC\x00__TMC_END__\x00__DTOR_END__\x00__dso_handle\x00__GNU_EH_FRAME_HDR\x00_GLOBAL_OFFSET_TABLE_\x00puts\x00__cxa_finalize\x00_init\x00__deregister_frame_info\x00_ITM_registerTMCloneTable\x00_ITM_deregisterTMCloneTable\x00_fini\x00libbbb_bbb\x00__register_frame_info\x00" 0x35c8-0x377b (435)
|
||||
0x35d0|66 2e 63 00 5f 5f 43 54 4f 52 5f 4c 49 53 54 5f|f.c.__CTOR_LIST_|
|
||||
* |until 0x377a.7 (435) | |
|
||||
0x3fd0|09 00 00 00 |.... | name: ".strtab" (9) 0x3fd0-0x3fd4 (4)
|
||||
@ -1495,7 +1495,7 @@ $ fq -d elf dv libbbb.so
|
||||
0x4000|01 00 00 00 00 00 00 00 |........ | addralign: 1 0x4000-0x4008 (8)
|
||||
0x4000| 00 00 00 00 00 00 00 00| ........| entsize: 0 0x4008-0x4010 (8)
|
||||
| | | [30]{}: section_header 0x377b-0x4050 (2261)
|
||||
0x3770| 00 2e 73 79 6d| ..sym| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.gnu.hash\x00.dynsym\x00.d..." 0x377b-0x388b (272)
|
||||
0x3770| 00 2e 73 79 6d| ..sym| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.rela.dyn\x00.rela.plt\x00.init\x00.plt.got\x00.text\x00.fini\x00.rodata\x00.eh_frame_hdr\x00.eh_frame\x00.note.gnu.property\x00.ctors\x00.dtors\x00.dynamic\x00.data\x00.bss\x00.comment\x00.debug_aranges\x00.debug_info\x00.debug_abbrev\x00.debug_line\x00.debug_str\x00.debug_ranges\x00" 0x377b-0x388b (272)
|
||||
0x3780|74 61 62 00 2e 73 74 72 74 61 62 00 2e 73 68 73|tab..strtab..shs|
|
||||
* |until 0x388a.7 (272) | |
|
||||
0x4010|11 00 00 00 |.... | name: ".shstrtab" (17) 0x4010-0x4014 (4)
|
||||
|
@ -391,7 +391,7 @@ $ fq -d elf dv a_dynamic
|
||||
0x2430|08 00 00 00 00 00 00 00 |........ | addralign: 8 0x2430-0x2438 (8)
|
||||
0x2430| 18 00 00 00 00 00 00 00| ........| entsize: 24 0x2438-0x2440 (8)
|
||||
| | | [4]{}: section_header 0x380-0x2480 (8448)
|
||||
0x0380|00 70 75 74 73 00 5f 5f 63 78 61 5f 66 69 6e 61|.puts.__cxa_fina| string: "\x00puts\x00__cxa_finalize\x00__deregister_frame_info\x00_I..." 0x380-0x443 (195)
|
||||
0x0380|00 70 75 74 73 00 5f 5f 63 78 61 5f 66 69 6e 61|.puts.__cxa_fina| string: "\x00puts\x00__cxa_finalize\x00__deregister_frame_info\x00_ITM_registerTMCloneTable\x00_ITM_deregisterTMCloneTable\x00__register_frame_info\x00_init\x00_fini\x00libbbb_bbb\x00__libc_start_main\x00libbbb.so\x00libc.musl-aarch64.so.1\x00" 0x380-0x443 (195)
|
||||
* |until 0x442.7 (195) | |
|
||||
0x2440|35 00 00 00 |5... | name: ".dynstr" (53) 0x2440-0x2444 (4)
|
||||
0x2440| 03 00 00 00 | .... | type: "strtab" (0x3) (String table) 0x2444-0x2448 (4)
|
||||
@ -1998,7 +1998,7 @@ $ fq -d elf dv a_dynamic
|
||||
0x2ab0|08 00 00 00 00 00 00 00 |........ | addralign: 8 0x2ab0-0x2ab8 (8)
|
||||
0x2ab0| 18 00 00 00 00 00 00 00| ........| entsize: 24 0x2ab8-0x2ac0 (8)
|
||||
| | | [30]{}: section_header 0x2008-0x2b00 (2808)
|
||||
0x2000| 00 53 63 72 74 31 2e 63| .Scrt1.c| string: "\x00Scrt1.c\x00$x\x00crti.o\x00crtn.o\x00crtstuff.c\x00$d\x00__EH_FR..." 0x2008-0x221a (530)
|
||||
0x2000| 00 53 63 72 74 31 2e 63| .Scrt1.c| string: "\x00Scrt1.c\x00$x\x00crti.o\x00crtn.o\x00crtstuff.c\x00$d\x00__EH_FRAME_BEGIN__\x00deregister_tm_clones\x00__do_global_dtors_aux\x00completed.1\x00__do_global_dtors_aux_fini_array_entry\x00frame_dummy\x00object.0\x00__frame_dummy_init_array_entry\x00a.c\x00__FRAME_END__\x00_DYNAMIC\x00__GNU_EH_FRAME_HDR\x00_GLOBAL_OFFSET_TABLE_\x00__TMC_END__\x00puts\x00__cxa_finalize\x00__bss_start__\x00__dso_handle\x00aaa\x00_init\x00__deregister_frame_info\x00_ITM_registerTMCloneTable\x00__bss_end__\x00_start_c\x00_ITM_deregisterTMCloneTable\x00__bss_start\x00__end__\x00_fini\x00_edata\x00_end\x00libbbb_bbb\x00__libc_start_main\x00__register_frame_info\x00" 0x2008-0x221a (530)
|
||||
0x2010|00 24 78 00 63 72 74 69 2e 6f 00 63 72 74 6e 2e|.$x.crti.o.crtn.|
|
||||
* |until 0x2219.7 (530) | |
|
||||
0x2ac0|09 00 00 00 |.... | name: ".strtab" (9) 0x2ac0-0x2ac4 (4)
|
||||
@ -2027,7 +2027,7 @@ $ fq -d elf dv a_dynamic
|
||||
0x2af0|01 00 00 00 00 00 00 00 |........ | addralign: 1 0x2af0-0x2af8 (8)
|
||||
0x2af0| 00 00 00 00 00 00 00 00| ........| entsize: 0 0x2af8-0x2b00 (8)
|
||||
| | | [31]{}: section_header 0x221a-0x2b40 (2342)
|
||||
0x2210| 00 2e 73 79 6d 74| ..symt| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.interp\x00.gnu.hash\x00.d..." 0x221a-0x233d (291)
|
||||
0x2210| 00 2e 73 79 6d 74| ..symt| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.interp\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.rela.dyn\x00.rela.plt\x00.init\x00.text\x00.fini\x00.rodata\x00.eh_frame_hdr\x00.eh_frame\x00.init_array\x00.fini_array\x00.dynamic\x00.got\x00.data\x00.bss\x00.comment\x00.debug_aranges\x00.debug_info\x00.debug_abbrev\x00.debug_line\x00.debug_frame\x00.debug_str\x00.debug_loc\x00.debug_ranges\x00" 0x221a-0x233d (291)
|
||||
0x2220|61 62 00 2e 73 74 72 74 61 62 00 2e 73 68 73 74|ab..strtab..shst|
|
||||
* |until 0x233c.7 (291) | |
|
||||
0x2b00|11 00 00 00 |.... | name: ".shstrtab" (17) 0x2b00-0x2b04 (4)
|
||||
|
@ -2916,7 +2916,7 @@ $ fq -d elf dv a_static
|
||||
0x154d0|08 00 00 00 00 00 00 00 |........ | addralign: 8 0x154d0-0x154d8 (8)
|
||||
0x154d0| 18 00 00 00 00 00 00 00| ........| entsize: 24 0x154d8-0x154e0 (8)
|
||||
| | | [22]{}: section_header 0x14830-0x15520 (3312)
|
||||
0x14830|00 63 72 74 69 2e 6f 00 24 78 00 63 72 74 6e 2e|.crti.o.$x.crtn.| string: "\x00crti.o\x00$x\x00crtn.o\x00crt1.c\x00crtstuff.c\x00$d\x00__EH_FRA..." 0x14830-0x14e78 (1608)
|
||||
0x14830|00 63 72 74 69 2e 6f 00 24 78 00 63 72 74 6e 2e|.crti.o.$x.crtn.| string: "\x00crti.o\x00$x\x00crtn.o\x00crt1.c\x00crtstuff.c\x00$d\x00__EH_FRAME_BEGIN__\x00deregister_tm_clones\x00__do_global_dtors_aux\x00completed.1\x00__do_global_dtors_aux_fini_array_entry\x00frame_dummy\x00object.0\x00__frame_dummy_init_array_entry\x00a.c\x00libbbb.c\x00__libc_start_main.c\x00dummy1\x00libc_start_main_stage2\x00defsysinfo.c\x00libc.c\x00stdout.c\x00buf\x00memset.lo\x00__environ.c\x00__init_tls.c\x00static_init_tls\x00builtin_tls\x00main_tls\x00_Exit.c\x00__lockfile.c\x00__overflow.c\x00__stdio_close.c\x00__stdio_seek.c\x00__stdout_write.c\x00__towrite.c\x00fputs.c\x00fwrite.c\x00memcpy.lo\x00strlen.c\x00__set_thread_area.lo\x00default_attr.c\x00lseek.c\x00syscall_ret.c\x00__stdio_exit.c\x00close_file\x00dummy_file\x00__stdio_write.c\x00ofl.c\x00ofl_head\x00__lock.c\x00__errno_location.c\x00__FRAME_END__\x00__fini_array_end\x00__fini_array_start\x00__init_array_end\x00_GLOBAL_OFFSET_TABLE_\x00__init_array_start\x00__thread_list_lock\x00__stdout_used\x00stdout\x00__init_libc\x00__syscall_ret\x00__stdout_write\x00__ofl_unlock\x00__unlockfile\x00__hwcap\x00__stdio_write\x00__towrite\x00memcpy\x00__ofl_lock\x00__TMC_END__\x00__unlock\x00__overflow\x00__libc\x00__bss_start__\x00__dso_handle\x00__set_thread_area\x00__stdin_used\x00__copy_tls\x00__stdio_seek\x00__lockfile\x00___errno_location\x00aaa\x00_Exit\x00__towrite_needs_stdio_exit\x00__init_tls\x00__funcs_on_exit\x00__stdio_ofl_lockptr\x00fputs_unlocked\x00__bss_end__\x00___environ\x00__progname\x00_start_c\x00__stdout_FILE\x00program_invocation_short_name\x00__libc_start_init\x00__init_tp\x00__init_ssp\x00__fwritex\x00__bss_start\x00memset\x00__stdio_exit\x00__lock\x00__end__\x00__aio_close\x00__lseek\x00__libc_exit_fini\x00fwrite_unlocked\x00fwrite\x00_edata\x00__stdio_close\x00__stderr_used\x00__stdio_exit_needed\x00libbbb_bbb\x00__libc_start_main\x00strlen\x00lseek64\x00program_invocation_name\x00__default_stacksize\x00fputs\x00__default_guardsize\x00__sysinfo\x00__progname_full\x00" 0x14830-0x14e78 (1608)
|
||||
* |until 0x14e77.7 (1608) | |
|
||||
0x154e0|09 00 00 00 |.... | name: ".strtab" (9) 0x154e0-0x154e4 (4)
|
||||
0x154e0| 03 00 00 00 | .... | type: "strtab" (0x3) (String table) 0x154e4-0x154e8 (4)
|
||||
@ -2944,7 +2944,7 @@ $ fq -d elf dv a_static
|
||||
0x15510|01 00 00 00 00 00 00 00 |........ | addralign: 1 0x15510-0x15518 (8)
|
||||
0x15510| 00 00 00 00 00 00 00 00| ........| entsize: 0 0x15518-0x15520 (8)
|
||||
| | | [23]{}: section_header 0x14e78-0x15560 (1768)
|
||||
0x14e70| 00 2e 73 79 6d 74 61 62| ..symtab| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.init\x00.text\x00.fini\x00.r..." 0x14e78-0x14f5b (227)
|
||||
0x14e70| 00 2e 73 79 6d 74 61 62| ..symtab| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.init\x00.text\x00.fini\x00.rodata\x00.eh_frame\x00.init_array\x00.fini_array\x00.data.rel.ro\x00.got\x00.data\x00.bss\x00.comment\x00.debug_aranges\x00.debug_info\x00.debug_abbrev\x00.debug_line\x00.debug_frame\x00.debug_str\x00.debug_loc\x00.debug_ranges\x00" 0x14e78-0x14f5b (227)
|
||||
0x14e80|00 2e 73 74 72 74 61 62 00 2e 73 68 73 74 72 74|..strtab..shstrt|
|
||||
* |until 0x14f5a.7 (227) | |
|
||||
0x15520|11 00 00 00 |.... | name: ".shstrtab" (17) 0x15520-0x15524 (4)
|
||||
|
@ -391,7 +391,7 @@ $ fq -d elf dv a_stripped
|
||||
0x11d0| 08 00 00 00 00 00 00 00| ........| addralign: 8 0x11d8-0x11e0 (8)
|
||||
0x11e0|18 00 00 00 00 00 00 00 |........ | entsize: 24 0x11e0-0x11e8 (8)
|
||||
| | | [4]{}: section_header 0x380-0x1228 (3752)
|
||||
0x0380|00 70 75 74 73 00 5f 5f 63 78 61 5f 66 69 6e 61|.puts.__cxa_fina| string: "\x00puts\x00__cxa_finalize\x00__deregister_frame_info\x00_I..." 0x380-0x443 (195)
|
||||
0x0380|00 70 75 74 73 00 5f 5f 63 78 61 5f 66 69 6e 61|.puts.__cxa_fina| string: "\x00puts\x00__cxa_finalize\x00__deregister_frame_info\x00_ITM_registerTMCloneTable\x00_ITM_deregisterTMCloneTable\x00__register_frame_info\x00_init\x00_fini\x00libbbb_bbb\x00__libc_start_main\x00libbbb.so\x00libc.musl-aarch64.so.1\x00" 0x380-0x443 (195)
|
||||
* |until 0x442.7 (195) | |
|
||||
0x11e0| 25 00 00 00 | %... | name: ".dynstr" (37) 0x11e8-0x11ec (4)
|
||||
0x11e0| 03 00 00 00| ....| type: "strtab" (0x3) (String table) 0x11ec-0x11f0 (4)
|
||||
@ -942,7 +942,7 @@ $ fq -d elf dv a_stripped
|
||||
0x1610| 01 00 00 00 00 00 00 00| ........| addralign: 1 0x1618-0x1620 (8)
|
||||
0x1620|01 00 00 00 00 00 00 00 |........ | entsize: 1 0x1620-0x1628 (8)
|
||||
| | | [21]{}: section_header 0x1039-0x1668 (1583)
|
||||
0x1030| 00 2e 73 68 73 74 72| ..shstr| string: "\x00.shstrtab\x00.interp\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.r..." 0x1039-0x10e6 (173)
|
||||
0x1030| 00 2e 73 68 73 74 72| ..shstr| string: "\x00.shstrtab\x00.interp\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.rela.dyn\x00.rela.plt\x00.init\x00.text\x00.fini\x00.rodata\x00.eh_frame_hdr\x00.eh_frame\x00.init_array\x00.fini_array\x00.dynamic\x00.got\x00.data\x00.bss\x00.comment\x00" 0x1039-0x10e6 (173)
|
||||
0x1040|74 61 62 00 2e 69 6e 74 65 72 70 00 2e 67 6e 75|tab..interp..gnu|
|
||||
* |until 0x10e5.7 (173) | |
|
||||
0x1620| 01 00 00 00 | .... | name: ".shstrtab" (1) 0x1628-0x162c (4)
|
||||
|
@ -552,7 +552,7 @@ $ fq -d ar dv libbbb.a
|
||||
0x690| 00 00 00 00| ....| entsize: 0 0x69c-0x6a4 (8)
|
||||
0x6a0|00 00 00 00 |.... |
|
||||
| | | [12]{}: section_header 0x33c-0x6e4 (936)
|
||||
0x330| 00 2e 73 79| ..sy| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.rela.text\x00.data\x00.bs..." 0x33c-0x39d (97)
|
||||
0x330| 00 2e 73 79| ..sy| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.rela.text\x00.data\x00.bss\x00.rodata\x00.comment\x00.note.GNU-stack\x00.rela.eh_frame\x00" 0x33c-0x39d (97)
|
||||
0x340|6d 74 61 62 00 2e 73 74 72 74 61 62 00 2e 73 68|mtab..strtab..sh|
|
||||
* |until 0x39c.7 (97) | |
|
||||
0x6a0| 11 00 00 00 | .... | name: ".shstrtab" (17) 0x6a4-0x6a8 (4)
|
||||
|
@ -327,7 +327,7 @@ $ fq -d elf dv libbbb.so
|
||||
0x1cd0| 08 00 00 00 00 00 00 00| ........| addralign: 8 0x1cd8-0x1ce0 (8)
|
||||
0x1ce0|18 00 00 00 00 00 00 00 |........ | entsize: 24 0x1ce0-0x1ce8 (8)
|
||||
| | | [3]{}: section_header 0x2e0-0x1d28 (6728)
|
||||
0x02e0|00 5f 69 6e 69 74 00 5f 66 69 6e 69 00 5f 49 54|._init._fini._IT| string: "\x00_init\x00_fini\x00_ITM_deregisterTMCloneTable\x00_ITM_r..." 0x2e0-0x387 (167)
|
||||
0x02e0|00 5f 69 6e 69 74 00 5f 66 69 6e 69 00 5f 49 54|._init._fini._IT| string: "\x00_init\x00_fini\x00_ITM_deregisterTMCloneTable\x00_ITM_registerTMCloneTable\x00__cxa_finalize\x00__deregister_frame_info\x00__register_frame_info\x00libbbb_bbb\x00puts\x00libc.musl-aarch64.so.1\x00" 0x2e0-0x387 (167)
|
||||
* |until 0x386.7 (167) | |
|
||||
0x1ce0| 2d 00 00 00 | -... | name: ".dynstr" (45) 0x1ce8-0x1cec (4)
|
||||
0x1ce0| 03 00 00 00| ....| type: "strtab" (0x3) (String table) 0x1cec-0x1cf0 (4)
|
||||
@ -1715,7 +1715,7 @@ $ fq -d elf dv libbbb.so
|
||||
0x22d0| 08 00 00 00 00 00 00 00| ........| addralign: 8 0x22d8-0x22e0 (8)
|
||||
0x22e0|18 00 00 00 00 00 00 00 |........ | entsize: 24 0x22e0-0x22e8 (8)
|
||||
| | | [27]{}: section_header 0x1968-0x2328 (2496)
|
||||
0x1960| 00 63 72 74 69 2e 6f 00| .crti.o.| string: "\x00crti.o\x00$x\x00crtn.o\x00crtstuff.c\x00$d\x00__EH_FRAME_BEGI..." 0x1968-0x1b1e (438)
|
||||
0x1960| 00 63 72 74 69 2e 6f 00| .crti.o.| string: "\x00crti.o\x00$x\x00crtn.o\x00crtstuff.c\x00$d\x00__EH_FRAME_BEGIN__\x00deregister_tm_clones\x00__do_global_dtors_aux\x00completed.1\x00__do_global_dtors_aux_fini_array_entry\x00frame_dummy\x00object.0\x00__frame_dummy_init_array_entry\x00libbbb.c\x00__FRAME_END__\x00_DYNAMIC\x00__TMC_END__\x00__dso_handle\x00__GNU_EH_FRAME_HDR\x00_GLOBAL_OFFSET_TABLE_\x00puts\x00__cxa_finalize\x00_init\x00__deregister_frame_info\x00_ITM_registerTMCloneTable\x00_ITM_deregisterTMCloneTable\x00_fini\x00libbbb_bbb\x00__register_frame_info\x00" 0x1968-0x1b1e (438)
|
||||
0x1970|24 78 00 63 72 74 6e 2e 6f 00 63 72 74 73 74 75|$x.crtn.o.crtstu|
|
||||
* |until 0x1b1d.7 (438) | |
|
||||
0x22e0| 09 00 00 00 | .... | name: ".strtab" (9) 0x22e8-0x22ec (4)
|
||||
@ -1744,7 +1744,7 @@ $ fq -d elf dv libbbb.so
|
||||
0x2310| 01 00 00 00 00 00 00 00| ........| addralign: 1 0x2318-0x2320 (8)
|
||||
0x2320|00 00 00 00 00 00 00 00 |........ | entsize: 0 0x2320-0x2328 (8)
|
||||
| | | [28]{}: section_header 0x1b1e-0x2368 (2122)
|
||||
0x1b10| 00 2e| ..| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.gnu.hash\x00.dynsym\x00.d..." 0x1b1e-0x1c21 (259)
|
||||
0x1b10| 00 2e| ..| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.rela.dyn\x00.rela.plt\x00.init\x00.text\x00.fini\x00.rodata\x00.eh_frame_hdr\x00.eh_frame\x00.init_array\x00.fini_array\x00.dynamic\x00.got\x00.data\x00.bss\x00.comment\x00.debug_aranges\x00.debug_info\x00.debug_abbrev\x00.debug_line\x00.debug_str\x00.debug_ranges\x00" 0x1b1e-0x1c21 (259)
|
||||
0x1b20|73 79 6d 74 61 62 00 2e 73 74 72 74 61 62 00 2e|symtab..strtab..|
|
||||
* |until 0x1c20.7 (259) | |
|
||||
0x2320| 11 00 00 00 | .... | name: ".shstrtab" (17) 0x2328-0x232c (4)
|
||||
|
@ -374,7 +374,7 @@ $ fq -d elf dv a_dynamic
|
||||
0x20f0| 04 00 00 00 | .... | addralign: 4 0x20f4-0x20f8 (4)
|
||||
0x20f0| 10 00 00 00 | .... | entsize: 16 0x20f8-0x20fc (4)
|
||||
| | | [4]{}: section_header 0x220-0x2124 (7940)
|
||||
0x0220|00 70 75 74 73 00 5f 5f 63 78 61 5f 66 69 6e 61|.puts.__cxa_fina| string: "\x00puts\x00__cxa_finalize\x00__deregister_frame_info\x00_I..." 0x220-0x2e1 (193)
|
||||
0x0220|00 70 75 74 73 00 5f 5f 63 78 61 5f 66 69 6e 61|.puts.__cxa_fina| string: "\x00puts\x00__cxa_finalize\x00__deregister_frame_info\x00_ITM_registerTMCloneTable\x00_ITM_deregisterTMCloneTable\x00__register_frame_info\x00_init\x00_fini\x00libbbb_bbb\x00__libc_start_main\x00libbbb.so\x00libc.musl-armhf.so.1\x00" 0x220-0x2e1 (193)
|
||||
* |until 0x2e0.7 (193) | |
|
||||
0x20f0| 35 00 00 00| 5...| name: ".dynstr" (53) 0x20fc-0x2100 (4)
|
||||
0x2100|03 00 00 00 |.... | type: "strtab" (0x3) (String table) 0x2100-0x2104 (4)
|
||||
@ -2092,7 +2092,7 @@ $ fq -d elf dv a_dynamic
|
||||
0x2500| 04 00 00 00 | .... | addralign: 4 0x2504-0x2508 (4)
|
||||
0x2500| 10 00 00 00 | .... | entsize: 16 0x2508-0x250c (4)
|
||||
| | | [30]{}: section_header 0x1d38-0x2534 (2044)
|
||||
0x1d30| 00 53 63 72 74 31 2e 63| .Scrt1.c| string: "\x00Scrt1.c\x00$a\x00$d\x00crti.o\x00crtn.o\x00crtstuff.c\x00all_imp..." 0x1d38-0x1f36 (510)
|
||||
0x1d30| 00 53 63 72 74 31 2e 63| .Scrt1.c| string: "\x00Scrt1.c\x00$a\x00$d\x00crti.o\x00crtn.o\x00crtstuff.c\x00all_implied_fbits\x00deregister_tm_clones\x00__do_global_dtors_aux\x00completed.1\x00__do_global_dtors_aux_fini_array_entry\x00frame_dummy\x00object.0\x00__frame_dummy_init_array_entry\x00a.c\x00__FRAME_END__\x00_DYNAMIC\x00_GLOBAL_OFFSET_TABLE_\x00__TMC_END__\x00puts\x00__cxa_finalize\x00__bss_start__\x00__dso_handle\x00aaa\x00_init\x00__deregister_frame_info\x00_ITM_registerTMCloneTable\x00__bss_end__\x00_start_c\x00_ITM_deregisterTMCloneTable\x00__bss_start\x00__end__\x00_fini\x00_edata\x00_end\x00libbbb_bbb\x00__libc_start_main\x00__register_frame_info\x00" 0x1d38-0x1f36 (510)
|
||||
0x1d40|00 24 61 00 24 64 00 63 72 74 69 2e 6f 00 63 72|.$a.$d.crti.o.cr|
|
||||
* |until 0x1f35.7 (510) | |
|
||||
0x2500| 09 00 00 00| ....| name: ".strtab" (9) 0x250c-0x2510 (4)
|
||||
@ -2120,7 +2120,7 @@ $ fq -d elf dv a_dynamic
|
||||
0x2520| 01 00 00 00| ....| addralign: 1 0x252c-0x2530 (4)
|
||||
0x2530|00 00 00 00 |.... | entsize: 0 0x2530-0x2534 (4)
|
||||
| | | [31]{}: section_header 0x1f36-0x255c (1574)
|
||||
0x1f30| 00 2e 73 79 6d 74 61 62 00 2e| ..symtab..| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.interp\x00.gnu.hash\x00.d..." 0x1f36-0x2059 (291)
|
||||
0x1f30| 00 2e 73 79 6d 74 61 62 00 2e| ..symtab..| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.interp\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.rel.dyn\x00.rel.plt\x00.init\x00.text\x00.fini\x00.rodata\x00.eh_frame\x00.init_array\x00.fini_array\x00.dynamic\x00.got\x00.data\x00.bss\x00.comment\x00.ARM.attributes\x00.debug_aranges\x00.debug_info\x00.debug_abbrev\x00.debug_line\x00.debug_frame\x00.debug_str\x00.debug_loc\x00.debug_ranges\x00" 0x1f36-0x2059 (291)
|
||||
0x1f40|73 74 72 74 61 62 00 2e 73 68 73 74 72 74 61 62|strtab..shstrtab|
|
||||
* |until 0x2058.7 (291) | |
|
||||
0x2530| 11 00 00 00 | .... | name: ".shstrtab" (17) 0x2534-0x2538 (4)
|
||||
|
@ -3788,7 +3788,7 @@ $ fq -d elf dv a_static
|
||||
0x14d50|04 00 00 00 |.... | addralign: 4 0x14d50-0x14d54 (4)
|
||||
0x14d50| 10 00 00 00 | .... | entsize: 16 0x14d54-0x14d58 (4)
|
||||
| | | [23]{}: section_header 0x14060-0x14d80 (3360)
|
||||
0x14060|00 63 72 74 69 2e 6f 00 24 61 00 63 72 74 6e 2e|.crti.o.$a.crtn.| string: "\x00crti.o\x00$a\x00crtn.o\x00$d\x00crt1.c\x00crtstuff.c\x00all_impl..." 0x14060-0x148cd (2157)
|
||||
0x14060|00 63 72 74 69 2e 6f 00 24 61 00 63 72 74 6e 2e|.crti.o.$a.crtn.| string: "\x00crti.o\x00$a\x00crtn.o\x00$d\x00crt1.c\x00crtstuff.c\x00all_implied_fbits\x00deregister_tm_clones\x00__do_global_dtors_aux\x00completed.1\x00__do_global_dtors_aux_fini_array_entry\x00frame_dummy\x00object.0\x00__frame_dummy_init_array_entry\x00libbbb.c\x00__libc_start_main.c\x00dummy1\x00libc_start_main_stage2\x00defsysinfo.c\x00libc.c\x00stdout.c\x00buf\x00memset.c\x00__environ.c\x00__init_tls.c\x00static_init_tls\x00builtin_tls\x00main_tls\x00_Exit.c\x00__lockfile.c\x00a_barrier\x00__overflow.c\x00__stdio_close.c\x00__stdio_seek.c\x00__stdout_write.c\x00__towrite.c\x00fputs.c\x00fwrite.c\x00memcpy.lo\x00copy_last_3_and_return\x00src_aligned\x00non_congruent\x00congruent_aligned32\x00cached_aligned32\x00less_than_32_left\x00partial_word_tail\x00less_than_thirtytwo\x00loop24\x00loop8\x00loop16\x00strlen.c\x00__set_thread_area.c\x00atomics.lo\x00default_attr.c\x00lseek.c\x00syscall_ret.c\x00__stdio_exit.c\x00close_file\x00dummy_file\x00__stdio_write.c\x00ofl.c\x00ofl_head\x00__lock.c\x00__errno_location.c\x00_udivsi3.o\x00.udivsi3_skip_div0_test\x00shift\x00_dvmd_lnx.o\x00raise.c\x00block.c\x00all_mask\x00app_mask\x00__FRAME_END__\x00__fini_array_end\x00__fini_array_start\x00__init_array_end\x00_GLOBAL_OFFSET_TABLE_\x00__init_array_start\x00__a_barrier_v7\x00__thread_list_lock\x00__a_gettp_ptr\x00__stdout_used\x00stdout\x00__a_barrier_ptr\x00__init_libc\x00__syscall_ret\x00__stdout_write\x00__ofl_unlock\x00__unlockfile\x00__hwcap\x00__restore_sigs\x00__stdio_write\x00__towrite\x00memcpy\x00__ofl_lock\x00__TMC_END__\x00__unlock\x00__overflow\x00__libc\x00__udivsi3\x00__bss_start__\x00__dso_handle\x00__set_thread_area\x00__stdin_used\x00__copy_tls\x00__stdio_seek\x00__lockfile\x00___errno_location\x00aaa\x00_Exit\x00__towrite_needs_stdio_exit\x00__a_gettp_cp15\x00__a_cas_v7\x00__init_tls\x00__funcs_on_exit\x00__a_cas_dummy\x00__stdio_ofl_lockptr\x00fputs_unlocked\x00__a_barrier_oldkuser\x00__bss_end__\x00___environ\x00__progname\x00_start_c\x00__block_all_sigs\x00__stdout_FILE\x00program_invocation_short_name\x00__libc_start_init\x00__init_tp\x00__init_ssp\x00__aeabi_ldiv0\x00__fwritex\x00__bss_start\x00memset\x00__a_barrier_v6\x00__stdio_exit\x00__aeabi_uidiv\x00__lock\x00__end__\x00__a_cas_v6\x00__aio_close\x00__lseek\x00__a_cas_ptr\x00__libc_exit_fini\x00fwrite_unlocked\x00__aeabi_uidivmod\x00fwrite\x00_edata\x00__stdio_close\x00__stderr_used\x00__stdio_exit_needed\x00__a_barrier_dummy\x00__aeabi_idiv0\x00libbbb_bbb\x00__libc_start_main\x00strlen\x00lseek64\x00program_invocation_name\x00__default_stacksize\x00fputs\x00__default_guardsize\x00__block_app_sigs\x00__sysinfo\x00__progname_full\x00raise\x00" 0x14060-0x148cd (2157)
|
||||
* |until 0x148cc.7 (2157) | |
|
||||
0x14d50| 09 00 00 00 | .... | name: ".strtab" (9) 0x14d58-0x14d5c (4)
|
||||
0x14d50| 03 00 00 00| ....| type: "strtab" (0x3) (String table) 0x14d5c-0x14d60 (4)
|
||||
@ -3815,7 +3815,7 @@ $ fq -d elf dv a_static
|
||||
0x14d70| 01 00 00 00 | .... | addralign: 1 0x14d78-0x14d7c (4)
|
||||
0x14d70| 00 00 00 00| ....| entsize: 0 0x14d7c-0x14d80 (4)
|
||||
| | | [24]{}: section_header 0x148cd-0x14da8 (1243)
|
||||
0x148c0| 00 2e 73| ..s| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.init\x00.text\x00.fini\x00.r..." 0x148cd-0x149c0 (243)
|
||||
0x148c0| 00 2e 73| ..s| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.init\x00.text\x00.fini\x00.rodata\x00.eh_frame\x00.init_array\x00.fini_array\x00.data.rel.ro\x00.got\x00.data\x00.bss\x00.comment\x00.ARM.attributes\x00.debug_aranges\x00.debug_info\x00.debug_abbrev\x00.debug_line\x00.debug_frame\x00.debug_str\x00.debug_loc\x00.debug_ranges\x00" 0x148cd-0x149c0 (243)
|
||||
0x148d0|79 6d 74 61 62 00 2e 73 74 72 74 61 62 00 2e 73|ymtab..strtab..s|
|
||||
* |until 0x149bf.7 (243) | |
|
||||
0x14d80|11 00 00 00 |.... | name: ".shstrtab" (17) 0x14d80-0x14d84 (4)
|
||||
|
@ -374,7 +374,7 @@ $ fq -d elf dv a_stripped
|
||||
0x11b0|04 00 00 00 |.... | addralign: 4 0x11b0-0x11b4 (4)
|
||||
0x11b0| 10 00 00 00 | .... | entsize: 16 0x11b4-0x11b8 (4)
|
||||
| | | [4]{}: section_header 0x220-0x11e0 (4032)
|
||||
0x0220|00 70 75 74 73 00 5f 5f 63 78 61 5f 66 69 6e 61|.puts.__cxa_fina| string: "\x00puts\x00__cxa_finalize\x00__deregister_frame_info\x00_I..." 0x220-0x2e1 (193)
|
||||
0x0220|00 70 75 74 73 00 5f 5f 63 78 61 5f 66 69 6e 61|.puts.__cxa_fina| string: "\x00puts\x00__cxa_finalize\x00__deregister_frame_info\x00_ITM_registerTMCloneTable\x00_ITM_deregisterTMCloneTable\x00__register_frame_info\x00_init\x00_fini\x00libbbb_bbb\x00__libc_start_main\x00libbbb.so\x00libc.musl-armhf.so.1\x00" 0x220-0x2e1 (193)
|
||||
* |until 0x2e0.7 (193) | |
|
||||
0x11b0| 25 00 00 00 | %... | name: ".dynstr" (37) 0x11b8-0x11bc (4)
|
||||
0x11b0| 03 00 00 00| ....| type: "strtab" (0x3) (String table) 0x11bc-0x11c0 (4)
|
||||
@ -915,7 +915,7 @@ $ fq -d elf dv a_stripped
|
||||
0x1450| 01 00 00 00 | .... | addralign: 1 0x1458-0x145c (4)
|
||||
0x1450| 00 00 00 00| ....| entsize: 0 0x145c-0x1460 (4)
|
||||
| | | [21]{}: section_header 0x1068-0x1488 (1056)
|
||||
0x1060| 00 2e 73 68 73 74 72 74| ..shstrt| string: "\x00.shstrtab\x00.interp\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.r..." 0x1068-0x1115 (173)
|
||||
0x1060| 00 2e 73 68 73 74 72 74| ..shstrt| string: "\x00.shstrtab\x00.interp\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.rel.dyn\x00.rel.plt\x00.init\x00.text\x00.fini\x00.rodata\x00.eh_frame\x00.init_array\x00.fini_array\x00.dynamic\x00.got\x00.data\x00.bss\x00.comment\x00.ARM.attributes\x00" 0x1068-0x1115 (173)
|
||||
0x1070|61 62 00 2e 69 6e 74 65 72 70 00 2e 67 6e 75 2e|ab..interp..gnu.|
|
||||
* |until 0x1114.7 (173) | |
|
||||
0x1460|01 00 00 00 |.... | name: ".shstrtab" (1) 0x1460-0x1464 (4)
|
||||
|
@ -473,7 +473,7 @@ $ fq -d ar dv libbbb.a
|
||||
0x480|01 00 00 00 |.... | addralign: 1 0x480-0x484 (4)
|
||||
0x480| 00 00 00 00 | .... | entsize: 0 0x484-0x488 (4)
|
||||
| | | [11]{}: section_header 0x26c-0x4b0 (580)
|
||||
0x260| 00 2e 73 79| ..sy| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.rel.text\x00.data\x00.bss..." 0x26c-0x2cd (97)
|
||||
0x260| 00 2e 73 79| ..sy| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.rel.text\x00.data\x00.bss\x00.rodata\x00.comment\x00.note.GNU-stack\x00.ARM.attributes\x00" 0x26c-0x2cd (97)
|
||||
0x270|6d 74 61 62 00 2e 73 74 72 74 61 62 00 2e 73 68|mtab..strtab..sh|
|
||||
* |until 0x2cc.7 (97) | |
|
||||
0x480| 11 00 00 00 | .... | name: ".shstrtab" (17) 0x488-0x48c (4)
|
||||
|
@ -305,7 +305,7 @@ $ fq -d elf dv libbbb.so
|
||||
0x1a80| 04 00 00 00 | .... | addralign: 4 0x1a88-0x1a8c (4)
|
||||
0x1a80| 10 00 00 00| ....| entsize: 16 0x1a8c-0x1a90 (4)
|
||||
| | | [3]{}: section_header 0x1c0-0x1ab8 (6392)
|
||||
0x01c0|00 5f 69 6e 69 74 00 5f 66 69 6e 69 00 5f 49 54|._init._fini._IT| string: "\x00_init\x00_fini\x00_ITM_deregisterTMCloneTable\x00_ITM_r..." 0x1c0-0x265 (165)
|
||||
0x01c0|00 5f 69 6e 69 74 00 5f 66 69 6e 69 00 5f 49 54|._init._fini._IT| string: "\x00_init\x00_fini\x00_ITM_deregisterTMCloneTable\x00_ITM_registerTMCloneTable\x00__cxa_finalize\x00__deregister_frame_info\x00__register_frame_info\x00libbbb_bbb\x00puts\x00libc.musl-armhf.so.1\x00" 0x1c0-0x265 (165)
|
||||
* |until 0x264.7 (165) | |
|
||||
0x1a90|2d 00 00 00 |-... | name: ".dynstr" (45) 0x1a90-0x1a94 (4)
|
||||
0x1a90| 03 00 00 00 | .... | type: "strtab" (0x3) (String table) 0x1a94-0x1a98 (4)
|
||||
@ -1769,7 +1769,7 @@ $ fq -d elf dv libbbb.so
|
||||
0x1e40| 04 00 00 00 | .... | addralign: 4 0x1e48-0x1e4c (4)
|
||||
0x1e40| 10 00 00 00| ....| entsize: 16 0x1e4c-0x1e50 (4)
|
||||
| | | [27]{}: section_header 0x1770-0x1e78 (1800)
|
||||
0x1770|00 63 72 74 69 2e 6f 00 24 61 00 63 72 74 6e 2e|.crti.o.$a.crtn.| string: "\x00crti.o\x00$a\x00crtn.o\x00crtstuff.c\x00$d\x00all_implied_fbi..." 0x1770-0x1912 (418)
|
||||
0x1770|00 63 72 74 69 2e 6f 00 24 61 00 63 72 74 6e 2e|.crti.o.$a.crtn.| string: "\x00crti.o\x00$a\x00crtn.o\x00crtstuff.c\x00$d\x00all_implied_fbits\x00deregister_tm_clones\x00__do_global_dtors_aux\x00completed.1\x00__do_global_dtors_aux_fini_array_entry\x00frame_dummy\x00object.0\x00__frame_dummy_init_array_entry\x00libbbb.c\x00__FRAME_END__\x00_DYNAMIC\x00__TMC_END__\x00__dso_handle\x00_GLOBAL_OFFSET_TABLE_\x00puts\x00__cxa_finalize\x00_init\x00__deregister_frame_info\x00_ITM_registerTMCloneTable\x00_ITM_deregisterTMCloneTable\x00_fini\x00libbbb_bbb\x00__register_frame_info\x00" 0x1770-0x1912 (418)
|
||||
* |until 0x1911.7 (418) | |
|
||||
0x1e50|09 00 00 00 |.... | name: ".strtab" (9) 0x1e50-0x1e54 (4)
|
||||
0x1e50| 03 00 00 00 | .... | type: "strtab" (0x3) (String table) 0x1e54-0x1e58 (4)
|
||||
@ -1796,7 +1796,7 @@ $ fq -d elf dv libbbb.so
|
||||
0x1e70|01 00 00 00 |.... | addralign: 1 0x1e70-0x1e74 (4)
|
||||
0x1e70| 00 00 00 00 | .... | entsize: 0 0x1e74-0x1e78 (4)
|
||||
| | | [28]{}: section_header 0x1912-0x1ea0 (1422)
|
||||
0x1910| 00 2e 73 79 6d 74 61 62 00 2e 73 74 72 74| ..symtab..strt| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.gnu.hash\x00.dynsym\x00.d..." 0x1912-0x1a15 (259)
|
||||
0x1910| 00 2e 73 79 6d 74 61 62 00 2e 73 74 72 74| ..symtab..strt| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.rel.dyn\x00.rel.plt\x00.init\x00.text\x00.fini\x00.rodata\x00.eh_frame\x00.init_array\x00.fini_array\x00.dynamic\x00.got\x00.data\x00.bss\x00.comment\x00.ARM.attributes\x00.debug_aranges\x00.debug_info\x00.debug_abbrev\x00.debug_line\x00.debug_str\x00.debug_ranges\x00" 0x1912-0x1a15 (259)
|
||||
0x1920|61 62 00 2e 73 68 73 74 72 74 61 62 00 2e 67 6e|ab..shstrtab..gn|
|
||||
* |until 0x1a14.7 (259) | |
|
||||
0x1e70| 11 00 00 00 | .... | name: ".shstrtab" (17) 0x1e78-0x1e7c (4)
|
||||
|
@ -374,7 +374,7 @@ $ fq -d elf dv a_dynamic
|
||||
0x20f0| 04 00 00 00 | .... | addralign: 4 0x20f4-0x20f8 (4)
|
||||
0x20f0| 10 00 00 00 | .... | entsize: 16 0x20f8-0x20fc (4)
|
||||
| | | [4]{}: section_header 0x220-0x2124 (7940)
|
||||
0x0220|00 70 75 74 73 00 5f 5f 63 78 61 5f 66 69 6e 61|.puts.__cxa_fina| string: "\x00puts\x00__cxa_finalize\x00__deregister_frame_info\x00_I..." 0x220-0x2e1 (193)
|
||||
0x0220|00 70 75 74 73 00 5f 5f 63 78 61 5f 66 69 6e 61|.puts.__cxa_fina| string: "\x00puts\x00__cxa_finalize\x00__deregister_frame_info\x00_ITM_registerTMCloneTable\x00_ITM_deregisterTMCloneTable\x00__register_frame_info\x00_init\x00_fini\x00libbbb_bbb\x00__libc_start_main\x00libbbb.so\x00libc.musl-armhf.so.1\x00" 0x220-0x2e1 (193)
|
||||
* |until 0x2e0.7 (193) | |
|
||||
0x20f0| 35 00 00 00| 5...| name: ".dynstr" (53) 0x20fc-0x2100 (4)
|
||||
0x2100|03 00 00 00 |.... | type: "strtab" (0x3) (String table) 0x2100-0x2104 (4)
|
||||
@ -2092,7 +2092,7 @@ $ fq -d elf dv a_dynamic
|
||||
0x2500| 04 00 00 00 | .... | addralign: 4 0x2504-0x2508 (4)
|
||||
0x2500| 10 00 00 00 | .... | entsize: 16 0x2508-0x250c (4)
|
||||
| | | [30]{}: section_header 0x1d38-0x2534 (2044)
|
||||
0x1d30| 00 53 63 72 74 31 2e 63| .Scrt1.c| string: "\x00Scrt1.c\x00$a\x00$d\x00crti.o\x00crtn.o\x00crtstuff.c\x00all_imp..." 0x1d38-0x1f36 (510)
|
||||
0x1d30| 00 53 63 72 74 31 2e 63| .Scrt1.c| string: "\x00Scrt1.c\x00$a\x00$d\x00crti.o\x00crtn.o\x00crtstuff.c\x00all_implied_fbits\x00deregister_tm_clones\x00__do_global_dtors_aux\x00completed.1\x00__do_global_dtors_aux_fini_array_entry\x00frame_dummy\x00object.0\x00__frame_dummy_init_array_entry\x00a.c\x00__FRAME_END__\x00_DYNAMIC\x00_GLOBAL_OFFSET_TABLE_\x00__TMC_END__\x00puts\x00__cxa_finalize\x00__bss_start__\x00__dso_handle\x00aaa\x00_init\x00__deregister_frame_info\x00_ITM_registerTMCloneTable\x00__bss_end__\x00_start_c\x00_ITM_deregisterTMCloneTable\x00__bss_start\x00__end__\x00_fini\x00_edata\x00_end\x00libbbb_bbb\x00__libc_start_main\x00__register_frame_info\x00" 0x1d38-0x1f36 (510)
|
||||
0x1d40|00 24 61 00 24 64 00 63 72 74 69 2e 6f 00 63 72|.$a.$d.crti.o.cr|
|
||||
* |until 0x1f35.7 (510) | |
|
||||
0x2500| 09 00 00 00| ....| name: ".strtab" (9) 0x250c-0x2510 (4)
|
||||
@ -2120,7 +2120,7 @@ $ fq -d elf dv a_dynamic
|
||||
0x2520| 01 00 00 00| ....| addralign: 1 0x252c-0x2530 (4)
|
||||
0x2530|00 00 00 00 |.... | entsize: 0 0x2530-0x2534 (4)
|
||||
| | | [31]{}: section_header 0x1f36-0x255c (1574)
|
||||
0x1f30| 00 2e 73 79 6d 74 61 62 00 2e| ..symtab..| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.interp\x00.gnu.hash\x00.d..." 0x1f36-0x2059 (291)
|
||||
0x1f30| 00 2e 73 79 6d 74 61 62 00 2e| ..symtab..| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.interp\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.rel.dyn\x00.rel.plt\x00.init\x00.text\x00.fini\x00.rodata\x00.eh_frame\x00.init_array\x00.fini_array\x00.dynamic\x00.got\x00.data\x00.bss\x00.comment\x00.ARM.attributes\x00.debug_aranges\x00.debug_info\x00.debug_abbrev\x00.debug_line\x00.debug_frame\x00.debug_str\x00.debug_loc\x00.debug_ranges\x00" 0x1f36-0x2059 (291)
|
||||
0x1f40|73 74 72 74 61 62 00 2e 73 68 73 74 72 74 61 62|strtab..shstrtab|
|
||||
* |until 0x2058.7 (291) | |
|
||||
0x2530| 11 00 00 00 | .... | name: ".shstrtab" (17) 0x2534-0x2538 (4)
|
||||
|
@ -3788,7 +3788,7 @@ $ fq -d elf dv a_static
|
||||
0x14d50|04 00 00 00 |.... | addralign: 4 0x14d50-0x14d54 (4)
|
||||
0x14d50| 10 00 00 00 | .... | entsize: 16 0x14d54-0x14d58 (4)
|
||||
| | | [23]{}: section_header 0x14060-0x14d80 (3360)
|
||||
0x14060|00 63 72 74 69 2e 6f 00 24 61 00 63 72 74 6e 2e|.crti.o.$a.crtn.| string: "\x00crti.o\x00$a\x00crtn.o\x00$d\x00crt1.c\x00crtstuff.c\x00all_impl..." 0x14060-0x148cd (2157)
|
||||
0x14060|00 63 72 74 69 2e 6f 00 24 61 00 63 72 74 6e 2e|.crti.o.$a.crtn.| string: "\x00crti.o\x00$a\x00crtn.o\x00$d\x00crt1.c\x00crtstuff.c\x00all_implied_fbits\x00deregister_tm_clones\x00__do_global_dtors_aux\x00completed.1\x00__do_global_dtors_aux_fini_array_entry\x00frame_dummy\x00object.0\x00__frame_dummy_init_array_entry\x00libbbb.c\x00__libc_start_main.c\x00dummy1\x00libc_start_main_stage2\x00defsysinfo.c\x00libc.c\x00stdout.c\x00buf\x00memset.c\x00__environ.c\x00__init_tls.c\x00static_init_tls\x00builtin_tls\x00main_tls\x00_Exit.c\x00__lockfile.c\x00a_barrier\x00__overflow.c\x00__stdio_close.c\x00__stdio_seek.c\x00__stdout_write.c\x00__towrite.c\x00fputs.c\x00fwrite.c\x00memcpy.lo\x00copy_last_3_and_return\x00src_aligned\x00non_congruent\x00congruent_aligned32\x00cached_aligned32\x00less_than_32_left\x00partial_word_tail\x00less_than_thirtytwo\x00loop24\x00loop8\x00loop16\x00strlen.c\x00__set_thread_area.c\x00atomics.lo\x00default_attr.c\x00lseek.c\x00syscall_ret.c\x00__stdio_exit.c\x00close_file\x00dummy_file\x00__stdio_write.c\x00ofl.c\x00ofl_head\x00__lock.c\x00__errno_location.c\x00_udivsi3.o\x00.udivsi3_skip_div0_test\x00shift\x00_dvmd_lnx.o\x00raise.c\x00block.c\x00all_mask\x00app_mask\x00__FRAME_END__\x00__fini_array_end\x00__fini_array_start\x00__init_array_end\x00_GLOBAL_OFFSET_TABLE_\x00__init_array_start\x00__a_barrier_v7\x00__thread_list_lock\x00__a_gettp_ptr\x00__stdout_used\x00stdout\x00__a_barrier_ptr\x00__init_libc\x00__syscall_ret\x00__stdout_write\x00__ofl_unlock\x00__unlockfile\x00__hwcap\x00__restore_sigs\x00__stdio_write\x00__towrite\x00memcpy\x00__ofl_lock\x00__TMC_END__\x00__unlock\x00__overflow\x00__libc\x00__udivsi3\x00__bss_start__\x00__dso_handle\x00__set_thread_area\x00__stdin_used\x00__copy_tls\x00__stdio_seek\x00__lockfile\x00___errno_location\x00aaa\x00_Exit\x00__towrite_needs_stdio_exit\x00__a_gettp_cp15\x00__a_cas_v7\x00__init_tls\x00__funcs_on_exit\x00__a_cas_dummy\x00__stdio_ofl_lockptr\x00fputs_unlocked\x00__a_barrier_oldkuser\x00__bss_end__\x00___environ\x00__progname\x00_start_c\x00__block_all_sigs\x00__stdout_FILE\x00program_invocation_short_name\x00__libc_start_init\x00__init_tp\x00__init_ssp\x00__aeabi_ldiv0\x00__fwritex\x00__bss_start\x00memset\x00__a_barrier_v6\x00__stdio_exit\x00__aeabi_uidiv\x00__lock\x00__end__\x00__a_cas_v6\x00__aio_close\x00__lseek\x00__a_cas_ptr\x00__libc_exit_fini\x00fwrite_unlocked\x00__aeabi_uidivmod\x00fwrite\x00_edata\x00__stdio_close\x00__stderr_used\x00__stdio_exit_needed\x00__a_barrier_dummy\x00__aeabi_idiv0\x00libbbb_bbb\x00__libc_start_main\x00strlen\x00lseek64\x00program_invocation_name\x00__default_stacksize\x00fputs\x00__default_guardsize\x00__block_app_sigs\x00__sysinfo\x00__progname_full\x00raise\x00" 0x14060-0x148cd (2157)
|
||||
* |until 0x148cc.7 (2157) | |
|
||||
0x14d50| 09 00 00 00 | .... | name: ".strtab" (9) 0x14d58-0x14d5c (4)
|
||||
0x14d50| 03 00 00 00| ....| type: "strtab" (0x3) (String table) 0x14d5c-0x14d60 (4)
|
||||
@ -3815,7 +3815,7 @@ $ fq -d elf dv a_static
|
||||
0x14d70| 01 00 00 00 | .... | addralign: 1 0x14d78-0x14d7c (4)
|
||||
0x14d70| 00 00 00 00| ....| entsize: 0 0x14d7c-0x14d80 (4)
|
||||
| | | [24]{}: section_header 0x148cd-0x14da8 (1243)
|
||||
0x148c0| 00 2e 73| ..s| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.init\x00.text\x00.fini\x00.r..." 0x148cd-0x149c0 (243)
|
||||
0x148c0| 00 2e 73| ..s| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.init\x00.text\x00.fini\x00.rodata\x00.eh_frame\x00.init_array\x00.fini_array\x00.data.rel.ro\x00.got\x00.data\x00.bss\x00.comment\x00.ARM.attributes\x00.debug_aranges\x00.debug_info\x00.debug_abbrev\x00.debug_line\x00.debug_frame\x00.debug_str\x00.debug_loc\x00.debug_ranges\x00" 0x148cd-0x149c0 (243)
|
||||
0x148d0|79 6d 74 61 62 00 2e 73 74 72 74 61 62 00 2e 73|ymtab..strtab..s|
|
||||
* |until 0x149bf.7 (243) | |
|
||||
0x14d80|11 00 00 00 |.... | name: ".shstrtab" (17) 0x14d80-0x14d84 (4)
|
||||
|
@ -374,7 +374,7 @@ $ fq -d elf dv a_stripped
|
||||
0x11b0|04 00 00 00 |.... | addralign: 4 0x11b0-0x11b4 (4)
|
||||
0x11b0| 10 00 00 00 | .... | entsize: 16 0x11b4-0x11b8 (4)
|
||||
| | | [4]{}: section_header 0x220-0x11e0 (4032)
|
||||
0x0220|00 70 75 74 73 00 5f 5f 63 78 61 5f 66 69 6e 61|.puts.__cxa_fina| string: "\x00puts\x00__cxa_finalize\x00__deregister_frame_info\x00_I..." 0x220-0x2e1 (193)
|
||||
0x0220|00 70 75 74 73 00 5f 5f 63 78 61 5f 66 69 6e 61|.puts.__cxa_fina| string: "\x00puts\x00__cxa_finalize\x00__deregister_frame_info\x00_ITM_registerTMCloneTable\x00_ITM_deregisterTMCloneTable\x00__register_frame_info\x00_init\x00_fini\x00libbbb_bbb\x00__libc_start_main\x00libbbb.so\x00libc.musl-armhf.so.1\x00" 0x220-0x2e1 (193)
|
||||
* |until 0x2e0.7 (193) | |
|
||||
0x11b0| 25 00 00 00 | %... | name: ".dynstr" (37) 0x11b8-0x11bc (4)
|
||||
0x11b0| 03 00 00 00| ....| type: "strtab" (0x3) (String table) 0x11bc-0x11c0 (4)
|
||||
@ -915,7 +915,7 @@ $ fq -d elf dv a_stripped
|
||||
0x1450| 01 00 00 00 | .... | addralign: 1 0x1458-0x145c (4)
|
||||
0x1450| 00 00 00 00| ....| entsize: 0 0x145c-0x1460 (4)
|
||||
| | | [21]{}: section_header 0x1068-0x1488 (1056)
|
||||
0x1060| 00 2e 73 68 73 74 72 74| ..shstrt| string: "\x00.shstrtab\x00.interp\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.r..." 0x1068-0x1115 (173)
|
||||
0x1060| 00 2e 73 68 73 74 72 74| ..shstrt| string: "\x00.shstrtab\x00.interp\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.rel.dyn\x00.rel.plt\x00.init\x00.text\x00.fini\x00.rodata\x00.eh_frame\x00.init_array\x00.fini_array\x00.dynamic\x00.got\x00.data\x00.bss\x00.comment\x00.ARM.attributes\x00" 0x1068-0x1115 (173)
|
||||
0x1070|61 62 00 2e 69 6e 74 65 72 70 00 2e 67 6e 75 2e|ab..interp..gnu.|
|
||||
* |until 0x1114.7 (173) | |
|
||||
0x1460|01 00 00 00 |.... | name: ".shstrtab" (1) 0x1460-0x1464 (4)
|
||||
|
@ -473,7 +473,7 @@ $ fq -d ar dv libbbb.a
|
||||
0x480|01 00 00 00 |.... | addralign: 1 0x480-0x484 (4)
|
||||
0x480| 00 00 00 00 | .... | entsize: 0 0x484-0x488 (4)
|
||||
| | | [11]{}: section_header 0x26c-0x4b0 (580)
|
||||
0x260| 00 2e 73 79| ..sy| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.rel.text\x00.data\x00.bss..." 0x26c-0x2cd (97)
|
||||
0x260| 00 2e 73 79| ..sy| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.rel.text\x00.data\x00.bss\x00.rodata\x00.comment\x00.note.GNU-stack\x00.ARM.attributes\x00" 0x26c-0x2cd (97)
|
||||
0x270|6d 74 61 62 00 2e 73 74 72 74 61 62 00 2e 73 68|mtab..strtab..sh|
|
||||
* |until 0x2cc.7 (97) | |
|
||||
0x480| 11 00 00 00 | .... | name: ".shstrtab" (17) 0x488-0x48c (4)
|
||||
|
@ -305,7 +305,7 @@ $ fq -d elf dv libbbb.so
|
||||
0x1a80| 04 00 00 00 | .... | addralign: 4 0x1a88-0x1a8c (4)
|
||||
0x1a80| 10 00 00 00| ....| entsize: 16 0x1a8c-0x1a90 (4)
|
||||
| | | [3]{}: section_header 0x1c0-0x1ab8 (6392)
|
||||
0x01c0|00 5f 69 6e 69 74 00 5f 66 69 6e 69 00 5f 49 54|._init._fini._IT| string: "\x00_init\x00_fini\x00_ITM_deregisterTMCloneTable\x00_ITM_r..." 0x1c0-0x265 (165)
|
||||
0x01c0|00 5f 69 6e 69 74 00 5f 66 69 6e 69 00 5f 49 54|._init._fini._IT| string: "\x00_init\x00_fini\x00_ITM_deregisterTMCloneTable\x00_ITM_registerTMCloneTable\x00__cxa_finalize\x00__deregister_frame_info\x00__register_frame_info\x00libbbb_bbb\x00puts\x00libc.musl-armhf.so.1\x00" 0x1c0-0x265 (165)
|
||||
* |until 0x264.7 (165) | |
|
||||
0x1a90|2d 00 00 00 |-... | name: ".dynstr" (45) 0x1a90-0x1a94 (4)
|
||||
0x1a90| 03 00 00 00 | .... | type: "strtab" (0x3) (String table) 0x1a94-0x1a98 (4)
|
||||
@ -1769,7 +1769,7 @@ $ fq -d elf dv libbbb.so
|
||||
0x1e40| 04 00 00 00 | .... | addralign: 4 0x1e48-0x1e4c (4)
|
||||
0x1e40| 10 00 00 00| ....| entsize: 16 0x1e4c-0x1e50 (4)
|
||||
| | | [27]{}: section_header 0x1770-0x1e78 (1800)
|
||||
0x1770|00 63 72 74 69 2e 6f 00 24 61 00 63 72 74 6e 2e|.crti.o.$a.crtn.| string: "\x00crti.o\x00$a\x00crtn.o\x00crtstuff.c\x00$d\x00all_implied_fbi..." 0x1770-0x1912 (418)
|
||||
0x1770|00 63 72 74 69 2e 6f 00 24 61 00 63 72 74 6e 2e|.crti.o.$a.crtn.| string: "\x00crti.o\x00$a\x00crtn.o\x00crtstuff.c\x00$d\x00all_implied_fbits\x00deregister_tm_clones\x00__do_global_dtors_aux\x00completed.1\x00__do_global_dtors_aux_fini_array_entry\x00frame_dummy\x00object.0\x00__frame_dummy_init_array_entry\x00libbbb.c\x00__FRAME_END__\x00_DYNAMIC\x00__TMC_END__\x00__dso_handle\x00_GLOBAL_OFFSET_TABLE_\x00puts\x00__cxa_finalize\x00_init\x00__deregister_frame_info\x00_ITM_registerTMCloneTable\x00_ITM_deregisterTMCloneTable\x00_fini\x00libbbb_bbb\x00__register_frame_info\x00" 0x1770-0x1912 (418)
|
||||
* |until 0x1911.7 (418) | |
|
||||
0x1e50|09 00 00 00 |.... | name: ".strtab" (9) 0x1e50-0x1e54 (4)
|
||||
0x1e50| 03 00 00 00 | .... | type: "strtab" (0x3) (String table) 0x1e54-0x1e58 (4)
|
||||
@ -1796,7 +1796,7 @@ $ fq -d elf dv libbbb.so
|
||||
0x1e70|01 00 00 00 |.... | addralign: 1 0x1e70-0x1e74 (4)
|
||||
0x1e70| 00 00 00 00 | .... | entsize: 0 0x1e74-0x1e78 (4)
|
||||
| | | [28]{}: section_header 0x1912-0x1ea0 (1422)
|
||||
0x1910| 00 2e 73 79 6d 74 61 62 00 2e 73 74 72 74| ..symtab..strt| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.gnu.hash\x00.dynsym\x00.d..." 0x1912-0x1a15 (259)
|
||||
0x1910| 00 2e 73 79 6d 74 61 62 00 2e 73 74 72 74| ..symtab..strt| string: "\x00.symtab\x00.strtab\x00.shstrtab\x00.gnu.hash\x00.dynsym\x00.dynstr\x00.rel.dyn\x00.rel.plt\x00.init\x00.text\x00.fini\x00.rodata\x00.eh_frame\x00.init_array\x00.fini_array\x00.dynamic\x00.got\x00.data\x00.bss\x00.comment\x00.ARM.attributes\x00.debug_aranges\x00.debug_info\x00.debug_abbrev\x00.debug_line\x00.debug_str\x00.debug_ranges\x00" 0x1912-0x1a15 (259)
|
||||
0x1920|61 62 00 2e 73 68 73 74 72 74 61 62 00 2e 67 6e|ab..shstrtab..gn|
|
||||
* |until 0x1a14.7 (259) | |
|
||||
0x1e70| 11 00 00 00 | .... | name: ".shstrtab" (17) 0x1e78-0x1e7c (4)
|
||||
|
13
format/fit/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
### Generated files
|
||||
- format/fit/mappers/messages_generated.go
|
||||
- format/fit/mappers/types_generated.go
|
||||
|
||||
### How to generate them if needed
|
||||
|
||||
1. Download the Fit SDK from: https://developer.garmin.com/fit/download/
|
||||
2. Install NodeJS and NPM
|
||||
3. Go to the `format/fit/testdata/generator` folder.
|
||||
4. Run `npm install` if it's your first time
|
||||
5. Run `node index.js t /PathToSDK/Profile.xlsx > ../../mappers/types_generated.go`
|
||||
6. Run `node index.js m /PathToSDK/Profile.xlsx > ../../mappers/messages_generated.go`
|
||||
8. Correct formating and spelling of farenheit->fahrenheit and bondary->boundary in generated files to please Go linter
|
434
format/fit/fit.go
Normal file
@ -0,0 +1,434 @@
|
||||
package fit
|
||||
|
||||
// https://developer.garmin.com/fit/protocol/
|
||||
// https://developer.garmin.com/fit/cookbook/decoding-activity-files/
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"fmt"
|
||||
"slices"
|
||||
|
||||
"github.com/wader/fq/format"
|
||||
"github.com/wader/fq/format/fit/mappers"
|
||||
"github.com/wader/fq/pkg/decode"
|
||||
"github.com/wader/fq/pkg/interp"
|
||||
"github.com/wader/fq/pkg/scalar"
|
||||
)
|
||||
|
||||
//go:embed fit.md
|
||||
var fitFS embed.FS
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.FIT,
|
||||
&decode.Format{
|
||||
Description: "Garmin Flexible and Interoperable Data Transfer",
|
||||
Groups: []*decode.Group{format.Probe},
|
||||
DecodeFn: decodeFIT,
|
||||
})
|
||||
|
||||
interp.RegisterFS(fitFS)
|
||||
}
|
||||
|
||||
var fitCRCTable = [16]uint16{
|
||||
0x0000, 0xcc01, 0xd801, 0x1400, 0xf001, 0x3c00, 0x2800, 0xe401,
|
||||
0xa001, 0x6c00, 0x7800, 0xb401, 0x5000, 0x9c01, 0x8801, 0x4400,
|
||||
}
|
||||
|
||||
func calcCRC(bytes []byte) uint16 {
|
||||
var crc uint16
|
||||
crc = 0
|
||||
for i := 0; i < len(bytes); i++ {
|
||||
// compute checksum of lower four bits of byte
|
||||
var checkByte = bytes[i]
|
||||
var tmp = fitCRCTable[crc&0xf]
|
||||
crc = (crc >> 4) & 0x0fff
|
||||
crc = crc ^ tmp ^ fitCRCTable[checkByte&0xf]
|
||||
tmp = fitCRCTable[crc&0xf]
|
||||
crc = (crc >> 4) & 0x0fff
|
||||
crc = crc ^ tmp ^ fitCRCTable[(checkByte>>4)&0xf]
|
||||
}
|
||||
|
||||
return crc
|
||||
}
|
||||
|
||||
type fitContext struct {
|
||||
dataSize uint64
|
||||
headerSize uint64
|
||||
}
|
||||
|
||||
type dataRecordContext struct {
|
||||
compressed bool
|
||||
data bool
|
||||
localMessageType uint64
|
||||
hasDeveloperFields bool
|
||||
}
|
||||
|
||||
type fileDescriptionContext struct {
|
||||
devIdx uint64
|
||||
fDefNo uint64
|
||||
typ string
|
||||
name string
|
||||
unit string
|
||||
nativeFieldNo uint64
|
||||
nativeMsgNo uint64
|
||||
}
|
||||
|
||||
type valueType struct {
|
||||
value uint64
|
||||
typ string
|
||||
}
|
||||
|
||||
type devFieldDefMap map[uint64]map[uint64]mappers.FieldDef
|
||||
type localFieldDefMap map[uint64]map[uint64]mappers.LocalFieldDef
|
||||
type localMsgIsDevDef map[uint64]bool
|
||||
type valueMap map[string]valueType
|
||||
|
||||
// expected size in bytes
|
||||
var expectedSizeMap = map[string]uint64{
|
||||
"byte": 1,
|
||||
"enum": 1,
|
||||
"float32": 4,
|
||||
"float64": 8,
|
||||
"sint8": 1,
|
||||
"sint16": 2,
|
||||
"sint32": 4,
|
||||
"sint64": 8,
|
||||
"uint8": 1,
|
||||
"uint8z": 1,
|
||||
"uint16": 2,
|
||||
"uint16z": 2,
|
||||
"uint32": 4,
|
||||
"uint32z": 4,
|
||||
"uint64": 8,
|
||||
"uint64z": 8,
|
||||
}
|
||||
|
||||
// "Magic" numbers
|
||||
const (
|
||||
developerFieldDescMesgNo = 206 // Special data message used as dynamic field definition message
|
||||
)
|
||||
|
||||
func fitDecodeFileHeader(d *decode.D, fc *fitContext) {
|
||||
frameStart := d.Pos()
|
||||
|
||||
headerSize := d.FieldU8("header_size")
|
||||
d.FieldU8("protocol_version")
|
||||
d.FieldU16("profile_version")
|
||||
dataSize := d.FieldU32("data_size")
|
||||
|
||||
d.FieldRawLen("data_type", 4*8, d.AssertBitBuf([]byte(".FIT")))
|
||||
if headerSize == 14 {
|
||||
headerCRC := calcCRC(d.BytesRange(frameStart, int(headerSize)-2))
|
||||
d.FieldU16("crc", d.UintValidate(uint64(headerCRC)), scalar.UintHex)
|
||||
}
|
||||
fc.headerSize = headerSize
|
||||
fc.dataSize = dataSize
|
||||
}
|
||||
|
||||
func fitDecodeDataRecordHeader(d *decode.D, drc *dataRecordContext) {
|
||||
headerType := d.FieldU1("header_type", scalar.UintMapSymStr{0: "normal", 1: "compressed"})
|
||||
drc.compressed = headerType == 1
|
||||
if drc.compressed {
|
||||
localMessageType := d.FieldU2("local_message_type")
|
||||
d.FieldU32("time_offset")
|
||||
drc.localMessageType = localMessageType
|
||||
drc.data = true
|
||||
} else {
|
||||
mTypeIsDef := d.FieldU1("message_type", scalar.UintMapSymStr{0: "data", 1: "definition"})
|
||||
hasDeveloperFields := d.FieldBool("has_developer_fields")
|
||||
d.FieldBool("reserved")
|
||||
localMessageType := d.FieldU4("local_message_type")
|
||||
|
||||
drc.hasDeveloperFields = hasDeveloperFields
|
||||
drc.localMessageType = localMessageType
|
||||
drc.data = mTypeIsDef == 0
|
||||
}
|
||||
}
|
||||
|
||||
func fitDecodeDefinitionMessage(d *decode.D, drc *dataRecordContext, lmfd localFieldDefMap, dmfd devFieldDefMap, isDevMap localMsgIsDevDef) {
|
||||
d.FieldU8("reserved")
|
||||
endian := d.FieldU8("architecture", scalar.UintMapSymStr{0: "little_endian", 1: "big_endian"})
|
||||
switch endian {
|
||||
case 0:
|
||||
d.Endian = decode.LittleEndian
|
||||
case 1:
|
||||
d.Endian = decode.BigEndian
|
||||
default:
|
||||
d.Fatalf("Unknown endian %d", endian)
|
||||
}
|
||||
|
||||
messageNo := d.FieldU16("global_message_number", mappers.TypeDefMap["mesg_num"])
|
||||
isDevMap[drc.localMessageType] = messageNo == developerFieldDescMesgNo
|
||||
|
||||
numFields := d.FieldU8("fields")
|
||||
lmfd[drc.localMessageType] = make(map[uint64]mappers.LocalFieldDef, numFields)
|
||||
|
||||
d.FieldArray("field_definitions", func(d *decode.D) {
|
||||
for i := uint64(0); i < numFields; i++ {
|
||||
d.FieldStruct("field_definition", func(d *decode.D) {
|
||||
fieldDefNo := d.FieldU8("field_definition_number", mappers.FieldDefMap[messageNo])
|
||||
size := d.FieldU8("size")
|
||||
baseType := d.FieldU8("base_type", mappers.TypeDefMap["fit_base_type"])
|
||||
|
||||
var typ = mappers.TypeDefMap["fit_base_type"][baseType].Name
|
||||
fDefLookup, isSet := mappers.FieldDefMap[messageNo][fieldDefNo]
|
||||
if isSet {
|
||||
var foundName = fDefLookup.Name
|
||||
lmfd[drc.localMessageType][i] = mappers.LocalFieldDef{
|
||||
Name: foundName,
|
||||
Type: typ,
|
||||
Size: size,
|
||||
Format: fDefLookup.Type,
|
||||
Unit: fDefLookup.Unit,
|
||||
Scale: fDefLookup.Scale,
|
||||
Offset: fDefLookup.Offset,
|
||||
GlobalFieldDef: fDefLookup,
|
||||
GlobalMessageNo: messageNo,
|
||||
GlobalFieldDefNo: fieldDefNo,
|
||||
}
|
||||
} else {
|
||||
var foundName = fmt.Sprintf("UNKNOWN_%d", fieldDefNo)
|
||||
lmfd[drc.localMessageType][i] = mappers.LocalFieldDef{
|
||||
Name: foundName,
|
||||
Type: typ,
|
||||
Size: size,
|
||||
Format: "unknown",
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
if drc.hasDeveloperFields {
|
||||
numDevFields := d.FieldU8("developer_fields")
|
||||
|
||||
d.FieldArray("developer_field_definitions", func(d *decode.D) {
|
||||
for i := numFields; i < (numDevFields + numFields); i++ {
|
||||
d.FieldStruct("developer_field_definition", func(d *decode.D) {
|
||||
fieldDefNo := d.FieldU8("field_definition_number")
|
||||
size := d.FieldU8("size")
|
||||
devDataIdx := d.FieldU8("developer_data_index")
|
||||
|
||||
fDefLookup, isSet := dmfd[devDataIdx][fieldDefNo]
|
||||
|
||||
if isSet {
|
||||
var foundName = fDefLookup.Name
|
||||
lmfd[drc.localMessageType][i] = mappers.LocalFieldDef{
|
||||
Name: foundName,
|
||||
Type: fDefLookup.Type,
|
||||
Size: size,
|
||||
Unit: fDefLookup.Unit,
|
||||
Scale: fDefLookup.Scale,
|
||||
Offset: fDefLookup.Offset,
|
||||
}
|
||||
} else {
|
||||
var foundName = fmt.Sprintf("UNKNOWN_%d", fieldDefNo)
|
||||
lmfd[drc.localMessageType][i] = mappers.LocalFieldDef{
|
||||
Name: foundName,
|
||||
Type: "UNKNOWN",
|
||||
Size: size,
|
||||
Format: "UNKNOWN",
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func readUint(d *decode.D, fDef mappers.LocalFieldDef, valMap valueMap) {
|
||||
expectedSize := expectedSizeMap[fDef.Type]
|
||||
if fDef.Size != expectedSize {
|
||||
d.SeekRel(int64(fDef.Size) * 8) // skip over array types since they cannot be referenced by subfields
|
||||
} else {
|
||||
val := d.U(int(expectedSize) * 8)
|
||||
valMap[fDef.Name] = valueType{value: val, typ: fDef.Format}
|
||||
}
|
||||
}
|
||||
|
||||
func fieldUint(d *decode.D, fDef mappers.LocalFieldDef, uintFormatter scalar.UintFn, fdc *fileDescriptionContext, valMap valueMap) {
|
||||
var val uint64
|
||||
expectedSize := expectedSizeMap[fDef.Type]
|
||||
|
||||
if fDef.Size != expectedSize {
|
||||
arrayCount := fDef.Size / expectedSize
|
||||
for i := uint64(0); i < arrayCount; i++ {
|
||||
d.FieldU(fmt.Sprintf("%s_%d", fDef.Name, i), int(expectedSize)*8, uintFormatter)
|
||||
}
|
||||
} else {
|
||||
if fDef.GlobalFieldDef.HasSubField {
|
||||
var found = false
|
||||
if subFieldValueMap, ok := mappers.SubFieldDefMap[fDef.GlobalMessageNo][fDef.GlobalFieldDefNo]; ok {
|
||||
for k := range subFieldValueMap {
|
||||
if subFieldDef, ok := subFieldValueMap[k][mappers.TypeDefMap[valMap[k].typ][valMap[k].value].Name]; ok {
|
||||
subUintFormatter := mappers.GetUintFormatter(mappers.LocalFieldDef{
|
||||
Name: subFieldDef.Name,
|
||||
Type: fDef.Type,
|
||||
Size: fDef.Size,
|
||||
Format: subFieldDef.Type,
|
||||
Unit: subFieldDef.Unit,
|
||||
Scale: subFieldDef.Scale,
|
||||
Offset: subFieldDef.Offset,
|
||||
})
|
||||
val = d.FieldU(subFieldDef.Name, int(expectedSize)*8, subUintFormatter)
|
||||
found = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
if !found { // SubField conditions could not be resolved
|
||||
val = d.FieldU(fDef.Name, int(expectedSize)*8, uintFormatter)
|
||||
}
|
||||
} else {
|
||||
val = d.FieldU(fDef.Name, int(expectedSize)*8, uintFormatter)
|
||||
}
|
||||
|
||||
// Save developer field definitions
|
||||
switch fDef.Name {
|
||||
case "developer_data_index":
|
||||
fdc.devIdx = val
|
||||
case "field_definition_number":
|
||||
fdc.fDefNo = val
|
||||
case "fit_base_type_id":
|
||||
fdc.typ = mappers.TypeDefMap["fit_base_type"][val].Name
|
||||
case "native_field_num":
|
||||
fdc.nativeFieldNo = val
|
||||
case "native_mesg_num":
|
||||
fdc.nativeMsgNo = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func fieldSint(d *decode.D, fDef mappers.LocalFieldDef, sintFormatter scalar.SintFn) {
|
||||
expectedSize := expectedSizeMap[fDef.Type]
|
||||
if fDef.Size != expectedSize {
|
||||
arrayCount := fDef.Size / expectedSize
|
||||
for i := uint64(0); i < arrayCount; i++ {
|
||||
d.FieldS(fmt.Sprintf("%s_%d", fDef.Name, i), int(expectedSize)*8, sintFormatter)
|
||||
}
|
||||
} else {
|
||||
d.FieldS(fDef.Name, int(expectedSize)*8, sintFormatter)
|
||||
}
|
||||
}
|
||||
|
||||
func fieldFloat(d *decode.D, fDef mappers.LocalFieldDef, floatFormatter scalar.FltFn) {
|
||||
expectedSize := expectedSizeMap[fDef.Type]
|
||||
if fDef.Size != expectedSize {
|
||||
arrayCount := fDef.Size / expectedSize
|
||||
for i := uint64(0); i < arrayCount; i++ {
|
||||
d.FieldF(fmt.Sprintf("%s_%d", fDef.Name, i), int(expectedSize)*8, floatFormatter)
|
||||
}
|
||||
} else {
|
||||
d.FieldF(fDef.Name, int(expectedSize)*8)
|
||||
}
|
||||
}
|
||||
|
||||
func fieldString(d *decode.D, fDef mappers.LocalFieldDef, fdc *fileDescriptionContext) {
|
||||
val := d.FieldUTF8NullFixedLen(fDef.Name, int(fDef.Size), scalar.StrMapDescription{"": "Invalid"})
|
||||
|
||||
// Save developer field definitions
|
||||
switch fDef.Name {
|
||||
case "field_name":
|
||||
fdc.name = val
|
||||
case "units":
|
||||
fdc.unit = val
|
||||
}
|
||||
}
|
||||
|
||||
func fitDecodeDataMessage(d *decode.D, drc *dataRecordContext, lmfd localFieldDefMap, dmfd devFieldDefMap, isDevMap localMsgIsDevDef) {
|
||||
var fdc fileDescriptionContext
|
||||
valMap := make(valueMap, len(lmfd[drc.localMessageType]))
|
||||
keys := make([]int, len(lmfd[drc.localMessageType]))
|
||||
i := 0
|
||||
for k := range lmfd[drc.localMessageType] {
|
||||
keys[i] = int(k)
|
||||
i++
|
||||
}
|
||||
slices.Sort(keys)
|
||||
|
||||
isDevDep := isDevMap[drc.localMessageType]
|
||||
|
||||
// pre read all integer fields and store them in the value map
|
||||
// so that they can be referenced by eventual subfields
|
||||
curPos := d.Pos()
|
||||
for _, k := range keys {
|
||||
fDef := lmfd[drc.localMessageType][uint64(k)]
|
||||
switch fDef.Type {
|
||||
case "enum", "byte", "uint8", "uint8z", "uint16", "uint16z", "uint32", "uint32z", "uint64", "uint64z":
|
||||
readUint(d, fDef, valMap)
|
||||
default:
|
||||
d.SeekRel(int64(fDef.Size) * 8)
|
||||
}
|
||||
}
|
||||
d.SeekRel(curPos - d.Pos())
|
||||
|
||||
for _, k := range keys {
|
||||
fDef := lmfd[drc.localMessageType][uint64(k)]
|
||||
|
||||
var uintFormatter = mappers.GetUintFormatter(fDef)
|
||||
var sintFormatter = mappers.GetSintFormatter(fDef)
|
||||
var floatFormatter = mappers.GetFloatFormatter(fDef)
|
||||
|
||||
switch fDef.Type {
|
||||
case "enum", "byte", "uint8", "uint8z", "uint16", "uint16z", "uint32", "uint32z", "uint64", "uint64z":
|
||||
fieldUint(d, fDef, uintFormatter, &fdc, valMap)
|
||||
case "sint8", "sint16", "sint32", "sint64":
|
||||
fieldSint(d, fDef, sintFormatter)
|
||||
case "float32", "float64":
|
||||
fieldFloat(d, fDef, floatFormatter)
|
||||
case "string":
|
||||
fieldString(d, fDef, &fdc)
|
||||
default:
|
||||
d.Fatalf("Unknown type %s", fDef.Type)
|
||||
}
|
||||
}
|
||||
|
||||
if isDevDep {
|
||||
if _, ok := dmfd[fdc.devIdx]; !ok {
|
||||
dmfd[fdc.devIdx] = make(map[uint64]mappers.FieldDef)
|
||||
}
|
||||
dmfd[fdc.devIdx][fdc.fDefNo] = mappers.FieldDef{
|
||||
Name: fdc.name,
|
||||
Type: fdc.typ,
|
||||
Unit: fdc.unit,
|
||||
Scale: 0,
|
||||
Offset: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func decodeFIT(d *decode.D) any {
|
||||
var fc fitContext
|
||||
d.Endian = decode.LittleEndian
|
||||
|
||||
var lmfd localFieldDefMap = make(localFieldDefMap)
|
||||
var dmfd devFieldDefMap = make(devFieldDefMap)
|
||||
var isDevMap localMsgIsDevDef = make(localMsgIsDevDef)
|
||||
|
||||
d.FieldStruct("header", func(d *decode.D) { fitDecodeFileHeader(d, &fc) })
|
||||
|
||||
d.FieldArray("data_records", func(d *decode.D) {
|
||||
for d.Pos() < int64((fc.headerSize+fc.dataSize)*8) {
|
||||
d.FieldStruct("data_record", func(d *decode.D) {
|
||||
var drc dataRecordContext
|
||||
d.FieldStruct("record_header", func(d *decode.D) { fitDecodeDataRecordHeader(d, &drc) })
|
||||
switch drc.data {
|
||||
case true:
|
||||
d.FieldStruct("data_message", func(d *decode.D) { fitDecodeDataMessage(d, &drc, lmfd, dmfd, isDevMap) })
|
||||
case false:
|
||||
d.FieldStruct("definition_message", func(d *decode.D) { fitDecodeDefinitionMessage(d, &drc, lmfd, dmfd, isDevMap) })
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
var fileCRC uint16
|
||||
if fc.headerSize == 12 {
|
||||
fileCRC = calcCRC(d.BytesRange(0, int(fc.dataSize+fc.headerSize))) // 12 byte header - CRC whole file except the CRC itself
|
||||
} else {
|
||||
fileCRC = calcCRC(d.BytesRange(14*8, int(fc.dataSize))) // 14 byte header - CRC everything below header except the CRC itself
|
||||
}
|
||||
d.FieldU16("crc", d.UintValidate(uint64(fileCRC)), scalar.UintHex)
|
||||
|
||||
return nil
|
||||
}
|
19
format/fit/fit.md
Normal file
@ -0,0 +1,19 @@
|
||||
### Limitations
|
||||
|
||||
- Fields with subcomponents, such as "compressed_speed_distance" field on globalMessageNumber 20 is not represented correctly.
|
||||
The field is read as 3 separate bytes where the first 12 bits are speed and the last 12 bits are distance.
|
||||
- There are still lots of UNKOWN fields due to gaps in Garmins SDK Profile documentation. (Currently FIT SDK 21.126)
|
||||
- Compressed timestamp messages are not accumulated against last known full timestamp.
|
||||
|
||||
### Convert stream of data messages to JSON array
|
||||
|
||||
```
|
||||
$ fq '[.data_records[] | select(.record_header.message_type == "data").data_message]' file.fit
|
||||
```
|
||||
|
||||
### Authors
|
||||
- Mikael Lofjärd mikael.lofjard@gmail.com, original author
|
||||
|
||||
### References
|
||||
- https://developer.garmin.com/fit/protocol/
|
||||
- https://developer.garmin.com/fit/cookbook/decoding-activity-files/
|
37
format/fit/mappers/messages.go
Normal file
@ -0,0 +1,37 @@
|
||||
package mappers
|
||||
|
||||
import (
|
||||
"github.com/wader/fq/pkg/scalar"
|
||||
)
|
||||
|
||||
type FieldDef struct {
|
||||
Name string
|
||||
Type string
|
||||
Unit string
|
||||
Scale float64
|
||||
Offset int64
|
||||
Size uint64
|
||||
HasSubField bool
|
||||
}
|
||||
|
||||
type LocalFieldDef struct {
|
||||
Name string
|
||||
Type string
|
||||
Format string
|
||||
Unit string
|
||||
Scale float64
|
||||
Offset int64
|
||||
Size uint64
|
||||
GlobalFieldDef FieldDef
|
||||
GlobalMessageNo uint64
|
||||
GlobalFieldDefNo uint64
|
||||
}
|
||||
|
||||
type fieldDefMap map[uint64]FieldDef
|
||||
|
||||
func (m fieldDefMap) MapUint(s scalar.Uint) (scalar.Uint, error) {
|
||||
if t, ok := m[s.Actual]; ok {
|
||||
s.Sym = t.Name
|
||||
}
|
||||
return s, nil
|
||||
}
|
1714
format/fit/mappers/messages_generated.go
Normal file
19
format/fit/mappers/types.go
Normal file
@ -0,0 +1,19 @@
|
||||
package mappers
|
||||
|
||||
import (
|
||||
"github.com/wader/fq/pkg/scalar"
|
||||
)
|
||||
|
||||
type TypeDefLookup struct {
|
||||
Name string
|
||||
Type string
|
||||
}
|
||||
|
||||
type typeDefMap map[uint64]TypeDefLookup
|
||||
|
||||
func (m typeDefMap) MapUint(s scalar.Uint) (scalar.Uint, error) {
|
||||
if t, ok := m[s.Actual]; ok {
|
||||
s.Sym = t.Name
|
||||
}
|
||||
return s, nil
|
||||
}
|
3711
format/fit/mappers/types_generated.go
Normal file
121
format/fit/mappers/values.go
Normal file
@ -0,0 +1,121 @@
|
||||
package mappers
|
||||
|
||||
import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"github.com/wader/fq/pkg/scalar"
|
||||
)
|
||||
|
||||
var epochDate = time.Date(1989, time.December, 31, 0, 0, 0, 0, time.UTC)
|
||||
|
||||
// Used for conversion from semicircles to decimal longitude latitude
|
||||
var scConst = 180 / math.Pow(2, 31)
|
||||
|
||||
var invalidUint = map[string]uint64{
|
||||
"byte": 0xff,
|
||||
"enum": 0xff,
|
||||
"uint8": 0xff,
|
||||
"uint8z": 0x00,
|
||||
"uint16": 0xffff,
|
||||
"uint16z": 0x0000,
|
||||
"uint32": 0xffff_ffff,
|
||||
"uint32z": 0x0000_0000,
|
||||
"uint64": 0xffff_ffff_ffff_ffff,
|
||||
"uint64z": 0x0000_0000_0000_0000,
|
||||
}
|
||||
|
||||
var invalidSint = map[string]int64{
|
||||
"sint8": 0x7f,
|
||||
"sint16": 0x7fff,
|
||||
"sint32": 0x7fff_ffff,
|
||||
"sint64": 0x7fff_ffff_ffff_ffff,
|
||||
}
|
||||
|
||||
var invalidFloat = map[string]float64{
|
||||
"float32": 0xffff_ffff,
|
||||
"float64": 0xffff_ffff_ffff_ffff,
|
||||
}
|
||||
|
||||
func GetUintFormatter(fDef LocalFieldDef) scalar.UintFn {
|
||||
return scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) {
|
||||
if s.Actual == invalidUint[fDef.Type] {
|
||||
s.Description = "invalid"
|
||||
return s, nil
|
||||
}
|
||||
if fDef.Scale != 0.0 && fDef.Offset != 0 {
|
||||
s.Sym = (float64(s.Actual) / fDef.Scale) - float64(fDef.Offset)
|
||||
} else {
|
||||
if fDef.Scale != 0.0 {
|
||||
s.Sym = float64(s.Actual) / fDef.Scale
|
||||
}
|
||||
if fDef.Offset != 0 {
|
||||
s.Sym = int64(s.Actual) - fDef.Offset
|
||||
}
|
||||
}
|
||||
|
||||
if t, ok := TypeDefMap[fDef.Format]; ok {
|
||||
if u, innerOk := t[s.Actual]; innerOk {
|
||||
s.Sym = u.Name
|
||||
}
|
||||
}
|
||||
|
||||
switch fDef.Format {
|
||||
case "date_time",
|
||||
"local_date_time":
|
||||
s.Description = epochDate.Add(time.Duration(s.Actual) * time.Second).Format(time.RFC3339)
|
||||
default:
|
||||
s.Description = fDef.Unit
|
||||
}
|
||||
|
||||
return s, nil
|
||||
})
|
||||
}
|
||||
|
||||
func GetSintFormatter(fDef LocalFieldDef) scalar.SintFn {
|
||||
return scalar.SintFn(func(s scalar.Sint) (scalar.Sint, error) {
|
||||
if s.Actual == invalidSint[fDef.Type] {
|
||||
s.Description = "invalid"
|
||||
return s, nil
|
||||
}
|
||||
if fDef.Unit == "semicircles" {
|
||||
s.Sym = float64(s.Actual) * scConst
|
||||
} else {
|
||||
if fDef.Scale != 0.0 && fDef.Offset != 0 {
|
||||
s.Sym = (float64(s.Actual) / fDef.Scale) - float64(fDef.Offset)
|
||||
} else {
|
||||
if fDef.Scale != 0.0 {
|
||||
s.Sym = float64(s.Actual) / fDef.Scale
|
||||
}
|
||||
if fDef.Offset != 0 {
|
||||
s.Sym = s.Actual - fDef.Offset
|
||||
}
|
||||
}
|
||||
|
||||
s.Description = fDef.Unit
|
||||
}
|
||||
return s, nil
|
||||
})
|
||||
}
|
||||
|
||||
func GetFloatFormatter(fDef LocalFieldDef) scalar.FltFn {
|
||||
return scalar.FltFn(func(s scalar.Flt) (scalar.Flt, error) {
|
||||
if s.Actual == invalidFloat[fDef.Type] {
|
||||
s.Description = "invalid"
|
||||
return s, nil
|
||||
}
|
||||
if fDef.Scale != 0.0 && fDef.Offset != 0 {
|
||||
s.Sym = (s.Actual / fDef.Scale) - float64(fDef.Offset)
|
||||
} else {
|
||||
if fDef.Scale != 0.0 {
|
||||
s.Sym = s.Actual / fDef.Scale
|
||||
}
|
||||
if fDef.Offset != 0 {
|
||||
s.Sym = s.Actual - float64(fDef.Offset)
|
||||
}
|
||||
}
|
||||
|
||||
s.Description = fDef.Unit
|
||||
return s, nil
|
||||
})
|
||||
}
|
BIN
format/fit/testdata/activity.fit
vendored
Normal file
37316
format/fit/testdata/activity.fqtest
vendored
Normal file
BIN
format/fit/testdata/activity_dev.fit
vendored
Normal file
59060
format/fit/testdata/activity_dev.fqtest
vendored
Normal file
BIN
format/fit/testdata/activity_invalid_strings.fit
vendored
Normal file
42672
format/fit/testdata/activity_invalid_strings.fqtest
vendored
Normal file
3
format/fit/testdata/generator/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
node_modules/
|
||||
package-lock.json
|
||||
|
234
format/fit/testdata/generator/index.js
vendored
Normal file
@ -0,0 +1,234 @@
|
||||
// import xlsx from 'node-xlsx';
|
||||
var xlsx = require('node-xlsx').default;
|
||||
|
||||
const command = process.argv[2];
|
||||
const profilePath = process.argv[3];
|
||||
|
||||
if (!command) {
|
||||
console.log("Usage: node index.js [command] [profilePath]");
|
||||
console.log("");
|
||||
console.log("t - generate TypeDefMap");
|
||||
console.log("m - generate MsgDefMap");
|
||||
return 0;
|
||||
}
|
||||
|
||||
const workSheetsFromFile = xlsx.parse(profilePath);
|
||||
|
||||
const inTypes = workSheetsFromFile[0].data;
|
||||
const inMessages = workSheetsFromFile[1].data;
|
||||
|
||||
let currentType = '';
|
||||
let dynamicFieldName = '';
|
||||
let currentFDefNo = null;
|
||||
const outTypes = {};
|
||||
const outMessages = {};
|
||||
const outSubFields = {};
|
||||
|
||||
for (let li = 1; li < inTypes.length; li++) {
|
||||
const row = inTypes[li];
|
||||
|
||||
if (row[0]) {
|
||||
currentType = row[0];
|
||||
outTypes[currentType] = { type: row[1], fields: [] };
|
||||
} else {
|
||||
if (row[4] && row[4].indexOf("Deprecated") > -1) {
|
||||
continue;
|
||||
}
|
||||
const val = row[3];
|
||||
outTypes[currentType].fields[val] = row[2];
|
||||
}
|
||||
|
||||
}
|
||||
for (let li = 1; li < inMessages.length; li++) {
|
||||
const row = inMessages[li];
|
||||
const refFields = {}
|
||||
|
||||
if (row[0]) {
|
||||
currentType = row[0];
|
||||
currentMsgNum = outTypes.mesg_num.fields.indexOf(currentType);
|
||||
outMessages[currentMsgNum] = { msgNum: currentMsgNum, type: currentType, fields: {} };
|
||||
outSubFields[currentMsgNum] = { msgNum: currentMsgNum, fields: {} }
|
||||
} else {
|
||||
if (row[2] == undefined) {
|
||||
continue;
|
||||
}
|
||||
const fDefNo = row[1];
|
||||
const name = row[2];
|
||||
const type = row[3];
|
||||
const scale = row[6];
|
||||
const offset = row[7];
|
||||
const unit = row[8];
|
||||
|
||||
if (fDefNo != null) {
|
||||
outMessages[currentMsgNum].fields[name] = { fDefNo, name, type, unit, scale, offset };
|
||||
currentFDefNo = fDefNo
|
||||
dynamicFieldName = name
|
||||
} else {
|
||||
const refField = row[11].split(",")[0]
|
||||
const refVals = row[12].split(",")
|
||||
|
||||
if (!Object.hasOwnProperty.call(refFields, refField)) {
|
||||
refFields[refField] = {}
|
||||
}
|
||||
refVals.forEach(element => {
|
||||
refFields[refField][element] = { name, type, unit, scale, offset }
|
||||
});
|
||||
|
||||
outMessages[currentMsgNum].fields[dynamicFieldName]["hasSub"] = true;
|
||||
outSubFields[currentMsgNum].fields[currentFDefNo] = refFields
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (command == "t") {
|
||||
|
||||
console.log("package mappers");
|
||||
console.log("");
|
||||
|
||||
console.log("var TypeDefMap = map[string]typeDefMap{");
|
||||
for (const key in outTypes) {
|
||||
if (Object.hasOwnProperty.call(outTypes, key)) {
|
||||
const element = outTypes[key];
|
||||
console.log(`\t\"${key}\": {`);
|
||||
|
||||
for (let index = 0; index < element.fields.length; index++) {
|
||||
const field = element.fields[index];
|
||||
if (field) {
|
||||
console.log(`\t\t${index}: {Name: \"${field}\"},`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`\t},`);
|
||||
}
|
||||
}
|
||||
console.log(`}`);
|
||||
}
|
||||
|
||||
if (command == "m") {
|
||||
console.log("package mappers");
|
||||
console.log("");
|
||||
|
||||
const baseTypes = ["bool", "byte", "enum", "uint8", "uint8z", "sint8", "sint16", "uint16", "uint16z", "sint32",
|
||||
"uint32", "uint32z", "float32", "float64", "sint64", "uint64", "uint64z", "string"];
|
||||
|
||||
console.log("var SubFieldDefMap = map[uint64]map[uint64]map[string]map[string]FieldDef{");
|
||||
for (const key in outSubFields) {
|
||||
if (Object.hasOwnProperty.call(outSubFields, key)) {
|
||||
const element = outSubFields[key];
|
||||
if (Object.keys(element.fields).length == 0) {
|
||||
continue
|
||||
}
|
||||
console.log(`\t${key}: {`);
|
||||
|
||||
for (const fieldKey in element.fields) {
|
||||
const field = element.fields[fieldKey];
|
||||
console.log(`\t\t${fieldKey}: {`);
|
||||
|
||||
for (const refFieldKey in field) {
|
||||
const refField = field[refFieldKey];
|
||||
console.log(`\t\t\t"${refFieldKey}": {`);
|
||||
|
||||
for (const refValKey in refField) {
|
||||
const subField = refField[refValKey];
|
||||
|
||||
if (subField) {
|
||||
let type = "";
|
||||
let unit = "";
|
||||
let scale = "";
|
||||
let offset = "";
|
||||
|
||||
if (baseTypes.indexOf(subField.type) == -1) {
|
||||
type = `, Type: \"${subField.type}\"`;
|
||||
}
|
||||
|
||||
if (subField.unit) {
|
||||
unit = `, Unit: \"${subField.unit}\"`;
|
||||
}
|
||||
|
||||
if (subField.scale) {
|
||||
if (typeof (subField.scale) == "string") {
|
||||
// ignore multi scale (for component fields) for now
|
||||
const testScale = subField.scale.split(",");
|
||||
if (testScale.length == 1) {
|
||||
scale = `, Scale: ${testScale[0]}`;
|
||||
}
|
||||
} else {
|
||||
scale = `, Scale: ${subField.scale}`;
|
||||
}
|
||||
}
|
||||
|
||||
if (subField.offset) {
|
||||
offset = `, Offset: ${subField.offset}`
|
||||
}
|
||||
|
||||
console.log(`\t\t\t\t"${refValKey}": {Name: \"${subField.name}\"${type}${unit}${scale}${offset}},`);
|
||||
}
|
||||
}
|
||||
console.log(`\t\t\t},`);
|
||||
}
|
||||
console.log(`\t\t},`);
|
||||
}
|
||||
console.log(`\t},`);
|
||||
}
|
||||
}
|
||||
console.log("}");
|
||||
console.log("");
|
||||
|
||||
console.log("var FieldDefMap = map[uint64]fieldDefMap{");
|
||||
|
||||
for (const key in outMessages) {
|
||||
if (Object.hasOwnProperty.call(outMessages, key)) {
|
||||
const element = outMessages[key];
|
||||
console.log(`\t${key}: {`);
|
||||
|
||||
for (const msgKey in element.fields) {
|
||||
if (Object.hasOwnProperty.call(element.fields, msgKey)) {
|
||||
const field = element.fields[msgKey];
|
||||
if (field) {
|
||||
let type = "";
|
||||
let unit = "";
|
||||
let scale = "";
|
||||
let offset = "";
|
||||
let hasSub = "";
|
||||
|
||||
if (baseTypes.indexOf(field.type) == -1) {
|
||||
type = `, Type: \"${field.type}\"`;
|
||||
}
|
||||
|
||||
if (field.unit) {
|
||||
unit = `, Unit: \"${field.unit}\"`;
|
||||
}
|
||||
|
||||
if (field.scale) {
|
||||
if (typeof (field.scale) == "string") {
|
||||
// ignore multi scale (for component fields) for now
|
||||
const testScale = field.scale.split(",");
|
||||
if (testScale.length == 1) {
|
||||
scale = `, Scale: ${testScale[0]}`;
|
||||
}
|
||||
} else {
|
||||
scale = `, Scale: ${field.scale}`;
|
||||
}
|
||||
}
|
||||
|
||||
if (field.offset) {
|
||||
offset = `, Offset: ${field.offset}`
|
||||
}
|
||||
|
||||
if (field.hasSub) {
|
||||
hasSub = `, HasSubField: ${field.hasSub}`
|
||||
}
|
||||
|
||||
console.log(`\t\t${field.fDefNo}: {Name: \"${field.name}\"${type}${unit}${scale}${offset}${hasSub}},`);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`\t},`);
|
||||
}
|
||||
}
|
||||
console.log(`}`);
|
||||
}
|
14
format/fit/testdata/generator/package.json
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "parser",
|
||||
"version": "1.0.0",
|
||||
"description": "Parse ANT Fit Profile to GoLang/fq",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "Mikael Lofjärd",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"node-xlsx": "^0.23.0"
|
||||
}
|
||||
}
|
BIN
format/fit/testdata/settings.fit
vendored
Normal file
125
format/fit/testdata/settings.fqtest
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
$ fq -d fit dv settings.fit
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: settings.fit (fit) 0x0-0x52 (82)
|
||||
| | | header{}: 0x0-0xc (12)
|
||||
0x00|0c |. | header_size: 12 0x0-0x1 (1)
|
||||
0x00| 10 | . | protocol_version: 16 0x1-0x2 (1)
|
||||
0x00| 47 00 | G. | profile_version: 71 0x2-0x4 (2)
|
||||
0x00| 44 00 00 00 | D... | data_size: 68 0x4-0x8 (4)
|
||||
0x00| 2e 46 49 54 | .FIT | data_type: raw bits (valid) 0x8-0xc (4)
|
||||
| | | data_records[0:6]: 0xc-0x50 (68)
|
||||
| | | [0]{}: data_record 0xc-0x1e (18)
|
||||
| | | record_header{}: 0xc-0xd (1)
|
||||
0x00| 40 | @ | header_type: "normal" (0) 0xc-0xc.1 (0.1)
|
||||
0x00| 40 | @ | message_type: "definition" (1) 0xc.1-0xc.2 (0.1)
|
||||
0x00| 40 | @ | has_developer_fields: false 0xc.2-0xc.3 (0.1)
|
||||
0x00| 40 | @ | reserved: false 0xc.3-0xc.4 (0.1)
|
||||
0x00| 40 | @ | local_message_type: 0 0xc.4-0xd (0.4)
|
||||
| | | definition_message{}: 0xd-0x1e (17)
|
||||
0x00| 00 | . | reserved: 0 0xd-0xe (1)
|
||||
0x00| 01 | . | architecture: "big_endian" (1) 0xe-0xf (1)
|
||||
0x00| 00| .| global_message_number: "file_id" (0) 0xf-0x11 (2)
|
||||
0x10|00 |. |
|
||||
0x10| 04 | . | fields: 4 0x11-0x12 (1)
|
||||
| | | field_definitions[0:4]: 0x12-0x1e (12)
|
||||
| | | [0]{}: field_definition 0x12-0x15 (3)
|
||||
0x10| 01 | . | field_definition_number: "manufacturer" (1) 0x12-0x13 (1)
|
||||
0x10| 02 | . | size: 2 0x13-0x14 (1)
|
||||
0x10| 84 | . | base_type: "uint16" (132) 0x14-0x15 (1)
|
||||
| | | [1]{}: field_definition 0x15-0x18 (3)
|
||||
0x10| 02 | . | field_definition_number: "product" (2) 0x15-0x16 (1)
|
||||
0x10| 02 | . | size: 2 0x16-0x17 (1)
|
||||
0x10| 84 | . | base_type: "uint16" (132) 0x17-0x18 (1)
|
||||
| | | [2]{}: field_definition 0x18-0x1b (3)
|
||||
0x10| 03 | . | field_definition_number: "serial_number" (3) 0x18-0x19 (1)
|
||||
0x10| 04 | . | size: 4 0x19-0x1a (1)
|
||||
0x10| 8c | . | base_type: "uint32z" (140) 0x1a-0x1b (1)
|
||||
| | | [3]{}: field_definition 0x1b-0x1e (3)
|
||||
0x10| 00 | . | field_definition_number: "type" (0) 0x1b-0x1c (1)
|
||||
0x10| 01 | . | size: 1 0x1c-0x1d (1)
|
||||
0x10| 00 | . | base_type: "enum" (0) 0x1d-0x1e (1)
|
||||
| | | [1]{}: data_record 0x1e-0x28 (10)
|
||||
| | | record_header{}: 0x1e-0x1f (1)
|
||||
0x10| 00 | . | header_type: "normal" (0) 0x1e-0x1e.1 (0.1)
|
||||
0x10| 00 | . | message_type: "data" (0) 0x1e.1-0x1e.2 (0.1)
|
||||
0x10| 00 | . | has_developer_fields: false 0x1e.2-0x1e.3 (0.1)
|
||||
0x10| 00 | . | reserved: false 0x1e.3-0x1e.4 (0.1)
|
||||
0x10| 00 | . | local_message_type: 0 0x1e.4-0x1f (0.4)
|
||||
| | | data_message{}: 0x1f-0x28 (9)
|
||||
0x10| 00| .| manufacturer: 256 0x1f-0x21 (2)
|
||||
0x20|01 |. |
|
||||
0x20| 03 dc | .. | product: 56323 0x21-0x23 (2)
|
||||
0x20| 00 01 e2 40 | ...@ | serial_number: 1088553216 0x23-0x27 (4)
|
||||
0x20| 02 | . | type: "settings" (2) 0x27-0x28 (1)
|
||||
| | | [2]{}: data_record 0x28-0x3d (21)
|
||||
| | | record_header{}: 0x28-0x29 (1)
|
||||
0x20| 40 | @ | header_type: "normal" (0) 0x28-0x28.1 (0.1)
|
||||
0x20| 40 | @ | message_type: "definition" (1) 0x28.1-0x28.2 (0.1)
|
||||
0x20| 40 | @ | has_developer_fields: false 0x28.2-0x28.3 (0.1)
|
||||
0x20| 40 | @ | reserved: false 0x28.3-0x28.4 (0.1)
|
||||
0x20| 40 | @ | local_message_type: 0 0x28.4-0x29 (0.4)
|
||||
| | | definition_message{}: 0x29-0x3d (20)
|
||||
0x20| 00 | . | reserved: 0 0x29-0x2a (1)
|
||||
0x20| 01 | . | architecture: "big_endian" (1) 0x2a-0x2b (1)
|
||||
0x20| 00 03 | .. | global_message_number: "user_profile" (3) 0x2b-0x2d (2)
|
||||
0x20| 05 | . | fields: 5 0x2d-0x2e (1)
|
||||
| | | field_definitions[0:5]: 0x2e-0x3d (15)
|
||||
| | | [0]{}: field_definition 0x2e-0x31 (3)
|
||||
0x20| 04 | . | field_definition_number: "weight" (4) 0x2e-0x2f (1)
|
||||
0x20| 02| .| size: 2 0x2f-0x30 (1)
|
||||
0x30|84 |. | base_type: "uint16" (132) 0x30-0x31 (1)
|
||||
| | | [1]{}: field_definition 0x31-0x34 (3)
|
||||
0x30| 01 | . | field_definition_number: "gender" (1) 0x31-0x32 (1)
|
||||
0x30| 01 | . | size: 1 0x32-0x33 (1)
|
||||
0x30| 00 | . | base_type: "enum" (0) 0x33-0x34 (1)
|
||||
| | | [2]{}: field_definition 0x34-0x37 (3)
|
||||
0x30| 02 | . | field_definition_number: "age" (2) 0x34-0x35 (1)
|
||||
0x30| 01 | . | size: 1 0x35-0x36 (1)
|
||||
0x30| 02 | . | base_type: "uint8" (2) 0x36-0x37 (1)
|
||||
| | | [3]{}: field_definition 0x37-0x3a (3)
|
||||
0x30| 03 | . | field_definition_number: "height" (3) 0x37-0x38 (1)
|
||||
0x30| 01 | . | size: 1 0x38-0x39 (1)
|
||||
0x30| 02 | . | base_type: "uint8" (2) 0x39-0x3a (1)
|
||||
| | | [4]{}: field_definition 0x3a-0x3d (3)
|
||||
0x30| 05 | . | field_definition_number: "language" (5) 0x3a-0x3b (1)
|
||||
0x30| 01 | . | size: 1 0x3b-0x3c (1)
|
||||
0x30| 00 | . | base_type: "enum" (0) 0x3c-0x3d (1)
|
||||
| | | [3]{}: data_record 0x3d-0x44 (7)
|
||||
| | | record_header{}: 0x3d-0x3e (1)
|
||||
0x30| 00 | . | header_type: "normal" (0) 0x3d-0x3d.1 (0.1)
|
||||
0x30| 00 | . | message_type: "data" (0) 0x3d.1-0x3d.2 (0.1)
|
||||
0x30| 00 | . | has_developer_fields: false 0x3d.2-0x3d.3 (0.1)
|
||||
0x30| 00 | . | reserved: false 0x3d.3-0x3d.4 (0.1)
|
||||
0x30| 00 | . | local_message_type: 0 0x3d.4-0x3e (0.4)
|
||||
| | | data_message{}: 0x3e-0x44 (6)
|
||||
0x30| 03 84| ..| weight: 3379.5 (33795) (kg) 0x3e-0x40 (2)
|
||||
0x40|01 |. | gender: "male" (1) 0x40-0x41 (1)
|
||||
0x40| 1c | . | age: 28 (years) 0x41-0x42 (1)
|
||||
0x40| be | . | height: 1.9 (190) (m) 0x42-0x43 (1)
|
||||
0x40| 00 | . | language: "english" (0) 0x43-0x44 (1)
|
||||
| | | [4]{}: data_record 0x44-0x4d (9)
|
||||
| | | record_header{}: 0x44-0x45 (1)
|
||||
0x40| 40 | @ | header_type: "normal" (0) 0x44-0x44.1 (0.1)
|
||||
0x40| 40 | @ | message_type: "definition" (1) 0x44.1-0x44.2 (0.1)
|
||||
0x40| 40 | @ | has_developer_fields: false 0x44.2-0x44.3 (0.1)
|
||||
0x40| 40 | @ | reserved: false 0x44.3-0x44.4 (0.1)
|
||||
0x40| 40 | @ | local_message_type: 0 0x44.4-0x45 (0.4)
|
||||
| | | definition_message{}: 0x45-0x4d (8)
|
||||
0x40| 00 | . | reserved: 0 0x45-0x46 (1)
|
||||
0x40| 01 | . | architecture: "big_endian" (1) 0x46-0x47 (1)
|
||||
0x40| 00 04 | .. | global_message_number: "hrm_profile" (4) 0x47-0x49 (2)
|
||||
0x40| 01 | . | fields: 1 0x49-0x4a (1)
|
||||
| | | field_definitions[0:1]: 0x4a-0x4d (3)
|
||||
| | | [0]{}: field_definition 0x4a-0x4d (3)
|
||||
0x40| 01 | . | field_definition_number: "hrm_ant_id" (1) 0x4a-0x4b (1)
|
||||
0x40| 02 | . | size: 2 0x4b-0x4c (1)
|
||||
0x40| 8b | . | base_type: "uint16z" (139) 0x4c-0x4d (1)
|
||||
| | | [5]{}: data_record 0x4d-0x50 (3)
|
||||
| | | record_header{}: 0x4d-0x4e (1)
|
||||
0x40| 00 | . | header_type: "normal" (0) 0x4d-0x4d.1 (0.1)
|
||||
0x40| 00 | . | message_type: "data" (0) 0x4d.1-0x4d.2 (0.1)
|
||||
0x40| 00 | . | has_developer_fields: false 0x4d.2-0x4d.3 (0.1)
|
||||
0x40| 00 | . | reserved: false 0x4d.3-0x4d.4 (0.1)
|
||||
0x40| 00 | . | local_message_type: 0 0x4d.4-0x4e (0.4)
|
||||
| | | data_message{}: 0x4e-0x50 (2)
|
||||
0x40| 00 64| .d| hrm_ant_id: 25600 0x4e-0x50 (2)
|
||||
0x50|39 50| |9P| | crc: 0x5039 (valid) 0x50-0x52 (2)
|
@ -9,7 +9,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/wader/fq/format"
|
||||
"github.com/wader/fq/internal/mathex"
|
||||
"github.com/wader/fq/internal/mathx"
|
||||
"github.com/wader/fq/pkg/bitio"
|
||||
"github.com/wader/fq/pkg/decode"
|
||||
"github.com/wader/fq/pkg/interp"
|
||||
@ -65,7 +65,7 @@ func flacDecode(d *decode.D) any {
|
||||
|
||||
samplesInFrame := ffo.Samples
|
||||
if streamTotalSamples > 0 {
|
||||
samplesInFrame = mathex.Min(streamTotalSamples-streamDecodedSamples, ffo.Samples)
|
||||
samplesInFrame = mathx.Min(streamTotalSamples-streamDecodedSamples, ffo.Samples)
|
||||
}
|
||||
frameStreamSamplesBuf := ffo.SamplesBuf[0 : samplesInFrame*uint64(ffo.Channels*ffo.BitsPerSample/8)]
|
||||
framesNDecodedSamples += ffo.Samples
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"math/bits"
|
||||
|
||||
"github.com/wader/fq/format"
|
||||
"github.com/wader/fq/internal/mathex"
|
||||
"github.com/wader/fq/internal/mathx"
|
||||
"github.com/wader/fq/pkg/checksum"
|
||||
"github.com/wader/fq/pkg/decode"
|
||||
"github.com/wader/fq/pkg/interp"
|
||||
@ -478,7 +478,7 @@ func frameDecode(d *decode.D) any {
|
||||
for j := 0; j < count; j++ {
|
||||
high := d.Unary(0)
|
||||
low := d.U(riceParameter)
|
||||
samples[n] = mathex.ZigZag[uint64, int64](high<<riceParameter | low)
|
||||
samples[n] = mathx.ZigZag[uint64, int64](high<<riceParameter | low)
|
||||
n++
|
||||
}
|
||||
samplesStop := d.Pos()
|
||||
|
@ -45,17 +45,17 @@ type Probe_Args_In struct {
|
||||
|
||||
var (
|
||||
Image = &decode.Group{Name: "image"}
|
||||
Probe = &decode.Group{Name: "probe", DefaultInArg: Probe_In{}}
|
||||
Probe_Args = &decode.Group{Name: "probe_args", DefaultInArg: Probe_Args_In{}}
|
||||
Link_Frame = &decode.Group{Name: "link_frame", DefaultInArg: Link_Frame_In{}} // ex: ethernet
|
||||
INET_Packet = &decode.Group{Name: "inet_packet", DefaultInArg: INET_Packet_In{}} // ex: ipv4
|
||||
IP_Packet = &decode.Group{Name: "ip_packet", DefaultInArg: INET_Packet_In{}} // ex: tcp
|
||||
Link_Frame = &decode.Group{Name: "link_frame", DefaultInArg: Link_Frame_In{}} // ex: ethernet
|
||||
MP3_Frame_Tags = &decode.Group{Name: "mp3_frame_tags"}
|
||||
Probe = &decode.Group{Name: "probe", DefaultInArg: Probe_In{}}
|
||||
Probe_Args = &decode.Group{Name: "probe_args", DefaultInArg: Probe_Args_In{}}
|
||||
TCP_Stream = &decode.Group{Name: "tcp_stream", DefaultInArg: TCP_Stream_In{}} // ex: http
|
||||
UDP_Payload = &decode.Group{Name: "udp_payload", DefaultInArg: UDP_Payload_In{}} // ex: dns
|
||||
MP3_Frame_Tags = &decode.Group{Name: "mp3_frame_tags"}
|
||||
|
||||
Bytes = &decode.Group{Name: "bytes"}
|
||||
Bits = &decode.Group{Name: "bits"}
|
||||
Bytes = &decode.Group{Name: "bytes"}
|
||||
|
||||
AAC_Frame = &decode.Group{Name: "aac_frame"}
|
||||
ADTS = &decode.Group{Name: "adts"}
|
||||
@ -83,7 +83,6 @@ var (
|
||||
Bitcoin_Block = &decode.Group{Name: "bitcoin_block"}
|
||||
Bitcoin_Script = &decode.Group{Name: "bitcoin_script"}
|
||||
Bitcoin_Transaction = &decode.Group{Name: "bitcoin_transaction"}
|
||||
Opentimestamps = &decode.Group{Name: "opentimestamps"}
|
||||
Bplist = &decode.Group{Name: "bplist"}
|
||||
BSD_Loopback_Frame = &decode.Group{Name: "bsd_loopback_frame"}
|
||||
BSON = &decode.Group{Name: "bson"}
|
||||
@ -97,6 +96,7 @@ var (
|
||||
Ether_8023_Frame = &decode.Group{Name: "ether8023_frame"}
|
||||
Exif = &decode.Group{Name: "exif"}
|
||||
Fairplay_SPC = &decode.Group{Name: "fairplay_spc"}
|
||||
FIT = &decode.Group{Name: "fit"}
|
||||
FLAC = &decode.Group{Name: "flac"}
|
||||
FLAC_Frame = &decode.Group{Name: "flac_frame"}
|
||||
FLAC_Metadatablock = &decode.Group{Name: "flac_metadatablock"}
|
||||
@ -122,6 +122,7 @@ var (
|
||||
ID3v2 = &decode.Group{Name: "id3v2"}
|
||||
IPv4Packet = &decode.Group{Name: "ipv4_packet"}
|
||||
IPv6Packet = &decode.Group{Name: "ipv6_packet"}
|
||||
JP2C = &decode.Group{Name: "jp2c"}
|
||||
JPEG = &decode.Group{Name: "jpeg"}
|
||||
JSON = &decode.Group{Name: "json"}
|
||||
JSONL = &decode.Group{Name: "jsonl"}
|
||||
@ -141,13 +142,15 @@ var (
|
||||
MP4 = &decode.Group{Name: "mp4"}
|
||||
MPEG_ASC = &decode.Group{Name: "mpeg_asc"}
|
||||
MPEG_ES = &decode.Group{Name: "mpeg_es"}
|
||||
MPES_PES = &decode.Group{Name: "mpeg_pes"}
|
||||
MPEG_PES_Packet = &decode.Group{Name: "mpeg_pes_packet"}
|
||||
MPEG_SPU = &decode.Group{Name: "mpeg_spu"}
|
||||
MPEG_TS = &decode.Group{Name: "mpeg_ts"}
|
||||
MPES_PES = &decode.Group{Name: "mpeg_pes"}
|
||||
MsgPack = &decode.Group{Name: "msgpack"}
|
||||
NES = &decode.Group{Name: "nes"}
|
||||
Ogg = &decode.Group{Name: "ogg"}
|
||||
Ogg_Page = &decode.Group{Name: "ogg_page"}
|
||||
Opentimestamps = &decode.Group{Name: "opentimestamps"}
|
||||
Opus_Packet = &decode.Group{Name: "opus_packet"}
|
||||
PCAP = &decode.Group{Name: "pcap"}
|
||||
PCAPNG = &decode.Group{Name: "pcapng"}
|
||||
|
@ -114,7 +114,7 @@ func gzipDecodeMember(d *decode.D) bitio.ReaderAtSeeker {
|
||||
readCompressedSize, uncompressedBR, err =
|
||||
d.FieldReaderRange("uncompressed", d.Pos(), d.BitsLeft(), rFn)
|
||||
if err != nil {
|
||||
d.IOPanic(err, "TryFieldReaderRange")
|
||||
d.IOPanic(err, "uncompressed", "FieldReaderRange")
|
||||
}
|
||||
d.FieldRawLen("compressed", readCompressedSize)
|
||||
crc32W := crc32.NewIEEE()
|
||||
@ -149,7 +149,7 @@ func gzipDecode(d *decode.D) any {
|
||||
|
||||
cbr, err := bitio.NewMultiReader(brs...)
|
||||
if err != nil {
|
||||
d.IOPanic(err, "NewMultiReader")
|
||||
d.IOPanic(err, "members", "NewMultiReader")
|
||||
}
|
||||
dv, _, _ := d.TryFieldFormatBitBuf("uncompressed", cbr, &probeGroup, format.Probe_In{})
|
||||
if dv == nil {
|
||||
|
@ -5,9 +5,10 @@ package icc
|
||||
|
||||
import (
|
||||
"github.com/wader/fq/format"
|
||||
"github.com/wader/fq/internal/mathex"
|
||||
"github.com/wader/fq/internal/mathx"
|
||||
"github.com/wader/fq/pkg/decode"
|
||||
"github.com/wader/fq/pkg/interp"
|
||||
"github.com/wader/fq/pkg/scalar"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -70,7 +71,7 @@ func multiLocalizedUnicodeType(tagStart int64, d *decode.D) {
|
||||
}
|
||||
|
||||
var typeToDecode = map[string]func(tagStart int64, d *decode.D){
|
||||
"XYZ ": xyzType,
|
||||
"XYZ": xyzType,
|
||||
"text": textType,
|
||||
"para": paraType,
|
||||
"desc": descType,
|
||||
@ -111,13 +112,13 @@ func iccProfileDecode(d *decode.D) any {
|
||||
d.FramedFn(int64(size)*8, func(d *decode.D) {
|
||||
d.FieldStruct("header", func(d *decode.D) {
|
||||
d.FieldU32("size")
|
||||
d.FieldUTF8NullFixedLen("cmm_type_signature", 4)
|
||||
d.FieldUTF8NullFixedLen("cmm_type_signature", 4, scalar.ActualTrimSpace)
|
||||
d.FieldUintFn("version_major", decodeBCDU8)
|
||||
d.FieldUintFn("version_minor", decodeBCDU8)
|
||||
d.FieldU16("version_reserved")
|
||||
d.FieldUTF8NullFixedLen("device_class_signature", 4)
|
||||
d.FieldUTF8NullFixedLen("color_space", 4)
|
||||
d.FieldUTF8NullFixedLen("connection_space", 4)
|
||||
d.FieldUTF8NullFixedLen("device_class_signature", 4, scalar.ActualTrimSpace)
|
||||
d.FieldUTF8NullFixedLen("color_space", 4, scalar.ActualTrimSpace)
|
||||
d.FieldUTF8NullFixedLen("connection_space", 4, scalar.ActualTrimSpace)
|
||||
d.FieldStruct("timestamp", func(d *decode.D) {
|
||||
d.FieldU16("year")
|
||||
d.FieldU16("month")
|
||||
@ -127,16 +128,16 @@ func iccProfileDecode(d *decode.D) any {
|
||||
d.FieldU16("seconds")
|
||||
|
||||
})
|
||||
d.FieldUTF8NullFixedLen("file_signature", 4)
|
||||
d.FieldUTF8NullFixedLen("primary_platform", 4)
|
||||
d.FieldUTF8NullFixedLen("file_signature", 4, scalar.ActualTrimSpace)
|
||||
d.FieldUTF8NullFixedLen("primary_platform", 4, scalar.ActualTrimSpace)
|
||||
d.FieldU32("flags")
|
||||
d.FieldUTF8NullFixedLen("device_manufacturer", 4)
|
||||
d.FieldUTF8NullFixedLen("device_model", 4)
|
||||
d.FieldUTF8NullFixedLen("device_attribute", 8)
|
||||
d.FieldUTF8NullFixedLen("render_intent", 4)
|
||||
d.FieldUTF8NullFixedLen("xyz_illuminant", 12)
|
||||
d.FieldUTF8NullFixedLen("profile_creator_signature", 4)
|
||||
d.FieldUTF8NullFixedLen("profile_id", 16)
|
||||
d.FieldUTF8NullFixedLen("device_manufacturer", 4, scalar.ActualTrimSpace)
|
||||
d.FieldUTF8NullFixedLen("device_model", 4, scalar.ActualTrimSpace)
|
||||
d.FieldUTF8NullFixedLen("device_attribute", 8, scalar.ActualTrimSpace)
|
||||
d.FieldUTF8NullFixedLen("render_intent", 4, scalar.ActualTrimSpace)
|
||||
d.FieldUTF8NullFixedLen("xyz_illuminant", 12, scalar.ActualTrimSpace)
|
||||
d.FieldUTF8NullFixedLen("profile_creator_signature", 4, scalar.ActualTrimSpace)
|
||||
d.FieldUTF8NullFixedLen("profile_id", 16, scalar.ActualTrimSpace)
|
||||
d.FieldRawLen("reserved", 28*8, d.BitBufIsZero())
|
||||
})
|
||||
|
||||
@ -145,13 +146,13 @@ func iccProfileDecode(d *decode.D) any {
|
||||
d.FieldArray("table", func(d *decode.D) {
|
||||
for i := uint64(0); i < tagCount; i++ {
|
||||
d.FieldStruct("element", func(d *decode.D) {
|
||||
d.FieldUTF8NullFixedLen("signature", 4)
|
||||
d.FieldUTF8NullFixedLen("signature", 4, scalar.ActualTrimSpace)
|
||||
offset := d.FieldU32("offset")
|
||||
size := d.FieldU32("size")
|
||||
|
||||
d.RangeFn(int64(offset)*8, int64(size)*8, func(d *decode.D) {
|
||||
tagStart := d.Pos()
|
||||
typ := d.FieldUTF8NullFixedLen("type", 4)
|
||||
typ := d.FieldUTF8NullFixedLen("type", 4, scalar.ActualTrimSpace)
|
||||
d.FieldU32("reserved")
|
||||
|
||||
if fn, ok := typeToDecode[typ]; ok {
|
||||
@ -166,7 +167,7 @@ func iccProfileDecode(d *decode.D) any {
|
||||
// was. instead add alignment after if offset+size does not align and to be sure clamp it if outside buffer.
|
||||
alignStart := int64(offset) + int64(size)
|
||||
alignBytes := (4 - (int64(offset)+int64(size))%4) % 4
|
||||
alignBytes = mathex.Min(d.Len()/8-alignStart, alignBytes)
|
||||
alignBytes = mathx.Min(d.Len()/8-alignStart, alignBytes)
|
||||
if alignBytes != 0 {
|
||||
d.RangeFn(alignStart*8, alignBytes*8, func(d *decode.D) {
|
||||
d.FieldRawLen("alignment", d.BitsLeft())
|
||||
|
18
format/icc/testdata/sRGB2014.fqtest
vendored
@ -8,8 +8,8 @@ $ fq -d icc_profile dv sRGB2014.icc
|
||||
0x000| 00 | . | version_minor: 0 0x9-0xa (1)
|
||||
0x000| 00 00 | .. | version_reserved: 0 0xa-0xc (2)
|
||||
0x000| 6d 6e 74 72| mntr| device_class_signature: "mntr" 0xc-0x10 (4)
|
||||
0x010|52 47 42 20 |RGB | color_space: "RGB " 0x10-0x14 (4)
|
||||
0x010| 58 59 5a 20 | XYZ | connection_space: "XYZ " 0x14-0x18 (4)
|
||||
0x010|52 47 42 20 |RGB | color_space: "RGB" 0x10-0x14 (4)
|
||||
0x010| 58 59 5a 20 | XYZ | connection_space: "XYZ" 0x14-0x18 (4)
|
||||
| | | timestamp{}: 0x18-0x24 (12)
|
||||
0x010| 07 df | .. | year: 2015 0x18-0x1a (2)
|
||||
0x010| 00 02 | .. | month: 2 0x1a-0x1c (2)
|
||||
@ -55,7 +55,7 @@ $ fq -d icc_profile dv sRGB2014.icc
|
||||
0x090|62 58 59 5a |bXYZ | signature: "bXYZ" 0x90-0x94 (4)
|
||||
0x090| 00 00 01 a8 | .... | offset: 424 0x94-0x98 (4)
|
||||
0x090| 00 00 00 14 | .... | size: 20 0x98-0x9c (4)
|
||||
0x1a0| 58 59 5a 20 | XYZ | type: "XYZ " 0x1a8-0x1ac (4)
|
||||
0x1a0| 58 59 5a 20 | XYZ | type: "XYZ" 0x1a8-0x1ac (4)
|
||||
0x1a0| 00 00 00 00| ....| reserved: 0 0x1ac-0x1b0 (4)
|
||||
0x1b0|00 00 24 a0 |..$. | x: 0.14306640625 0x1b0-0x1b4 (4)
|
||||
0x1b0| 00 00 0f 84 | .... | y: 0.06060791015625 0x1b4-0x1b8 (4)
|
||||
@ -109,7 +109,7 @@ $ fq -d icc_profile dv sRGB2014.icc
|
||||
0x0c0| 67 58 59 5a| gXYZ| signature: "gXYZ" 0xcc-0xd0 (4)
|
||||
0x0d0|00 00 0a 50 |...P | offset: 2640 0xd0-0xd4 (4)
|
||||
0x0d0| 00 00 00 14 | .... | size: 20 0xd4-0xd8 (4)
|
||||
0xa50|58 59 5a 20 |XYZ | type: "XYZ " 0xa50-0xa54 (4)
|
||||
0xa50|58 59 5a 20 |XYZ | type: "XYZ" 0xa50-0xa54 (4)
|
||||
0xa50| 00 00 00 00 | .... | reserved: 0 0xa54-0xa58 (4)
|
||||
0xa50| 00 00 62 99 | ..b. | x: 0.3851470947265625 0xa58-0xa5c (4)
|
||||
0xa50| 00 00 b7 85| ....| y: 0.7168731689453125 0xa5c-0xa60 (4)
|
||||
@ -118,7 +118,7 @@ $ fq -d icc_profile dv sRGB2014.icc
|
||||
0x0d0| 6c 75 6d 69 | lumi | signature: "lumi" 0xd8-0xdc (4)
|
||||
0x0d0| 00 00 0a 64| ...d| offset: 2660 0xdc-0xe0 (4)
|
||||
0x0e0|00 00 00 14 |.... | size: 20 0xe0-0xe4 (4)
|
||||
0xa60| 58 59 5a 20 | XYZ | type: "XYZ " 0xa64-0xa68 (4)
|
||||
0xa60| 58 59 5a 20 | XYZ | type: "XYZ" 0xa64-0xa68 (4)
|
||||
0xa60| 00 00 00 00 | .... | reserved: 0 0xa68-0xa6c (4)
|
||||
0xa60| 00 00 00 00| ....| x: 0 0xa6c-0xa70 (4)
|
||||
0xa70|00 50 00 00 |.P.. | y: 80 0xa70-0xa74 (4)
|
||||
@ -135,7 +135,7 @@ $ fq -d icc_profile dv sRGB2014.icc
|
||||
0x0f0|62 6b 70 74 |bkpt | signature: "bkpt" 0xf0-0xf4 (4)
|
||||
0x0f0| 00 00 0a 9c | .... | offset: 2716 0xf4-0xf8 (4)
|
||||
0x0f0| 00 00 00 14 | .... | size: 20 0xf8-0xfc (4)
|
||||
0xa90| 58 59 5a 20| XYZ | type: "XYZ " 0xa9c-0xaa0 (4)
|
||||
0xa90| 58 59 5a 20| XYZ | type: "XYZ" 0xa9c-0xaa0 (4)
|
||||
0xaa0|00 00 00 00 |.... | reserved: 0 0xaa0-0xaa4 (4)
|
||||
0xaa0| 00 00 00 9e | .... | x: 0.002410888671875 0xaa4-0xaa8 (4)
|
||||
0xaa0| 00 00 00 a4 | .... | y: 0.00250244140625 0xaa8-0xaac (4)
|
||||
@ -144,7 +144,7 @@ $ fq -d icc_profile dv sRGB2014.icc
|
||||
0x0f0| 72 58 59 5a| rXYZ| signature: "rXYZ" 0xfc-0x100 (4)
|
||||
0x100|00 00 0a b0 |.... | offset: 2736 0x100-0x104 (4)
|
||||
0x100| 00 00 00 14 | .... | size: 20 0x104-0x108 (4)
|
||||
0xab0|58 59 5a 20 |XYZ | type: "XYZ " 0xab0-0xab4 (4)
|
||||
0xab0|58 59 5a 20 |XYZ | type: "XYZ" 0xab0-0xab4 (4)
|
||||
0xab0| 00 00 00 00 | .... | reserved: 0 0xab4-0xab8 (4)
|
||||
0xab0| 00 00 6f a2 | ..o. | x: 0.436065673828125 0xab8-0xabc (4)
|
||||
0xab0| 00 00 38 f5| ..8.| y: 0.2224884033203125 0xabc-0xac0 (4)
|
||||
@ -153,7 +153,7 @@ $ fq -d icc_profile dv sRGB2014.icc
|
||||
0x100| 74 65 63 68 | tech | signature: "tech" 0x108-0x10c (4)
|
||||
0x100| 00 00 0a c4| ....| offset: 2756 0x10c-0x110 (4)
|
||||
0x110|00 00 00 0c |.... | size: 12 0x110-0x114 (4)
|
||||
0xac0| 73 69 67 20 | sig | type: "sig " 0xac4-0xac8 (4)
|
||||
0xac0| 73 69 67 20 | sig | type: "sig" 0xac4-0xac8 (4)
|
||||
0xac0| 00 00 00 00 | .... | reserved: 0 0xac8-0xacc (4)
|
||||
0xac0| 43 52 54 20| CRT | data: raw bits 0xacc-0xad0 (4)
|
||||
| | | [12]{}: element 0x114-0xb58 (2628)
|
||||
@ -180,7 +180,7 @@ $ fq -d icc_profile dv sRGB2014.icc
|
||||
0x120|77 74 70 74 |wtpt | signature: "wtpt" 0x120-0x124 (4)
|
||||
0x120| 00 00 0b 58 | ...X | offset: 2904 0x124-0x128 (4)
|
||||
0x120| 00 00 00 14 | .... | size: 20 0x128-0x12c (4)
|
||||
0xb50| 58 59 5a 20 | XYZ | type: "XYZ " 0xb58-0xb5c (4)
|
||||
0xb50| 58 59 5a 20 | XYZ | type: "XYZ" 0xb58-0xb5c (4)
|
||||
0xb50| 00 00 00 00| ....| reserved: 0 0xb5c-0xb60 (4)
|
||||
0xb60|00 00 f6 d6 |.... | x: 0.964202880859375 0xb60-0xb64 (4)
|
||||
0xb60| 00 01 00 00 | .... | y: 1 0xb64-0xb68 (4)
|
||||
|
@ -302,7 +302,7 @@ func textNullLenFn(encoding int, notFoundFixedBytes int) func(d *decode.D) strin
|
||||
func(v uint64) bool { return v == 0 },
|
||||
)
|
||||
if err != nil {
|
||||
d.IOPanic(err, "textNullLenFn")
|
||||
d.IOPanic(err, "", "textNullLenFn")
|
||||
}
|
||||
if offset < 0 {
|
||||
if notFoundFixedBytes < 0 {
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"net"
|
||||
|
||||
"github.com/wader/fq/format"
|
||||
"github.com/wader/fq/internal/bitioex"
|
||||
"github.com/wader/fq/internal/bitiox"
|
||||
"github.com/wader/fq/pkg/decode"
|
||||
"github.com/wader/fq/pkg/interp"
|
||||
"github.com/wader/fq/pkg/scalar"
|
||||
@ -105,7 +105,7 @@ var hopByHopTypeNames = scalar.UintMapSymStr{
|
||||
|
||||
var mapUToIPv6Sym = scalar.BitBufFn(func(s scalar.BitBuf) (scalar.BitBuf, error) {
|
||||
b := &bytes.Buffer{}
|
||||
if _, err := bitioex.CopyBits(b, s.Actual); err != nil {
|
||||
if _, err := bitiox.CopyBits(b, s.Actual); err != nil {
|
||||
return s, err
|
||||
}
|
||||
s.Sym = net.IP(b.Bytes()).String()
|
||||
|
144
format/jpeg/jp2c.go
Normal file
@ -0,0 +1,144 @@
|
||||
package jpeg
|
||||
|
||||
import (
|
||||
"github.com/wader/fq/format"
|
||||
"github.com/wader/fq/pkg/decode"
|
||||
"github.com/wader/fq/pkg/interp"
|
||||
"github.com/wader/fq/pkg/scalar"
|
||||
)
|
||||
|
||||
func init() {
|
||||
interp.RegisterFormat(
|
||||
format.JP2C,
|
||||
&decode.Format{
|
||||
Description: "JPEG 2000 codestream",
|
||||
Groups: []*decode.Group{format.Probe, format.Image},
|
||||
DecodeFn: jp2cDecode,
|
||||
RootName: "segments",
|
||||
RootArray: true,
|
||||
})
|
||||
}
|
||||
|
||||
const (
|
||||
JP2_SOC = 0xff_4f /* start of codestream */
|
||||
JP2_SOT = 0xff_90 /* start of tile */
|
||||
JP2_SOD = 0xff_93 /* start of data */
|
||||
JP2_EOC = 0xff_d9 /* end of codestream */
|
||||
/* fixed information segment */
|
||||
JP2_SIZ = 0xff_51 /* image and tile size */
|
||||
/* functional segments */
|
||||
JP2_COD = 0xff_52 /* coding style default */
|
||||
JP2_COC = 0xff_53 /* coding style component */
|
||||
JP2_RGN = 0xff_5e /* region of interest */
|
||||
JP2_QCD = 0xff_5c /* quantization default */
|
||||
JP2_QCC = 0xff_5d /* quantization component */
|
||||
JP2_POC = 0xff_5f /* progression order change */
|
||||
/* pointer segments */
|
||||
JP2_TLM = 0xff_55 /* tile-part lengths */
|
||||
JP2_PLM = 0xff_57 /* packet length (main header) */
|
||||
JP2_PLT = 0xff_58 /* packet length (tile-part header) */
|
||||
JP2_PPM = 0xff_60 /* packed packet headers (main header) */
|
||||
JP2_PPT = 0xff_61 /* packet packet headers (tile-part header) */
|
||||
/* bitstream internal markers and segments */
|
||||
JP2_SOP = 0xff_91 /* start of packet */
|
||||
JP2_EPH = 0xff_92 /* end of packet header */
|
||||
/* informational segments */
|
||||
JP2_CRG = 0xff_63 /* component registration */
|
||||
JP2_COM = 0xff_64 /* comment */
|
||||
)
|
||||
|
||||
var jp2Markers = scalar.UintMap{
|
||||
JP2_SOC: {Sym: "soc", Description: "Start of codestream"},
|
||||
JP2_SOT: {Sym: "sot", Description: "Start of tile"},
|
||||
JP2_SOD: {Sym: "sod", Description: "Start of data"},
|
||||
JP2_EOC: {Sym: "eoc", Description: "End of codestream"},
|
||||
JP2_SIZ: {Sym: "siz", Description: "Image and tile size"},
|
||||
JP2_COD: {Sym: "cod", Description: "Coding style default"},
|
||||
JP2_COC: {Sym: "coc", Description: "Coding style component"},
|
||||
JP2_RGN: {Sym: "rgn", Description: "Region of interest"},
|
||||
JP2_QCD: {Sym: "qcd", Description: "Quantization default"},
|
||||
JP2_QCC: {Sym: "qcc", Description: "Quantization component"},
|
||||
JP2_POC: {Sym: "poc", Description: "Progression order change"},
|
||||
JP2_TLM: {Sym: "tlm", Description: "Tile-part lengths"},
|
||||
JP2_PLM: {Sym: "plm", Description: "Packet length (main header)"},
|
||||
JP2_PLT: {Sym: "plt", Description: "Packet length (tile-part header)"},
|
||||
JP2_PPM: {Sym: "ppm", Description: "Packed packet headers (main header)"},
|
||||
JP2_PPT: {Sym: "ppt", Description: "Packet packet headers (tile-part header)"},
|
||||
JP2_SOP: {Sym: "sop", Description: "Start of packet"},
|
||||
JP2_EPH: {Sym: "eph", Description: "End of packet header"},
|
||||
JP2_CRG: {Sym: "crg", Description: "Component registration"},
|
||||
JP2_COM: {Sym: "com", Description: "Comment"},
|
||||
}
|
||||
|
||||
func jp2cDecode(d *decode.D) any {
|
||||
if d.PeekUintBits(16) != JP2_SOC {
|
||||
d.Fatalf("no SOC marker")
|
||||
}
|
||||
|
||||
seenSOC := false
|
||||
seenSIZ := false
|
||||
seenEOC := false
|
||||
|
||||
for !seenEOC && !d.End() {
|
||||
d.FieldStruct("segment", func(d *decode.D) {
|
||||
marker := d.FieldU16("marker", jp2Markers, scalar.UintHex)
|
||||
switch marker {
|
||||
case JP2_SOC:
|
||||
// zero length
|
||||
seenSOC = true
|
||||
return
|
||||
case JP2_SOD:
|
||||
l, _ := d.PeekFind(16, 8, d.BitsLeft(), func(v uint64) bool {
|
||||
return v == JP2_SOT || v == JP2_EOC
|
||||
})
|
||||
d.FieldRawLen("data", l)
|
||||
case JP2_SOT:
|
||||
d.FieldU16("l_sot")
|
||||
d.FieldU16("i_sot")
|
||||
d.FieldU32("p_sot")
|
||||
d.FieldU8("tp_sot")
|
||||
d.FieldU8("tn_sot")
|
||||
case JP2_SIZ:
|
||||
seenSIZ = true
|
||||
d.FieldU16("l_siz")
|
||||
d.FieldU16("r_siz")
|
||||
d.FieldU32("x_siz")
|
||||
d.FieldU32("y_siz")
|
||||
d.FieldU32("xo_siz")
|
||||
d.FieldU32("yo_siz")
|
||||
d.FieldU32("xt_siz")
|
||||
d.FieldU32("yt_siz")
|
||||
d.FieldU32("xto_siz")
|
||||
d.FieldU32("yto_siz")
|
||||
cSiz := d.FieldU16("c_siz")
|
||||
d.FieldArray("components", func(d *decode.D) {
|
||||
for i := 0; i < int(cSiz); i++ {
|
||||
d.FieldStruct("component", func(d *decode.D) {
|
||||
d.FieldU8("s_sizi")
|
||||
d.FieldU8("xr_sizi")
|
||||
d.FieldU8("yr_sizi")
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
case JP2_COM:
|
||||
length := d.FieldU16("length")
|
||||
d.FieldU16("r_cme")
|
||||
d.FieldUTF8("data", int(length-4))
|
||||
case JP2_EOC:
|
||||
// zero length
|
||||
seenEOC = true
|
||||
return
|
||||
default:
|
||||
length := d.FieldU16("length")
|
||||
d.FieldRawLen("data", int64(length-2)*8)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if !(seenSOC && seenSIZ && seenEOC) {
|
||||
d.Fatalf("SOC, SIZ or EOC marker not found")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -124,7 +124,7 @@ var markers = scalar.UintMap{
|
||||
RST6: {Sym: "rst6", Description: "Restart with modulo 8 count 6"},
|
||||
RST7: {Sym: "rst7", Description: "Restart with modulo 8 count 7"},
|
||||
SOI: {Sym: "soi", Description: "Start of image"},
|
||||
EOI: {Sym: "eoi", Description: "End of image true"},
|
||||
EOI: {Sym: "eoi", Description: "End of image"},
|
||||
SOS: {Sym: "sos", Description: "Start of scan"},
|
||||
DQT: {Sym: "dqt", Description: "Define quantization table(s)"},
|
||||
DNL: {Sym: "dnl", Description: "Define number of lines"},
|
||||
@ -262,6 +262,29 @@ func jpegDecode(d *decode.D) any {
|
||||
}
|
||||
})
|
||||
})
|
||||
case DHT:
|
||||
lH := int64(d.FieldU16("lh"))
|
||||
d.FramedFn(lH*8-16, func(d *decode.D) {
|
||||
d.FieldArray("hs", func(d *decode.D) {
|
||||
for d.NotEnd() {
|
||||
d.FieldStruct("h", func(d *decode.D) {
|
||||
d.FieldU4("tc")
|
||||
d.FieldU4("th")
|
||||
hK := uint64(0)
|
||||
hV := uint64(0)
|
||||
d.FieldArrayLoop("l", func() bool { return hK < 16 }, func(d *decode.D) {
|
||||
hV += d.FieldU8("l")
|
||||
hK++
|
||||
})
|
||||
hK = 0
|
||||
d.FieldArrayLoop("v", func() bool { return hK < hV }, func(d *decode.D) {
|
||||
d.FieldU8("v")
|
||||
hK++
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
case RST0, RST1, RST2, RST3, RST4, RST5, RST6, RST7:
|
||||
inECD = true
|
||||
case TEM:
|
||||
|
56
format/jpeg/testdata/4x4.fqtest
vendored
@ -109,15 +109,57 @@ $ fq -d jpeg dv 4x4.jpg
|
||||
| | | [4]{}: marker 0x66-0x7c (22)
|
||||
0x60| ff | . | prefix: raw bits (valid) 0x66-0x67 (1)
|
||||
0x60| c4 | . | code: "dht" (196) (Define Huffman table(s)) 0x67-0x68 (1)
|
||||
0x60| 00 14 | .. | length: 20 0x68-0x6a (2)
|
||||
0x60| 00 01 00 00 00 00| ......| data: raw bits 0x6a-0x7c (18)
|
||||
0x70|00 00 00 00 00 00 00 00 00 00 00 08 |............ |
|
||||
0x60| 00 14 | .. | lh: 20 0x68-0x6a (2)
|
||||
| | | hs[0:1]: 0x6a-0x7c (18)
|
||||
| | | [0]{}: h 0x6a-0x7c (18)
|
||||
0x60| 00 | . | tc: 0 0x6a-0x6a.4 (0.4)
|
||||
0x60| 00 | . | th: 0 0x6a.4-0x6b (0.4)
|
||||
| | | l[0:16]: 0x6b-0x7b (16)
|
||||
0x60| 01 | . | [0]: 1 l 0x6b-0x6c (1)
|
||||
0x60| 00 | . | [1]: 0 l 0x6c-0x6d (1)
|
||||
0x60| 00 | . | [2]: 0 l 0x6d-0x6e (1)
|
||||
0x60| 00 | . | [3]: 0 l 0x6e-0x6f (1)
|
||||
0x60| 00| .| [4]: 0 l 0x6f-0x70 (1)
|
||||
0x70|00 |. | [5]: 0 l 0x70-0x71 (1)
|
||||
0x70| 00 | . | [6]: 0 l 0x71-0x72 (1)
|
||||
0x70| 00 | . | [7]: 0 l 0x72-0x73 (1)
|
||||
0x70| 00 | . | [8]: 0 l 0x73-0x74 (1)
|
||||
0x70| 00 | . | [9]: 0 l 0x74-0x75 (1)
|
||||
0x70| 00 | . | [10]: 0 l 0x75-0x76 (1)
|
||||
0x70| 00 | . | [11]: 0 l 0x76-0x77 (1)
|
||||
0x70| 00 | . | [12]: 0 l 0x77-0x78 (1)
|
||||
0x70| 00 | . | [13]: 0 l 0x78-0x79 (1)
|
||||
0x70| 00 | . | [14]: 0 l 0x79-0x7a (1)
|
||||
0x70| 00 | . | [15]: 0 l 0x7a-0x7b (1)
|
||||
| | | v[0:1]: 0x7b-0x7c (1)
|
||||
0x70| 08 | . | [0]: 8 v 0x7b-0x7c (1)
|
||||
| | | [5]{}: marker 0x7c-0x92 (22)
|
||||
0x70| ff | . | prefix: raw bits (valid) 0x7c-0x7d (1)
|
||||
0x70| c4 | . | code: "dht" (196) (Define Huffman table(s)) 0x7d-0x7e (1)
|
||||
0x70| 00 14| ..| length: 20 0x7e-0x80 (2)
|
||||
0x80|10 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................| data: raw bits 0x80-0x92 (18)
|
||||
0x90|00 00 |.. |
|
||||
0x70| 00 14| ..| lh: 20 0x7e-0x80 (2)
|
||||
| | | hs[0:1]: 0x80-0x92 (18)
|
||||
| | | [0]{}: h 0x80-0x92 (18)
|
||||
0x80|10 |. | tc: 1 0x80-0x80.4 (0.4)
|
||||
0x80|10 |. | th: 0 0x80.4-0x81 (0.4)
|
||||
| | | l[0:16]: 0x81-0x91 (16)
|
||||
0x80| 01 | . | [0]: 1 l 0x81-0x82 (1)
|
||||
0x80| 00 | . | [1]: 0 l 0x82-0x83 (1)
|
||||
0x80| 00 | . | [2]: 0 l 0x83-0x84 (1)
|
||||
0x80| 00 | . | [3]: 0 l 0x84-0x85 (1)
|
||||
0x80| 00 | . | [4]: 0 l 0x85-0x86 (1)
|
||||
0x80| 00 | . | [5]: 0 l 0x86-0x87 (1)
|
||||
0x80| 00 | . | [6]: 0 l 0x87-0x88 (1)
|
||||
0x80| 00 | . | [7]: 0 l 0x88-0x89 (1)
|
||||
0x80| 00 | . | [8]: 0 l 0x89-0x8a (1)
|
||||
0x80| 00 | . | [9]: 0 l 0x8a-0x8b (1)
|
||||
0x80| 00 | . | [10]: 0 l 0x8b-0x8c (1)
|
||||
0x80| 00 | . | [11]: 0 l 0x8c-0x8d (1)
|
||||
0x80| 00 | . | [12]: 0 l 0x8d-0x8e (1)
|
||||
0x80| 00 | . | [13]: 0 l 0x8e-0x8f (1)
|
||||
0x80| 00| .| [14]: 0 l 0x8f-0x90 (1)
|
||||
0x90|00 |. | [15]: 0 l 0x90-0x91 (1)
|
||||
| | | v[0:1]: 0x91-0x92 (1)
|
||||
0x90| 00 | . | [0]: 0 v 0x91-0x92 (1)
|
||||
| | | [6]{}: marker 0x92-0x9c (10)
|
||||
0x90| ff | . | prefix: raw bits (valid) 0x92-0x93 (1)
|
||||
0x90| da | . | code: "sos" (218) (Start of scan) 0x93-0x94 (1)
|
||||
@ -135,4 +177,4 @@ $ fq -d jpeg dv 4x4.jpg
|
||||
0x90| 3f bf | ?. | [7]: raw bits entropy_coded_data 0x9c-0x9e (2)
|
||||
| | | [8]{}: marker 0x9e-0xa0 (2)
|
||||
0x90| ff | . | prefix: raw bits (valid) 0x9e-0x9f (1)
|
||||
0x90| d9| .| code: "eoi" (217) (End of image true) 0x9f-0xa0 (1)
|
||||
0x90| d9| .| code: "eoi" (217) (End of image) 0x9f-0xa0 (1)
|
||||
|
BIN
format/jpeg/testdata/jp2c_3c.jp2
vendored
Normal file
129
format/jpeg/testdata/jp2c_3c.jp2.fqtest
vendored
Normal file
@ -0,0 +1,129 @@
|
||||
# jp2c with 3 components
|
||||
# gm convert -size 4x4 'gradient:#ff00ff-#00ff00' -colors 254 jp2c_3c.jp2
|
||||
$ fq dv jp2c_3c.jp2
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: jp2c_3c.jp2 (mp4) 0x0-0x18a (394)
|
||||
| | | boxes[0:4]: 0x0-0x18a (394)
|
||||
| | | [0]{}: box 0x0-0xc (12)
|
||||
0x000|00 00 00 0c |.... | size: 12 0x0-0x4 (4)
|
||||
0x000| 6a 50 20 20 | jP | type: "jP" (JPEG 2000 Signature) 0x4-0x8 (4)
|
||||
0x000| 0d 0a 87 0a | .... | signature: raw bits (valid) 0x8-0xc (4)
|
||||
| | | [1]{}: box 0xc-0x20 (20)
|
||||
0x000| 00 00 00 14| ....| size: 20 0xc-0x10 (4)
|
||||
0x010|66 74 79 70 |ftyp | type: "ftyp" (File type and compatibility) 0x10-0x14 (4)
|
||||
0x010| 6a 70 32 20 | jp2 | major_brand: "jp2" 0x14-0x18 (4)
|
||||
0x010| 00 00 00 00 | .... | minor_version: 0 0x18-0x1c (4)
|
||||
| | | brands[0:1]: 0x1c-0x20 (4)
|
||||
0x010| 6a 70 32 20| jp2 | [0]: "jp2" brand 0x1c-0x20 (4)
|
||||
| | | [2]{}: box 0x20-0x4d (45)
|
||||
0x020|00 00 00 2d |...- | size: 45 0x20-0x24 (4)
|
||||
0x020| 6a 70 32 68 | jp2h | type: "jp2h" (Header) 0x24-0x28 (4)
|
||||
| | | boxes[0:2]: 0x28-0x4d (37)
|
||||
| | | [0]{}: box 0x28-0x3e (22)
|
||||
0x020| 00 00 00 16 | .... | size: 22 0x28-0x2c (4)
|
||||
0x020| 69 68 64 72| ihdr| type: "ihdr" (Image Header) 0x2c-0x30 (4)
|
||||
0x030|00 00 00 04 |.... | width: 4 0x30-0x34 (4)
|
||||
0x030| 00 00 00 04 | .... | height: 4 0x34-0x38 (4)
|
||||
0x030| 00 03 | .. | nc: 3 0x38-0x3a (2)
|
||||
0x030| 0f | . | bpc: 16 0x3a-0x3b (1)
|
||||
0x030| 07 | . | c: "jpeg_2000" (7) 0x3b-0x3c (1)
|
||||
0x030| 00 | . | unk_c: 0 0x3c-0x3d (1)
|
||||
0x030| 00 | . | ipr: 0 0x3d-0x3e (1)
|
||||
| | | [1]{}: box 0x3e-0x4d (15)
|
||||
0x030| 00 00| ..| size: 15 0x3e-0x42 (4)
|
||||
0x040|00 0f |.. |
|
||||
0x040| 63 6f 6c 72 | colr | type: "colr" (Specifies the colourspace of the image) 0x42-0x46 (4)
|
||||
0x040| 01 00 00 00 | .... | parameter_type: "\x01\x00\x00\x00" 0x46-0x4a (4)
|
||||
0x040| 00 00 10 | ... | data: raw bits 0x4a-0x4d (3)
|
||||
| | | [3]{}: box 0x4d-0x18a (317)
|
||||
0x040| 00 00 00| ...| size: 0 (Rest of file) 0x4d-0x51 (4)
|
||||
0x050|00 |. |
|
||||
0x050| 6a 70 32 63 | jp2c | type: "jp2c" (JPEG 2000 contiguous codestream) 0x51-0x55 (4)
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| segments[0:13]: (jp2c) 0x55-0x18a (309)
|
||||
| | | [0]{}: segment 0x55-0x57 (2)
|
||||
0x050| ff 4f | .O | marker: "soc" (0xff4f) (Start of codestream) 0x55-0x57 (2)
|
||||
| | | [1]{}: segment 0x57-0x88 (49)
|
||||
0x050| ff 51 | .Q | marker: "siz" (0xff51) (Image and tile size) 0x57-0x59 (2)
|
||||
0x050| 00 2f | ./ | l_siz: 47 0x59-0x5b (2)
|
||||
0x050| 00 00 | .. | r_siz: 0 0x5b-0x5d (2)
|
||||
0x050| 00 00 00| ...| x_siz: 4 0x5d-0x61 (4)
|
||||
0x060|04 |. |
|
||||
0x060| 00 00 00 04 | .... | y_siz: 4 0x61-0x65 (4)
|
||||
0x060| 00 00 00 00 | .... | xo_siz: 0 0x65-0x69 (4)
|
||||
0x060| 00 00 00 00 | .... | yo_siz: 0 0x69-0x6d (4)
|
||||
0x060| 00 00 00| ...| xt_siz: 4 0x6d-0x71 (4)
|
||||
0x070|04 |. |
|
||||
0x070| 00 00 00 04 | .... | yt_siz: 4 0x71-0x75 (4)
|
||||
0x070| 00 00 00 00 | .... | xto_siz: 0 0x75-0x79 (4)
|
||||
0x070| 00 00 00 00 | .... | yto_siz: 0 0x79-0x7d (4)
|
||||
0x070| 00 03 | .. | c_siz: 3 0x7d-0x7f (2)
|
||||
| | | components[0:3]: 0x7f-0x88 (9)
|
||||
| | | [0]{}: component 0x7f-0x82 (3)
|
||||
0x070| 0f| .| s_sizi: 15 0x7f-0x80 (1)
|
||||
0x080|01 |. | xr_sizi: 1 0x80-0x81 (1)
|
||||
0x080| 01 | . | yr_sizi: 1 0x81-0x82 (1)
|
||||
| | | [1]{}: component 0x82-0x85 (3)
|
||||
0x080| 0f | . | s_sizi: 15 0x82-0x83 (1)
|
||||
0x080| 01 | . | xr_sizi: 1 0x83-0x84 (1)
|
||||
0x080| 01 | . | yr_sizi: 1 0x84-0x85 (1)
|
||||
| | | [2]{}: component 0x85-0x88 (3)
|
||||
0x080| 0f | . | s_sizi: 15 0x85-0x86 (1)
|
||||
0x080| 01 | . | xr_sizi: 1 0x86-0x87 (1)
|
||||
0x080| 01 | . | yr_sizi: 1 0x87-0x88 (1)
|
||||
| | | [2]{}: segment 0x88-0xac (36)
|
||||
0x080| ff 64 | .d | marker: "com" (0xff64) (Comment) 0x88-0x8a (2)
|
||||
0x080| 00 22 | ." | length: 34 0x8a-0x8c (2)
|
||||
0x080| 00 01 | .. | r_cme: 1 0x8c-0x8e (2)
|
||||
0x080| 43 72| Cr| data: "Creator: JasPer Version 2.0.33" 0x8e-0xac (30)
|
||||
0x090|65 61 74 6f 72 3a 20 4a 61 73 50 65 72 20 56 65|eator: JasPer Ve|
|
||||
0x0a0|72 73 69 6f 6e 20 32 2e 30 2e 33 33 |rsion 2.0.33 |
|
||||
| | | [3]{}: segment 0xac-0xba (14)
|
||||
0x0a0| ff 52 | .R | marker: "cod" (0xff52) (Coding style default) 0xac-0xae (2)
|
||||
0x0a0| 00 0c| ..| length: 12 0xae-0xb0 (2)
|
||||
0x0b0|00 00 00 01 01 05 04 04 00 01 |.......... | data: raw bits 0xb0-0xba (10)
|
||||
| | | [4]{}: segment 0xba-0xcf (21)
|
||||
0x0b0| ff 5c | .\ | marker: "qcd" (0xff5c) (Quantization default) 0xba-0xbc (2)
|
||||
0x0b0| 00 13 | .. | length: 19 0xbc-0xbe (2)
|
||||
0x0b0| 40 80| @.| data: raw bits 0xbe-0xcf (17)
|
||||
0x0c0|88 88 90 88 88 90 88 88 90 88 88 90 88 88 90 |............... |
|
||||
| | | [5]{}: segment 0xcf-0xe5 (22)
|
||||
0x0c0| ff| .| marker: "qcc" (0xff5d) (Quantization component) 0xcf-0xd1 (2)
|
||||
0x0d0|5d |] |
|
||||
0x0d0| 00 14 | .. | length: 20 0xd1-0xd3 (2)
|
||||
0x0d0| 01 40 80 88 88 90 88 88 90 88 88 90 88| .@...........| data: raw bits 0xd3-0xe5 (18)
|
||||
0x0e0|88 90 88 88 90 |..... |
|
||||
| | | [6]{}: segment 0xe5-0xfb (22)
|
||||
0x0e0| ff 5d | .] | marker: "qcc" (0xff5d) (Quantization component) 0xe5-0xe7 (2)
|
||||
0x0e0| 00 14 | .. | length: 20 0xe7-0xe9 (2)
|
||||
0x0e0| 02 40 80 88 88 90 88| .@.....| data: raw bits 0xe9-0xfb (18)
|
||||
0x0f0|88 90 88 88 90 88 88 90 88 88 90 |........... |
|
||||
| | | [7]{}: segment 0xfb-0x107 (12)
|
||||
0x0f0| ff 90 | .. | marker: "sot" (0xff90) (Start of tile) 0xfb-0xfd (2)
|
||||
0x0f0| 00 0a | .. | l_sot: 10 0xfd-0xff (2)
|
||||
0x0f0| 00| .| i_sot: 0 0xff-0x101 (2)
|
||||
0x100|00 |. |
|
||||
0x100| 00 00 00 8d | .... | p_sot: 141 0x101-0x105 (4)
|
||||
0x100| 00 | . | tp_sot: 0 0x105-0x106 (1)
|
||||
0x100| 01 | . | tn_sot: 1 0x106-0x107 (1)
|
||||
| | | [8]{}: segment 0x107-0x11d (22)
|
||||
0x100| ff 5d | .] | marker: "qcc" (0xff5d) (Quantization component) 0x107-0x109 (2)
|
||||
0x100| 00 14 | .. | length: 20 0x109-0x10b (2)
|
||||
0x100| 00 40 80 00 00| .@...| data: raw bits 0x10b-0x11d (18)
|
||||
0x110|00 00 00 00 00 00 00 88 88 90 88 88 90 |............. |
|
||||
| | | [9]{}: segment 0x11d-0x133 (22)
|
||||
0x110| ff 5d | .] | marker: "qcc" (0xff5d) (Quantization component) 0x11d-0x11f (2)
|
||||
0x110| 00| .| length: 20 0x11f-0x121 (2)
|
||||
0x120|14 |. |
|
||||
0x120| 01 40 80 00 00 00 00 00 00 00 00 00 88 88 90| .@.............| data: raw bits 0x121-0x133 (18)
|
||||
0x130|88 88 90 |... |
|
||||
| | | [10]{}: segment 0x133-0x149 (22)
|
||||
0x130| ff 5d | .] | marker: "qcc" (0xff5d) (Quantization component) 0x133-0x135 (2)
|
||||
0x130| 00 14 | .. | length: 20 0x135-0x137 (2)
|
||||
0x130| 02 40 80 00 00 00 00 00 00| .@.......| data: raw bits 0x137-0x149 (18)
|
||||
0x140|00 00 00 88 88 90 88 88 90 |......... |
|
||||
| | | [11]{}: segment 0x149-0x188 (63)
|
||||
0x140| ff 93 | .. | marker: "sod" (0xff93) (Start of data) 0x149-0x14b (2)
|
||||
0x140| c0 00 21 07 cf| ..!..| data: raw bits 0x14b-0x188 (61)
|
||||
0x150|fc 30 08 05 3f cf fc 30 08 05 3f 80 80 80 80 80|.0..?..0..?.....|
|
||||
* |until 0x187.7 (61) | |
|
||||
| | | [12]{}: segment 0x188-0x18a (2)
|
||||
0x180| ff d9| | ..| | marker: "eoc" (0xffd9) (End of codestream) 0x188-0x18a (2)
|
BIN
format/jpeg/testdata/test.j2c
vendored
Normal file
59
format/jpeg/testdata/test.j2c.fqtest
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
# test probe
|
||||
$ fq dv test.j2c
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.[0:9]: test.j2c (jp2c) 0x0-0xa4 (164)
|
||||
| | | [0]{}: segment 0x0-0x2 (2)
|
||||
0x00|ff 4f |.O | marker: "soc" (0xff4f) (Start of codestream) 0x0-0x2 (2)
|
||||
| | | [1]{}: segment 0x2-0x2d (43)
|
||||
0x00| ff 51 | .Q | marker: "siz" (0xff51) (Image and tile size) 0x2-0x4 (2)
|
||||
0x00| 00 29 | .) | l_siz: 41 0x4-0x6 (2)
|
||||
0x00| 00 00 | .. | r_siz: 0 0x6-0x8 (2)
|
||||
0x00| 00 00 00 01 | .... | x_siz: 1 0x8-0xc (4)
|
||||
0x00| 00 00 00 01| ....| y_siz: 1 0xc-0x10 (4)
|
||||
0x10|00 00 00 00 |.... | xo_siz: 0 0x10-0x14 (4)
|
||||
0x10| 00 00 00 00 | .... | yo_siz: 0 0x14-0x18 (4)
|
||||
0x10| 00 00 00 01 | .... | xt_siz: 1 0x18-0x1c (4)
|
||||
0x10| 00 00 00 01| ....| yt_siz: 1 0x1c-0x20 (4)
|
||||
0x20|00 00 00 00 |.... | xto_siz: 0 0x20-0x24 (4)
|
||||
0x20| 00 00 00 00 | .... | yto_siz: 0 0x24-0x28 (4)
|
||||
0x20| 00 01 | .. | c_siz: 1 0x28-0x2a (2)
|
||||
| | | components[0:1]: 0x2a-0x2d (3)
|
||||
| | | [0]{}: component 0x2a-0x2d (3)
|
||||
0x20| 0f | . | s_sizi: 15 0x2a-0x2b (1)
|
||||
0x20| 01 | . | xr_sizi: 1 0x2b-0x2c (1)
|
||||
0x20| 01 | . | yr_sizi: 1 0x2c-0x2d (1)
|
||||
| | | [2]{}: segment 0x2d-0x51 (36)
|
||||
0x20| ff 64 | .d | marker: "com" (0xff64) (Comment) 0x2d-0x2f (2)
|
||||
0x20| 00| .| length: 34 0x2f-0x31 (2)
|
||||
0x30|22 |" |
|
||||
0x30| 00 01 | .. | r_cme: 1 0x31-0x33 (2)
|
||||
0x30| 43 72 65 61 74 6f 72 3a 20 4a 61 73 50| Creator: JasP| data: "Creator: JasPer Version 2.0.33" 0x33-0x51 (30)
|
||||
0x40|65 72 20 56 65 72 73 69 6f 6e 20 32 2e 30 2e 33|er Version 2.0.3|
|
||||
0x50|33 |3 |
|
||||
| | | [3]{}: segment 0x51-0x5f (14)
|
||||
0x50| ff 52 | .R | marker: "cod" (0xff52) (Coding style default) 0x51-0x53 (2)
|
||||
0x50| 00 0c | .. | length: 12 0x53-0x55 (2)
|
||||
0x50| 00 00 00 01 00 05 04 04 00 01 | .......... | data: raw bits 0x55-0x5f (10)
|
||||
| | | [4]{}: segment 0x5f-0x74 (21)
|
||||
0x50| ff| .| marker: "qcd" (0xff5c) (Quantization default) 0x5f-0x61 (2)
|
||||
0x60|5c |\ |
|
||||
0x60| 00 13 | .. | length: 19 0x61-0x63 (2)
|
||||
0x60| 40 80 88 88 90 88 88 90 88 88 90 88 88| @............| data: raw bits 0x63-0x74 (17)
|
||||
0x70|90 88 88 90 |.... |
|
||||
| | | [5]{}: segment 0x74-0x80 (12)
|
||||
0x70| ff 90 | .. | marker: "sot" (0xff90) (Start of tile) 0x74-0x76 (2)
|
||||
0x70| 00 0a | .. | l_sot: 10 0x76-0x78 (2)
|
||||
0x70| 00 00 | .. | i_sot: 0 0x78-0x7a (2)
|
||||
0x70| 00 00 00 2e | .... | p_sot: 46 0x7a-0x7e (4)
|
||||
0x70| 00 | . | tp_sot: 0 0x7e-0x7f (1)
|
||||
0x70| 01| .| tn_sot: 1 0x7f-0x80 (1)
|
||||
| | | [6]{}: segment 0x80-0x96 (22)
|
||||
0x80|ff 5d |.] | marker: "qcc" (0xff5d) (Quantization component) 0x80-0x82 (2)
|
||||
0x80| 00 14 | .. | length: 20 0x82-0x84 (2)
|
||||
0x80| 00 40 80 00 00 00 00 00 00 00 00 00| .@..........| data: raw bits 0x84-0x96 (18)
|
||||
0x90|00 00 00 00 00 00 |...... |
|
||||
| | | [7]{}: segment 0x96-0xa2 (12)
|
||||
0x90| ff 93 | .. | marker: "sod" (0xff93) (Start of data) 0x96-0x98 (2)
|
||||
0x90| df f8 90 08 07 80 80 80| ........| data: raw bits 0x98-0xa2 (10)
|
||||
0xa0|80 80 |.. |
|
||||
| | | [8]{}: segment 0xa2-0xa4 (2)
|
||||
0xa0| ff d9| | ..| | marker: "eoc" (0xffd9) (End of codestream) 0xa2-0xa4 (2)
|
BIN
format/jpeg/testdata/test.jp2
vendored
Normal file
98
format/jpeg/testdata/test.jp2.fqtest
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
# gm convert "xc:#000000" test.jp2
|
||||
$ fq dv test.jp2
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: test.jp2 (mp4) 0x0-0xf9 (249)
|
||||
| | | boxes[0:4]: 0x0-0xf9 (249)
|
||||
| | | [0]{}: box 0x0-0xc (12)
|
||||
0x00|00 00 00 0c |.... | size: 12 0x0-0x4 (4)
|
||||
0x00| 6a 50 20 20 | jP | type: "jP" (JPEG 2000 Signature) 0x4-0x8 (4)
|
||||
0x00| 0d 0a 87 0a | .... | signature: raw bits (valid) 0x8-0xc (4)
|
||||
| | | [1]{}: box 0xc-0x20 (20)
|
||||
0x00| 00 00 00 14| ....| size: 20 0xc-0x10 (4)
|
||||
0x10|66 74 79 70 |ftyp | type: "ftyp" (File type and compatibility) 0x10-0x14 (4)
|
||||
0x10| 6a 70 32 20 | jp2 | major_brand: "jp2" 0x14-0x18 (4)
|
||||
0x10| 00 00 00 00 | .... | minor_version: 0 0x18-0x1c (4)
|
||||
| | | brands[0:1]: 0x1c-0x20 (4)
|
||||
0x10| 6a 70 32 20| jp2 | [0]: "jp2" brand 0x1c-0x20 (4)
|
||||
| | | [2]{}: box 0x20-0x4d (45)
|
||||
0x20|00 00 00 2d |...- | size: 45 0x20-0x24 (4)
|
||||
0x20| 6a 70 32 68 | jp2h | type: "jp2h" (Header) 0x24-0x28 (4)
|
||||
| | | boxes[0:2]: 0x28-0x4d (37)
|
||||
| | | [0]{}: box 0x28-0x3e (22)
|
||||
0x20| 00 00 00 16 | .... | size: 22 0x28-0x2c (4)
|
||||
0x20| 69 68 64 72| ihdr| type: "ihdr" (Image Header) 0x2c-0x30 (4)
|
||||
0x30|00 00 00 01 |.... | width: 1 0x30-0x34 (4)
|
||||
0x30| 00 00 00 01 | .... | height: 1 0x34-0x38 (4)
|
||||
0x30| 00 01 | .. | nc: 1 0x38-0x3a (2)
|
||||
0x30| 0f | . | bpc: 16 0x3a-0x3b (1)
|
||||
0x30| 07 | . | c: "jpeg_2000" (7) 0x3b-0x3c (1)
|
||||
0x30| 00 | . | unk_c: 0 0x3c-0x3d (1)
|
||||
0x30| 00 | . | ipr: 0 0x3d-0x3e (1)
|
||||
| | | [1]{}: box 0x3e-0x4d (15)
|
||||
0x30| 00 00| ..| size: 15 0x3e-0x42 (4)
|
||||
0x40|00 0f |.. |
|
||||
0x40| 63 6f 6c 72 | colr | type: "colr" (Specifies the colourspace of the image) 0x42-0x46 (4)
|
||||
0x40| 01 00 00 00 | .... | parameter_type: "\x01\x00\x00\x00" 0x46-0x4a (4)
|
||||
0x40| 00 00 11 | ... | data: raw bits 0x4a-0x4d (3)
|
||||
| | | [3]{}: box 0x4d-0xf9 (172)
|
||||
0x40| 00 00 00| ...| size: 0 (Rest of file) 0x4d-0x51 (4)
|
||||
0x50|00 |. |
|
||||
0x50| 6a 70 32 63 | jp2c | type: "jp2c" (JPEG 2000 contiguous codestream) 0x51-0x55 (4)
|
||||
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef| segments[0:9]: (jp2c) 0x55-0xf9 (164)
|
||||
| | | [0]{}: segment 0x55-0x57 (2)
|
||||
0x50| ff 4f | .O | marker: "soc" (0xff4f) (Start of codestream) 0x55-0x57 (2)
|
||||
| | | [1]{}: segment 0x57-0x82 (43)
|
||||
0x50| ff 51 | .Q | marker: "siz" (0xff51) (Image and tile size) 0x57-0x59 (2)
|
||||
0x50| 00 29 | .) | l_siz: 41 0x59-0x5b (2)
|
||||
0x50| 00 00 | .. | r_siz: 0 0x5b-0x5d (2)
|
||||
0x50| 00 00 00| ...| x_siz: 1 0x5d-0x61 (4)
|
||||
0x60|01 |. |
|
||||
0x60| 00 00 00 01 | .... | y_siz: 1 0x61-0x65 (4)
|
||||
0x60| 00 00 00 00 | .... | xo_siz: 0 0x65-0x69 (4)
|
||||
0x60| 00 00 00 00 | .... | yo_siz: 0 0x69-0x6d (4)
|
||||
0x60| 00 00 00| ...| xt_siz: 1 0x6d-0x71 (4)
|
||||
0x70|01 |. |
|
||||
0x70| 00 00 00 01 | .... | yt_siz: 1 0x71-0x75 (4)
|
||||
0x70| 00 00 00 00 | .... | xto_siz: 0 0x75-0x79 (4)
|
||||
0x70| 00 00 00 00 | .... | yto_siz: 0 0x79-0x7d (4)
|
||||
0x70| 00 01 | .. | c_siz: 1 0x7d-0x7f (2)
|
||||
| | | components[0:1]: 0x7f-0x82 (3)
|
||||
| | | [0]{}: component 0x7f-0x82 (3)
|
||||
0x70| 0f| .| s_sizi: 15 0x7f-0x80 (1)
|
||||
0x80|01 |. | xr_sizi: 1 0x80-0x81 (1)
|
||||
0x80| 01 | . | yr_sizi: 1 0x81-0x82 (1)
|
||||
| | | [2]{}: segment 0x82-0xa6 (36)
|
||||
0x80| ff 64 | .d | marker: "com" (0xff64) (Comment) 0x82-0x84 (2)
|
||||
0x80| 00 22 | ." | length: 34 0x84-0x86 (2)
|
||||
0x80| 00 01 | .. | r_cme: 1 0x86-0x88 (2)
|
||||
0x80| 43 72 65 61 74 6f 72 3a| Creator:| data: "Creator: JasPer Version 2.0.33" 0x88-0xa6 (30)
|
||||
0x90|20 4a 61 73 50 65 72 20 56 65 72 73 69 6f 6e 20| JasPer Version |
|
||||
0xa0|32 2e 30 2e 33 33 |2.0.33 |
|
||||
| | | [3]{}: segment 0xa6-0xb4 (14)
|
||||
0xa0| ff 52 | .R | marker: "cod" (0xff52) (Coding style default) 0xa6-0xa8 (2)
|
||||
0xa0| 00 0c | .. | length: 12 0xa8-0xaa (2)
|
||||
0xa0| 00 00 00 01 00 05| ......| data: raw bits 0xaa-0xb4 (10)
|
||||
0xb0|04 04 00 01 |.... |
|
||||
| | | [4]{}: segment 0xb4-0xc9 (21)
|
||||
0xb0| ff 5c | .\ | marker: "qcd" (0xff5c) (Quantization default) 0xb4-0xb6 (2)
|
||||
0xb0| 00 13 | .. | length: 19 0xb6-0xb8 (2)
|
||||
0xb0| 40 80 88 88 90 88 88 90| @.......| data: raw bits 0xb8-0xc9 (17)
|
||||
0xc0|88 88 90 88 88 90 88 88 90 |......... |
|
||||
| | | [5]{}: segment 0xc9-0xd5 (12)
|
||||
0xc0| ff 90 | .. | marker: "sot" (0xff90) (Start of tile) 0xc9-0xcb (2)
|
||||
0xc0| 00 0a | .. | l_sot: 10 0xcb-0xcd (2)
|
||||
0xc0| 00 00 | .. | i_sot: 0 0xcd-0xcf (2)
|
||||
0xc0| 00| .| p_sot: 46 0xcf-0xd3 (4)
|
||||
0xd0|00 00 2e |... |
|
||||
0xd0| 00 | . | tp_sot: 0 0xd3-0xd4 (1)
|
||||
0xd0| 01 | . | tn_sot: 1 0xd4-0xd5 (1)
|
||||
| | | [6]{}: segment 0xd5-0xeb (22)
|
||||
0xd0| ff 5d | .] | marker: "qcc" (0xff5d) (Quantization component) 0xd5-0xd7 (2)
|
||||
0xd0| 00 14 | .. | length: 20 0xd7-0xd9 (2)
|
||||
0xd0| 00 40 80 00 00 00 00| .@.....| data: raw bits 0xd9-0xeb (18)
|
||||
0xe0|00 00 00 00 00 00 00 00 00 00 00 |........... |
|
||||
| | | [7]{}: segment 0xeb-0xf7 (12)
|
||||
0xe0| ff 93 | .. | marker: "sod" (0xff93) (Start of data) 0xeb-0xed (2)
|
||||
0xe0| df f8 90| ...| data: raw bits 0xed-0xf7 (10)
|
||||
0xf0|08 07 80 80 80 80 80 |....... |
|
||||
| | | [8]{}: segment 0xf7-0xf9 (2)
|
||||
0xf0| ff d9| | ..| | marker: "eoc" (0xffd9) (End of codestream) 0xf7-0xf9 (2)
|