4 Commits
Author SHA1 Message Date
cnmcdee a2106045a6 json: --json output and libsfile linkable library
- sfile --json: one JSON object per file (JSON Lines) carrying format,
  offsets, decoded fields and geotags when present; default CLI
  output byte-identical (verified against the pre-refactor binary).
- libsfile: src/sfile.h + src/sfile_lib.c expose the decoder
  (sfile_decode_file/mem, sfile_result_to_json, format table
  introspection); make lib builds libsfile.a and libsfile.so.1.1.0,
  make install installs them plus the header.
- tests/test_json.py: JSON parses and matches the text table on the
  same files (make test-json); tests/test_library.c + test_lib.sh:
  static and shared link test (make test-lib).
2026-12-02 09:28:39 +00:00
Muse 7e9657520c stag: scan a directory and tabulate geotags as CSV
stag [dir] [outfile] collects media files (non-recursive), runs sfile
on each via the geotag client seam (src/geotag_client.c, $SFILE/PATH/
alongside-executable lookup) and writes one CSV row per file:
file,format,latitude,longitude,altitude,datum,timestamp,source.
Files with no geotag still get a row, with the geotag fields empty.

Also fixes a typo in the seam that broke the build: strrchr(self, /)
was missing its quotes (must be strrchr(self, /)).

Makefile: new stag target (links geotag_client.c, -lm); all still
builds just sfile.
2026-12-02 09:15:06 +00:00
cnmcdee eac6be4802 scar: file carver built on sfiles format table
Scan a raw disk image for sfiles known magics (831 formats) and carve
out the files: PNG chunk walk, JPEG marker walk, GIF block walk, ZIP
local-header walk + EOCD, PDF %%EOF scan, gzip inflate sizing; next-
header/EOF fallback with a size cap for the rest. Report lists offset,
format, size, confidence and how the end was found.

- src/scar.c, src/footers.h: carver + footer/trailer table
- Makefile: scar target (links -lz), test-scar target, install both
- tests/test_scar.py: synthetic image, 7 files recovered byte-identical
- docs/scar.md: usage, real example output, decisions, limits
2026-12-02 09:12:01 +00:00
Muse 7db001b480 sfile v1: table-driven header decoder for 831 formats
- Engine (src/sfile.c): generic, magic+extension identification,
  uniform header table output, text/XML fallback decoder
- Generator (tools/gen_formats.py): parses the collected C/C++ reference
  code (read sequences, structs, explicit data[N] offsets) into a format
  table; curated magic table; container-layout inheritance (ZIP/RIFF/
  ftyp/Ogg); hand overrides for well-known formats (PNG, ZIP, WAV, ...)
- Test loop (tests/run_tests.py) + README
- 347 formats with field layouts, 197 with magic; verified on real
  sample files (see tests/)
2026-11-25 02:13:20 +00:00