Documentation
¶
Index ¶
- Constants
- Variables
- func DetectGitInstalled() bool
- func DetectPackageManager() string
- func DetectServiceManager() string
- func ExecGitCommand(dir string, command ...string) ([]byte, error)
- func FindServices(pattern string) (map[string]string, error)
- func FindServicesSysV(pattern string) (map[string]string, error)
- func FindServicesSystemd(pattern string) (map[string]string, error)
- func GetServiceStatusRaw(name string) ([]byte, error)
- func IsGitRepository(path string) (string, bool)
- func IsSymlink(info os.FileInfo) bool
- func ListInstalledPackagesRaw(pattern ...string) ([]byte, error)
- func LoadCommandOutput(command string, arguments ...string) (output []byte, err error)
- func LoadCommandOutputWithTimeout(timeout time.Duration, command string, arguments ...string) (output []byte, err error)
- func ProcessList() (processList []ps.Process, err error)
- func ProcessListFilter(filter []string) (processList []ps.Process, err error)
- type Collection
- func (c *Collection) AddCommandOutput(file, command string, arguments ...string)
- func (c *Collection) AddCommandOutputWithTimeout(file string, timeout time.Duration, command string, arguments ...string)
- func (c *Collection) AddFileDataRaw(fileName string, data []byte)
- func (c *Collection) AddFileFromReaderRaw(name string, r io.Reader) (err error)
- func (c *Collection) AddFileJSON(fileName string, data []byte)
- func (c *Collection) AddFileJSONRaw(fileName string, data []byte)
- func (c *Collection) AddFileToOutput(file *File) (err error)
- func (c *Collection) AddFileToOutputRaw(file *File) (err error)
- func (c *Collection) AddFileYAML(fileName string, data interface{})
- func (c *Collection) AddFiles(prefix, source string)
- func (c *Collection) AddFilesIfFound(prefix string, sources ...string)
- func (c *Collection) AddGitRepoInfo(fileName, path string)
- func (c *Collection) AddInstalledPackagesRaw(fileName string, pattern ...string)
- func (c *Collection) AddJournalLog(fileName, service string)
- func (c *Collection) AddLogToOutput() (err error)
- func (c *Collection) AddServiceStatusRaw(fileName, name string)
- func (c *Collection) ClearObfuscators()
- func (c *Collection) Close() error
- func (c *Collection) RegisterObfuscator(o *obfuscate.Obfuscator)
- func (c *Collection) RegisterObfuscators(list ...*obfuscate.Obfuscator)
- type File
- func LoadFiles(prefix, source string) (files []*File, err error)
- func LoadFilesFromDirectory(prefix, source string) (files []*File, err error)
- func LoadFilesFromGlob(prefix, source string) (files []*File, err error)
- func NewFile(name string) *File
- func NewFileFromReader(name string, r io.Reader) (*File, error)
- type GitRepoInfo
- type JournalElement
Constants ¶
const ( PackageManagerRPM = "rpm" PackageManagerDebian = "dpkg" )
const ( ServiceManagerSystemD = "systemd" ServiceManagerSysV = "sysv" )
const DefaultTimeout = 5 * time.Second
Variables ¶
var ErrNoPackageManager = errors.New("could not detect a supported package manager")
ErrNoPackageManager is returned when we could not detect one.
var ErrNoServiceManager = errors.New("could not detect a supported service manager")
ErrNoServiceManager is returned when we could not detect one.
var FoundPackageManager string
var FoundServiceManager string
FoundServiceManager remembers the current service manager found.
Functions ¶
func DetectGitInstalled ¶
func DetectGitInstalled() bool
func DetectPackageManager ¶
func DetectPackageManager() string
func DetectServiceManager ¶
func DetectServiceManager() string
func GetServiceStatusRaw ¶
func IsGitRepository ¶
func LoadCommandOutput ¶
func ProcessList ¶
func ProcessList() (processList []ps.Process, err error)
ProcessList returns array of type ps.Process. Error returns nil if no error.
func ProcessListFilter ¶
ProcessListFilter returns string array of processes with given filter. Error returns nil if no error.
Types ¶
type Collection ¶
type Collection struct { Output *zip.Writer Log *logrus.Logger LogData *bytes.Buffer ExecTimeout time.Duration Obfuscators []*obfuscate.Obfuscator Detailed bool JournalLoggingInterval string Config config.Config Metric *metrics.Metrics }
func (*Collection) AddCommandOutput ¶
func (c *Collection) AddCommandOutput(file, command string, arguments ...string)
func (*Collection) AddCommandOutputWithTimeout ¶
func (*Collection) AddFileDataRaw ¶
func (c *Collection) AddFileDataRaw(fileName string, data []byte)
func (*Collection) AddFileFromReaderRaw ¶
func (c *Collection) AddFileFromReaderRaw(name string, r io.Reader) (err error)
func (*Collection) AddFileJSON ¶
func (c *Collection) AddFileJSON(fileName string, data []byte)
AddFileJSON will add json data and apply obfuscation
func (*Collection) AddFileJSONRaw ¶ added in v1.0.0
func (c *Collection) AddFileJSONRaw(fileName string, data []byte)
AddFileJSONRaw will add raw json data without obfuscation
func (*Collection) AddFileToOutput ¶
func (c *Collection) AddFileToOutput(file *File) (err error)
AddFileToOutput adds a single file while calling any obfuscator.
func (*Collection) AddFileToOutputRaw ¶
func (c *Collection) AddFileToOutputRaw(file *File) (err error)
AddFileToOutputRaw adds the file directly to ZIP output.
No obfuscation is applied.
func (*Collection) AddFileYAML ¶
func (c *Collection) AddFileYAML(fileName string, data interface{})
func (*Collection) AddFiles ¶
func (c *Collection) AddFiles(prefix, source string)
func (*Collection) AddFilesIfFound ¶
func (c *Collection) AddFilesIfFound(prefix string, sources ...string)
func (*Collection) AddGitRepoInfo ¶
func (c *Collection) AddGitRepoInfo(fileName, path string)
func (*Collection) AddInstalledPackagesRaw ¶
func (c *Collection) AddInstalledPackagesRaw(fileName string, pattern ...string)
func (*Collection) AddJournalLog ¶
func (c *Collection) AddJournalLog(fileName, service string)
func (*Collection) AddLogToOutput ¶
func (c *Collection) AddLogToOutput() (err error)
func (*Collection) AddServiceStatusRaw ¶
func (c *Collection) AddServiceStatusRaw(fileName, name string)
func (*Collection) ClearObfuscators ¶
func (c *Collection) ClearObfuscators()
ClearObfuscators clears the list of Obfuscators in the Collection
func (*Collection) Close ¶
func (c *Collection) Close() error
func (*Collection) RegisterObfuscator ¶
func (c *Collection) RegisterObfuscator(o *obfuscate.Obfuscator)
RegisterObfuscator adds the given Obfuscator to the Obfuscators of Collection
func (*Collection) RegisterObfuscators ¶
func (c *Collection) RegisterObfuscators(list ...*obfuscate.Obfuscator)
RegisterObfuscators adds the given list of Obfuscator to the Obfuscators of Collection
type GitRepoInfo ¶
type GitRepoInfo struct { Path string HeadCommit string Remotes string Describe string Status string }
func LoadGitRepoInfo ¶
func LoadGitRepoInfo(path string) (*GitRepoInfo, error)
type JournalElement ¶
type JournalElement struct {
Service string
}