Added commandline flags
This commit is contained in:
parent
32981d6a55
commit
80e5782a45
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
@ -8,7 +9,15 @@ import (
|
|||||||
"github.com/optimyze-interviews/OezguerKesim/GetRuntimeAddresses/symbolyze"
|
"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() {
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
mapFD, err := ebpf.CreateMap()
|
mapFD, err := ebpf.CreateMap()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Failed to create eBPF map: %s\n", err)
|
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)
|
fmt.Printf("Created eBPF map (FD: %d)\n", mapFD)
|
||||||
|
|
||||||
//
|
scanner := symbolyze.New(*symbol, *glob)
|
||||||
// Solution to your tasks goes here
|
|
||||||
//
|
|
||||||
|
|
||||||
scanner := symbolyze.New("_PyRuntime", "*python3*")
|
|
||||||
scanner.OnFound(mapFD.Set)
|
scanner.OnFound(mapFD.Set)
|
||||||
|
if *debug {
|
||||||
|
scanner.DebugOn()
|
||||||
|
}
|
||||||
|
|
||||||
err = scanner.Run()
|
err = scanner.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Failed to run the symbolyze scanner: %s", err)
|
fmt.Printf("Failed to run the symbolyze scanner: %s", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user