1
1
mirror of https://github.com/wader/fq.git synced 2024-11-23 18:56:52 +03:00
Commit Graph

275 Commits

Author SHA1 Message Date
Mattias Wadman
c3a0686c9e mp3_frame_tags: Refactor and rename xing format to mp3_frame_tags
Make more sense to use a more general name when there is both info and xing
and possibly vbri in the future. Also both xing and info seems to have extension
fields

Remove some old tests that are not really needed anymore.
2022-11-16 17:32:03 +01:00
Mattias Wadman
4bfd9d8119 doc: Add link to nttw6 presentation video and slides
Also clarify install instructions a bit
2022-10-30 13:28:46 +01:00
Mattias Wadman
2a86d323b4 doc,rtmp,pcap,markdown: Add more examples 2022-10-09 19:18:14 +02:00
Mattias Wadman
09ea08f3aa
Merge pull request #427 from dgmcdona/bplist
Adds support for Apple Binary Plist, version 00
2022-10-04 14:25:53 +02:00
Mattias Wadman
0fdc03a4f1 doc: Fix some incorrect example prompts 2022-09-27 13:42:31 +02:00
Mattias Wadman
00ee10a1a1 interp: Make to{actual,sym} behave similar to tovalue
Before if you did toactual it behaved differently and even gave error for
a scalar that only had actual value set. Now both to{actal,sym} works
similar to tovalue but will force if actual or sym value should be used.
2022-09-25 17:53:12 +02:00
David McDonald
bcccde2358 Fixes and embeds documentation 2022-09-24 12:57:11 -05:00
David McDonald
5f61994087 adds function for decoding fixed sized arrays 2022-09-23 20:50:41 -05:00
David McDonald
a77cec921f Added documentation and tests, fixed bad date parsing 2022-09-23 20:23:23 -05:00
Mattias Wadman
a7a101ca67 doc,help: Nicer format help and move help tests into each format
Also add authors to avro and macho decoders

Generated with:
for i in $(go run . -r -n '_registry | [([([.files[][].name | split(".")[0]] | unique[]), (.formats[].name)] | count[] | select(.[1] == 2)[0]), (.formats[] | select(.decode_in_arg).name)] | unique[]'); do DIR=$(dirname $(find format -name $i.go)); echo "$ fq -h $i" > "$DIR/testdata/help_$i.fqtest" ; done
2022-09-22 23:07:58 +02:00
Mattias Wadman
725ab1b17b doc,html,xml: Add more documentation and examples 2022-09-20 17:35:27 +02:00
Mattias Wadman
fe64530e11 csv: Add tsv and header example
Also fix string esacpe in fuzz options parser
2022-09-15 01:16:45 +02:00
Mattias Wadman
1385b5d0ba wasm: Add some documentation 2022-09-12 11:53:48 +02:00
Mattias Wadman
abd19ed89b doc: Fix format sections a bit 2022-09-11 09:55:56 +02:00
Mattias Wadman
87b2c6c10c help,doc: Use markdown for format documentation again
Markdown is used as is in online documentation and in cli the markdown decoder
is used to decode and the some jq code massages it into something cli friendly.

Was just too much of a mess to have doc in jq.
2022-09-11 00:53:29 +02:00
Mattias Wadman
095e1161b7 xml: Switch from "-" to "@" as attribute prefix and make it an option
Seems to be more common.
2022-08-25 17:15:23 +02:00
Mattias Wadman
8fc43533a9 prores_frame: Add basic container and frame header decoder 2022-08-24 19:33:35 +02:00
bitbears-dev
89cb0d8e91
Merge branch 'wader:master' into wasm-support 2022-08-22 21:01:19 +09:00
@0xb17bea125
ce43887298
wasm: make doc 2022-08-20 14:58:05 +09:00
Mattias Wadman
394717cae8 gopacket: Switch/update to new fork, remove SLL2 hack
SLL2 support merged upstream https://github.com/gopacket/gopacket/pull/1

This also cuts down a bit on some indirect deps
2022-08-20 01:25:03 +02:00
Mattias Wadman
701c67c136 jsonl: Add decoder, also tojsonl encoder 2022-08-15 19:43:59 +02:00
Mattias Wadman
46dca8cdc5 dns: Don't use dns (udp) format for tcp also
Fixes issue with TCP streams being probed as dns over TCP
2022-08-09 18:15:34 +02:00
Mattias Wadman
f4e0137244 xml,html: Always include attrs and children in array mode
Was hard to use when you dont know what indexes things will have. They are sill optioal for toxml
2022-08-04 11:44:59 +02:00
Mattias Wadman
725c8e83ab macho: Split into macho/macho_fat, fix offset issue and add string decoding
Split fat macho into own decoder macho_fat. This also fixes issue with section
offset etc not being correct as they are from the start of each embedded file.

Make all address and offset field be in hex.

Decode __cstring, __ustring and __cfstring sections.

Fix LC_ENCRYPTION_INFO_64 missing pading issue.

Skip ranging for __bss and __common as they dont have any data in the file.

Simplifed magic handling a bit and add symbols.

Simplified state struct field, had redudant struct.
2022-08-02 14:36:53 +02:00
Mattias Wadman
ed4247836c doc,interp: Update and add more examples 2022-07-30 20:21:35 +02:00
Mattias Wadman
f247edb592 doc: Update README demo a bit with new features 2022-07-29 16:34:27 +02:00
Mattias Wadman
10cc551871 doc: Improve and cleanup text formats
Hopefully will get time to revamp how docs work
2022-07-24 11:55:50 +02:00
Mattias Wadman
cae288e6be format,intepr: Refactor json, yaml, etc into formats also move out related functions
json, yaml, toml, xml, html, csv are now normal formats and most of them also particiate
in probing (not html and csv).

Also fixes a bunch of bugs in to/fromxml, to/fromjq etc.
2022-07-23 21:48:45 +02:00
Mattias Wadman
7aff654a43 doc: Clarify decode, slurp and spew args 2022-07-21 20:56:19 +02:00
Mattias Wadman
342612eb7e dev: Cleanup linters and fix some unused args 2022-07-19 18:33:50 +02:00
Mattias Wadman
b03887229c doc: Use singular jq value to refer to jq value 2022-07-10 10:44:56 +02:00
Mattias Wadman
64f3e5c717 fairplay: Add basic SPC decoder and PSSH system id 2022-07-07 17:11:55 +02:00
Mattias Wadman
417255b72b bitcoin: Add blkdat, block, transcation and script decoder 2022-07-04 09:59:51 +02:00
Mattias Wadman
d4fe00d65c
Merge pull request #299 from wader/interp-add-group
interp: Add group/0
2022-06-30 12:31:37 +02:00
Mattias Wadman
b10061196f doc: Typos and add note about Try* functions 2022-06-30 12:23:59 +02:00
Sergei Kuzmin
02f00be9a6
Update usage.md 2022-06-26 04:56:56 -07:00
Mattias Wadman
a3c33fc1f4 interp: Add group/0
Also add tests for count, count_by, delta and delta_by
2022-06-21 15:18:12 +02:00
Mattias Wadman
0863374f8c doc: Correct bencode spec URL
Also rename _tojq value_sep to object_sep and fix formats_diagram.jq to use tomd5
2022-06-13 18:49:34 +02:00
Mattias Wadman
3b717c3ba4 interp: Add to/from<encoding> for some common serialzations, encodings and hashes
Add toxml/fromxml for XML encoding, mighe be lossy on ordering
fromxml has {seq:bool} to add #seq attributes to improve ordering
toxml has {indent:number} to choose space indent depth

Add tojson, same as in jq but also has {indent:number} options

Add toyaml/fromyaml for YAML

Add totoml/fromtoml for TOML

Add tojq/fromjq for jq-flavored JSON (optional quotes for keys, comments and trailing commas support)

Add tocsv/fromcsv for CSV
formcvs takes {comma:string, comment:string} for custom separtor and comment character

Rename/split hex into tohex/fromhex
Rename/split base64 into tobase64/frombase64
tobase64/frombase64 takes {encoding:string} option for base64 flavour (std, url, rawstd, rawurl)

Add to/from<format> urlpath, urlquery, url, xmlentities, base64, hex

