diff --git a/GetRuntimeAddresses/main.go b/GetRuntimeAddresses/main.go index 46e41a3..7bbafb6 100644 --- a/GetRuntimeAddresses/main.go +++ b/GetRuntimeAddresses/main.go @@ -1,6 +1,7 @@ package main import ( + "flag" "fmt" "os" @@ -8,7 +9,15 @@ import ( "github.com/optimyze-interviews/OezguerKesim/GetRuntimeAddresses/symbolyze" ) +var ( + symbol = flag.String("symbol", "_PyRuntime", "Symbol to search for") + glob = flag.String("glob", "*python3*", "pattern an ELF-file must match (see filepath.Match)") + debug = flag.Bool("debug", false, "run in debug mode") +) + func main() { + flag.Parse() + mapFD, err := ebpf.CreateMap() if err != nil { fmt.Printf("Failed to create eBPF map: %s\n", err) @@ -17,12 +26,12 @@ func main() { fmt.Printf("Created eBPF map (FD: %d)\n", mapFD) - // - // Solution to your tasks goes here - // - - scanner := symbolyze.New("_PyRuntime", "*python3*") + scanner := symbolyze.New(*symbol, *glob) scanner.OnFound(mapFD.Set) + if *debug { + scanner.DebugOn() + } + err = scanner.Run() if err != nil { fmt.Printf("Failed to run the symbolyze scanner: %s", err)