obfuscate

package module
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 9 Imported by: 0

README

Skyhook Obfuscators

This repository provides obfuscation objects and algorithms for Skyhook.

Building WASM

This command can be used to build the WASM file. It can be dropped into Skyhook directly, or incorporated into other tooling.

cd wasm
GOOS=js GOARCH=wasm go build -o algos.wasm

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Decode

func Base64Decode(in []byte) (out []byte, err error)

func Base64Encode

func Base64Encode(in []byte) (out []byte)

func Deobfuscate

func Deobfuscate(input []byte, chain []Obfuscator) (out []byte, err error)

Deobfuscate operates on a chain of Obfuscator objects and returns the deobfuscated output

func Obfuscate

func Obfuscate(input []byte, chain []Obfuscator) (out []byte, err error)

Obfuscate operates on a chain of Obfuscator objects and returns the obfuscated output

func ParseObfuscators

func ParseObfuscators(obfConfigs *[]ObfuscatorConfig) (chain *[]Obfuscator, failures []string)

ParseObfuscators parses a slice of ObfuscatorConfig structs into a chain of Obfuscator objects.

func UnparseObfuscators

func UnparseObfuscators(obfs *[]Obfuscator) *[]ObfuscatorConfig

UnparseObfuscators parses a slice of objects that implement obfuscate.Obfuscator and returns a slice of pointers to ObfuscatorConfig structs.

Types

type AES

type AES struct {
	Key string `json:"key"`
}

AES structure maintains a key value and satisfies Obfuscator interface.

func (*AES) ByteKey

func (a *AES) ByteKey() []byte

ByteKey returns Key as a byte slice.

func (*AES) Deobfuscate

func (a *AES) Deobfuscate(input []byte) (output []byte, err error)

Deobfuscate AES decrypts input bytes. Returns decrypted output and an error value.

func (*AES) Obfuscate

func (a *AES) Obfuscate(input []byte) (output []byte, err error)

Obfuscate AES encrypts input bytes. Returns encrypted output and an error value.

type Base64

type Base64 struct {
	Rounds uint `json:"rounds"`
}

Base64 structure maintains a rounds value and satisfies Obfuscator interface.

func (*Base64) Deobfuscate

func (b *Base64) Deobfuscate(input []byte) (output []byte, err error)

Deobfuscate Base64 decodes input bytes by a number of rounds. Returns decoded output and an error value.

func (*Base64) Obfuscate

func (b *Base64) Obfuscate(input []byte) (output []byte, err error)

Obfuscate Base64 encodes input bytes by a number of rounds. Returns encoded output and an error value.

type Blowfish

type Blowfish struct {
	Key  string `json:"key"`
	Salt string `json:"salt"`
}

Blowfish structure maintains a key and salt value and satisfies Obfuscator interface. Salt is optional.

func (*Blowfish) ByteKey

func (b *Blowfish) ByteKey() []byte

func (*Blowfish) ByteSalt

func (b *Blowfish) ByteSalt() []byte

func (*Blowfish) Deobfuscate

func (b *Blowfish) Deobfuscate(input []byte) (output []byte, err error)

Deobfuscate Blowfish decrypts input bytes, optionally salted. Returns decrypted output and an error value.

func (*Blowfish) Obfuscate

func (b *Blowfish) Obfuscate(input []byte) (output []byte, err error)

Obfuscate Blowfish encrypts input bytes, optionally salted. Returns encrypted output and an error value.

type Obfuscator

type Obfuscator interface {
	Obfuscate(input []byte) (output []byte, err error)
	Deobfuscate(input []byte) (output []byte, err error)
}

Obfuscator interface allows for homogenous obfuscation chaining.

func MapToAlgorithm

func MapToAlgorithm(name string) (o Obfuscator, ok bool)

MapToAlgorithm maps the name of an obfuscation algorithm back to the proper type.

type ObfuscatorConfig

type ObfuscatorConfig struct {
	Algo   string                 `nonzero:"" mapstructure:"algo" json:"algo" yaml:"algo"`
	Config map[string]interface{} `nonzero:"" mapstructure:"config" json:"config" yaml:"config"`
}

ObfuscatorConfig represents a configuration for an Obfuscator.

type Twofish

type Twofish struct {
	Key string `json:"key"`
}

Twofish structure maintains a key value and satisfies Obfuscator interface.

func (*Twofish) ByteKey

func (t *Twofish) ByteKey() []byte

func (*Twofish) Deobfuscate

func (t *Twofish) Deobfuscate(input []byte) (output []byte, err error)

Deobfuscate Twofish encrypts input bytes. Returns decrypted output and an error value.

func (*Twofish) Obfuscate

func (t *Twofish) Obfuscate(input []byte) (output []byte, err error)

Obfuscate Twofish encrypts input bytes. Returns encrypted output and an error value.

type XOR

type XOR struct {
	Key string `json:"key"`
}

XOR structure maintains a key value and satisfies Obfuscator interface.

func (*XOR) ByteKey

func (x *XOR) ByteKey() []byte

func (*XOR) Deobfuscate

func (x *XOR) Deobfuscate(input []byte) (output []byte, err error)

Deobfuscate XOR decrypts input bytes. Returns decrypted output and an error value.

func (*XOR) Obfuscate

func (x *XOR) Obfuscate(input []byte) (output []byte, err error)

Obfuscate XOR encrypts input bytes. Returns encrypted output and an error value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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