CLI hex dumper with colors

Overview

heksa

Screenshot

GitHub All Releases GitHub release (latest by date) GitHub tag (latest by date)

Hex dumper with colors

Features

  • ANSI colors for different byte groups such as
    • Printable: A-Z, a-z, 0-9
    • Spaces: space, tab, new line
    • Special: 0x00, 0xFF
  • Output multiple formats at once (hexadecimal, decimal, octal, bits or special combination formats)
  • Multiple offset formats (hexadecimal, decimal, octal, percentage)
    • First one is displayed on left side and second one on the right side
  • Read only N bytes
  • Seek to given offset
    • also reads from end of file when using minus sign
  • Seek and limit supports
    • Prefixes hex (0x), octal (0o) and binary (0b)
    • Units (KB, KiB, MB, MiB, GB, GiB, TB, TiB)
  • Read from stdin

Screenshot

heksa --help

heksa - hex file dumper v1.13.0 - (2020-08-04T21:40:08+03:00)
(c) Pekka Järvinen 2019- [ https://github.com/raspi/heksa ]
SYNOPSIS:
    heksa [--format|-f <fmt1,fmt2,..>] [--help|-h|-?]
          [--limit|-l <[prefix]bytes[unit]>] [--offset-format|-o <fmt1[,fmt2]>]
          [--seek|-s <[prefix]offset[unit]>] [--splitter|-S <size>] [--version]
          [--width|-w <[prefix]width>] <filename> or STDIN

OPTIONS:
    --format|-f <fmt1,fmt2,..>          One or multiple of: asc, bit, bitwasc, bitwdec, bitwhex, blk, dec, decwasc, hex, hexwasc, oct (default: "hex,asc")

    --help|-h|-?                        Show this help (default: false)

    --limit|-l <[prefix]bytes[unit]>    Read only N bytes (0 = no limit). See NOTES. (default: "0")

    --offset-format|-o <fmt1[,fmt2]>    One or two of: dec, hex, humiec, humsi, oct, per, no, ''.
                                        First one is displayed on the left side and second one on right side after formatters. (default: "hex")

    --seek|-s <[prefix]offset[unit]>    Start reading from certain offset. See NOTES. (default: "0")

    --splitter|-S <size>                Insert visual splitter every N bytes. Zero (0) disables. (default: 8)

    --version                           Show version information (default: false)

    --width|-w <[prefix]width>          Width. See NOTES. (default: "16")


NOTES:
    - You can use prefixes for seek, limit and width. 0x = hex, 0b = binary, 0o = octal
    - Use '--seek \-1234' for seeking from end of file
    - Limit and seek parameters supports units (KB, KiB, MB, MiB, GB, GiB, TB, TiB)
    - Offset formatters:
      - Disable formatter output with 'no' or ''
      - 'humiec' (IEC: 1024 B) and 'humsi' (SI: 1000 B) displays offset in human form (n KiB/KB)

EXAMPLES:
    heksa -f hex,asc,bit foo.dat
    heksa -o hex,per -f hex,asc foo.dat
    heksa -o hex -f hex,asc,bit foo.dat
    heksa -o no -f bit foo.dat
    heksa -l 0x1024 foo.dat
    heksa -s 0b1010 foo.dat
    heksa -s 4321KiB foo.dat
    heksa -w 8 foo.dat

Requirements

Get source

git clone https://github.com/raspi/heksa

Contributing and helping with the project

See CONTRIBUTING.md and current issues that might need help.

Developing

  1. Make changes
  2. make build or just go build .

Releasing new version:

Requirements:

  • upx for compressing executables
  1. Create new version tag
  2. make release

If there's a lot of visual changes you can take new screenshots with screenshot.sh script in _assets directory

Comments
  • Variable width output

    Variable width output

    Submission type

    • [x] Request for enhancement

    I'd like to be able to adjust the width of the output from the current 2x8 format to a chosen width or be possibly redraw to match the console width on a SIGWINCH?

    enhancement 
    opened by tomtastic 4
  • Do not display repeated lines by default

    Do not display repeated lines by default

    % python -c "print('01234567' * 10,end='')" | heksa -w 8 
    000000┊30 31 32 33 34 35 36 37┊01234567
    000008┊30 31 32 33 34 35 36 37┊01234567
    000010┊30 31 32 33 34 35 36 37┊01234567
    000018┊30 31 32 33 34 35 36 37┊01234567
    000020┊30 31 32 33 34 35 36 37┊01234567
    000028┊30 31 32 33 34 35 36 37┊01234567
    000030┊30 31 32 33 34 35 36 37┊01234567
    000038┊30 31 32 33 34 35 36 37┊01234567
    000040┊30 31 32 33 34 35 36 37┊01234567
    000048┊30 31 32 33 34 35 36 37┊01234567
    

    Would become something like:

    000000┊30 31 32 33 34 35 36 37┊01234567
    -- line repeated 8 times (N bytes) --
    000048┊30 31 32 33 34 35 36 37┊01234567
    
    enhancement discussion 
    opened by raspi 0
  • Fixed offset marker

    Fixed offset marker

    Add --marker parameter which marks every N bytes with visual marker. Highlight with some color and/or add bold/underline effect.

    The use case is file formats that use fixed block size(s). Marker helps to see where next block starts/ends.

    Example:

    heksa --marker 1KiB
    

    It could also be some sort of loop:

    heksa --marker 1KiB,2KiB,5B
    

    This would set first marker at 1 KiB, then the next (last + 2KiB) and the next (last + 5 B) and then again (last + 1 KiB) and so on..

    enhancement help wanted discussion 
    opened by raspi 0
  • Search functionality

    Search functionality

    Add --search or --find parameter for searching bytes. Highlight the found bytes with some color and/or add bold/underline effect.

    Example:

    heksa --search 'Hello' hello.txt
    

    Also what about case (in)sensitivity?

    Maybe also add search option where you can use a file as search source:

    heksa --search-file find-this.dat hello.txt
    

    This will probably require double buffered io.Reader with moving search "window". The first will read for example 1024 bytes of file and mark the found search position offsets. The second is the currently used one which reads width bytes and needs to be changed to read from the bigger buffer. This changes the reader's current functionality a lot and needs some rewrites.

    Other considerations:

    Hex search where only [0-9a-f ] can be used in the search string:

    heksa --search-hex '00010203040506...' hello.txt
    heksa --search-hex '00 01 02 03 04 05 06 ...' hello.txt
    
    enhancement help wanted discussion 
    opened by raspi 2
  • Good UTF8 replacements for non-printable characters

    Good UTF8 replacements for non-printable characters

    Figure out good replacements for non-printable characters when displaying ASCII-output (--format asc)

    Currently we have some replacements such as:

    • 0x00 is 'Ø'
    • New line is '↲'
    • Tab is '⇥'

    Find more characters to be replaced.

    Reference: https://github.com/raspi/heksa/blob/4e2f793a1c1fd0a5883f2fbb463d37e0c6347381/pkg/reader/ascii_lookup.go

    enhancement help wanted 
    opened by raspi 2
  • Make good color scheme for byte groups

    Make good color scheme for byte groups

    Currently we have different color groups for:

    • Spaces ('\n', '\r', ' ', '\t')
    • A-Z, a-z
    • 0-9
    • NULL (0x00) and 0xFF
    • Upper bytes 127-

    Reference: https://github.com/raspi/heksa/blob/6cce0bda45dc0e4a7577468bbe5da764b7c7f423/default_colors.go

    Figure out more color groupings

    enhancement help wanted 
    opened by raspi 1
Releases(v1.14.0)
Owner
Pekka Järvinen
Pekka Järvinen
Chalk is a Go Package which can be used for making terminal output more vibrant with text colors, text styles and background colors.

Chalk Chalk is a Go Package which can be used for making terminal output more vibrant with text colors, text styles and background colors. Documentati

null 6 Oct 29, 2022
self-aware Golang profile dumper[beta]

holmes WARNING : holmes is under heavy development now, so API will make breaking change during dev. If you want to use it in production, please wait

MOSN 856 Jan 6, 2023
Detects whether a terminal supports colors

Termcolor Detects what level of color support your terminal has. This package is heavily inspired by chalk's support-color module. Install go get gith

Efe Karakus 26 Nov 27, 2022
Donald Knuth's Algorithm 7.2.2.1M for covering with multiplicities and colors via dancing links

Covering with multiplicities and colors via Dancing Links Go implementation of Donald Knuth's Algorithm 7.2.2.1M for covering with multiplicities and

Soojin Nam 5 Dec 14, 2022
A Go package for converting RGB and other color formats/colorspaces into DMC thread colors (DMC color name and floss number)

go-c2dmc A Go package for converting RGB and other color formats/colorspaces into DMC thread colors (DMC color name and floss number). Implemented as

null 6 Jul 25, 2022
Golang package with functionality to add colors to your logs to the terminal.

colrz It's a set of funcs and constants to provide basic colors to your terminal app. How to use Get it go get github.com/unnamedxaer/colrz Use it pac

Kamil 0 Sep 15, 2022
Go-colorful: A library for playing with colors in golang

go-colorful A library for playing with colors in Go. Supports Go 1.13 onwards. Why? I love games. I make games. I love detail and I get lost in detail

Lucas Beyer 1k Dec 30, 2022
Light weight Terminal User Interface (TUI) to pick material colors written by Go.

mcpick Light weight Terminal User Interface (TUI) to pick material colors. You do NOT need to take your hands off the keyboard to pick colors. Getting

tenkoh 6 Dec 27, 2022
Elegant CLI wrapper for kubeseal CLI

Overview This is a wrapper CLI ofkubeseal CLI, specifically the raw mode. If you just need to encrypt your secret on RAW mode, this CLI will be the ea

Elm 4 Jan 8, 2022
CLI to run a docker image with R. CLI built using cobra library in go.

BlueBeak Installation Guide Task 1: Building the CLI The directory structure looks like Fastest process: 1)cd into bbtools 2)cd into bbtools/bin 3)I h

