sys

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2020 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connections

func Connections(parent *proclib.Process) []netlib.Connection

Connections uses the gopsutil/net to get all connections created by a process (or all by default).

@callable: sys.connections @param: parent @?Process @retval: connections @[]Connection

@usage: connections = sys.connections()

func DetectOS added in v0.2.3

func DetectOS() string

DetectOS uses the GOOS variable to determine the OS.

@callable: sys.detectOS @retval: os @string

@usage: os = sys.detectOS()

func Exec

func Exec(executable string, disown bool) (string, error)

Exec uses the os/exec.command to execute the passed executable/params.

@callable: sys.exec @param: executable @String @param: disown @?Bool @retval: output @String @retval: err @Error

@usage: output = sys.exec("/usr/sbin/nginx", disown=True)

func Files added in v0.3.0

func Files(path string) (files []filelib.File, err error)

Files uses the ioutil.ReadDir to get all files in a given path.

@callable: sys.files @retval: files @[]File

@usage: files = sys.files()

func Import

func Import() script.Library

@DEPRECATE Import the sys library to enable scripts to access low level system functionality.

func Include added in v0.3.0

func Include() script.Option

Include the sys library in a script environment.

func Library added in v0.3.0

func Library() script.Library

Library prepares a new sys library for use within a script environment.

func OpenFile added in v0.3.0

func OpenFile(filePath string) (file.Type, error)

OpenFile uses os.Open to Open a file.

@callable: sys.openFile @param: path @string @retval: file @File @retval: err @Error

@usage: f, err = sys.openFile("/usr/bin/malware")

func Processes

func Processes() (procs []proclib.Process)

Processes uses the gopsutil/process to get all processes.

@callable: sys.processes @retval: procs @[]Process

@usage: processes = sys.processes()

Types

type File added in v0.3.0

type File struct {
	*os.File
}

File is our impl of File.

func (*File) Move added in v0.3.0

func (f *File) Move(dstPath string) error

Move uses os.Rename to move a file/folder

func (*File) Remove added in v0.3.0

func (f *File) Remove() error

Remove uses os.Remove to remove a file/folder. WARNING: basically works like rm -rf

func (*File) Sync added in v0.3.0

func (f *File) Sync() error

Sync closes and then reopens the file.

Jump to

Keyboard shortcuts

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