Documentation
¶
Index ¶
- func ByteToString(orig []byte) string
- func CheckUnpriUserNS() error
- func ContainsStrInSlice(elem string, sli []string) bool
- func FileExist(path string) bool
- func FindTargetDeviceID(mi *MountInfo) bool
- func GetAllCGroupSubSystem() ([]string, error)
- func GetCgroupVersion() (int, error)
- func GetKernelVersion() ([]int, error)
- func HttpSendJson(method string, url string, data string) (string, error)
- func IntContains(s []int, e int) bool
- func IsDir(FilePath string) bool
- func IsDirectory(path string) bool
- func IsSoftLink(FilePath string) bool
- func MakeDev(major, minor string) int
- func RandString(n int) string
- func ReadLines(path string) ([]string, error)
- func RemoveDuplicateElement(addrs []string) []string
- func RewriteFile(path string, content string, perm os.FileMode)
- func SetBlockAccessible(path string) error
- func ShellExec(shellPath string) error
- func StringContains(s []string, e string) bool
- func UnixHttpSend(method string, unixPath string, uri string, data string) (string, error)
- func WriteFile(path string, content string) error
- func WriteFileAdd(path string, content string) error
- func WriteShellcodeToCrontab(header string, filePath string, shellcode string) error
- type CgroupInfo
- type MountInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteToString ¶
func CheckUnpriUserNS ¶ added in v1.0.6
func CheckUnpriUserNS() error
CheckUnpriUserNS checks if the current host enable unprivileged user namespace. reference:
https://blog.trailofbits.com/2019/07/19/understanding-docker-container-escapes/ https://unit42.paloaltonetworks.com/cve-2022-0492-cgroups/
exceptional case:
the sysctl files(/proc/sys/kernel/unprivileged_userns_clone) only exist in Debian, Ubuntu. We can not check the sysctl file in other distros, test in CentOS Linux release 8.4.2105 (Core).
func ContainsStrInSlice ¶ added in v1.0.6
func GetAllCGroupSubSystem ¶ added in v1.0.6
func GetCgroupVersion ¶ added in v1.0.6
get cgroup version V1/V2 hybrid mode will not work in container
func HttpSendJson ¶ added in v0.1.10
func IntContains ¶ added in v1.0.4
IntContains check string array contains a int number
func IsDirectory ¶ added in v1.0.2
func IsSoftLink ¶
func RandString ¶
func ReadLines ¶ added in v1.0.3
ReadLines reads a whole file into memory and returns a slice of its lines. from https://stackoverflow.com/questions/5884154/read-text-file-into-string-array-and-write
func RemoveDuplicateElement ¶
func SetBlockAccessible ¶
set all block device accessible
func StringContains ¶ added in v1.0.4
StringContains check string array contains a string
func UnixHttpSend ¶
func WriteFileAdd ¶ added in v1.0.1
Types ¶
type CgroupInfo ¶ added in v1.0.6
type CgroupInfo struct {
HierarchyID int
ControllerLst string // split by "," but should not be split
CgroupPath string
}
func GetAllCGroup ¶ added in v1.0.6
func GetAllCGroup() ([]CgroupInfo, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.