| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 | package mainimport (	"fmt"	"os"	"os/exec"	"strconv"	"strings"	"sync"	"github.com/langgenius/dify-sandbox/internal/static/python_syscall")const (	SYSCALL_NUMS = 400)func run(allowed_syscalls []int) {	nums := []string{}	for _, syscall := range allowed_syscalls {		nums = append(nums, strconv.Itoa(syscall))	}	os.Setenv("ALLOWED_SYSCALLS", strings.Join(nums, ","))	_, err := exec.Command("python3", "cmd/test/fuzz_python_amd64/test.py").Output()	if err == nil {	} else {		fmt.Println("failed")	}}func find_syscall(syscall int, syscalls []int) int {	for i, s := range syscalls {		if s == syscall {			return i		}	}	return -1}func main() {	original := python_syscall.ALLOW_SYSCALLS	original = append(original, python_syscall.ALLOW_NETWORK_SYSCALLS...)	// generate task list	list := make([][]int, SYSCALL_NUMS)	for i := 0; i < SYSCALL_NUMS; i++ {		list[i] = make([]int, len(original))		copy(list[i], original)		// add i		if find_syscall(i, original) == -1 {			list[i] = append(list[i], i)		}		// for j := 217; j < 218; j++ {		// 	if find_syscall(j, list[i]) == -1 {		// 		list[i] = append(list[i], j)		// 	}		// }	}	lock := sync.Mutex{}	wg := sync.WaitGroup{}	i := 0	// run 4 tasks concurrently	for j := 0; j < 4; j++ {		wg.Add(1)		go func() {			defer wg.Done()			for {				lock.Lock()				if i >= len(list) {					lock.Unlock()					return				}				task := list[i]				i++				lock.Unlock()				run(task)			}		}()	}	// wait for all tasks to finish	wg.Wait()}
 |