Add to<hash> md4, md5, sha1, sha256, sha512, sha3_224, sha3_256, sha3_384, sha3_512

Add to/from<encoding> iso8859-1, utf8, utf16, utf16le, utf16be
2022-05-28 16:31:20 +02:00
Mattias Wadman
aa694e3f20 zip: s/Decompress/Uncompress/ 2022-05-26 19:36:06 +02:00
Mattias Wadman
47350e46a6 zip: Add uncompress=false test and some docs 2022-05-26 16:39:01 +02:00
Mattias Wadman
8021492197 interp: help: Fix incorrect options example 2022-05-26 12:52:51 +02:00
Mattias Wadman
e641274487 zip: Add zip64 support and uncompress option
{uncompress:boolean} uncompress and probe, default true
2022-05-26 12:46:50 +02:00
Mattias Wadman
a980656c15 doc: go 1.18 and improve intro text a bit 2022-05-23 21:57:45 +02:00
Mattias Wadman
e9d9f8aef9 fq: Use go 1.18
Rename s/interface{}/any/g
Preparation for using generics in decode API and native jq funcations etc
Remove some unused linter ignores as linter has been fixed
2022-05-20 15:23:16 +02:00
Mattias Wadman
1aaaefb0ac wav,bencode,mpeg_ps_packet,id3v1: Random fixes
wav: Rest of file should description not symbolic value
bencode: Remove redundant torepr example
mpeg_ps_packet,id3v1: Remove whitespace in symbolic value
2022-05-05 19:45:05 +02:00
Mattias Wadman
f4480c6fe5 decode,interp: Support for format specific options
interp: Refactor format help and also include options
interp: Add -o name=@path to load file content as value (not documented yet, might change)
interp,decode: Expose decode out value as _out (might change)
interp: Refactor foramts.jq into format_{decode,func,include}.jq
interp: Refactor torepr into _format_func for generic format function overloading
interp: Refactor -o options parsing to be more generic and collect unknowns options to be used as format options
decode of decode alises
func for format overloaded functions
include for format specific jq functions (also _help, torepr etc)
flac_frame: Add bits_per_sample option
mp3: Add max_unique_header_config and max_sync_seek options
mp4: Add decode_samples and allow_truncate options
avc_au: Has length_size option
hevc_au: Has length_size option
aac_frame: Has object_typee option
doc: Rewrite format doc generation, less hack more jq
2022-05-01 17:08:30 +02:00
Mattias Wadman
21ad628add interp: dump: Show field name for compound values in arrays
mp3: Remove one level of struct for granales
dump: Makes it a bit easier to understand array of arrays/structs.
avro_ocf: Rename ocf.go -> avro_ocr.go to have same name of source file as format
pcap,pcapng: Rename tcp flow struct to tcp_connection, makes more sense i think
mp4: Add ISOBMFF to format description
2022-04-21 17:47:15 +02:00
Mattias Wadman
788b0ac197 rtmp,amf0: Improve decoders, aac asc, chunk stream interrupt, fix amf0 ecma arrays
rtmp: Handle chunk streams that have been interrupted (capture terminated in middle of stream etc)
rtmp: Decode AAC ASC
rtmp: Add ffmpeg client/server stream test
rtmp: Decode user control messages
rtmo: Decode all data messages
amf0: Fix ecma array decoding
2022-04-04 14:42:16 +02:00
Mattias Wadman
e8dc7112b6 ipv6,icmpv6: Add decoder
Refactor to use groups between network layers to make them less coupled and reusable:
link_frame (ethernet etc)
inet_packet (ipv4,ipv6 etc)
ip_packet (tcp packet (not stream), udp segment etc)

