encoders

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: GPL-3.0 Imports: 21 Imported by: 0

README

implant/sliver/encoders

Overview

Binary and text encoders embedded with the implant for staging and comms. Hosts encoder registries, factories, and runtime switching logic. Runtime components handle base32, base58, base58 alphabet, and base58 genalphabet for implant-side encoders features.

Go Files

  • base32.go – Implements Base32 encoding/decoding routines used by the implant.
  • base58.go – Provides Base58 encode/decode helpers leveraging custom alphabets.
  • base58_alphabet.go – Defines the canonical Base58 alphabet tables.
  • base58_genalphabet.go – Generates Base58 alphabet permutations at build time for obfuscation.
  • base64.go – Wraps Base64 encoding utilities with implant-specific helpers.
  • encoders.go – Registers available encoders and exposes lookup functions for runtime selection.
  • english.go – Implements an English word encoder for human-readable payloads.
  • gzip.go – Handles gzip compression and decompression helpers.
  • hex.go – Provides hexadecimal encoding utilities.
  • images.go – Embeds steganographic encoders that hide data inside images.
  • nop.go – Supplies a passthrough encoder that leaves data untouched.

Sub-packages

  • basex/ – Base-N encoder implementations used by both implant and server. Provides reusable conversion tables and encode/decode routines.
  • traffic/ – Programmable traffic encoders compiled into the implant for obfuscation. Contains compiler, interpreter, and test harness logic for traffic scripts.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EncoderModulus = uint64(65537)
	MaxN           = uint64(9999999)

	Base32EncoderID, _  = strconv.ParseUint(`{{.Encoders.Base32EncoderID}}`, 10, 64)
	Base58EncoderID, _  = strconv.ParseUint(`{{.Encoders.Base58EncoderID}}`, 10, 64)
	Base64EncoderID, _  = strconv.ParseUint(`{{.Encoders.Base64EncoderID}}`, 10, 64)
	EnglishEncoderID, _ = strconv.ParseUint(`{{.Encoders.EnglishEncoderID}}`, 10, 64)
	GzipEncoderID, _    = strconv.ParseUint(`{{.Encoders.GzipEncoderID}}`, 10, 64)
	HexEncoderID, _     = strconv.ParseUint(`{{.Encoders.HexEncoderID}}`, 10, 64)
	PNGEncoderID, _     = strconv.ParseUint(`{{.Encoders.PNGEncoderID}}`, 10, 64)
)
View Source
var (
	Base64  = Base64Encoder{}
	Base58  = Base58Encoder{}
	Base32  = Base32Encoder{}
	Hex     = HexEncoder{}
	English = EnglishEncoder{}
	Gzip    = GzipEncoder{}
	PNG     = PNGEncoder{}

	// {{if .Config.Debug}}
	Nop = NoEncoder{}
)
View Source
var EncoderMap = map[uint64]Encoder{}

EncoderMap - Maps EncoderIDs to Encoders

EncoderMap - Maps EncoderIDs to Encoders

Functions

func B58Decode

func B58Decode(b string) []byte

B58Decode decodes a modified base58 string to a byte slice.

func B58Encode

func B58Encode(b []byte) string

B58Encode encodes a byte slice to a modified base58 string.

Types

type Base32Encoder

type Base32Encoder struct{}

Base32Encoder Encoder

func (Base32Encoder) Decode

func (e Base32Encoder) Decode(data []byte) ([]byte, error)

Decode - Base32 Decode

func (Base32Encoder) Encode

func (e Base32Encoder) Encode(data []byte) ([]byte, error)

Encode - Base32 Encode

type Base58Encoder

type Base58Encoder struct{}

Base58 Encoder

func (Base58Encoder) Decode

func (e Base58Encoder) Decode(data []byte) ([]byte, error)

Decode - Base58 Decode

func (Base58Encoder) Encode

func (e Base58Encoder) Encode(data []byte) ([]byte, error)

Encode - Base58 Encode

type Base64Encoder

type Base64Encoder struct{}

Base64Encoder Encoder

func (Base64Encoder) Decode

func (e Base64Encoder) Decode(data []byte) ([]byte, error)

Decode - Base64 Decode

func (Base64Encoder) Encode

func (e Base64Encoder) Encode(data []byte) ([]byte, error)

Encode - Base64 Encode

type Encoder

type Encoder interface {
	Encode([]byte) ([]byte, error)
	Decode([]byte) ([]byte, error)
}

Encoder - Can lossless-ly encode arbitrary binary data

func EncoderFromNonce

func EncoderFromNonce(nonce uint64) (uint64, Encoder, error)

EncoderFromNonce - Convert a nonce into an encoder

func RandomEncoder

func RandomEncoder(size int) (uint64, Encoder)

RandomEncoder - Get a random nonce identifier and a matching encoder

type EnglishEncoder

type EnglishEncoder struct{}

English Encoder - An ASCIIEncoder for binary to english text

func (EnglishEncoder) Decode

func (e EnglishEncoder) Decode(words []byte) ([]byte, error)

Decode - English => Binary

func (EnglishEncoder) Encode

func (e EnglishEncoder) Encode(data []byte) ([]byte, error)

Encode - Binary => English

type GzipEncoder

type GzipEncoder struct{}

Gzip - Gzip compression encoder

func (GzipEncoder) Decode

func (g GzipEncoder) Decode(data []byte) ([]byte, error)

Decode - Uncompressed data with gzip

func (GzipEncoder) Encode

func (g GzipEncoder) Encode(data []byte) ([]byte, error)

Encode - Compress data with gzip

type HexEncoder

type HexEncoder struct{}

Hex Encoder

func (HexEncoder) Decode

func (e HexEncoder) Decode(data []byte) ([]byte, error)

Decode - Hex Decode

func (HexEncoder) Encode

func (e HexEncoder) Encode(data []byte) ([]byte, error)

Encode - Hex Encode

type NoEncoder

type NoEncoder struct{}

NoEncoder - A NOP encoder

func (NoEncoder) Decode

func (n NoEncoder) Decode(data []byte) ([]byte, error)

Decode - Don't do anything

func (NoEncoder) Encode

func (n NoEncoder) Encode(data []byte) ([]byte, error)

Encode - Don't do anything

type PNGEncoder

type PNGEncoder struct{}

PNGEncoder - PNG image object

func (PNGEncoder) Decode

func (p PNGEncoder) Decode(data []byte) ([]byte, error)

Decode reads a encoded PNG to get the original binary data

func (PNGEncoder) Encode

func (p PNGEncoder) Encode(data []byte) ([]byte, error)

Encode outputs a valid PNG file

Directories

Path Synopsis
Package basex provides fast base encoding / decoding of any given alphabet using bitcoin style leading zero compression.
Package basex provides fast base encoding / decoding of any given alphabet using bitcoin style leading zero compression.

Jump to

Keyboard shortcuts

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