1
1
mirror of https://github.com/wader/fq.git synced 2024-11-26 10:33:53 +03:00
Commit Graph

148 Commits

Author SHA1 Message Date
bump
f9dff5c65d Update github-golangci-lint to 1.60.2 from 1.60.1
Release notes https://github.com/golangci/golangci-lint/releases/tag/v1.60.2

Skip some gosec rules as they give too many false positives
2024-08-21 19:00:27 +02:00
bump
2c38cf1324 Update github-golangci-lint to 1.60.1 from 1.59.1
Release notes https://github.com/golangci/golangci-lint/releases/tag/v1.60.1

Require go 1.21 and fix various lint warnings and use new features
2024-08-14 20:05:40 +02:00
Mattias Wadman
ee2ee24dbb decode: Cleanup io panic a bit 2024-04-12 17:23:03 +02:00
Mattias Wadman
bf7fa07c41 fq: Use go 1.20 and cleanup
Also rename *ex packages to *x
2024-04-01 19:14:10 +02:00
Mattias Wadman
621d7f2c22 decode: Align some heavily used structs to save space
From betteralign:
Compound: 8 bytes saved: struct with 40 pointer bytes could be 32
Value: 40 bytes saved: struct with 128 pointer bytes could be 88
2024-04-01 18:12:31 +02:00
Michael B.
b05aa997ab leveldb: address PR comments 2023-12-05 11:31:30 +01:00
Mattias Wadman
ac276ee119 gzip: Correctly handle multiple members
A gzip file consists of one or more "members" that are concatenated on uncompress.

Introduce a members array with each member and uncompressed is now the concatenation.

Fixes #794
2023-10-24 10:45:32 +02:00
Mattias Wadman
23ae4d978b decode,interp: Make synthetic values more visible and not act as decode values 2023-10-07 17:40:16 +02:00
Mattias Wadman
0d0147643a gomod: Update x/exp and gomarkdown
Add cmp package from go 1.21 to have cmp.Compare to make sort easier
2023-08-09 14:36:51 +02:00
Mattias Wadman
97194ad8bc mp4: Nicer major brand and handle some qt brand short strings better 2023-07-26 12:15:51 +02:00
Mattias Wadman
e2eb667091 html: Add to probe group
As decoder now can know they are decoding as part of probing we can now
use some heuristics to see if we should decode as html.
The reason heuristics is needed is that x/html parser will alwaus succeed.

Add lazyre package to help delay compile of RE and make it concurrency safe.
2023-05-11 19:07:18 +02:00
Mattias Wadman
a200d3eee0
Merge pull request #415 from pnsafonov/postgres
Postgres
2023-05-06 09:07:13 +02:00
Mattias Wadman
684a083813 interp,decode: Support decode group argument
Will be used for probing via -d <string> and filename
2023-05-03 10:01:13 +02:00
Pavel Safonov
bb2659d442 Merge remote-tracking branch 'master' into postgres_merge_master_0 2023-05-03 09:44:02 +03:00
Mattias Wadman
b08ef00dd1 decode,interp: Refactor format groups into a proper struct
Replaces []Format with a Group type.
A bit more type safe.
Breaking change for RegisterFormat, now takes a first argument that is a "single" format group.
Lots of naming cleanup.

This is also preparation for decode group argument which will enable doing intresting
probing, ex a format decoder could know it's decode as part of probe group  (html could
be probed possibly), or have "arg probe" group for decoder who inspect args to know
if they should probe (-d /path/to/schema etc) to enable nice CLI-ergonomics.
2023-04-29 20:02:34 +02:00
Mattias Wadman
c5f6809b02 decode,fuzz,dev: Move recoverable error check to recoverfn.Run
This preserves the callstack on non-recoverable panics so that using
a debugger and fuzzing is much easier.

Add vscode debug config.
Remove fuzz stacktrace log workaround.
2023-03-31 12:47:04 +02:00
Mattias Wadman
a6c4db75fd decode: Cleanup old unused help system code 2023-03-28 21:51:04 +02:00
Mattias Wadman
980ecdba82 decode: Add float 80 reader
Rename *d.Bits to UintBits as it return a uint
Add *d.Bits that return []byte
2023-03-10 01:15:55 +01:00
Mattias Wadman
9852f56b74 tls: Add TLS 1.0, 1.1, 1.2 decode and decryption
What it can do:
- Decodes records and most standard messages and extensions.
- Decryptes records and reassemples application data stream if a keylog is provided
  and the cipher suite is supported.
- Supports most recommended and used ciphers and a bunch of older ones.

What it can't do:
- SSL v3 maybe supported, is similar to TLS 1.0, not tested.
- Decryption and renegotiation/cipher change.
- Record defragmentation not supported, seems rare over TCP.
- TLS 1.3
- SSL v2 but v2 compat header is supported.
- Some key exchange messages not decoded yet

Decryption code is heavly based on golang crypto/tls and zmap/zcrypto.

Will be base for decoding http2 and other TLS based on protocols.

Fixes #587
2023-03-05 13:52:12 +01:00
Mattias Wadman
8e0dde03d0 decode: Support multiple format args and some rename and refactor
This will allow passing both cli options and format options to sub decoder.
Ex: pass keylog option to a tls decoder when decoding a pcap.
Ex: pass decode options to a format inside a http body inside a pcap.

