Documentation
¶
Index ¶
- Constants
- func CheckProcessOpenDevTun(pid int) (bool, string)
- func CheckUidAuthority(user string, pid int) (bool, error)
- func CopyDir(src string, dst string) error
- func CopyFile(src, dst string) error
- func GetAllProcesses() utils.Set
- func GetAllUsers(pid int, users map[int]string) (int, int, error)
- func GetContainerDaemonArgs() ([]string, error)
- func GetContainerRealFilePath(pid int, path string) (string, error)
- func GetContainerSocketTable(rootPid int) map[uint32]SocketInfo
- func GetExePathFromLink(pid int) (string, error)
- func GetFDSocketInode(pid int, fd int) (uint32, error)
- func GetFileHash(filepath string) ([fileHashKeep]byte, error)
- func GetProcessGroupId(pid int) int
- func GetProcessName(pid int) string
- func GetProcessPIDs(pid int) (ppid, gid, sid int, status, cmd string)
- func GetProcessSocketInodes(pid int) (utils.Set, error)
- func GetProcessUIDs(pid int) (name string, ppid, ruid, euid int)
- func GetSessionId(pid int) int
- func HashZero(hash [fileHashKeep]byte) bool
- func IsPackageLib(path string) bool
- func IsPidValid(pid int) bool
- type Connection
- type FileInfoExt
- type SocketInfo
Constants ¶
const ErrorNotDirectory string = "src is not a directory"
///////
const UserUidMin int = 1000
Variables ¶
This section is empty.
Functions ¶
func CheckProcessOpenDevTun ¶
func CopyDir ¶
CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped.
func CopyFile ¶
CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.
func GetAllProcesses ¶
func GetAllUsers ¶
This is to enter process' mount namespace and get the passwd file.
func GetContainerDaemonArgs ¶
func GetContainerRealFilePath ¶
try to get sym link
func GetContainerSocketTable ¶
func GetContainerSocketTable(rootPid int) map[uint32]SocketInfo
Container's socket tables are located at /proc/[rootPid]/root/proc/1/net/ inode is unique and handle either only one service
func GetExePathFromLink ¶
func GetFileHash ¶
func GetProcessGroupId ¶
func GetProcessName ¶
func GetProcessPIDs ¶
Get ppid, group and session id from /proc/<pid>/stat Error if ppid is -1
func GetProcessUIDs ¶
Get the process parent id and uid from /proc/<pid>/status Error if ppid is -1
func GetSessionId ¶
func IsPackageLib ¶
func IsPidValid ¶
Types ¶
type Connection ¶
type Connection struct { LocIP net.IP RemIP net.IP LocPort uint16 RemPort uint16 Ether uint16 Protocol uint8 }
func GetProcessConnection ¶
func GetProcessConnection(pid int, clientPort *share.CLUSProtoPort, inodes utils.Set) *Connection
type FileInfoExt ¶
type FileInfoExt struct { ContainerId string Path string Link string FileMode os.FileMode Size int64 Hash [fileHashKeep]byte Filter interface{} Children []*FileInfoExt Protect bool UserAdded bool }
func GetFileDirInfo ¶
func GetFileDirInfo(file string) FileInfoExt
func GetFileInfoExtFromPath ¶
func GetFileInfoExtFromPath(root int, path string, flt interface{}, protect, userAdded bool) []*FileInfoExt
get the file information, if the file is a symlink, return both the symlink and the real file
func GetFileInfoExtFromPid ¶
func GetFileInfoExtFromPid(root, pid int) []*FileInfoExt