Documentation
¶
Index ¶
- Variables
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func BytesToCompressed(b []byte) []byte
- func CalledBy() string
- func CompressedToBytes(b []byte) []byte
- func DNSQuestion(target, request string) (string, error)
- func DeobfuscateString(Data string) string
- func HTTPGetFile(url string) ([]byte, error)
- func LocalCopyFile(src, dst string) error
- func LocalDirCreate(path string) error
- func LocalDirRemoveAll(dir string) error
- func LocalFileAppendBytes(filename string, bytes []byte) error
- func LocalFileAppendString(input, filename string) error
- func LocalFileCreate(path string, bytes []byte) error
- func LocalFileDelete(path string) error
- func LocalFileExists(path string) bool
- func LocalFileRead(path string) ([]byte, error)
- func LocalFileReplace(file, match, replacement string) error
- func LocalFileReplaceMulti(file string, matches []string, replacement string) error
- func LocalSystemInfo() ([]string, error)
- func MustAsset(name string) []byte
- func ObfuscateString(Data string) string
- func RandString(strlen int) string
- func RandStringRunes(n int) string
- func RandUpperAlphaString(strlen int) string
- func RandomInt(min, max int) int
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func StripSpaces(str string) string
- func XorBytes(a []byte, b []byte) []byte
- func XorFiles(file1 string, file2 string, outPut string) error
- type Compiler
- type EmbeddedFile
- type Engine
- func (e *Engine) AddImport(name string, data func() []byte)
- func (e *Engine) CreateVM()
- func (e *Engine) CurrentUser() map[string]string
- func (e *Engine) DebugConsole(call otto.FunctionCall) otto.Value
- func (e *Engine) EnableLogging()
- func (e *Engine) ExecutePlan() error
- func (e *Engine) InjectVars()
- func (e *Engine) InteractiveSession()
- func (e *Engine) LoadScript(source []byte) error
- func (e *Engine) LogCrit(i ...interface{})
- func (e *Engine) LogCritf(fmtString string, i ...interface{})
- func (e *Engine) LogDebug(i ...interface{})
- func (e *Engine) LogDebugf(fmtString string, i ...interface{})
- func (e *Engine) LogError(i ...interface{})
- func (e *Engine) LogErrorf(fmtString string, i ...interface{})
- func (e *Engine) LogInfo(i ...interface{})
- func (e *Engine) LogInfof(fmtString string, i ...interface{})
- func (e *Engine) LogWarn(i ...interface{})
- func (e *Engine) LogWarnf(fmtString string, i ...interface{})
- func (e *Engine) RunAfterDeploy() error
- func (e *Engine) RunBeforeDeploy() error
- func (e *Engine) RunDeploy() error
- func (e *Engine) RunOnError() error
- func (e *Engine) SessionCompleter(d prompt.Document) []prompt.Suggest
- func (e *Engine) SessionExecutor(in string)
- func (e *Engine) SetName(name string)
- func (e *Engine) VMAppendFile(call otto.FunctionCall) otto.Value
- func (e *Engine) VMAsset(call otto.FunctionCall) otto.Value
- func (e *Engine) VMB64Decode(call otto.FunctionCall) otto.Value
- func (e *Engine) VMB64Encode(call otto.FunctionCall) otto.Value
- func (e *Engine) VMCPUStats(call otto.FunctionCall) otto.Value
- func (e *Engine) VMCanExecFile(call otto.FunctionCall) otto.Value
- func (e *Engine) VMCanMakeHTTPConn(call otto.FunctionCall) otto.Value
- func (e *Engine) VMCanMakeTCPConn(call otto.FunctionCall) otto.Value
- func (e *Engine) VMCanPing(call otto.FunctionCall) otto.Value
- func (e *Engine) VMCanReadFile(call otto.FunctionCall) otto.Value
- func (e *Engine) VMCanSSHLogin(call otto.FunctionCall) otto.Value
- func (e *Engine) VMCanSudo(call otto.FunctionCall) otto.Value
- func (e *Engine) VMCanWriteFile(call otto.FunctionCall) otto.Value
- func (e *Engine) VMCmdSuccessful(call otto.FunctionCall) otto.Value
- func (e *Engine) VMCopyFile(call otto.FunctionCall) otto.Value
- func (e *Engine) VMDNSQuery(call otto.FunctionCall) otto.Value
- func (e *Engine) VMDeleteFile(call otto.FunctionCall) otto.Value
- func (e *Engine) VMDetectSSLMITM(call otto.FunctionCall) otto.Value
- func (e *Engine) VMDirExists(call otto.FunctionCall) otto.Value
- func (e *Engine) VMEnvVars(call otto.FunctionCall) otto.Value
- func (e *Engine) VMExec(call otto.FunctionCall) otto.Value
- func (e *Engine) VMExecuteFile(call otto.FunctionCall) otto.Value
- func (e *Engine) VMExistsInPath(call otto.FunctionCall) otto.Value
- func (e *Engine) VMExpectedDNS(call otto.FunctionCall) otto.Value
- func (e *Engine) VMFileContains(call otto.FunctionCall) otto.Value
- func (e *Engine) VMFileCreateTime(call otto.FunctionCall) otto.Value
- func (e *Engine) VMFileExists(call otto.FunctionCall) otto.Value
- func (e *Engine) VMFileModifyTime(call otto.FunctionCall) otto.Value
- func (e *Engine) VMGetDirsInPath(call otto.FunctionCall) otto.Value
- func (e *Engine) VMGetEnv(call otto.FunctionCall) otto.Value
- func (e *Engine) VMGetTweet(call otto.FunctionCall) otto.Value
- func (e *Engine) VMHTTPRequest(call otto.FunctionCall) otto.Value
- func (e *Engine) VMHalt(call otto.FunctionCall) otto.Value
- func (e *Engine) VMHasPublicIP(call otto.FunctionCall) otto.Value
- func (e *Engine) VMImplode(call otto.FunctionCall) otto.Value
- func (e *Engine) VMIsAWS(call otto.FunctionCall) otto.Value
- func (e *Engine) VMIsVM(call otto.FunctionCall) otto.Value
- func (e *Engine) VMLocalUserExists(call otto.FunctionCall) otto.Value
- func (e *Engine) VMLogCrit(call otto.FunctionCall) otto.Value
- func (e *Engine) VMLogDebug(call otto.FunctionCall) otto.Value
- func (e *Engine) VMLogError(call otto.FunctionCall) otto.Value
- func (e *Engine) VMLogInfo(call otto.FunctionCall) otto.Value
- func (e *Engine) VMLogWarn(call otto.FunctionCall) otto.Value
- func (e *Engine) VMLoggedInUsers(call otto.FunctionCall) otto.Value
- func (e *Engine) VMMD5(call otto.FunctionCall) otto.Value
- func (e *Engine) VMMatches(call otto.FunctionCall) otto.Value
- func (e *Engine) VMMemStats(call otto.FunctionCall) otto.Value
- func (e *Engine) VMProcExistsWithName(call otto.FunctionCall) otto.Value
- func (e *Engine) VMReplaceInFile(call otto.FunctionCall) otto.Value
- func (e *Engine) VMRetrieveFileFromURL(call otto.FunctionCall) otto.Value
- func (e *Engine) VMSHA1(call otto.FunctionCall) otto.Value
- func (e *Engine) VMSSHCmd(call otto.FunctionCall) otto.Value
- func (e *Engine) VMServeFileOverHTTP(call otto.FunctionCall) otto.Value
- func (e *Engine) VMSignal(call otto.FunctionCall) otto.Value
- func (e *Engine) VMSleep(call otto.FunctionCall) otto.Value
- func (e *Engine) VMTCPPortInUse(call otto.FunctionCall) otto.Value
- func (e *Engine) VMTimestamp(call otto.FunctionCall) otto.Value
- func (e *Engine) VMUDPPortInUse(call otto.FunctionCall) otto.Value
- func (e *Engine) VMUsersRunningProcs(call otto.FunctionCall) otto.Value
- func (e *Engine) VMWriteFile(call otto.FunctionCall) otto.Value
- func (e *Engine) ValidateAST(source []byte) error
- func (e *Engine) ValueToByteSlice(v otto.Value) []byte
- type VMBundle
- type VMExecResponse
Constants ¶
This section is empty.
Variables ¶
var (
Debugger = true
)
var VMPreload = `` /* 1010-byte string literal not displayed */
Functions ¶
func Asset ¶ added in v0.0.4
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 ¶ added in v0.0.4
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 ¶ added in v0.0.4
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 ¶ added in v0.0.4
func AssetNames() []string
AssetNames returns the names of the assets.
func BytesToCompressed ¶
func CompressedToBytes ¶
func DNSQuestion ¶
func DeobfuscateString ¶
DeobfuscateString from https://github.com/SaturnsVoid/GoBot2/blob/7d6609cd49f006f5aee76a4ffd97eb25d12a1a9b/components/Cryptography.go#L44
func HTTPGetFile ¶
HTTPGetFile takes a url and returns a byte slice of the file there
func LocalCopyFile ¶
func LocalDirCreate ¶
func LocalDirRemoveAll ¶
func LocalFileAppendBytes ¶
LocalFileAppendBytes adds bytes to the end of filename's path.
func LocalFileAppendString ¶
LocalFileAppendString adds input as strings to the end of filename's path.
func LocalFileCreate ¶
func LocalFileDelete ¶
func LocalFileExists ¶
func LocalFileRead ¶
LocalReadFile takes a file path and returns the byte array of the file there
func LocalFileReplace ¶
Replace will replace all instances of match with replace in file.
func LocalFileReplaceMulti ¶
ReplaceMulti will replace all instances of possible matches with replacement in file.
func LocalSystemInfo ¶
func MustAsset ¶ added in v0.0.4
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func ObfuscateString ¶
ObfuscateString from https://github.com/SaturnsVoid/GoBot2/blob/7d6609cd49f006f5aee76a4ffd97eb25d12a1a9b/components/Cryptography.go#L52
func RandString ¶
RandString returns a string the length of strlen
func RandStringRunes ¶
func RandUpperAlphaString ¶ added in v0.0.4
func RestoreAsset ¶ added in v0.0.4
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶ added in v0.0.4
RestoreAssets restores an asset under the given directory recursively
func StripSpaces ¶
StripSpaces will remove the spaces from a single string and return the new string
Types ¶
type Compiler ¶
type Compiler struct { OS string `json:"os"` Arch string `json:"arch"` // ScriptFile string // PackageName string OutputFile string `json:"output"` // AssetFiles []string // Embeds []EmbeddedFile VMs []*VMBundle `json:"vms"` BuildDir string `json:"build_dir"` AssetDir string `json:"asset_dir"` OutputSource bool `json:"output_source"` Logger *l.Logger `json:"-"` Source string `json:"-"` }
func NewCompiler ¶
func (*Compiler) BuildEntryPoint ¶
func (c *Compiler) BuildEntryPoint()
func (*Compiler) CompileAssets ¶
func (c *Compiler) CompileAssets()
func (*Compiler) CreateBuildDir ¶
func (c *Compiler) CreateBuildDir()
func (*Compiler) GatherAssets ¶
func (c *Compiler) GatherAssets()
func (*Compiler) ParseAssets ¶ added in v0.0.4
func (*Compiler) WriteScript ¶
func (c *Compiler) WriteScript()
func (*Compiler) WriteSource ¶ added in v0.0.4
func (c *Compiler) WriteSource()
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 Engine ¶
func (*Engine) CurrentUser ¶ added in v0.0.3
func (*Engine) DebugConsole ¶
func (e *Engine) DebugConsole(call otto.FunctionCall) otto.Value
func (*Engine) EnableLogging ¶
func (e *Engine) EnableLogging()
func (*Engine) ExecutePlan ¶
func (*Engine) InjectVars ¶ added in v0.0.3
func (e *Engine) InjectVars()
func (*Engine) InteractiveSession ¶
func (e *Engine) InteractiveSession()
func (*Engine) LoadScript ¶
func (*Engine) RunAfterDeploy ¶
func (*Engine) RunBeforeDeploy ¶
func (*Engine) RunOnError ¶
func (*Engine) SessionCompleter ¶
func (*Engine) SessionExecutor ¶
func (*Engine) VMAppendFile ¶
func (e *Engine) VMAppendFile(call otto.FunctionCall) otto.Value
func (*Engine) VMB64Decode ¶
func (e *Engine) VMB64Decode(call otto.FunctionCall) otto.Value
func (*Engine) VMB64Encode ¶
func (e *Engine) VMB64Encode(call otto.FunctionCall) otto.Value
func (*Engine) VMCPUStats ¶
func (e *Engine) VMCPUStats(call otto.FunctionCall) otto.Value
func (*Engine) VMCanExecFile ¶
func (e *Engine) VMCanExecFile(call otto.FunctionCall) otto.Value
func (*Engine) VMCanMakeHTTPConn ¶
func (e *Engine) VMCanMakeHTTPConn(call otto.FunctionCall) otto.Value
func (*Engine) VMCanMakeTCPConn ¶
func (e *Engine) VMCanMakeTCPConn(call otto.FunctionCall) otto.Value
func (*Engine) VMCanReadFile ¶
func (e *Engine) VMCanReadFile(call otto.FunctionCall) otto.Value
func (*Engine) VMCanSSHLogin ¶
func (e *Engine) VMCanSSHLogin(call otto.FunctionCall) otto.Value
func (*Engine) VMCanWriteFile ¶
func (e *Engine) VMCanWriteFile(call otto.FunctionCall) otto.Value
func (*Engine) VMCmdSuccessful ¶
func (e *Engine) VMCmdSuccessful(call otto.FunctionCall) otto.Value
func (*Engine) VMCopyFile ¶
func (e *Engine) VMCopyFile(call otto.FunctionCall) otto.Value
func (*Engine) VMDNSQuery ¶
func (e *Engine) VMDNSQuery(call otto.FunctionCall) otto.Value
Uses the native DNS client (including things like host files and resolution)
func (*Engine) VMDeleteFile ¶
func (e *Engine) VMDeleteFile(call otto.FunctionCall) otto.Value
func (*Engine) VMDetectSSLMITM ¶
func (e *Engine) VMDetectSSLMITM(call otto.FunctionCall) otto.Value
func (*Engine) VMDirExists ¶
func (e *Engine) VMDirExists(call otto.FunctionCall) otto.Value
func (*Engine) VMExecuteFile ¶
func (e *Engine) VMExecuteFile(call otto.FunctionCall) otto.Value
func (*Engine) VMExistsInPath ¶
func (e *Engine) VMExistsInPath(call otto.FunctionCall) otto.Value
func (*Engine) VMExpectedDNS ¶
func (e *Engine) VMExpectedDNS(call otto.FunctionCall) otto.Value
func (*Engine) VMFileContains ¶
func (e *Engine) VMFileContains(call otto.FunctionCall) otto.Value
func (*Engine) VMFileCreateTime ¶
func (e *Engine) VMFileCreateTime(call otto.FunctionCall) otto.Value
func (*Engine) VMFileExists ¶
func (e *Engine) VMFileExists(call otto.FunctionCall) otto.Value
func (*Engine) VMFileModifyTime ¶
func (e *Engine) VMFileModifyTime(call otto.FunctionCall) otto.Value
func (*Engine) VMGetDirsInPath ¶
func (e *Engine) VMGetDirsInPath(call otto.FunctionCall) otto.Value
func (*Engine) VMGetTweet ¶
func (e *Engine) VMGetTweet(call otto.FunctionCall) otto.Value
func (*Engine) VMHTTPRequest ¶
func (e *Engine) VMHTTPRequest(call otto.FunctionCall) otto.Value
func (*Engine) VMHasPublicIP ¶
func (e *Engine) VMHasPublicIP(call otto.FunctionCall) otto.Value
func (*Engine) VMLocalUserExists ¶
func (e *Engine) VMLocalUserExists(call otto.FunctionCall) otto.Value
func (*Engine) VMLogDebug ¶
func (e *Engine) VMLogDebug(call otto.FunctionCall) otto.Value
func (*Engine) VMLogError ¶
func (e *Engine) VMLogError(call otto.FunctionCall) otto.Value
func (*Engine) VMLoggedInUsers ¶
func (e *Engine) VMLoggedInUsers(call otto.FunctionCall) otto.Value
func (*Engine) VMMemStats ¶
func (e *Engine) VMMemStats(call otto.FunctionCall) otto.Value
func (*Engine) VMProcExistsWithName ¶
func (e *Engine) VMProcExistsWithName(call otto.FunctionCall) otto.Value
func (*Engine) VMReplaceInFile ¶
func (e *Engine) VMReplaceInFile(call otto.FunctionCall) otto.Value
func (*Engine) VMRetrieveFileFromURL ¶
func (e *Engine) VMRetrieveFileFromURL(call otto.FunctionCall) otto.Value
func (*Engine) VMServeFileOverHTTP ¶
func (e *Engine) VMServeFileOverHTTP(call otto.FunctionCall) otto.Value
func (*Engine) VMTCPPortInUse ¶
func (e *Engine) VMTCPPortInUse(call otto.FunctionCall) otto.Value
func (*Engine) VMTimestamp ¶
func (e *Engine) VMTimestamp(call otto.FunctionCall) otto.Value
func (*Engine) VMUDPPortInUse ¶
func (e *Engine) VMUDPPortInUse(call otto.FunctionCall) otto.Value
func (*Engine) VMUsersRunningProcs ¶
func (e *Engine) VMUsersRunningProcs(call otto.FunctionCall) otto.Value
func (*Engine) VMWriteFile ¶
func (e *Engine) VMWriteFile(call otto.FunctionCall) otto.Value
func (*Engine) ValidateAST ¶
type VMBundle ¶ added in v0.0.4
type VMBundle struct { ID string `json:"id"` ScriptFile string `json:"source"` AssetFiles []string `json:"imports"` Embeds []EmbeddedFile `json:"-"` }
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"` }
func ExecuteCommand ¶
func ExecuteCommand(c string, args ...string) VMExecResponse
ExecuteCommand function