Add ArgAs method to lookup argument based on type. This also makes the format
decode function have same signature as sub decoders in the decode API.

This change decode.Format a bit:
DecodeFn is now just func(d *D) any
DecodeInArg renamed to DefaultInArg
2023-02-18 21:38:51 +01:00
Mattias Wadman
9b81d4d3ab decode: More type safe API and split scalar into multiple types
Preparation to make decoder use less memory and API more type safe.
Now each scalar type has it's own struct type so it can store different
things and enables to have a scalar interface.
Also own types will enable experimenting with decode DLS designs like
using chained methods that are type aware.
2022-12-14 16:23:58 +01:00
Mattias Wadman
83ccedc506 mp4,decode: Properly decode ilst items (both mdta and mdir)
Refactor mp4 decoder to be simpler and have fallback for unknown box type
Cleanup some old ilst hacks
Add generic string reader to decode API that takes an encoding parameters
2022-12-08 15:56:22 +01:00
Mattias Wadman
e77f776999 decode,interp: Rename unknown gap fields from "unknown#" to "gap#"
Think it makes it clearer and also less likely to collide with a field
name a deocder wants to use.
2022-12-01 20:43:30 +01:00
Pavel Safonov
6fe61cd634 Merge branch 'wader_master' into postgres_wal_removed 2022-11-23 13:57:50 +03:00
Mattias Wadman
c93301fc70 raw,bits,bytes: Replace raw format with bits and bytes format that decode to a binary
raw format was a hack to skip decoding to be able to get a binary using tobyte etc.
Now you can do fq -d bytes ... instead of fq -d raw 'tobytes | ...'
2022-11-20 19:51:12 +01:00
Pavel Safonov
e87d5a6b71 postgres: remove unused code 2022-11-07 11:25:14 +03:00
Pavel Safonov
9c7f20b6a0 Merge branch 'postgres' into postgres_wal_sync_with_postgres 2022-11-01 08:26:17 +03:00
Pavel Safonov
cdf283101f Merge branch 'wader_master' into postgres 2022-11-01 08:25:07 +03:00
Mattias Wadman
7254b0f9f5 decode,elf,fuzz: TryBytesRange error on negative size 2022-10-20 15:10:35 +02:00
Pavel Safonov
dd9c7f0420 Merge branch 'postgres' into postgres_wal_sync_with_postgres 2022-10-12 10:43:59 +03:00
Mattias Wadman
bafd1f564e decode,fuzz: Signed integer (S) read require at least one bit
Otherwise there is no sign bit and it will panic on shifting.

Maybe should require 2? now -0 and +1 hmm
2022-10-11 12:12:28 +02:00
Pavel Safonov
6588e1dd88 Merge branch 'wader_master' into postgres 2022-10-05 19:39:35 +03: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
d784db69bc Adds support for Apple Binary Plist, version 00 2022-09-23 20:21:32 -05:00
Pavel Safonov
9f1adb2d81 postgres: change AssertPosBytes to AssertPos (bits) 2022-09-21 13:36:15 +03:00
Pavel Safonov
448c369014 postgres: try to implement pg_wal 2022-09-15 16:34:22 +03:00
Pavel Safonov
8e27e30f89 Merge branch 'wader_master' into postgres 2022-09-09 17:30:33 +03:00
Pavel Safonov
666bbfba29 postgres: fix some unknown, chanche tests tovalue -> dv 2022-09-05 12:50:59 +03:00
Pavel Safonov
d58860580a Merge branch 'master' of github.com:pnsafonov/fq into postgres 2022-09-02 16:16:19 +03:00
Pavel Safonov
2ee01f79c2 allow to change FillGaps in decoder 2022-09-02 09:03:08 +03:00
Mattias Wadman
a6429ffe7a decode: Remove RangeSorted flag as we can decide on array/struct instead 2022-09-01 17:45:28 +02:00
Mattias Wadman
768df3012c interp,decode: For struct use map to lookup field
Will make it faster for struct with logs of fields and seems to
not cuase any significant difference for small structs.

All this really needs a rewrite somehow, maybe refactor into interfaces somehow? getting messy.
2022-09-01 11:35:19 +02:00
Pavel Safonov
7cd43b4919 perfomance: increase performance by map usage 2022-09-01 09:36:50 +03:00
Pavel Safonov
b4c4de26ca Merge remote-tracking branch 'github/master' 2022-08-31 12:17:14 +03:00
Mattias Wadman
226a9a3e08 generics: Use more from x/exp 2022-08-31 10:50:56 +02:00
Mattias Wadman
7d86534348 sortex: Package with type safe sort helpers 2022-08-30 11:02:57 +02:00
Pavel Safonov
e4ba72f42f Merge remote-tracking branch 'github/master' 2022-08-25 09:55:48 +03:00
Mattias Wadman
326dada7ca decode: Add LEB128 readers 2022-08-20 12:05:44 +02:00
Mattias Wadman
0cd846a18c *extra: Rename <pkg>extra to just <pkg>ex and refactor to use generics 2022-08-12 16:29:47 +02:00