obfuscator

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2020 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GENERICMATCH is a string literal for generic regex matching strings in the executable
	// GENERICMATCH = `[[:word:]\.\/\(\)\*\[\]\&\%\{\}\$ ]*`
	GENERICMATCH = `[[:word:]\.\\/ ]*`
)

Variables

This section is empty.

Functions

func WalkGoPackageForGhosts

func WalkGoPackageForGhosts(dirpath string, pkgName string) ([]string, error)

WalkGoPackageForGhosts gathers all ghosts from a specified gopackage's directory and package name

Types

type Mordor

type Mordor struct {
	sync.RWMutex
	Horde  map[string]*Orc
	Dead   map[string]bool
	Logger logger.Logger
}

Mordor is a post compilation obfuscator type that replaces ascii strings out of binary files

func NewMordor

func NewMordor(l logger.Logger) *Mordor

NewMordor returns a new mordor object with some sane defaults added specifically for genesis

func (*Mordor) AddGhosts

func (m *Mordor) AddGhosts(g []string)

AddGhosts bulk adds a list of ghosts to this mordor object's Horde

func (*Mordor) AddSingleGhost

func (m *Mordor) AddSingleGhost(g string) error

AddSingleGhost adds a ghost with a filter appended to the end of the regular expression

func (*Mordor) AddSingleGhostLiteral

func (m *Mordor) AddSingleGhostLiteral(g string) error

AddSingleGhostLiteral adds a ghost without building a generic regular expression filter

func (*Mordor) Assault

func (m *Mordor) Assault(srcFile string) error

Assault runs processes the given binary file by enumaerating each orc's filter on it to obfuscate strings out of the file

func (*Mordor) PrintStats

func (m *Mordor) PrintStats()

PrintStats is a debug function that uses the Mordor object's logger and prints stats about which Orcs matched and how many times

type Orc

type Orc struct {
	Name   string
	Hits   int
	Filter *regexp.Regexp
}

Orc is a type to represent a single string match that should be replaced in a binary

type StringDef

type StringDef struct {
	// unique ID of the string def in relation to the target source tree
	ID string `json:"id"`

	// original value of the string as defined in source
	Value string `json:"value"`

	// key used to encrypt string with
	Key rune `json:"key"`

	// the encrypted data to represent this string
	Data []rune `json:"data"`
}

StringDef represents an instance of an obfuscated string within the gscript compilers intermediate representation

type Stylist

type Stylist struct {
	sync.RWMutex

	// Defs is the StringDef slice for all the source code
	Combs map[*ast.File]*comb

	// BuildDir is the target build directory
	BuildDir string

	// Contains global fileset information for the package this comb belongs to
	FileSet *token.FileSet
}

Stylist creates a new pre-obfuscation tangle manager

func NewStylist

func NewStylist(buildDir string) *Stylist

NewStylist creates a new Stylist

func (*Stylist) AddPurpleHairDyeToRoots

func (s *Stylist) AddPurpleHairDyeToRoots() error

AddPurpleHairDyeToRoots creates the tangled hair arrays

func (*Stylist) GetIDLiterals

func (s *Stylist) GetIDLiterals() []string

GetIDLiterals returns all IDs used by all combs in this Stylist

func (*Stylist) GetTheQueenToHerThrown

func (s *Stylist) GetTheQueenToHerThrown() error

GetTheQueenToHerThrown re-writes the intermediate representation with the embedded tangled hairs

func (*Stylist) LollerSkateDaStringz

func (s *Stylist) LollerSkateDaStringz() error

LollerSkateDaStringz walks the build directory package AST

Jump to

Keyboard shortcuts

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