Rename data to payload as i think it makes more sense for network data
2022-04-03 17:43:51 +02:00
Mattias Wadman
d8aaf30345 rtmp,amf0: Add decoders
Basic RTMP support, used via tcp_stream group (pcap etc) or manually.
Basic AMF0 support, mostly what is used in RTMP.
2022-04-01 13:07:20 +02:00
Mattias Wadman
74978c9d08 hevc: Add hevc_vps, hevc_sps and hevc_pps decoders
Some extensions and other things still missing
2022-03-24 18:56:56 +01:00
Mattias Wadman
7cea8757b1 doc: Add 0.0.6 changes 2022-03-11 17:01:26 +01:00
Mattias Wadman
dff7e7dadb interp: Cleanup binary regexp overloading and add explode
Add explode for binary that explode into an array of the binary unit tobits
Remove scan_toend as it feels a bit weird and one can use tobytes | .[match(...):] instead
Some general cleanup also
2022-03-09 20:17:12 +01:00
Mattias Wadman
b97776c9e3 doc: Add fq bts2022 presentation 2022-03-08 18:20:18 +01:00
Mattias Wadman
3f50bb90a6 interp: Rework formats and options help
Replace --formats with --help formats
Add --help options
2022-03-03 18:25:20 +01:00
Mattias Wadman
920629f5fd doc: Regenerate and fix macho section size
Make macho format documentaion a bit more consistent.
2022-03-03 09:55:53 +01:00
Mattias Wadman
0a043f9096 repl,interp: Refactor repl and slurp
Now repl, slurp and help implemented using same query rewrite.
Include filename context in error if possible.
Add spew function that does opposite of slurp.
Start of help infra, not done or documented yet.
Show error pointer on parse error.
Rename internal eval to _eval and make eval be wrapper that
does rewrite and has various eror handling etc.
Nicer repl, slupr and help errors.
2022-03-01 18:31:00 +01:00
Mattias Wadman
d3397cf9e7 doc: Tweak format diagram 2022-02-28 10:42:39 +01:00
Mattias Wadman
758b2d0e34 doc: Regenerate after macho merge 2022-02-28 10:28:21 +01:00
siddik.acil
2e7767cd05 macho: remake docs 2022-02-21 20:33:30 +01:00
Mattias Wadman
d334c2d4ea doc: Add href in supported format list 2022-02-19 01:33:45 +01:00
Mattias Wadman
c95b0d6d19 doc: Forgot make doc 2022-02-16 20:13:28 +01:00
Mattias Wadman
68ba2e810e doc: Add CHANGES.md documenting release changes 2022-02-13 23:36:11 +01:00
Mattias Wadman
d4cc544448
Merge pull request #153 from wader/doc-dev-more-decode-api
doc: More decode API details and polish
2022-02-13 17:22:04 +01:00
Mattias Wadman
b3504680f7 doc: More decode API details and polish 2022-02-13 16:28:59 +01:00
Mattias Wadman
dd3e40fb1c doc: Unbreak formats_digaram.jq since radix change 2022-02-13 10:31:53 +01:00
Xentripetal
d54011663f make doc 2022-02-12 22:17:32 -06:00
Xentripetal
9636613ec6 Merge branch 'master' of https://github.com/wader/fq into avro 2022-02-12 22:16:50 -06:00
Mattias Wadman
b86da7aecc doc: Add inital decoder API documentation 2022-02-12 16:13:29 +01:00
Mattias Wadman
48a19cb82c interp: Add paste function to allow pasting text into REPL etc
Also refactor readline and eval args into option struct and partinally start
addressing some side effects during completion.
2022-02-11 17:59:06 +01:00
Xentripetal
0300c955c5 Take heading off doc to match make doc format 2022-02-09 20:59:29 -06:00
Xentripetal
2605bce4e3 Lint and add basic doc 2022-02-09 20:46:12 -06:00
Mattias Wadman
36307857de doc: Cleanup and add more decode value and binary documentation 2022-02-09 21:08:01 +01:00
Mattias Wadman
06245d1295 binary,decode,doc: Rename buffer to binary and add some documentation
Rename buffer to binary. Still some work left what to call buffer/binary in decode code.
Document decode value and binary type
Fix proper unit padding for tobytes and add still undocumenated extra padding argument.
Add some additional binary tests
2022-02-08 22:20:28 +01:00
Xentripetal
5b11385ea4 Pull latest from wader 2022-02-07 17:35:33 -06:00
Mattias Wadman
0312c92c31 asn1_ber: Add more doc and multiple outputs for frompem 2022-02-07 17:41:05 +01:00
Mattias Wadman
0829c167cc asn1_ber: Add decoder
Basic support, can also do CER and DER but without any extra validation.
No schema support.

