compiler

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2018 License: AGPL-3.0 Imports: 36 Imported by: 4

Documentation

Index

Constants

View Source
const (
	DEFAULT_PRIORITY = 100
	DEFAULT_TIMEOUT  = 30
)

Variables

View Source
var (
	FunctionMap = map[string]string{}
)
View Source
var ObfuscatedBlobs = []string{
	"2f686f6d652f5b5b3a776f72643a5d5c2e5c5c2f205d2a",
	"2f55736572732f5b5b3a776f72643a5d5c2e5c5c2f205d2a",
	"2f726f6f742f5b5b3a776f72643a5d5c2e5c5c2f205d2a",
	"2f746d702f5b5b3a776f72643a5d5c2e5c5c2f205d2a",
	"2f7573722f6c6f63616c2f5b5b3a776f72643a5d5c2e5c5c2f205d2a",
	"6769746875625b5b3a776f72643a5d5c2e5c5c2f205d2a",
	"676f6f676c655b5b3a776f72643a5d5c2e5c5c2f205d2a",
	"676f6c616e675b5b3a776f72643a5d5c2e5c5c2f205d2a",
	"676f706b675b5b3a776f72643a5d5c2e5c5c2f205d2a",
	"5550585b5b3a776f72643a5d5c2e5c5c2f205d2a",
	"24496e666f5b5b3a776f72643a5d5c2e5c5c2f205d2a",
	"67656e30636964655b5b3a776f72643a5d5c2e5c5c2f205d2a",
	"677363726970745b5b3a776f72643a5d5c2e5c5c2f205d2a",
}

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func BytesToCompressed

func BytesToCompressed(b []byte) []byte

func CompressedToBytes

func CompressedToBytes(b []byte) []byte

func CreateReplacement

func CreateReplacement(s string) []byte

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func PrettyPrintSource

func PrettyPrintSource(source string)

func RandUpperAlphaString

func RandUpperAlphaString(strlen int) string

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func RetrieveExample

func RetrieveExample() []byte

func ValidateAST added in v0.0.10

func ValidateAST(source []byte) error

Types

type ByLength

type ByLength []string

func (ByLength) Len

func (s ByLength) Len() int

func (ByLength) Less

func (s ByLength) Less(i, j int) bool

func (ByLength) Swap

func (s ByLength) Swap(i, j int)

type Compiler

type Compiler struct {
	OS             string              `json:"os"`
	Arch           string              `json:"arch"`
	OutputFile     string              `json:"output"`
	VMs            []*VMBundle         `json:"vms"`
	SortedVMs      map[int][]*VMBundle `json:"-"`
	BuildDir       string              `json:"build_dir"`
	AssetDir       string              `json:"asset_dir"`
	OutputSource   bool                `json:"output_source"`
	CompressBinary bool                `json:"compress_binary"`
	EnableLogging  bool                `json:"enable_logging"`
	Logger         *logrus.Logger      `json:"-"`
	Source         string              `json:"-"`
	StringDefs     []*StringDef        `json:"-"`
	UniqPriorities []int               `json:"-"`
}

Compiler creates a skeleton structure to produce a compiled binary

func NewCompiler

func NewCompiler(scripts []string, outfile, os, arch string, sourceOut, compression bool, enableLogging bool) *Compiler

NewCompiler returns a basic Compiler object

func (*Compiler) CreateBuildDir

func (c *Compiler) CreateBuildDir()

CreateBuildDir sets up the compiler's build directory

func (*Compiler) Do

func (c *Compiler) Do()

func (*Compiler) GenerateTangledHairs

func (c *Compiler) GenerateTangledHairs() string

func (*Compiler) HairTangler

func (c *Compiler) HairTangler(key rune, source string) string

func (*Compiler) LollerSkateDaStringz

func (c *Compiler) LollerSkateDaStringz(source []byte) []byte

func (*Compiler) MordorifyDarwin

func (c *Compiler) MordorifyDarwin()

func (*Compiler) MordorifyLinux

func (c *Compiler) MordorifyLinux()

func (*Compiler) MordorifyWindows

func (c *Compiler) MordorifyWindows()

func (*Compiler) ObfuscateBinary

func (c *Compiler) ObfuscateBinary()

func (*Compiler) ParseMacros added in v0.0.10

func (c *Compiler) ParseMacros(vm *VMBundle) []string

ParseMacros normalizes the import files into localized assets

func (*Compiler) Visit

func (c *Compiler) Visit(node goast.Node) goast.Visitor

type EmbeddedFile

type EmbeddedFile struct {
	SourcePath   string
	SourceURL    string
	Filename     string
	NameHash     string
	VariableDef  string
	Uncompressed []byte
	Compressed   []byte
}

func (*EmbeddedFile) Compress

func (e *EmbeddedFile) Compress()

func (*EmbeddedFile) Embed

func (e *EmbeddedFile) Embed()

func (*EmbeddedFile) ResolveData

func (e *EmbeddedFile) ResolveData()

func (*EmbeddedFile) ResolveFilename

func (e *EmbeddedFile) ResolveFilename()

func (*EmbeddedFile) ResolveVariableName

func (e *EmbeddedFile) ResolveVariableName()

type MacroList added in v0.0.10

type MacroList struct {
	Priority    int
	Timeout     int
	LocalFiles  []string
	RemoteFiles []string
}

func ParseMacros added in v0.0.10

func ParseMacros(script string, logger *logrus.Entry) *MacroList

type StringDef

type StringDef struct {
	ID    string `json:"id"`
	Value string `json:"value"`
	Key   rune   `json:"key"`
	Data  []rune `json:"data"`
}

type VMBundle

type VMBundle struct {
	ID           string         `json:"id"`
	ScriptFile   string         `json:"source"`
	AssetFiles   []string       `json:"imports"`
	Embeds       []EmbeddedFile `json:"-"`
	RequiredOS   string         `json:"required_os"`
	RequiredArch string         `json:"required_arch"`
	Priority     int            `json:"priority"`
	Timeout      int            `json:"timeout"`
}

VMBundle defines a standalone GSE VM that will be bundled into a compiled binary

type VMLibrary

type VMLibrary struct {
	ID         string `json:"id"`
	ScriptFile string `json:"library"`
}

Jump to

Keyboard shortcuts

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