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

[BUG] Invalid HTB API token #77

Closed QU35T-code closed 11 months ago

QU35T-code commented 11 months ago

Describe the bug Crash when API token is invalid.

To Reproduce Steps to reproduce the behavior:

❯ htb-cli sherlocks
error: invalid character '<' looking for beginning of value
panic: interface conversion: interface {} is nil, not []interface {}

goroutine 1 [running]:
github.com/GoToolSharing/htb-cli/lib/sherlocks.CreateFlex({0x0?, 0x0?}, {0x104840bb3, 0x6}, 0x0?)
        /Users/qu35t/go/pkg/mod/github.com/!go!tool!sharing/htb-cli@v1.4.1/lib/sherlocks/tui.go:46 +0x560
github.com/GoToolSharing/htb-cli/cmd.glob..func6.1({0x104859392, 0x38}, {0x104840bb3, 0x6}, 0x4?, 0x140001ea060)
        /Users/qu35t/go/pkg/mod/github.com/!go!tool!sharing/htb-cli@v1.4.1/cmd/sherlocks.go:90 +0xf8
github.com/GoToolSharing/htb-cli/cmd.glob..func6(0x140001ac500?, {0x1048400ea?, 0x4?, 0x10483ffda?})
        /Users/qu35t/go/pkg/mod/github.com/!go!tool!sharing/htb-cli@v1.4.1/cmd/sherlocks.go:102 +0x4c4
github.com/spf13/cobra.(*Command).execute(0x104cd6980, {0x104d129c0, 0x0, 0x0})
        /Users/qu35t/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:876 +0x548
github.com/spf13/cobra.(*Command).ExecuteC(0x104cd6700)
        /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/go/pkg/mod/github.com/!go!tool!sharing/htb-cli@v1.4.1/cmd/root.go:26 +0x24
main.main()
        /Users/qu35t/go/pkg/mod/github.com/!go!tool!sharing/htb-cli@v1.4.1/main.go:19 +0x80

Expected behavior No crash