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] Problem recovering the IP of a season machine #98

Closed QU35T-code closed 10 months ago

QU35T-code commented 10 months ago

If the machine is a season machine and has been passed on to vip servers, then ip retrieval will make an infinite loop.

To Reproduce Steps to reproduce the behavior:

> go run . start
⠏ Waiting for the machine to start in order to fetch the IP address (this might take a while).
> go run . info
? Do you want to check for active machine ? Yes
? Would you like to extend the active machine time ? Remaining: 25h 58m 15s No
Name      |OS      |Retired   |Difficulty   |Stars   |IP          |Status        |Last Reset        |Release
Bizness   |Linux   |No        |Easy         |2.5     |Undefined   |User & Root   |15 hours before   |2024-01-06

The following endpoint is fetch: /api/v4/machine/active Whereas if it's a season machine, it should be this one: /api/v4/season/machine/active

QU35T-code commented 10 months ago

https://github.com/GoToolSharing/htb-cli/issues/100#issuecomment-1895685089

suljov commented 10 months ago

is there a fix for this for now?

it as you said get stuck in a loop.

tried the info command

$ htb-cli info        
? Do you want to check for active machine ? Yes
2024-01-17T19:38:19.357+0100    ERROR   cmd/info.go:360     {"error": "date conversion error: parsing time \"%!s(<nil>)\" as \"2006-01-02 15:04:05\": cannot parse \"%!s(<nil>)\" as \"2006\""}
github.com/GoToolSharing/htb-cli/cmd.glob..func2
    /home/suljov/go/pkg/mod/github.com/!go!tool!sharing/htb-cli@v1.5.2-0.20240116210220-93784f9bb6d9/cmd/info.go:360
github.com/spf13/cobra.(*Command).execute
    /home/suljov/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:876
github.com/spf13/cobra.(*Command).ExecuteC
    /home/suljov/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:990
github.com/spf13/cobra.(*Command).Execute
    /home/suljov/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:918
github.com/GoToolSharing/htb-cli/cmd.Execute
    /home/suljov/go/pkg/mod/github.com/!go!tool!sharing/htb-cli@v1.5.2-0.20240116210220-93784f9bb6d9/cmd/root.go:46
main.main
    /home/suljov/go/pkg/mod/github.com/!go!tool!sharing/htb-cli@v1.5.2-0.20240116210220-93784f9bb6d9/main.go:8
runtime.main
    /usr/lib/go-1.21/src/runtime/proc.go:267
QU35T-code commented 10 months ago

Info issue is related to this issue : #96

QU35T-code commented 10 months ago

I work on a fix sry for that

QU35T-code commented 10 months ago

@suljov,

It should work now. Can you update the dev version and give it a try ?

go install github.com/GoToolSharing/htb-cli@dev

qu35t@local:~/Documents/htb-cli$ go run . start
Machine deployed to lab. Playing on a VIP server
Target: 10.10.11.248