โ›“๏ธโ€๐Ÿ’ฅ filefrag

Python library to get FIE and command line tool

๐Ÿ“ฆ Install

See the video for a demo including installing from source, but you can install with pip:

pip install filefrag

โ–ถ๏ธ Usage

Run pyfilefrag on the command line. See --help for details. It has --verbose, and --json outputs for your parsing pleasure.

To use the library, just call filefrag.FileMap('/path/whatever') to build a map of the extents in the file using ioctlโ€™s interface. Then you can poke about in the guts of a file:

Comes with a Device class to do comparisons, so it ought to work with fragments in files on different mountpoints, bind mounts and so on (unfortunately not snapโ€™s FUSE mounts; theyโ€™re far too abstract and piped in via a socket)

๐ŸŽ“ Example

from filefrag import FileMap

mapping = FileMap('/usr/bin/bash')

print(mapping.extents)
print(extents)

โš–๏ธ License

Licensed under the WTFPL with one additional clause:

  1. Donโ€™t blame me.

Do whatever the fuck you want, just donโ€™t blame me.

๐Ÿค Contributing

Not that this thing will ever be big enough to need a code of conduct, but itโ€™s a good excuse to pimp out my common fucking sense code of conduct.