Decode hex, base64 and protobuf recursively with a single command
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd/decode
decode
vendor
.gitignore
LICENSE
README.md
go.mod
go.sum

README.md

multicode

multicode allows to input a (nested) base64, hex or proto (protocol buffers) decoded sequence and will recursively try to encode it. This is helpful when you get encoded data but don't exactly know how it was encoded or encoding might lead to cumbersome command concatenation.

Installation

go get -u github.com/sj14/multicode/cmd/decode

Examples

First, let's encode a string with hex and base64 encoding:

$ echo hello there | xxd -p | base64
Njg2NTZjNmM2ZjIwNzQ2ODY1NzI2NTBhCg==

Decode:

$ decode Njg2NTZjNmM2ZjIwNzQ2ODY1NzI2NTBhCg==
hello there

Decode using the pipe:

$ echo Njg2NTZjNmM2ZjIwNzQ2ODY1NzI2NTBhCg== | decode
hello there

Decode in verbose mode:

$ decode -v Njg2NTZjNmM2ZjIwNzQ2ODY1NzI2NTBhCg==
- applied decoding 'base64':
68656C6C6F207468657265

- applied decoding 'hex':
hello there

- result:
hello there

Disable hex decoding:

$ decode -v -hex=false Njg2NTZjNmM2ZjIwNzQ2ODY1NzI2NTBhCg==
- applied decoding 'base64':
68656C6C6F207468657265

- result:
68656C6C6F207468657265

Usage

  -base64
        use base64 decoding (default true)
  -hex
        use hex decoding (default true)
  -none
        disable all decodings
  -proto
        use proto decoding (default true)
  -v    verbose ouput mode