From 039437cc8faa623fd80d8568d945d8677102db18 Mon Sep 17 00:00:00 2001 From: Selyss <99344963+Selyss@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:55:45 -0500 Subject: [PATCH] support for specific querying --- cmd/main.go | 4 ++-- pkg/assembuddy/requestTable.go | 13 +------------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 8a69fb9..6fe7fc6 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -51,8 +51,8 @@ func main() { log.Fatalf("Error: %s", err) } } - if opts.ListQueryMatches { - _, err := assembuddy.QueryInfo(opts.Arch) + if opts.Arch != "" && opts.Syscall != "" { + _, err := assembuddy.GetSyscallData(opts.Arch, opts.Syscall, opts.PrettyPrint) if err != nil { log.Fatalf("Error: %s", err) } diff --git a/pkg/assembuddy/requestTable.go b/pkg/assembuddy/requestTable.go index 49e53cd..e1ee91a 100644 --- a/pkg/assembuddy/requestTable.go +++ b/pkg/assembuddy/requestTable.go @@ -52,7 +52,7 @@ func GetSyscallData(arch string, name string, prettyp bool) ([]Syscall, error) { url := "https://api.syscall.sh/v1/syscalls/" // if arch is x64, x86, arm, or arm64, concat to endpointURL if arch == "x64" || arch == "x86" || arch == "arm" || arch == "arm64" { - url += arch + url += arch + "/" // if arch is not empty, return error } else if arch != "" { return nil, errors.New("invalid architecture") @@ -65,14 +65,3 @@ func ArchInfo() ([]Syscall, error) { url := "https://api.syscall.sh/v1/conventions" return fetchData(url, true) } - -func QueryInfo(arch string) ([]Syscall, error) { - url := "https://api.syscall.sh/v1/syscalls/" - if arch == "x64" || arch == "x86" || arch == "arm" || arch == "arm64" { - url += arch - } else if arch != "" { - return nil, errors.New("invalid architecture") - } - return fetchData(url, true) - // TODO: -}