Documentation
¶
Overview ¶
Copyright (c) 2023 Thomas Ziegler <[email protected]>. All rights reserved.
Licensed under the MIT License ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2023 Thomas Ziegler <[email protected]>. All rights reserved.
Licensed under the MIT License ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2023 Thomas Ziegler <[email protected]>. All rights reserved.
Licensed under the MIT License ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2023 Thomas Ziegler <[email protected]>. All rights reserved.
Licensed under the MIT License ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2023 Thomas Ziegler <[email protected]>. All rights reserved.
Licensed under the MIT License ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2023 Thomas Ziegler <[email protected]>. All rights reserved.
Licensed under the MIT License ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2023 Thomas Ziegler <[email protected]>. All rights reserved.
Licensed under the MIT License ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2023 Thomas Ziegler <[email protected]>. All rights reserved.
Licensed under the MIT License ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2023 Thomas Ziegler <[email protected]>. All rights reserved.
Licensed under the MIT License ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2023 Thomas Ziegler <[email protected]>. All rights reserved.
Licensed under the MIT License ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2023 Thomas Ziegler <[email protected]>. All rights reserved.
Licensed under the MIT License ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2023 Thomas Ziegler <[email protected]>. All rights reserved.
Licensed under the MIT License ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- Constants
- Variables
- func Execute(dCmd string, dCmdArgs []string, command string, ...) (int, int, error)
- func FindChildPid(pid int) ([]int, error)
- func GetNameOfWatchman(wm *Watchman) (string, bool)
- func GetShellRunner() *shellRunner
- func GetShellRunnerForOs(os string) *shellRunner
- func HandleAllMyPid(handlePid func(pid int) error) error
- func ListWatcherInstances() []string
- func New(target string, arguments map[string]string, any ...interface{}) *targetExecuter
- func RequirementCheck(require configure.Require) (bool, string)
- func ShutDownProcesses(reportFn func(target string, time int, succeed bool))
- type AnkVerifier
- type AnkoDefiner
- type AnkoException
- type AnkoRunner
- func (ar *AnkoRunner) AddDefaultDefine(symbol string, value interface{}, risk RiskLevel, help string) error
- func (ar *AnkoRunner) AddDefaultDefines(defs []AnkoDefiner) error
- func (ar *AnkoRunner) ClearBuffer()
- func (ar *AnkoRunner) DefaultDefine() error
- func (ar *AnkoRunner) Define(symbol string, value interface{}) error
- func (ar *AnkoRunner) Defines(defs []AnkoDefiner) error
- func (ar *AnkoRunner) EnableCancelation() context.CancelFunc
- func (ar *AnkoRunner) Error2MsgErrorDebug(target string, err error) (MsgErrDebug, bool)
- func (ar *AnkoRunner) ErrorExplain(err error) string
- func (ar *AnkoRunner) ErrorPos2Message(err error) error
- func (ar *AnkoRunner) GetBuffer() []string
- func (ar *AnkoRunner) GetContext() context.Context
- func (ar *AnkoRunner) GetEnv() *env.Env
- func (ar *AnkoRunner) InitEnv() (*env.Env, error)
- func (ar *AnkoRunner) LastError() error
- func (ar *AnkoRunner) LastScript() string
- func (ar *AnkoRunner) RunAnko(script string) (interface{}, error)
- func (ar *AnkoRunner) SetBufferHook(hook BufferHook)
- func (ar *AnkoRunner) SetContext(ctx context.Context)
- func (ar *AnkoRunner) SetLogger(logger mimiclog.Logger)
- func (ar *AnkoRunner) SetOptions(opts vm.Options)
- func (ar *AnkoRunner) SetOutputSupression(sup bool)
- func (ar *AnkoRunner) SetRiskLevel(risk RiskLevel)
- func (ar *AnkoRunner) SetTimeOut(to time.Duration)
- func (ar *AnkoRunner) ThrowException(err error, script string)
- type BufferHook
- type CombinedDh
- func (d *CombinedDh) AddData(key string, data map[string]interface{})
- func (d *CombinedDh) AddJSON(key, jsonString string) error
- func (d *CombinedDh) AddYaml(key, yamlString string) error
- func (d *CombinedDh) AppendToPH(key, value string) bool
- func (d *CombinedDh) ClearAll()
- func (d *CombinedDh) ExportVarToFile(variable string, filename string) error
- func (d *CombinedDh) GetData(key string) (map[string]interface{}, bool)
- func (d *CombinedDh) GetDataAsJson(key string) (string, bool)
- func (d *CombinedDh) GetDataAsYaml(key string) (string, bool)
- func (d *CombinedDh) GetDataKeys() []string
- func (d *CombinedDh) GetJSONPathResult(key, path string) (gjson.Result, bool)
- func (d *CombinedDh) GetPH(key string) string
- func (d *CombinedDh) GetPHExists(key string) (string, bool)
- func (d *CombinedDh) GetPlaceHoldersFnc(inspectFunc func(phKey string, phValue string))
- func (d *CombinedDh) GetYamc() *yamc.Yamc
- func (d *CombinedDh) HandlePlaceHolder(line string) string
- func (d *CombinedDh) HandlePlaceHolderWithScope(line string, scopeVars map[string]string) string
- func (d *CombinedDh) ImportDataFromYAMLFile(key string, filename string) error
- func (d *CombinedDh) SetIfNotExists(key, value string)
- func (d *CombinedDh) SetJSONValueByPath(key, path, value string) error
- func (d *CombinedDh) SetLogger(logger mimiclog.Logger)
- func (d *CombinedDh) SetPH(key, value string)
- type DataMapHandler
- type DefaultDataHandler
- func (d *DefaultDataHandler) AddData(key string, data interface{})
- func (d *DefaultDataHandler) AddJSON(key, jsonString string) error
- func (d *DefaultDataHandler) AddYaml(key, yamlString string) error
- func (d *DefaultDataHandler) GetData(key string) (interface{}, bool)
- func (d *DefaultDataHandler) GetDataAsJson(key string) (string, bool)
- func (d *DefaultDataHandler) GetDataAsYaml(key string) (string, bool)
- func (d *DefaultDataHandler) GetDataKeys() []string
- func (d *DefaultDataHandler) GetJSONPathResult(key, path string) (gjson.Result, bool)
- func (d *DefaultDataHandler) GetYamc() *yamc.Yamc
- func (d *DefaultDataHandler) ImportDataFromYAMLFile(key string, filename string) error
- func (d *DefaultDataHandler) SetJSONValueByPath(key, path, value string) error
- type DefaultPhHandler
- func (d *DefaultPhHandler) AppendToPH(key, value string) bool
- func (d *DefaultPhHandler) ClearAll()
- func (d *DefaultPhHandler) ExportVarToFile(variable string, filename string) error
- func (d *DefaultPhHandler) GetPH(key string) string
- func (d *DefaultPhHandler) GetPHExists(key string) (string, bool)
- func (d *DefaultPhHandler) GetPlaceHoldersFnc(inspectFunc func(phKey string, phValue string))
- func (d *DefaultPhHandler) HandlePlaceHolder(line string) string
- func (d *DefaultPhHandler) HandlePlaceHolderWithScope(line string, scopeVars map[string]string) string
- func (d *DefaultPhHandler) SetIfNotExists(key, value string)
- func (d *DefaultPhHandler) SetPH(key, value string)
- type DefaultRequires
- type MainCmdSetter
- type MsgArgs
- type MsgCommand
- type MsgErrDebug
- type MsgError
- type MsgExecOutput
- type MsgInfo
- type MsgNumber
- type MsgPid
- type MsgProcess
- type MsgReason
- type MsgStickCursor
- type MsgTarget
- type MsgType
- type PlaceHolder
- type ProcessDef
- type ProcessLog
- type Requires
- type RiskLevel
- type RunnerCtrl
- type TaskDef
- func (ts *TaskDef) GetProcess() *ProcessDef
- func (ts *TaskDef) GetProcessLog() []ProcessLog
- func (ts *TaskDef) GetProcessPid() (int, bool)
- func (ts *TaskDef) IsProcessRunning() bool
- func (ts *TaskDef) KillProcess() error
- func (ts *TaskDef) LogCmd(cmd string, args []string, command string)
- func (ts *TaskDef) StartTrackProcess(proc *os.Process)
- func (ts *TaskDef) StopProcessIfRunning() error
- type TaskListExec
- func (e *TaskListExec) GetWatch() *Watchman
- func (e *TaskListExec) RunTarget(target string, async bool) int
- func (e *TaskListExec) RunTargetWithVars(target string, scopeVars map[string]string, async bool) int
- func (e *TaskListExec) SetHardExistToAllTasks(exitOnErr bool)
- func (e *TaskListExec) SetLogger(logger mimiclog.Logger)
- type VerifiedLines
- type Watchman
- func (w *Watchman) ExpectTaskToStart(tickTimer time.Duration, timeoutTickCount int) bool
- func (w *Watchman) GetAllRunningTasks() []string
- func (w *Watchman) GetTask(target string) (TaskDef, bool)
- func (w *Watchman) GetTaskCount(target string) int
- func (w *Watchman) GetTaskDone(target string) bool
- func (w *Watchman) IncTaskCount(target string) int
- func (w *Watchman) IncTaskDoneCount(target string) (bool, error)
- func (w *Watchman) ListTasks() []string
- func (w *Watchman) ResetAllTaskInfos()
- func (w *Watchman) ResetAllTasksIfPossible() error
- func (w *Watchman) SetLogger(logger mimiclog.Logger)
- func (w *Watchman) StopAllTasks(reportFn func(target string, time int, succeed bool))
- func (w *Watchman) TaskRunning(target string) bool
- func (w *Watchman) TryCreate(target string) bool
- func (w *Watchman) UntilDone(tickTimer time.Duration, timeOut time.Duration) bool
- func (w *Watchman) UpdateTask(target string, task TaskDef) error
- func (w *Watchman) WaitForProcessStart(target string, tickDuration time.Duration, maxTicks int) (bool, int)
- func (w *Watchman) WaitForStopProcess(target string, tickDuration time.Duration, maxTicks int) (bool, int)
- type WinProcData
Constants ¶
const GlobalName = "global"
Variables ¶
var ( // ShellCmd is the command to execute shell commands // It is set to the default value for the current OS // If you want to use a different shell, you can change this value // before calling any of the tasks ShellCmd shellCmd = shellCmd{} )
Functions ¶
func Execute ¶
func Execute(dCmd string, dCmdArgs []string, command string, callback func(string, error) bool, startInfo func(*os.Process)) (int, int, error)
Execute executes a command and returns the internal exit code, the command exit code and an error the callback function is called for each line of the output the startInfo function is called if the process started and the process id is available
func FindChildPid ¶
windows Get-CimInstance Win32_Process | Where-Object { $_.ParentProcessId -eq $ppid } | Select-Object ProcessId
func GetNameOfWatchman ¶
GetNameOfWatchman returns the name of the watchman instance
func GetShellRunner ¶
func GetShellRunner() *shellRunner
func GetShellRunnerForOs ¶
func GetShellRunnerForOs(os string) *shellRunner
func HandleAllMyPid ¶
func ListWatcherInstances ¶
func ListWatcherInstances() []string
ListWatcherInstances returns a list of all watchman instances as string slice with the uuid string of the watchman instance
func ShutDownProcesses ¶
ShutDownProcesses stops all processes in all watchman instances and reports the result to the reportFn if it is not nil
Types ¶
type AnkVerifier ¶
type AnkVerifier struct { }
func NewAnkVerifier ¶
func NewAnkVerifier() *AnkVerifier
func (*AnkVerifier) VerifyLines ¶
func (av *AnkVerifier) VerifyLines(lines []string) ([]VerifiedLines, error)
VerifyLines verifies the given lines of script it just uses the parser to get at least syntax errors
type AnkoDefiner ¶
type AnkoDefiner struct {
// contains filtered or unexported fields
}
type AnkoException ¶
type AnkoRunner ¶
type AnkoRunner struct {
// contains filtered or unexported fields
}
func NewAnkoRunner ¶
func NewAnkoRunner() *AnkoRunner
func (*AnkoRunner) AddDefaultDefine ¶
func (ar *AnkoRunner) AddDefaultDefine(symbol string, value interface{}, risk RiskLevel, help string) error
func (*AnkoRunner) AddDefaultDefines ¶
func (ar *AnkoRunner) AddDefaultDefines(defs []AnkoDefiner) error
func (*AnkoRunner) ClearBuffer ¶
func (ar *AnkoRunner) ClearBuffer()
func (*AnkoRunner) DefaultDefine ¶
func (ar *AnkoRunner) DefaultDefine() error
func (*AnkoRunner) Define ¶
func (ar *AnkoRunner) Define(symbol string, value interface{}) error
func (*AnkoRunner) Defines ¶
func (ar *AnkoRunner) Defines(defs []AnkoDefiner) error
func (*AnkoRunner) EnableCancelation ¶
func (ar *AnkoRunner) EnableCancelation() context.CancelFunc
func (*AnkoRunner) Error2MsgErrorDebug ¶
func (ar *AnkoRunner) Error2MsgErrorDebug(target string, err error) (MsgErrDebug, bool)
func (*AnkoRunner) ErrorExplain ¶
func (ar *AnkoRunner) ErrorExplain(err error) string
func (*AnkoRunner) ErrorPos2Message ¶
func (ar *AnkoRunner) ErrorPos2Message(err error) error
func (*AnkoRunner) GetBuffer ¶
func (ar *AnkoRunner) GetBuffer() []string
func (*AnkoRunner) GetContext ¶
func (ar *AnkoRunner) GetContext() context.Context
func (*AnkoRunner) GetEnv ¶
func (ar *AnkoRunner) GetEnv() *env.Env
func (*AnkoRunner) LastError ¶
func (ar *AnkoRunner) LastError() error
func (*AnkoRunner) LastScript ¶
func (ar *AnkoRunner) LastScript() string
func (*AnkoRunner) RunAnko ¶
func (ar *AnkoRunner) RunAnko(script string) (interface{}, error)
func (*AnkoRunner) SetBufferHook ¶
func (ar *AnkoRunner) SetBufferHook(hook BufferHook)
func (*AnkoRunner) SetContext ¶
func (ar *AnkoRunner) SetContext(ctx context.Context)
func (*AnkoRunner) SetLogger ¶
func (ar *AnkoRunner) SetLogger(logger mimiclog.Logger)
func (*AnkoRunner) SetOptions ¶
func (ar *AnkoRunner) SetOptions(opts vm.Options)
func (*AnkoRunner) SetOutputSupression ¶
func (ar *AnkoRunner) SetOutputSupression(sup bool)
func (*AnkoRunner) SetRiskLevel ¶
func (ar *AnkoRunner) SetRiskLevel(risk RiskLevel)
SetRiskLevel sets the risk level for the AnkoRunner. so any DefaultDefine that is added must be at the same or lower risk level
func (*AnkoRunner) SetTimeOut ¶
func (ar *AnkoRunner) SetTimeOut(to time.Duration)
func (*AnkoRunner) ThrowException ¶
func (ar *AnkoRunner) ThrowException(err error, script string)
type BufferHook ¶
type BufferHook func(msg string)
type CombinedDh ¶
type CombinedDh struct {
// contains filtered or unexported fields
}
CombinedDh is a data handler that combines the functionality of the Placeholder Handler and the Datahandler It uses the Yamc library to store and retrieve data
func NewCombinedDataHandler ¶
func NewCombinedDataHandler() *CombinedDh
func (*CombinedDh) AddData ¶
func (d *CombinedDh) AddData(key string, data map[string]interface{})
func (*CombinedDh) AddJSON ¶
func (d *CombinedDh) AddJSON(key, jsonString string) error
AddJSON adds data by parsing a json string and store them with the given key
func (*CombinedDh) AddYaml ¶
func (d *CombinedDh) AddYaml(key, yamlString string) error
AddYaml adds data by parsing a json string and store them with the given key
func (*CombinedDh) AppendToPH ¶
func (d *CombinedDh) AppendToPH(key, value string) bool
func (*CombinedDh) ExportVarToFile ¶
func (d *CombinedDh) ExportVarToFile(variable string, filename string) error
func (*CombinedDh) GetData ¶
func (d *CombinedDh) GetData(key string) (map[string]interface{}, bool)
func (*CombinedDh) GetDataAsJson ¶
func (d *CombinedDh) GetDataAsJson(key string) (string, bool)
GetDataAsJson returns the data as json string if the key is not present it returns an empty string
func (*CombinedDh) GetDataAsYaml ¶
func (d *CombinedDh) GetDataAsYaml(key string) (string, bool)
GetDataAsYaml returns the data as yaml string if the key is not present it returns an empty string
func (*CombinedDh) GetDataKeys ¶
func (d *CombinedDh) GetDataKeys() []string
func (*CombinedDh) GetJSONPathResult ¶
func (d *CombinedDh) GetJSONPathResult(key, path string) (gjson.Result, bool)
GetJSONPathResult returns the result of a json path query if the key is not present it returns an empty result the returned value is a gjson.Result
func (*CombinedDh) GetPH ¶
func (d *CombinedDh) GetPH(key string) string
func (*CombinedDh) GetPHExists ¶
func (d *CombinedDh) GetPHExists(key string) (string, bool)
GetPHExists returns the value of the placeholder and a boolean if the placeholder exists
func (*CombinedDh) GetPlaceHoldersFnc ¶
func (d *CombinedDh) GetPlaceHoldersFnc(inspectFunc func(phKey string, phValue string))
GetPlaceHoldersFnc iterates over all placeholders and calls the inspectFunc
func (*CombinedDh) GetYamc ¶
func (d *CombinedDh) GetYamc() *yamc.Yamc
func (*CombinedDh) HandlePlaceHolder ¶
func (d *CombinedDh) HandlePlaceHolder(line string) string
HandlePlaceHolder handles the placeholders in the line e.g. ${myKey} will be replaced with the value of myKey if the key does not exist, it will return the original line it will also handle the map placeholders e.g. ${map:myMapKey:myMapPath} it will replace the placeholder with the value of the map if the map does not exist, it will return the original line
func (*CombinedDh) HandlePlaceHolderWithScope ¶
func (d *CombinedDh) HandlePlaceHolderWithScope(line string, scopeVars map[string]string) string
HandlePlaceHolderWithScope handles the placeholders in the line e.g. ${myKey} will be replaced with the value of myKey if the key does not exist, it will return the original line it will also handle the map placeholders e.g. ${map:myMapKey:myMapPath} in addition it will replace the placeholders with the values from the scopeVars
func (*CombinedDh) ImportDataFromYAMLFile ¶
func (d *CombinedDh) ImportDataFromYAMLFile(key string, filename string) error
func (*CombinedDh) SetIfNotExists ¶
func (d *CombinedDh) SetIfNotExists(key, value string)
func (*CombinedDh) SetJSONValueByPath ¶
func (d *CombinedDh) SetJSONValueByPath(key, path, value string) error
SetJSONValueByPath sets a value by a json path using the sjson library
func (*CombinedDh) SetLogger ¶
func (d *CombinedDh) SetLogger(logger mimiclog.Logger)
func (*CombinedDh) SetPH ¶
func (d *CombinedDh) SetPH(key, value string)
type DataMapHandler ¶
type DataMapHandler interface { GetJSONPathResult(key, path string) (gjson.Result, bool) // returns the result of a json path query GetDataAsJson(key string) (string, bool) // returns the data as json string GetDataAsYaml(key string) (string, bool) // returns the data as yaml string AddJSON(key, jsonString string) error // adds data by parsing a json string AddYaml(key, yamlString string) error // adds data by parsing a yaml string SetJSONValueByPath(key, path, value string) error // sets a value by a json path using GetDataKeys() []string // returns all keys }
DataMapHandler is the interface for the data handlers they are used to store and retrieve data
type DefaultDataHandler ¶
type DefaultDataHandler struct {
// contains filtered or unexported fields
}
DefaultDataHandler is the default implementation of the DataHandler interface It uses the yamc package to store and retrieve data
func NewDefaultDataHandler ¶
func NewDefaultDataHandler() *DefaultDataHandler
func (*DefaultDataHandler) AddData ¶
func (d *DefaultDataHandler) AddData(key string, data interface{})
func (*DefaultDataHandler) AddJSON ¶
func (d *DefaultDataHandler) AddJSON(key, jsonString string) error
func (*DefaultDataHandler) AddYaml ¶
func (d *DefaultDataHandler) AddYaml(key, yamlString string) error
func (*DefaultDataHandler) GetData ¶
func (d *DefaultDataHandler) GetData(key string) (interface{}, bool)
func (*DefaultDataHandler) GetDataAsJson ¶
func (d *DefaultDataHandler) GetDataAsJson(key string) (string, bool)
func (*DefaultDataHandler) GetDataAsYaml ¶
func (d *DefaultDataHandler) GetDataAsYaml(key string) (string, bool)
func (*DefaultDataHandler) GetDataKeys ¶
func (d *DefaultDataHandler) GetDataKeys() []string
func (*DefaultDataHandler) GetJSONPathResult ¶
func (d *DefaultDataHandler) GetJSONPathResult(key, path string) (gjson.Result, bool)
func (*DefaultDataHandler) GetYamc ¶
func (d *DefaultDataHandler) GetYamc() *yamc.Yamc
func (*DefaultDataHandler) ImportDataFromYAMLFile ¶
func (d *DefaultDataHandler) ImportDataFromYAMLFile(key string, filename string) error
func (*DefaultDataHandler) SetJSONValueByPath ¶
func (d *DefaultDataHandler) SetJSONValueByPath(key, path, value string) error
type DefaultPhHandler ¶
type DefaultPhHandler struct {
// contains filtered or unexported fields
}
func NewDefaultPhHandler ¶
func NewDefaultPhHandler() *DefaultPhHandler
func (*DefaultPhHandler) AppendToPH ¶
func (d *DefaultPhHandler) AppendToPH(key, value string) bool
func (*DefaultPhHandler) ClearAll ¶
func (d *DefaultPhHandler) ClearAll()
func (*DefaultPhHandler) ExportVarToFile ¶
func (d *DefaultPhHandler) ExportVarToFile(variable string, filename string) error
func (*DefaultPhHandler) GetPH ¶
func (d *DefaultPhHandler) GetPH(key string) string
func (*DefaultPhHandler) GetPHExists ¶
func (d *DefaultPhHandler) GetPHExists(key string) (string, bool)
func (*DefaultPhHandler) GetPlaceHoldersFnc ¶
func (d *DefaultPhHandler) GetPlaceHoldersFnc(inspectFunc func(phKey string, phValue string))
func (*DefaultPhHandler) HandlePlaceHolder ¶
func (d *DefaultPhHandler) HandlePlaceHolder(line string) string
func (*DefaultPhHandler) HandlePlaceHolderWithScope ¶
func (d *DefaultPhHandler) HandlePlaceHolderWithScope(line string, scopeVars map[string]string) string
func (*DefaultPhHandler) SetIfNotExists ¶
func (d *DefaultPhHandler) SetIfNotExists(key, value string)
func (*DefaultPhHandler) SetPH ¶
func (d *DefaultPhHandler) SetPH(key, value string)
type DefaultRequires ¶
type DefaultRequires struct {
// contains filtered or unexported fields
}
func NewDefaultRequires ¶
func NewDefaultRequires(variables PlaceHolder, logger mimiclog.Logger) *DefaultRequires
func (*DefaultRequires) CheckReason ¶
func (d *DefaultRequires) CheckReason(checkReason configure.Trigger, output string, e error) (bool, string)
checks reasons that is used for some triggers returns bool and a message what trigger was matched and the reason
func (*DefaultRequires) CheckRequirements ¶
func (d *DefaultRequires) CheckRequirements(require configure.Require) (bool, string)
test all requirements - operation system - variable matches - files exists - files not exists - environment variables returns bool and the message what is checked.
func (*DefaultRequires) StringMatchTest ¶
func (d *DefaultRequires) StringMatchTest(pattern, value string) bool
StringMatchTest test a pattern and a value. in this example: myvar: "=hello" the patter is "=hello" and the value should be "hello" for a match
type MainCmdSetter ¶
type MsgErrDebug ¶
type MsgExecOutput ¶
type MsgProcess ¶
MsgProcess is the process id that is running
type MsgReason ¶
type MsgReason string
MsgReason is the reason that is used to set why somethingis triggered. like stopreason
type MsgStickCursor ¶
type MsgStickCursor bool
type PlaceHolder ¶
type PlaceHolder interface { SetPH(key, value string) // sets a placeholder and its value AppendToPH(key, value string) bool // appends a value to a placeholder SetIfNotExists(key, value string) // sets a placeholder and its value if it does not exist GetPHExists(key string) (string, bool) // returns the value of a placeholder if it exists GetPH(key string) string // returns the value of a placeholder if it exists, otherwise it returns the placeholder itself GetPlaceHoldersFnc(inspectFunc func(phKey string, phValue string)) // iterates over all placeholders and calls the inspectFunc for each placeholder HandlePlaceHolder(line string) string // replaces all placeholders in a string HandlePlaceHolderWithScope(line string, scopeVars map[string]string) string // replaces all placeholders in a string with a scope ClearAll() // clears all placeholders ExportVarToFile(variable string, filename string) error // exports a placeholder to a file }
PlaceHolder is the interface for the placeholder handler they are used to store and retrieve placeholder
type ProcessDef ¶
type ProcessDef struct {
// contains filtered or unexported fields
}
type RunnerCtrl ¶
type RunnerCtrl struct {
// contains filtered or unexported fields
}
func (*RunnerCtrl) Cmd ¶
func (r *RunnerCtrl) Cmd(cmd string) error
func (*RunnerCtrl) GetRunner ¶
func (r *RunnerCtrl) GetRunner() *process.Process
func (*RunnerCtrl) GetTask ¶
func (r *RunnerCtrl) GetTask() configure.Task
type TaskDef ¶
type TaskDef struct {
// contains filtered or unexported fields
}
TaskDef holds information about running and finished tasks
func (*TaskDef) GetProcess ¶
func (ts *TaskDef) GetProcess() *ProcessDef
func (*TaskDef) GetProcessLog ¶
func (ts *TaskDef) GetProcessLog() []ProcessLog
func (*TaskDef) GetProcessPid ¶
func (*TaskDef) IsProcessRunning ¶
func (*TaskDef) KillProcess ¶
func (*TaskDef) StartTrackProcess ¶
func (*TaskDef) StopProcessIfRunning ¶
StopProcessIfRunning sends an interrupt signal to the process if the process is running if the process is not running, nothing happens. will not reported as error
type TaskListExec ¶
type TaskListExec struct {
// contains filtered or unexported fields
}
func NewStdTaskListExec ¶
func NewStdTaskListExec(config configure.RunConfig, adds ...interface{}) *TaskListExec
func NewTaskListExec ¶
func NewTaskListExec(config configure.RunConfig, adds ...interface{}) *TaskListExec
func (*TaskListExec) GetWatch ¶
func (e *TaskListExec) GetWatch() *Watchman
func (*TaskListExec) RunTargetWithVars ¶
func (*TaskListExec) SetHardExistToAllTasks ¶
func (e *TaskListExec) SetHardExistToAllTasks(exitOnErr bool)
func (*TaskListExec) SetLogger ¶
func (e *TaskListExec) SetLogger(logger mimiclog.Logger)
type VerifiedLines ¶
type Watchman ¶
type Watchman struct {
// contains filtered or unexported fields
}
the watchman implementation
func GetWatcherInstance ¶
GetWatcherInstance returns the watchman instance for a given uuid string or nil if the instance does not exists
func NewGlobalWatchman ¶
func NewGlobalWatchman() *Watchman
NewGlobalWatchman returns the global watchman instance. if the global watchman instance does not exists, it will be created this is a shortcut for GetWatcherInstance(GlobalName) and storeNamedInstance(wm, GlobalName) if the instance does not exists
func NewWatchman ¶
func NewWatchman() *Watchman
NewWatchman returns a new watchman instance and stores it in the global watchman instance list
func (*Watchman) ExpectTaskToStart ¶
ExpectTaskToStart waits until some of the tasks are started or the timeout is reached the timeout is defined by the tickTimer multiplied by the timeoutTickCount if we hit the timeout, we return false if we found a running task, we return true
func (*Watchman) GetAllRunningTasks ¶
returns the list of all running tasks as string slice by the task name
func (*Watchman) GetTask ¶
GetTask returns the task info for a given target or false if the task does not exists
func (*Watchman) GetTaskCount ¶
func (*Watchman) GetTaskDone ¶
func (*Watchman) IncTaskCount ¶
Increases the task count for a given target. If the task does not exists it will be created
func (*Watchman) IncTaskDoneCount ¶
Increases the task done count for a given target. If the task does not exists it will not be created. Instead an error will be returned. there is also no check against the count. So it is possible to increase the done count higher than the count of task runs
func (*Watchman) ResetAllTaskInfos ¶
func (w *Watchman) ResetAllTaskInfos()
ResetAllTaskInfos resets all task infos
func (*Watchman) ResetAllTasksIfPossible ¶
func (*Watchman) SetLogger ¶
SetLogger sets the logger for the watchman fullfills the mimiclog.Logger interface
func (*Watchman) StopAllTasks ¶
StopAllTasks stops all tasks they are registered in the watchman and reports the result to the reportFn if it is not nil
func (*Watchman) TaskRunning ¶
TaskRunning checks if a task is already running
func (*Watchman) TryCreate ¶
create a new task if it does not exists. if the handleFn is not nil, it will be called with the result of the check. it resturns true if the task is created or false if the task already exists
func (*Watchman) UpdateTask ¶
Updates the task info for a given target
type WinProcData ¶
type WinProcData struct { Pid int ProcName string SessionName string SessionId int MemUsage string Status string UserName string CpuTime string WindowTitle string }
WinProcData is a struct to hold the data of a process on windows
func WinCsvToProcData ¶
func WinCsvToProcData(csv string) ([]WinProcData, error)
parsing the csv output of tasklist comming from windows tasklist command
func WinProcInfo ¶
func WinProcInfo(pid int) (WinProcData, error)
Getting process info on windows is a bit tricky we use the tasklist command to get the info and parse the csv output