Documentation ¶
Index ¶
Constants ¶
const ( FilePermWrite = iota + 1 FilePermRead FilePermStat )
FilePermWrite / Read / Stat are permissions
Variables ¶
This section is empty.
Functions ¶
func GetExtraSet ¶
GetExtraSet evaluates the concatenated file set according to real path or raw path
Types ¶
type FileSet ¶
FileSet stores the file permissions in the hierarchical set
func (*FileSet) AddRange ¶
AddRange adds multiple files into the FileSet If path is relative path, add according to the workPath
func (*FileSet) IsInSetSmart ¶
IsInSetSmart same from uoj-judger
type FileSets ¶
type FileSets struct {
Writable, Readable, Statable, SoftBan FileSet
}
FileSets aggregates multiple permissions including write / read / stat / soft ban
func (*FileSets) AddFilePermission ¶
AddFilePermission adds the file into fileSets according to the given permission
func (*FileSets) IsReadableFile ¶
IsReadableFile determines whether the file path inside the read / write set
func (*FileSets) IsSoftBanFile ¶
IsSoftBanFile determines whether the file path inside the softban set
func (*FileSets) IsStatableFile ¶
IsStatableFile determines whether the file path inside the stat / read / write set
func (*FileSets) IsWritableFile ¶
IsWritableFile determines whether the file path inside the write set
type Handler ¶
type Handler struct { FileSet *FileSets SyscallCounter SyscallCounter }
Handler defines file access restricted handler to call the ptrace safe runner
func (*Handler) CheckRead ¶
func (h *Handler) CheckRead(fn string) ptracer.TraceAction
CheckRead checks whether the file have read permission
func (*Handler) CheckStat ¶
func (h *Handler) CheckStat(fn string) ptracer.TraceAction
CheckStat checks whether the file have stat permission
func (*Handler) CheckSyscall ¶
func (h *Handler) CheckSyscall(syscallName string) ptracer.TraceAction
CheckSyscall checks syscalls other than allowed and traced against the SyscallCounter
func (*Handler) CheckWrite ¶
func (h *Handler) CheckWrite(fn string) ptracer.TraceAction
CheckWrite checks whether the file have write permission
type SyscallCounter ¶
SyscallCounter defines a count-down for each each syscall occurs
func NewSyscallCounter ¶
func NewSyscallCounter() SyscallCounter
NewSyscallCounter creates a new SyscallCounter
func (SyscallCounter) Add ¶
func (s SyscallCounter) Add(name string, count int)
Add adds single counter to SyscallCounter
func (SyscallCounter) AddRange ¶
func (s SyscallCounter) AddRange(m map[string]int)
AddRange add multiple counter to SyscallCounter