Aniruddha Chattopadhyay 0 Dec 20, 2021
A wrapper of aliyun-cli subcommand alidns, run aliyun-cli in Declarative mode.

aliyun-dns A wrapper of aliyun-cli subcommand alidns, run aliyun-cli in Declarative mode. Installation Install aliyun-cli. Usage $ aliyun-dns -h A wra

许嘉华 0 Dec 21, 2021
Symfony-cli - The Symfony CLI tool For Golang

Symfony CLI Install To install Symfony CLI, please download the appropriate vers

Symfony CLI 394 Dec 28, 2022
Go-file-downloader-ftctl - A file downloader cli built using golang. Makes use of cobra for building the cli and go concurrent feature to download files.

ftctl This is a file downloader cli written in Golang which uses the concurrent feature of go to download files. The cli is built using cobra. How to

Dipto Chakrabarty 2 Jan 2, 2022
Cli-algorithm - A cli program with A&DS in go!

cli-algorithm Objectives The objective of this cli is to implement 4 basic algorithms to sort arrays been Merge Sort Insertion Sort Bubble Sort Quick

Leonardo Brombilla Antunes 0 Jan 2, 2022
Nebulant-cli - Nebulant's CLI

Nebulant CLI Website: https://nebulant.io Documentation: https://nebulant.io/docs.html The Nebulant CLI tool is a single binary that can be used as a

Develatio 2 Jan 11, 2022
News-parser-cli - Simple CLI which allows you to receive news depending on the parameters passed to it

news-parser-cli Simple CLI which allows you to receive news depending on the par

Maxym 0 Jan 4, 2022
Go-api-cli - Small CLI to fetch data from an API sync and async

Async API Cli CLI to fetch data on "todos" from a given API in a number of ways.

Pete Robinson 0 Jan 13, 2022
Syno-cli - Synology unofficial API CLI and library

Synology CLI Unofficial wrapper over Synology API in Go. Focus on administrative

Aleksandr Baryshnikov 16 Jan 6, 2023