goblet

package module
v0.0.0-...-3553dca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2022 License: MIT Imports: 1 Imported by: 0

README

goblet

This is a binary viewer made by Go.

It reads binaries from stdin or file and outputs them in bit, hex, or base64 format.

Installation

$ go install github.com/convto/goblet/cmd/goblet

Usage

goblet reads binaries from a stdin or file and outputs them in any text encoding.
Here is a simple example

$ goblet -bit test.bin 
00001000 10111001 01100000 00010000 10110010 10010010
00000100 00011000 00000001 

For multi-bit per character encodings such as base64 and hex, the output is padded.

$ goblet -hex test.bin
0___8___ b___9___ 6___0___ 1___0___ b___2___ 9___2___
0___4___ 1___8___ 0___1___ 
$ goblet -base64 test.bin
C_____L_ ____l___ __g_____ E_____L_ ____K___ __S_____
B_____B_ ____g___ __B_____

Currently supported options are

$ goblet -h
Usage of goblet:
  -base64
    	use base64 format
  -bit
    	use bit format
  -hex
    	use hex format
  -w int
    	width (default 6)

Documentation

Index

Constants

View Source
const (
	DefaultByteWidth = 6
	DefaultPadChar   = '_'
	CharLenBit       = 1
	CharLenHex       = 4
	CharLenBase64    = 6
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryViewer

type BinaryViewer struct {
	*bytes.Buffer
	// contains filtered or unexported fields
}

BinaryViewer provides I/O for viewing text-encoded binaries, write encoded binaries, you can read the formatted contents

func NewBinaryViewer

func NewBinaryViewer(srcLen, charLen, byteWidth int, padChar byte) *BinaryViewer

NewBinaryViewer creates binary viewer with options charLen is required, other parameter are optional TODO: refactor to functional option pattern

func (*BinaryViewer) Write

func (v *BinaryViewer) Write(p []byte) (n int, err error)

Directories

Path Synopsis
cmd
goblet command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL