Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shancat - Shannon Entropy 'Cat'

A Shannon Entropy visualization utility for the terminal, to assist in reverse engineering, forensics, file identification, or just.. if you like pretty colors :)

The core idea here is to make use of truecolor support in terminals so that color becomes an entirely new, or rather, become various entirely new dimensions through which data can be represented. At the moment I am merely encoding entropy density through a blue -> red gradient transition, but I intend on extending upon that, by encoding additional information such as the concentration of different types of bytes (control, printable, alphanumeric, whitespace, graphemes, etc) into the color as well.

Byte distribution is also missing, only entropy is shown graphically. I want to reserve an area at the top of the screen, optionally, where byte distribution is displayed, either as a horizontal map of the entire file (akin to the greyscale images, but colored, and fully scaled to the horizontal width of the terminal, encoding type concentrations in areas of the file, rather than entropy).

This is not even the original ambition; originaly, I was going to create a utility called shanless, this is merely an early prototype for a much more ambitious, stateful, pager-like file analysis TUI that focuses on entropy, byte distribution, byte categorization, statistical properties, with Vim motions, a mini-map and the ability to zoom until you start seeing, possibly horizontally, a color coded and color consistent hexdump.

More documentation is coming. This is still a work in progresss, but it is stable and functional as a useful, usable tool, assuming you're not using a POS terminal from the 90s.. well you can render it in ASCII if that's the case.. -ac so it's fineeeeee (:

Usage:

shancat -i filename

cat filename | shancat         # Equivalent
cat filename | shancat -

shancat -i 

shancat -i filename -ac        # ASCII Chart Mode (for non-truecolor terminals)
shancat -sw                    # Sets the sliding window size.
shancat -st                    # Sets the sliding window' step count.

# Also valid.
cat shancat | shancat -i - -sw 1024 -st 512 -ac -acr 540


Flags/Options List:
    -i string
      Input file path (stdin by default) (default "-")
    -st int
      Step size in bytes (default 96)
    -sw int
      Window size in bytes (default 256)
    -P
      Disallow partial windows at tail
    -c int
      Number of display columns; 0=auto(twidth)
    -ac
      Render an ASCII chart instead of using tcell.
    -acr int
      ASCII chart height (rows) (default 24)
281_flamesnip_2025-12-16_22-56-57 ksnip_tmp_wZglmz 338_flamesnip_2025-12-20_14-40-36 336_flamesnip_2025-12-20_14-29-45 335_flamesnip_2025-12-20_14-28-31 332_flamesnip_2025-12-20_12-56-28 ksnip_tmp_ByYkBl 330_flamesnip_2025-12-20_12-56-06 ksnip_tmp_BQWwXb 271_flamesnip_2025-12-16_18-47-58 274_flamesnip_2025-12-16_18-49-43

About

A Shannon Entropy visualization utility for the terminal, to assist in reverse engineering, forensics, file identification, or just.. if you like pretty colors :)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages