Documentation
¶
Overview ¶
Package magic works out what a blob of data might be.
A Runner looks at data, asks which operations claim to be able to decode something of that shape, runs them from the registry it is given, and looks at what comes out — recursively, to a given depth — then ranks the recipes it found by how much like ordinary text or a known file the result became. Ported from CyberChef's lib/Magic.mjs; the Magic operation renders what Runner.Speculate returns.
Index ¶
Constants ¶
const BruteForceLen = 100
BruteForceLen is how much of the data brute forcing works on, since trying every byte over a large input is slow and rarely more informative.
Variables ¶
This section is empty.
Functions ¶
func LanguageName ¶
LanguageName gives a language's name, falling back to its code.
Types ¶
type Option ¶
type Option struct {
Recipe core.Recipe
Data string
LangScores []LangScore
FileType *filesig.Sig
IsUTF8 bool
Entropy float64
MatchingOps []magicCheck
Useful bool
MatchesCrib bool
}
Option is one candidate recipe and what its result looks like.