Added commandline flags
This commit is contained in:
parent
32981d6a55
commit
80e5782a45
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user