dd86k / ff

Simple, decent binary file scanner

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ff, simple binary file scanner

ff aims to be a simple, fast, generic, and understandable binary file scanner.

Warning: This tool is not memory safe and will not work on big-endian (MSB) platforms.

$ ff ff ff.exe
PE32+ Windows Console Executable for x86-64, LARGE_ADDRESS_AWARE
ELF64LE System V Shared object for x86-64 machines

$ ff ff.exe -m
PE32+ Windows Console Executable for x86-64 machines, LARGE_ADDRESS_AWARE
Number of sections     : 0h
Timestamp              : 5AA58AC4h
Pointer to Symbol Table: 0h
Number of symbols      : 0h
Size of Optional Header: F0h
Characteristics        : 22h

$ ff * -sm
Manuel - Gas Gas Gas.flac: FLAC audio, 44100 Hz, 16-bit, 2 channels
cv.wav: WAVE audio (G.729) 8000 Hz, 0 kbps, 0-bit, 1 channels
2002ado.wad: PWAD, 894 entries at C7A7FDh

$ ff /dev/null
Character device

> ff NUL
Character device

For a list of files ff(1) picks up, visit File List (Gitbucket).

Compiling

There is a Makefile defaulting to clang. It will work with gcc aswell: make CC=gcc.

It's usually best to use build-clang.cmd on Windows, as you can add additional arguments easily. Reminder that you should add -O3 (or /Ot for cl). There is also build-clang.sh as an alternative to the Makefile for Unix-like systems.

However, if you want to define your own arguments:

You MUST:

  • Byte-align structs
    • cl, clang-cl: /Zp
    • clang, gcc: -fpack-struct=1

File Globbing on Windows

If you wish to include file globbing, throw in setargv.obj alongside the build script. This object file is included with your Visual Studio install. Don't forget to use the proper target architecture.

License

This project is licensed under the CC0 1.0 Universal Public Domain Dedication license.

About

Simple, decent binary file scanner

License:Creative Commons Zero v1.0 Universal


Languages

Language:C 98.6%Language:Batchfile 0.6%Language:Makefile 0.5%Language:Shell 0.2%