Skip to content

filetypes ​

Tool tools/triage/filetypes.py (program, Triage). What each file of a game is, from its bytes: the format its first bytes name, its size and its entropy.

Run it with ./gameframe run filetypes ARGS or python3 tools/triage/filetypes.py. Source on GitHub.

Its own help ​

This is the help text in the tool itself, as ./gameframe tool filetypes prints it.

text
What each file of a game is, from its bytes: the format its first bytes name, its size and
its entropy. It finds the code, the containers, the pictures and sounds, and the files that are
compressed or encrypted, before anything is decoded.

Usage: filetypes.py PATH [PATH ...] [--summary] [--blocks N] [--json]

  PATH         files or folders (folders are walked)
  --summary    one line per kind: how many files and how many bytes
  --blocks N   for each file, also the entropy of every N-byte block (find the compressed
               parts inside a container, or where an executable's packed data starts)
  --json       print the result as JSON

Entropy is in bits per byte, from 0 (one byte value repeated) to 8 (every value equally
likely). Text and code sit between about 4 and 6.5. Above about 7.5, the bytes are compressed
or encrypted: a decoder needs the game's decompressor or key (re-format, xorscan.py). A known
compressed format (ZIP, PNG, Ogg) is expected to be high. An unknown file that is high is the
one to look at. The kind is a guess from signatures. It is not proof: confirm it in the code
that reads the file (re-format). Standard library only.

Named by ​

Skills: re-inventory, re-format.

Code: Apache 2.0. Content: CC0 1.0. No game material: bring your own copy.