Skip to content

Commit

Permalink
chore: remove useless code in example app
Browse files Browse the repository at this point in the history
Signed-off-by: Alessio Greggi <ale_grey_91@hotmail.it>
  • Loading branch information
alegrey91 committed Jan 18, 2025
1 parent 87a4a20 commit 781eace
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 29 deletions.
4 changes: 2 additions & 2 deletions tests/testcases/example-app/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ module github.com/alegrey91/seccomp-test-coverage

go 1.20

require github.com/spf13/cobra v1.7.0

require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/seccomp/libseccomp-golang v0.10.0 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
)
2 changes: 0 additions & 2 deletions tests/testcases/example-app/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/seccomp/libseccomp-golang v0.10.0 h1:aA4bp+/Zzi0BnWZ2F1wgNBs5gTpm+na2rWM6M9YjLpY=
github.com/seccomp/libseccomp-golang v0.10.0/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
Expand Down
25 changes: 0 additions & 25 deletions tests/testcases/example-app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,9 @@ Copyright © 2023 Alessio Greggi alessiog@armosec.io
package main

import (
"fmt"
"syscall"

libseccomp "github.com/seccomp/libseccomp-golang"

"github.com/alegrey91/seccomp-test-coverage/cmd"
)

func whiteList(syscalls []string) {

filter, err := libseccomp.NewFilter(libseccomp.ActErrno.SetReturnCode(int16(syscall.EPERM)))
if err != nil {
fmt.Printf("Error creating filter: %s\n", err)
}
for _, element := range syscalls {
fmt.Printf("[+] Whitelisting: %s\n",element)
syscallID, err := libseccomp.GetSyscallFromName(element)
if err != nil {
panic(err)
}
filter.AddRule(syscallID, libseccomp.ActAllow)
}
filter.Load()
}

func main() {

//var syscalls = []string{"access", "brk", "clone", "close", "execve", "fcntl", "futex", "getpid", "getrandom", "getrlimit", "gettid", "lseek", "madvise", "mmap", "mprotect", "munmap", "newfstatat", "openat", "read", "renameat", "rseq", "setrlimit", "sigaltstack", "write", "exit_group"}
//whiteList(syscalls)
cmd.Execute()
}

0 comments on commit 781eace

Please sign in to comment.