Rorschach

Pretty print binary blobs based on common layout definition.

Example

```rust use rorschach::{Definition, Field, LittleEndian}; use rorschach::formatter::{self, Color};

let def = Definition::default() .field(Field::named("sequence") .is::(LittleEndian) .style(Color::Fixed(255).normal())) .field(Field::named("buttons") .bytes(3) .binary() .style(Color::Fixed(3).normal())) .field(Field::named("trigger.left") .is::(LittleEndian) .style(Color::Fixed(255).on(Color::Fixed(63)).underline())) .field(Field::named("trigger.right") .is::(LittleEndian) .style(Color::Fixed(255).on(Color::Fixed(63)))) .field(Field::padding() .bytes(3)) .field(Field::named("pad.left.x") .is::(LittleEndian) .style(Color::Fixed(255).on(Color::Fixed(27)).underline())) .field(Field::named("pad.left.y") .is::(LittleEndian) .style(Color::Fixed(27).normal())) .field(Field::named("pad.right.x") .is::(LittleEndian) .style(Color::Fixed(255).on(Color::Fixed(36)).underline())) .field(Field::named("pad.right.y") .is::(LittleEndian) .style(Color::Fixed(36).normal())) .field(Field::padding() .bytes(12)) .field(Field::named("acceleration.pitch") .is::(LittleEndian) .style(Color::Fixed(124).normal())) .field(Field::named("acceleration.yaw") .is::(LittleEndian) .style(Color::Fixed(160).normal())) .field(Field::named("acceleration.roll") .is::(LittleEndian) .style(Color::Fixed(196).normal())) .field(Field::named("orientation.pitch") .is::(LittleEndian) .style(Color::Fixed(57).normal())) .field(Field::named("orientation.yaw") .is::(LittleEndian) .style(Color::Fixed(93).normal())) .field(Field::named("orientation.roll") .is::(LittleEndian) .style(Color::Fixed(129).normal())) .field(Field::padding() .bytes(16)); ```

Structured

The structured formatter takes inspiration from the ASCII art tables often used in network related RFCs.

rust formatter::Structured::default() .header(true) .style(Default::default()) .format(&def, buffer, io::stdout()) .unwrap()

Structured Screenshot

Inline

The inline formatter is the simplest formatter, it just prints the bytes as hexadecimal one after another, but it does support coloring which can help reversing formats.

rust formatter::Inline::default() .newline(true) .split(4) .style(Default::default()) .format(&def, buffer, io::stdout()) .unwrap()

Inline Screenshot