out-of-tree kernel {module, exploit} development tool
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Copyright 2019 Mikhail Klementev. All rights reserved.
  2. // Use of this source code is governed by a AGPLv3 license
  3. // (or later) that can be found in the LICENSE file.
  4. package main
  5. import (
  6. "database/sql"
  7. "fmt"
  8. "io/ioutil"
  9. "log"
  10. "runtime"
  11. "time"
  12. "code.dumpstack.io/tools/out-of-tree/config"
  13. )
  14. func packHandler(db *sql.DB, path, registry string, stop time.Time,
  15. commands []config.DockerCommand, kcfg config.KernelConfig,
  16. autogen, download bool, exploitRuns, kernelRuns int64) (err error) {
  17. dockerTimeout := time.Minute
  18. qemuTimeout := time.Minute
  19. threads := runtime.NumCPU()
  20. tag := fmt.Sprintf("pack_run_%d", time.Now().Unix())
  21. log.Println("Tag:", tag)
  22. files, err := ioutil.ReadDir(path)
  23. if err != nil {
  24. return
  25. }
  26. for _, f := range files {
  27. workPath := path + "/" + f.Name()
  28. if !exists(workPath + "/.out-of-tree.toml") {
  29. continue
  30. }
  31. if autogen {
  32. var perRegex int64 = 1
  33. err = kernelAutogenHandler(workPath, registry,
  34. commands, perRegex, false, download)
  35. if err != nil {
  36. return
  37. }
  38. }
  39. log.Println(f.Name())
  40. pewHandler(kcfg, workPath, "", "", "", false,
  41. stop, dockerTimeout, qemuTimeout,
  42. kernelRuns, exploitRuns, pathDevNull,
  43. tag, threads, db, false)
  44. }
  45. return
  46. }