Redo format doc.md usage a bit, now format/<dir>/<format>.md instead.

Related to #20
2022-02-06 22:13:03 +01:00
Mattias Wadman
91b0fed929
Merge pull request #127 from wader/doc-foramts-option-links
doc: Add format links to format table
2022-02-05 18:24:03 +01:00
Mattias Wadman
c15f5283c0 doc: Add format links to format table 2022-02-05 18:15:18 +01:00
Mattias Wadman
366f6b185c interp: Support force decode as -o force=true 2022-02-05 17:24:42 +01:00
Mattias Wadman
7c5215347d bitio,decode: Refactor bitio usage and make buffer slicing more correct
Remove bitio.Buffer layer. bitio.Buffer was a kitchen sink layer with helpers
now it's just a buffer and most functions have been moved to decode instead.

bitio package now only have primitive types and functions simialar to standard
library io and bytes packages.

Make nearly eveything internally use bitio.Bit* interfaces so that slicing work
correctly this will also make it possible to start experimenting with more
complicated silcing helpers, ex things like:
breplace(.header.bitrate; 123) to get a new buffer with bitrate changed.
2022-02-04 21:41:53 +01:00
Mattias Wadman
710c29b24e doc: Color edges in diagram based on dest 2022-02-02 19:39:33 +01:00
Mattias Wadman
2ab395a03b protobuf: Add note about sub message decoding
Fix and cleanup some other doc also
2022-02-01 22:22:19 +01:00
Mattias Wadman
6b51b0676f doc: More display alias leftover fixes 2022-01-29 13:22:10 +01:00
Mattias Wadman
f0ce7179b2 doc: Document display and some more jq hints
Also fixed some verbose -> dv leftovers
2022-01-29 13:10:25 +01:00
Mattias Wadman
bc20f09fdb
Merge pull request #117 from wader/make-cleanup-targets
make: Cleanup some not very used targets
2022-01-29 12:31:10 +01:00
Mattias Wadman
b66e3287f2
Merge pull request #112 from wader/interp-cleanup-d-alises
interp: Cleanup display aliases, now: d, da, dd, dv, ddv
2022-01-29 12:28:46 +01:00
Mattias Wadman
fc52f20ed1
Merge pull request #116 from wader/doc-fix-filenames
doc,matroska: Fix filesname in example
2022-01-29 12:27:38 +01:00
Mattias Wadman
bf170be8ea make: Cleanup some not very used targets 2022-01-29 12:27:15 +01:00
Mattias Wadman
2efc3cba9b
Merge pull request #115 from wader/doc-example-usages
doc,interp: Add some example usages to cli help
2022-01-29 12:26:08 +01:00
Mattias Wadman
7bc2521938 doc,interp: Add some example usages to cli help 2022-01-29 12:21:51 +01:00
Mattias Wadman
8e47fb1a85 doc,matroska: Fix filesname in example 2022-01-29 12:20:47 +01:00
Mattias Wadman
a8664ed5ba doc: Add per format documentation 2022-01-29 12:01:36 +01:00
Mattias Wadman
fc0aacb654 interp: Cleanup display aliases, now: d, da, dd, dv, ddv
Think it makes sense to have them all start with d.
Also f is often used as function argument name.
2022-01-28 18:25:38 +01:00
Mattias Wadman
c52a1a2364 doc: Use f($a; $b) instead of jq f/2 notation
Also some general polish
2022-01-27 09:55:45 +01:00
Mattias Wadman
e792598c69 interp: Add grep_by/1 to recursively match using a filter
Refactor other grep functions to use it
2022-01-24 18:26:25 +01:00
Xentripetal
ee184075b7 Parse header using avro decoders. Still not certain this is the best idea. Will get opinions before finalizing. 2022-01-19 21:00:44 -06:00
Xentripetal
6e1f338ac3 Pull latest from wader 2022-01-19 19:39:12 -06:00
Xentripetal
06085a26f6 Undo change to doc/file.mp4. I have no idea how this got changed in the first place? Maybe some macos shenanigans. 2022-01-19 19:07:08 -06:00