wrapper

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package wrapper contains built-in implementations of the 'c2.Wrapper' interface, which can be used to wrap or encode data that is passed between Sessions and C2 Servers.

Index

Constants

View Source
const (
	// Zlib is the default Zlib Wrapper. This wrapper uses the default compression level. Use the 'NewZlib'
	// function to create a wrapper with a different level.
	Zlib = compress(0x0)
	// Gzip is the default Gzip Wrapper. This wrapper uses the default compression level. Use the 'NewGzip'
	// function to create a wrapper with a different level.
	Gzip = compress(0x1)
)
View Source
const (
	// Hex is the Hex encoding Wrapper. This wraps the binary data as hex values.
	Hex = simple(0x1)
	// Base64 is the Base64 Wrapper. This wraps the binary data as a Base64 byte string. This may be
	// combined with the Base64 transform.
	Base64 = simple(0x2)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	// contains filtered or unexported fields
}

Block is the cipher.Block implementation of a Wrapper. This instance will create a Block based Wrapper with ciphers such as AES.

func NewBlock

func NewBlock(b cipher.Block, v []byte) (Block, error)

NewBlock returns a Wrapper based on a Block Cipher, such as AES.

func (Block) Unwrap

func (b Block) Unwrap(r io.Reader) (io.Reader, error)

Unwrap fulfils the Wrapper interface.

func (Block) Wrap

func (b Block) Wrap(w io.WriteCloser) (io.WriteCloser, error)

Wrap fulfils the Wrapper interface.

type CBK added in v0.4.4

type CBK [5]byte

CBK is the crypto.CBK implementation of a Wrapper. This instance will create a new CBK instance with these supplied values and size.

func NewCBK added in v0.1.0

func NewCBK(a, b, c, d, size byte) CBK

NewCBK creates a special type of Wrapper for CBK-based encryptors.

NOTE: This function will prevent CBK from using its index based block functions, not sure if there's a way to work around this.

func (CBK) Unwrap added in v0.4.4

func (c CBK) Unwrap(r io.Reader) (io.Reader, error)

Unwrap fulfils the Wrapper interface.

func (CBK) Wrap added in v0.4.4

func (c CBK) Wrap(w io.WriteCloser) (io.WriteCloser, error)

Wrap fulfils the Wrapper interface.

type XOR added in v0.4.4

type XOR struct {
	// contains filtered or unexported fields
}

XOR is the crypto.XOR implementation of a Wrapper. This instance will create a XOR key stream with IV based on the supplied values.

func NewXOR added in v0.1.0

func NewXOR(k []byte) XOR

NewXOR is a function that is an alias for 'Stream(crypto.XOR(k), crypto.XOR(k))'

This wil return a Stream-backed XOR Wrapper.

func (XOR) Unwrap added in v0.4.4

func (x XOR) Unwrap(r io.Reader) (io.Reader, error)

Unwrap fulfils the Wrapper interface.

func (XOR) Wrap added in v0.4.4

func (x XOR) Wrap(w io.WriteCloser) (io.WriteCloser, error)

Wrap fulfils the Wrapper interface.

Jump to

Keyboard shortcuts

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