GoToolSharing / htb-cli

Interact with Hackthebox using your terminal - Be faster and more competitive !
https://github.com/GoToolSharing/htb-cli
GNU General Public License v3.0
87 stars 6 forks source link

panic: runtime error: index out of range [0] with length 0 #19

Closed QU35T-code closed 1 year ago

QU35T-code commented 1 year ago

Bug when specifying a challenge name while flagging a machine.

utils.go -> func SearchItemIDByName (Unmarshal)

go run . submit -m phonebook -f FLAG4TESTING -d 2

goroutine 1 [running]:
github.com/GoToolSharing/htb-cli/utils.SearchItemIDByName({0x16bd7f1d7?, 0x0?}, {0x0, 0x0}, {0x104365079, 0x7})
    /Users/qu35t/Documents/GoToolSharingCorp/htb-cli-reborn/utils/utils.go:66 +0x818
github.com/GoToolSharing/htb-cli/cmd.glob..func8(0x14000146600?, {0x104364073?, 0x4?, 0x104364077?})
    /Users/qu35t/Documents/GoToolSharingCorp/htb-cli-reborn/cmd/submit.go:46 +0x2c4
github.com/spf13/cobra.(*Command).execute(0x104724800, {0x1400007e6c0, 0x6, 0x6})
    /Users/qu35t/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:876 +0x548
github.com/spf13/cobra.(*Command).ExecuteC(0x104724080)
    /Users/qu35t/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:990 +0x318
github.com/spf13/cobra.(*Command).Execute(...)
    /Users/qu35t/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:918
github.com/GoToolSharing/htb-cli/cmd.Execute()
    /Users/qu35t/Documents/GoToolSharingCorp/htb-cli-reborn/cmd/root.go:28 +0x24
main.main()
    /Users/qu35t/Documents/GoToolSharingCorp/htb-cli-reborn/main.go:6 +0x1c
exit status 2
QU35T-code commented 1 year ago
❯ go run . submit -m phonebook -f FLAG4TESTING -d 2
No machine was found
exit status 1
❯ go run . submit -m sau -f FLAG4TESTING -d 2      
? The following machine was found : Sau (y/N)