engine

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2018 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Package engine is the package that implements the gscript Virtual Machine (VM).

VM Functions implemented:

Library core

Functions in core:

Asset(assetName) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.Asset
DeobfuscateString(str) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.DeobfuscateString
Halt() - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.Halt
MD5(data) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.MD5
ObfuscateString(str) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.ObfuscateString
RandomInt(min, max) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.RandomInt
RandomMixedCaseString(strlen) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.RandomMixedCaseString
RandomString(strlen) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.RandomString
StripSpaces(str) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.StripSpaces
Timestamp() - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.Timestamp
XorBytes(aByteArray, bByteArray) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.XorBytes

Library exec

Functions in exec:

ExecuteCommand(baseCmd, cmdArgs) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.ExecuteCommand
ForkExecuteCommand(baseCmd, cmdArgs) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.ForkExecuteCommand

Library file

Functions in file:

AppendFileBytes(path, fileData) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.AppendFileBytes
AppendFileString(path, addString) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.AppendFileString
CopyFile(srcPath, dstPath, perms) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.CopyFile
CreateDir(path) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.CreateDir
DeleteFile(path) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.DeleteFile
FileExists(path) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.FileExists
ReadFile(path) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.ReadFile
ReplaceFileString(file, match, replacement) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.ReplaceFileString
WriteFile(path, fileData, perms) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.WriteFile

Library os

Functions in os:

Chmod(path, perms) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.Chmod
EnvVars() - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.EnvVars
FindProcByName(procName) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.FindProcByName
GetEnvVar(vars) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.GetEnvVar
GetProcName(pid) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.GetProcName
InstallSystemService(path, name, displayName, description) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.InstallSystemService
ModTime(path) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.ModTime
ModifyTimestamp(path, accessTime, modifyTime) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.ModifyTimestamp
RemoveServiceByName(name) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.RemoveServiceByName
RunningProcs() - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.RunningProcs
SelfPath() - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.SelfPath
Signal(signal, pid) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.Signal
StartServiceByName(name) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.StartServiceByName
StopServiceByName(name) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.StopServiceByName

Library registry

Functions in registry:

AddRegKeyBinary(registryString, path, name, value) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.AddRegKeyBinary
AddRegKeyDWORD(registryString, path, name, value) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.AddRegKeyDWORD
AddRegKeyExpandedString(registryString, path, name, value) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.AddRegKeyExpandedString
AddRegKeyQWORD(registryString, path, name, value) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.AddRegKeyQWORD
AddRegKeyString(registryString, path, name, value) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.AddRegKeyString
AddRegKeyStrings(registryString, path, name, value) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.AddRegKeyStrings
DelRegKey(registryString, path) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.DelRegKey
DelRegKeyValue(registryString, path, value) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.DelRegKeyValue
QueryRegKey(registryString, path) - https://godoc.org/github.com/gen0cide/gscript/engine/#Engine.QueryRegKey

Index

Constants

This section is empty.

Variables

View Source
var (
	Debugger = true
)

Functions

func InjectIntoProc

func InjectIntoProc(shellcode string, proccessID int64) error

Types

type Engine

type Engine struct {
	VM              *otto.Otto
	Logger          *logrus.Logger
	Imports         map[string]func() []byte
	Name            string
	DebuggerEnabled bool
	Timeout         int
	Halted          bool
	Paused          bool
}

func New

func New(name string) *Engine

func (*Engine) AddImport

func (e *Engine) AddImport(name string, data func() []byte)

func (*Engine) AddRegKeyBinary added in v0.1.0

func (e *Engine) AddRegKeyBinary(registryString string, path string, name string, value []byte) error

AddRegKeyBinary - Add a binary registry key

Package

registry

Author

