Expand description
Parser for libmagic-style hierarchical magic signature rule files (Magdir).
Structs§
- Hierarchical
Magic Rule - A parsed hierarchical libmagic rule with optional child rules.
- String
Flags - String matching modifiers for
stringandsearchtests.
Enums§
- Indirect
Op - Binary operation applied to indirect offset dereferenced pointer before applying adjustment.
- Indirect
Type - Data type dereferenced by an indirect offset.
- Magic
Cond - Rule branching condition type.
- Magic
Test - Type and comparison test of a magic rule.
- NumOp
- Arithmetic operations applied to read numeric values before comparison/format.
- Offset
- Location in file payload to inspect.
- Pascal
Length Size - Pascal string length prefix specification.
- RelOp
- Relational comparison operator for tests.
Functions§
- calculate_
rule_ strength - Calculates rule strength faithful to upstream
apprentice_magic_strength_1. - decode_
magic_ escapes - Decodes escape sequences (e.g. \037\235, \x1f, \n, \r, \t, \ ) from libmagic strings.
- parse_
magic_ content - Parses an entire libmagic file content into a list of hierarchical root rules.
- parse_
magic_ content_ with_ templates - Parses an entire libmagic file content into hierarchical root rules and named templates.
- parse_
magic_ line - Parses a single libmagic rule line into components.
- parse_
offset - Parses offset string into an
Offsetenum variant.