Gregwar/fatcat

On macos, only shows usage

antifuchs opened this issue · 3 comments

I'm trying to use fatcat on my macos laptop to forensics a set of old floppies that I found, but am failing at the first hurdle: No matter what arguments I pass the fatcat binary, all it does is show the usage screen.

I've repro'd this in the docs/images directory:

$ pwd
/Users/asf/Hacks/fatcat/docs/images
$ gunzip empty.img.gz
$ fatcat empty.img -l /
fatcat v1.0.6, Gregwar <g.passault@gmail.com>

Usage: fatcat disk.img [options]
  -i: display information about disk
  -O [offset]: global offset (may be partition place)

Browsing & extracting:
  -l [dir]: list files and directories in the given path
  -L [cluster]: list files and directories in the given cluster
  -r [path]: reads the file given by the path
  -R [cluster]: reads the data from given cluster
  -s [size]: specify the size of data to read from the cluster
  -d: enable listing of deleted files
  -x [directory]: extract all files to a directory, deleted files included if -d
                  will start with rootDirectory, unless -c is provided
* -S: write scamble data in unallocated sectors
* -z: write scamble data in unallocated sectors

FAT Hacking
  -@ [cluster]: Get the cluster address and information
  -2: analysis & compare the 2 FATs
  -b [file]: backup the FATs (see -t)
* -p [file]: restore (patch) the FATs (see -t)
* -w [cluster] -v [value]: write next cluster (see -t)
  -t [table]: specify which table to write (0:both, 1:first, 2:second)
* -m: merge the FATs
  -o: search for orphan files and directories
* -f: try to fix reachable directories

Entries hacking
  -e [path]: sets the entry to hack, combined with:
* -c [cluster]: sets the entry cluster
* -s [size]: sets the entry size
* -a [attributes]: sets the entry attributes
  -k [cluster]: try to find an entry that point to that cluster

*: These flags writes on the disk, and may damage it, be careful
$ fatcat empty.img -i
fatcat v1.0.6, Gregwar <g.passault@gmail.com>

Usage: fatcat disk.img [options]
  -i: display information about disk
  -O [offset]: global offset (may be partition place)

Browsing & extracting:
  -l [dir]: list files and directories in the given path
  -L [cluster]: list files and directories in the given cluster
  -r [path]: reads the file given by the path
  -R [cluster]: reads the data from given cluster
  -s [size]: specify the size of data to read from the cluster
  -d: enable listing of deleted files
  -x [directory]: extract all files to a directory, deleted files included if -d
                  will start with rootDirectory, unless -c is provided
* -S: write scamble data in unallocated sectors
* -z: write scamble data in unallocated sectors

FAT Hacking
  -@ [cluster]: Get the cluster address and information
  -2: analysis & compare the 2 FATs
  -b [file]: backup the FATs (see -t)
* -p [file]: restore (patch) the FATs (see -t)
* -w [cluster] -v [value]: write next cluster (see -t)
  -t [table]: specify which table to write (0:both, 1:first, 2:second)
* -m: merge the FATs
  -o: search for orphan files and directories
* -f: try to fix reachable directories

Entries hacking
  -e [path]: sets the entry to hack, combined with:
* -c [cluster]: sets the entry cluster
* -s [size]: sets the entry size
* -a [attributes]: sets the entry attributes
  -k [cluster]: try to find an entry that point to that cluster

*: These flags writes on the disk, and may damage it, be careful

I built the binary using the exact procedure given in the README file, from current git master, 839090b

uname -a says Darwin courage.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64 i386 MacBookPro13,2 Darwin, I'm running macos 10.14.5 (18F132)

Hello

Can you try passing the arguments this way:

fatcat -l / empty.img

Maybe your getopt implementation requires all dashed arguments to be before the generic ones

Yup, that works! Phew. I thought I'd done that initially but maybe I got the arguments legitimately wrong then.

I guess that makes this a documentation bug?

I added some note in the readme, ping me if you thing it's not enough