- Vyrus (https://github.com/vyrus001)

Javascript

Here is the Javascript method signature:

AddRegKeyBinary(registryString, path, name, value)

Arguments

Here is a list of the arguments for the Javascript function:

  • registryString (string)
  • path (string)
  • name (string)
  • value ([]byte)

Returns

Here is a list of fields in the return object:

  • obj.runtimeError (error)

Example

Here is an example of how to use this function in gscript:

var obj = AddRegKeyBinary(registryString, path, name, value);
// obj.runtimeError

func (*Engine) AddRegKeyDWORD added in v0.1.0

func (e *Engine) AddRegKeyDWORD(registryString string, path string, name string, value uint32) error

AddRegKeyDWORD - Add a DWORD registry key

Package

registry

Author

- Vyrus (https://github.com/vyrus001)

Javascript

Here is the Javascript method signature:

AddRegKeyDWORD(registryString, path, name, value)

Arguments

Here is a list of the arguments for the Javascript function:

  • registryString (string)
  • path (string)
  • name (string)
  • value (uint32)

Returns

Here is a list of fields in the return object:

  • obj.runtimeError (error)

Example

Here is an example of how to use this function in gscript:

var obj = AddRegKeyDWORD(registryString, path, name, value);
// obj.runtimeError

func (*Engine) AddRegKeyExpandedString added in v0.1.0

func (e *Engine) AddRegKeyExpandedString(registryString string, path string, name string, value string) error

AddRegKeyExpandedString - Add an expanded string registry key

Package

registry

Author

- Vyrus (https://github.com/vyrus001)

Javascript

Here is the Javascript method signature:

AddRegKeyExpandedString(registryString, path, name, value)

Arguments

Here is a list of the arguments for the Javascript function:

  • registryString (string)
  • path (string)
  • name (string)
  • value (string)

Returns

Here is a list of fields in the return object:

  • obj.runtimeError (error)

Example

Here is an example of how to use this function in gscript:

var obj = AddRegKeyExpandedString(registryString, path, name, value);
// obj.runtimeError

func (*Engine) AddRegKeyQWORD added in v0.1.0

func (e *Engine) AddRegKeyQWORD(registryString string, path string, name string, value uint64) error

AddRegKeyQWORD - Add a QWORD registry key

Package

registry

Author

- Vyrus (https://github.com/vyrus001)

Javascript

Here is the Javascript method signature:

AddRegKeyQWORD(registryString, path, name, value)

Arguments

Here is a list of the arguments for the Javascript function:

  • registryString (string)
  • path (string)
  • name (string)
  • value (uint64)

Returns

Here is a list of fields in the return object:

  • obj.runtimeError (error)

Example

Here is an example of how to use this function in gscript:

var obj = AddRegKeyQWORD(registryString, path, name, value);
// obj.runtimeError

func (*Engine) AddRegKeyString added in v0.1.0

func (e *Engine) AddRegKeyString(registryString string, path string, name string, value string) error

AddRegKeyString - Add a string registry key

Package

registry

Author

- Vyrus (https://github.com/vyrus001)

Javascript

Here is the Javascript method signature:

AddRegKeyString(registryString, path, name, value)

Arguments

Here is a list of the arguments for the Javascript function:

  • registryString (string)
  • path (string)
  • name (string)
  • value (string)

Returns

Here is a list of fields in the return object:

  • obj.runtimeError (error)

Example

Here is an example of how to use this function in gscript:

var obj = AddRegKeyString(registryString, path, name, value);
// obj.runtimeError

func (*Engine) AddRegKeyStrings added in v0.1.0

func (e *Engine) AddRegKeyStrings(registryString string, path string, name string, value []string) error

AddRegKeyStrings - Add a registry key of type string(s)

Package

registry

Author

- Vyrus (https://github.com/vyrus001)

Javascript

Here is the Javascript method signature:

AddRegKeyStrings(registryString, path, name, value)

Arguments

Here is a list of the arguments for the Javascript function:

  • registryString (string)
  • path (string)
  • name (string)
  • value ([]string)

Returns

Here is a list of fields in the return object:

  • obj.runtimeError (error)

Example

Here is an example of how to use this function in gscript:

var obj = AddRegKeyStrings(registryString, path, name, value);
// obj.runtimeError

func (*Engine) AppendFileBytes added in v0.1.0

func (e *Engine) AppendFileBytes(path string, fileData []byte) error

AppendFileBytes - Addes a given byte array to the end of a file

Package

file

Author

- ahhh (https://github.com/ahhh)

Javascript

Here is the Javascript method signature:

AppendFileBytes(path, fileData)

Arguments

Here is a list of the arguments for the Javascript function:

  • path (string)
  • fileData ([]byte)

Returns

Here is a list of fields in the return object:

  • obj.fileError (error)

Example

Here is an example of how to use this function in gscript:

var obj = AppendFileBytes(path, fileData);
// obj.fileError

func (*Engine) AppendFileString added in v0.1.0

func (e *Engine) AppendFileString(path, addString string) error

AppendFileString - Addes a given string to the end of a file

Package

file

Author

- ahhh (https://github.com/ahhh)

Javascript

Here is the Javascript method signature:

AppendFileString(path, addString)

Arguments

Here is a list of the arguments for the Javascript function:

  • path (string)
  • addString (string)

Returns

Here is a list of fields in the return object:

  • obj.fileError (error)

Example

Here is an example of how to use this function in gscript:

var obj = AppendFileString(path, addString);
// obj.fileError

func (*Engine) Asset added in v0.1.0

func (e *Engine) Asset(filename string) ([]byte, error)

Asset - Retrieves a packed asset from the VM embedded file store.

Package

core

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

Asset(assetName)

Arguments

Here is a list of the arguments for the Javascript function:

  • assetName (string)

Returns

Here is a list of fields in the return object:

  • obj.fileData ([]byte)
  • obj.err (error)

Example

Here is an example of how to use this function in gscript:

var obj = Asset(assetName);
// obj.fileData
// obj.err

func (*Engine) Chmod added in v0.1.0

func (e *Engine) Chmod(path string, perms int64) error

Chmod - Change the permissions on a path.

Package

os

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

Chmod(path, perms)

Arguments

Here is a list of the arguments for the Javascript function:

  • path (string)
  • perms (int64)

Returns

Here is a list of fields in the return object:

  • obj.osError (error)

Example

Here is an example of how to use this function in gscript:

var obj = Chmod(path, perms);
// obj.osError

func (*Engine) CopyFile added in v0.1.0

func (e *Engine) CopyFile(srcPath, destPath string, perms int64) error

CopyFile - Reads the contents of one file and copies it to another with the given permissions.

Package

file

Author

- ahhh (https://github.com/ahhh)

Javascript

Here is the Javascript method signature:

CopyFile(srcPath, dstPath, perms)

Arguments

Here is a list of the arguments for the Javascript function:

  • srcPath (string)
  • dstPath (string)
  • perms (int64)

Returns

Here is a list of fields in the return object:

  • obj.fileError (error)

Example

Here is an example of how to use this function in gscript:

var obj = CopyFile(srcPath, dstPath, perms);
// obj.fileError

func (*Engine) CreateDir added in v0.1.0

func (e *Engine) CreateDir(path string) error

CreateDir - Creates a directory at a given path or return an error

Package

file

Author

- ahhh (https://github.com/ahhh)

Javascript

Here is the Javascript method signature:

CreateDir(path)

Arguments

Here is a list of the arguments for the Javascript function:

  • path (string)

Returns

Here is a list of fields in the return object:

  • obj.fileError (error)

Example

Here is an example of how to use this function in gscript:

var obj = CreateDir(path);
// obj.fileError

func (*Engine) CreateVM

func (e *Engine) CreateVM()

func (*Engine) DelRegKey added in v0.1.0

func (e *Engine) DelRegKey(registryString string, path string) error

DelRegKey - Delete a registry key

Package

registry

Author

- Vyrus (https://github.com/vyrus001)

Javascript

Here is the Javascript method signature:

DelRegKey(registryString, path)

Arguments

Here is a list of the arguments for the Javascript function:

  • registryString (string)
  • path (string)

Returns

Here is a list of fields in the return object:

  • obj.runtimeError (error)

Example

Here is an example of how to use this function in gscript:

var obj = DelRegKey(registryString, path);
// obj.runtimeError

func (*Engine) DelRegKeyValue added in v0.1.0

func (e *Engine) DelRegKeyValue(registryString string, path string, valueName string) error

DelRegKeyValue - Delete a registry key value

Package

registry

Author

- Vyrus (https://github.com/vyrus001)

Javascript

Here is the Javascript method signature:

DelRegKeyValue(registryString, path, value)

Arguments

Here is a list of the arguments for the Javascript function:

  • registryString (string)
  • path (string)
  • value (string)

Returns

Here is a list of fields in the return object:

  • obj.runtimeError (error)

Example

Here is an example of how to use this function in gscript:

var obj = DelRegKeyValue(registryString, path, value);
// obj.runtimeError

func (*Engine) DeleteFile added in v0.1.0

func (e *Engine) DeleteFile(path string) error

DeleteFile - Deletes a file at a given path or returns an error

Package

file

Author

- ahhh (https://github.com/ahhh)

Javascript

Here is the Javascript method signature:

DeleteFile(path)

Arguments

Here is a list of the arguments for the Javascript function:

  • path (string)

Returns

Here is a list of fields in the return object:

  • obj.fileError (error)

Example

Here is an example of how to use this function in gscript:

var obj = DeleteFile(path);
// obj.fileError

func (*Engine) DeobfuscateString added in v0.1.0

func (e *Engine) DeobfuscateString(Data string) string

DeobfuscateString - Basic string deobfuscator function.

Package

core

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

DeobfuscateString(str)

Arguments

Here is a list of the arguments for the Javascript function:

  • str (string)

Returns

Here is a list of fields in the return object:

  • obj.value (string)

Example

Here is an example of how to use this function in gscript:

var obj = DeobfuscateString(str);
// obj.value

func (*Engine) EnvVars added in v0.1.0

func (e *Engine) EnvVars() map[string]string

EnvVars - Returns a map of enviornment variable names to their corrisponding values.

Package

os

Author

- Vyrus (https://github.com/vyrus001)

Javascript

Here is the Javascript method signature:

EnvVars()

Arguments

Here is a list of the arguments for the Javascript function:

Returns

Here is a list of fields in the return object:

  • obj.vars (map[string]string)

Example

Here is an example of how to use this function in gscript:

var obj = EnvVars();
// obj.vars

func (*Engine) ExecuteCommand added in v0.1.0

func (e *Engine) ExecuteCommand(c string, args []string) VMExecResponse

ExecuteCommand - Executes system commands.

Package

exec

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

ExecuteCommand(baseCmd, cmdArgs)

Arguments

Here is a list of the arguments for the Javascript function:

  • baseCmd (string)
  • cmdArgs ([]string)

Returns

Here is a list of fields in the return object:

  • obj.retObject (VMExecResponse)

Example

Here is an example of how to use this function in gscript:

var obj = ExecuteCommand(baseCmd, cmdArgs);
// obj.retObject

func (*Engine) ExecutePlan

func (e *Engine) ExecutePlan() error

func (*Engine) FileExists added in v0.1.0

func (e *Engine) FileExists(path string) (bool, error)

FileExists - Checks if a file exists and returns a bool

Package

file

Author

- ahhh (https://github.com/ahhh)

Javascript

Here is the Javascript method signature:

FileExists(path)

Arguments

Here is a list of the arguments for the Javascript function:

  • path (string)

Returns

Here is a list of fields in the return object:

  • obj.fileExists (bool)
  • obj.fileError (error)

Example

Here is an example of how to use this function in gscript:

var obj = FileExists(path);
// obj.fileExists
// obj.fileError

func (*Engine) FindProcByName added in v0.1.0

func (e *Engine) FindProcByName(procName string) (int, error)

FindProcByName - Returns the Pid of a given proccess, if the proccess can not be found, an error is returned

Package

os

Author

- Vyrus (https://github.com/vyrus001)

Javascript

Here is the Javascript method signature:

FindProcByName(procName)

Arguments

Here is a list of the arguments for the Javascript function:

  • procName (string)

Returns

Here is a list of fields in the return object:

  • obj.pid (int)
  • obj.procError (error)

Example

Here is an example of how to use this function in gscript:

var obj = FindProcByName(procName);
// obj.pid
// obj.procError

func (*Engine) ForkExecuteCommand added in v0.1.0

func (e *Engine) ForkExecuteCommand(c string, args []string) (int, error)

ForkExecuteCommand - Executes system commands via a forked call.

Package

exec

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

ForkExecuteCommand(baseCmd, cmdArgs)

Arguments

Here is a list of the arguments for the Javascript function:

  • baseCmd (string)
  • cmdArgs ([]string)

Returns

Here is a list of fields in the return object:

  • obj.pid (int)
  • obj.execError (error)

Example

Here is an example of how to use this function in gscript:

var obj = ForkExecuteCommand(baseCmd, cmdArgs);
// obj.pid
// obj.execError

func (*Engine) GetEnvVar added in v0.1.0

func (e *Engine) GetEnvVar(eVar string) string

GetEnvVar - Returns the value of a given enviornment variable

Package

os

Author

- Vyrus (https://github.com/vyrus001)

Javascript

Here is the Javascript method signature:

GetEnvVar(vars)

Arguments

Here is a list of the arguments for the Javascript function:

  • vars (string)

Returns

Here is a list of fields in the return object:

  • obj.value (string)

Example

Here is an example of how to use this function in gscript:

var obj = GetEnvVar(vars);
// obj.value

func (*Engine) GetProcName added in v0.1.0

func (e *Engine) GetProcName(pid int) (string, error)

GetProcName - Returns the name of a target proccess

Package

os

Author

- Vyrus (https://github.com/vyrus001)

Javascript

Here is the Javascript method signature:

GetProcName(pid)

Arguments

Here is a list of the arguments for the Javascript function:

  • pid (int)

Returns

Here is a list of fields in the return object:

  • obj.procName (string)
  • obj.runtimeError (error)

Example

Here is an example of how to use this function in gscript:

var obj = GetProcName(pid);
// obj.procName
// obj.runtimeError

func (*Engine) Halt added in v0.1.0

func (e *Engine) Halt() bool

Halt - Stop the current VM from continuing execution.

Package

core

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

Halt()

Arguments

Here is a list of the arguments for the Javascript function:

Returns

Here is a list of fields in the return object:

  • obj.value (bool)

Example

Here is an example of how to use this function in gscript:

var obj = Halt();
// obj.value

func (*Engine) InstallSystemService added in v0.0.10

func (e *Engine) InstallSystemService(path, name, displayName, description string) error

InstallSystemService - Installs a target binary as a system service

Package

os

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

InstallSystemService(path, name, displayName, description)

Arguments

Here is a list of the arguments for the Javascript function:

  • path (string)
  • name (string)
  • displayName (string)
  • description (string)

Returns

Here is a list of fields in the return object:

  • obj.installError (error)

Example

Here is an example of how to use this function in gscript:

var obj = InstallSystemService(path, name, displayName, description);
// obj.installError

func (*Engine) LoadScript

func (e *Engine) LoadScript(filename string, source []byte) error

func (*Engine) MD5 added in v0.1.0

func (e *Engine) MD5(data []byte) string

MD5 - Perform an MD5() hash on data.

Package

core

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

MD5(data)

Arguments

Here is a list of the arguments for the Javascript function:

  • data ([]byte)

Returns

Here is a list of fields in the return object:

  • obj.value (string)

Example

Here is an example of how to use this function in gscript:

var obj = MD5(data);
// obj.value

func (*Engine) ModTime added in v0.1.0

func (e *Engine) ModTime(path string) (int64, error)

ModTime - Retrieves the last modified time of a path.

Package

os

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

ModTime(path)

Arguments

Here is a list of the arguments for the Javascript function:

  • path (string)

Returns

Here is a list of fields in the return object:

  • obj.modTime (int64)
  • obj.fileError (error)

Example

Here is an example of how to use this function in gscript:

var obj = ModTime(path);
// obj.modTime
// obj.fileError

func (*Engine) ModifyTimestamp added in v0.1.0

func (e *Engine) ModifyTimestamp(path string, accessTime, modifyTime int64) error

ModifyTimestamp - Change the access and modified time of a file.

Package

os

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

ModifyTimestamp(path, accessTime, modifyTime)

Arguments

Here is a list of the arguments for the Javascript function:

  • path (string)
  • accessTime (int64)
  • modifyTime (int64)

Returns

Here is a list of fields in the return object:

  • obj.fileError (error)

Example

Here is an example of how to use this function in gscript:

var obj = ModifyTimestamp(path, accessTime, modifyTime);
// obj.fileError

func (*Engine) ObfuscateString added in v0.1.0

func (e *Engine) ObfuscateString(Data string) string

ObfuscateString - Basic string obfuscator function.

Package

core

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

ObfuscateString(str)

Arguments

Here is a list of the arguments for the Javascript function:

  • str (string)

Returns

Here is a list of fields in the return object:

  • obj.value (string)

Example

Here is an example of how to use this function in gscript:

var obj = ObfuscateString(str);
// obj.value

func (*Engine) QueryRegKey added in v0.1.0

func (e *Engine) QueryRegKey(registryString string, path string) (RegistryRetValue, error)

QueryRegKey - Retrive a registry key

Package

registry

Author

- Vyrus (https://github.com/vyrus001)

Javascript

Here is the Javascript method signature:

QueryRegKey(registryString, path)

Arguments

Here is a list of the arguments for the Javascript function:

  • registryString (string)
  • path (string)

Returns

Here is a list of fields in the return object:

  • obj.keyObj (RegistryRetValue)
  • obj.runtimeError (error)

Example

Here is an example of how to use this function in gscript:

var obj = QueryRegKey(registryString, path);
// obj.keyObj
// obj.runtimeError

func (*Engine) RandomInt added in v0.1.0

func (e *Engine) RandomInt(min, max int64) int

RandomInt - Generates a random number between min and max.

Package

core

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

RandomInt(min, max)

Arguments

Here is a list of the arguments for the Javascript function:

  • min (int64)
  • max (int64)

Returns

Here is a list of fields in the return object:

  • obj.value (int)

Example

Here is an example of how to use this function in gscript:

var obj = RandomInt(min, max);
// obj.value

func (*Engine) RandomMixedCaseString added in v0.1.0

func (e *Engine) RandomMixedCaseString(n int64) string

RandomMixedCaseString - Generates a random mixed case alpha numeric string of a specified length.

Package

core

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

RandomMixedCaseString(strlen)

Arguments

Here is a list of the arguments for the Javascript function:

  • strlen (int64)

Returns

Here is a list of fields in the return object:

  • obj.value (string)

Example

Here is an example of how to use this function in gscript:

var obj = RandomMixedCaseString(strlen);
// obj.value

func (*Engine) RandomString added in v0.1.0

func (e *Engine) RandomString(strlen int64) string

RandomString - Generates a random alpha numeric string of a specified length.

Package

core

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

RandomString(strlen)

Arguments

Here is a list of the arguments for the Javascript function:

  • strlen (int64)

Returns

Here is a list of fields in the return object:

  • obj.value (string)

Example

Here is an example of how to use this function in gscript:

var obj = RandomString(strlen);
// obj.value

func (*Engine) ReadFile added in v0.1.0

func (e *Engine) ReadFile(path string) ([]byte, error)

ReadFile - Reads a file path and returns a byte array

Package

file

Author

- ahhh (https://github.com/ahhh)

Javascript

Here is the Javascript method signature:

ReadFile(path)

Arguments

Here is a list of the arguments for the Javascript function:

  • path (string)

Returns

Here is a list of fields in the return object:

  • obj.fileBytes ([]byte)
  • obj.fileError (error)

Example

Here is an example of how to use this function in gscript:

var obj = ReadFile(path);
// obj.fileBytes
// obj.fileError

func (*Engine) RemoveServiceByName added in v0.0.10

func (e *Engine) RemoveServiceByName(name string) error

RemoveServiceByName - Uninstalls a system service

Package

os

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

RemoveServiceByName(name)

Arguments

Here is a list of the arguments for the Javascript function:

  • name (string)

Returns

Here is a list of fields in the return object:

  • obj.removalError (error)

Example

Here is an example of how to use this function in gscript:

var obj = RemoveServiceByName(name);
// obj.removalError

func (*Engine) ReplaceFileString added in v0.1.0

func (e *Engine) ReplaceFileString(file, match, replacement string) (int, error)

ReplaceFileString - Searches a file for a string and replaces each instance found of that string. Returns the amount of strings replaced

Package

file

Author

- ahhh (https://github.com/ahhh)

Javascript

Here is the Javascript method signature:

ReplaceFileString(file, match, replacement)

Arguments

Here is a list of the arguments for the Javascript function:

  • file (string)
  • match (string)
  • replacement (string)

Returns

Here is a list of fields in the return object:

  • obj.stringsReplaced (int)
  • obj.fileError (error)

Example

Here is an example of how to use this function in gscript:

var obj = ReplaceFileString(file, match, replacement);
// obj.stringsReplaced
// obj.fileError

func (*Engine) RunWithTimeout added in v0.0.10

func (e *Engine) RunWithTimeout(command string) (otto.Value, error)

func (*Engine) RunningProcs added in v0.1.0

func (e *Engine) RunningProcs() ([]int, error)

RunningProcs - Returns an array of int's representing active PIDs currently running

Package

os

Author

- Vyrus (https://github.com/vyrus001)

Javascript

Here is the Javascript method signature:

RunningProcs()

Arguments

Here is a list of the arguments for the Javascript function:

Returns

Here is a list of fields in the return object:

  • obj.pids ([]int)
  • obj.runtimeError (error)

Example

Here is an example of how to use this function in gscript:

var obj = RunningProcs();
// obj.pids
// obj.runtimeError

func (*Engine) SelfPath added in v0.1.0

func (e *Engine) SelfPath() (string, error)

SelfPath - Retrieves the path to the currently running executable.

Package

os

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

SelfPath()

Arguments

Here is a list of the arguments for the Javascript function:

Returns

Here is a list of fields in the return object:

  • obj.path (string)
  • obj.osError (error)

Example

Here is an example of how to use this function in gscript:

var obj = SelfPath();
// obj.path
// obj.osError

func (*Engine) SetLogger

func (e *Engine) SetLogger(logger *logrus.Logger)

func (*Engine) SetName

func (e *Engine) SetName(name string)

func (*Engine) SetTimeout added in v0.0.10

func (e *Engine) SetTimeout(timeout int)

func (*Engine) Signal added in v0.1.0

func (e *Engine) Signal(proc int, sig int) error

Signal - Sends a signal to a target proccess

Package

os

Author

- Vyrus (https://github.com/vyrus001)

Javascript

Here is the Javascript method signature:

Signal(signal, pid)

Arguments

Here is a list of the arguments for the Javascript function:

  • signal (int)
  • pid (int)

Returns

Here is a list of fields in the return object:

  • obj.runtimeError (error)

Example

Here is an example of how to use this function in gscript:

var obj = Signal(signal, pid);
// obj.runtimeError

func (*Engine) StartServiceByName added in v0.0.10

func (e *Engine) StartServiceByName(name string) error

StartServiceByName - Starts a system service

Package

os

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

StartServiceByName(name)

Arguments

Here is a list of the arguments for the Javascript function:

  • name (string)

Returns

Here is a list of fields in the return object:

  • obj.startError (error)

Example

Here is an example of how to use this function in gscript:

var obj = StartServiceByName(name);
// obj.startError

func (*Engine) StopServiceByName added in v0.0.10

func (e *Engine) StopServiceByName(name string) error

StopServiceByName - Stops a system service

Package

os

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

StopServiceByName(name)

Arguments

Here is a list of the arguments for the Javascript function:

  • name (string)

Returns

Here is a list of fields in the return object:

  • obj.installError (error)

Example

Here is an example of how to use this function in gscript:

var obj = StopServiceByName(name);
// obj.installError

func (*Engine) StripSpaces added in v0.1.0

func (e *Engine) StripSpaces(str string) string

StripSpaces - Strip any unicode characters out of a string.

Package

core

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

StripSpaces(str)

Arguments

Here is a list of the arguments for the Javascript function:

  • str (string)

Returns

Here is a list of fields in the return object:

  • obj.value (string)

Example

Here is an example of how to use this function in gscript:

var obj = StripSpaces(str);
// obj.value

func (*Engine) Timestamp added in v0.1.0

func (e *Engine) Timestamp() int64

Timestamp - Get the system's current timestamp in epoch format.

Package

core

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

Timestamp()

Arguments

Here is a list of the arguments for the Javascript function:

Returns

Here is a list of fields in the return object:

  • obj.value (int64)

Example

Here is an example of how to use this function in gscript:

var obj = Timestamp();
// obj.value

func (*Engine) ValueToByteSlice

func (e *Engine) ValueToByteSlice(v otto.Value) []byte

func (*Engine) WriteFile added in v0.1.0

func (e *Engine) WriteFile(path string, fileData []byte, perms int64) (int, error)

WriteFile - Writes data from a byte array to a file with the given permissions.

Package

file

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

WriteFile(path, fileData, perms)

Arguments

Here is a list of the arguments for the Javascript function:

  • path (string)
  • fileData ([]byte)
  • perms (int64)

Returns

Here is a list of fields in the return object:

  • obj.bytesWritten (int)
  • obj.fileError (error)

Example

Here is an example of how to use this function in gscript:

var obj = WriteFile(path, fileData, perms);
// obj.bytesWritten
// obj.fileError

func (*Engine) XorBytes added in v0.1.0

func (e *Engine) XorBytes(a []byte, b []byte) []byte

XorBytes - XOR two byte arrays together.

Package

core

Author

- gen0cide (https://github.com/gen0cide)

Javascript

Here is the Javascript method signature:

XorBytes(aByteArray, bByteArray)

Arguments

Here is a list of the arguments for the Javascript function:

  • aByteArray ([]byte)
  • bByteArray ([]byte)

Returns

Here is a list of fields in the return object:

  • obj.value ([]byte)

Example

Here is an example of how to use this function in gscript:

var obj = XorBytes(aByteArray, bByteArray);
// obj.value

type RegistryRetValue added in v0.1.0

type RegistryRetValue struct {
	ValType        string   `json:"return_type"`
	StringVal      string   `json:"string_val"`
	StringArrayVal []string `json:"string_array_val"`
	ByteArrayVal   []byte   `json:"byte_array_val"`
	IntVal         uint32   `json:"int_val"`
	LongVal        uint64   `json:"long_val"`
}

type VMExecResponse

type VMExecResponse struct {
	Stdout   []string `json:"stdout"`
	Stderr   []string `json:"stderr"`
	Success  bool     `json:"success"`
	PID      int      `json:"pid"`
	ErrorMsg string   `json:"error_message"`
}

type VMResponse added in v0.1.0

type VMResponse map[string]interface{}

Jump to

Keyboard shortcuts

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